ESBMC
Efficient SMT-based Context-Bounded Model Checker
Loading...
Searching...
No Matches
annotation_conversion.inl File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

bool is_imported_numpy_module_alias (const nlohmann::json &ast, const std::string &name)
std::string unpacked_name_element_type (const std::string &type, size_t index)
 The type of element index of a value typed type: the matching parameter of tuple[...], the element of list[T], else "Any".
std::string subscript_result_type (const std::string &container, bool is_slice)
 The type a subscript of a container-typed value yields, or empty.
template<class Json>
bool is_empty_list_literal (const Json &node)
 True when node binds the empty list literal [], which is how a comprehension's result list starts before its appends.
bool has_bare_tuple (const std::string &type)
 True when type spells a tuple without its element types anywhere.
bool is_unresolved_arg_type (const std::string &type)
 True when an argument type says too little to annotate a parameter with (see collect_function_call_arg_types).
template<class Json>
static void count_attr_writers (const Json &node, const std::string &attr, const std::string &name, size_t &stores, size_t &name_reads)
 Counts the nodes under node that may store to an attribute named attr, a setattr call or a __class__ read, and the uses of name outside annotations.
template<class Json>
static Json find_first_append_arg (const Json &node, const std::string &name)
template<class Json>
static bool name_only_indexed (const Json &node, const std::string &name)
 Whether every read of name under node indexes it (name[i]), so no store, method call or alias can change the elements it holds.
template<class Json>
static bool union_has_none (const Json &slice)
 Whether a Union[...] slice lists None among its members.
static bool all_pointer_sized_scalars (const std::set< std::string > &types)
 Whether types is non-empty and holds only types whose values an untyped (pointer-sized) return slot can carry; a float cannot.
template<class Json>
static bool rebound_in_function (const std::string &name, const std::string &ctx, const Json &ast)
 Whether the function at ctx, or the enclosing one that binds name, assigns name after binding it, so its declaration says nothing of the value at a later call.
static bool call_site_types_agree (const std::string &a, const std::string &b)
 Whether two call-site types agree: equal, or the same container where one spells only the bare kind ([] beside list[int]), as the call-site inference already treats them.
template<class Json>
static bool aliases_function (const Json &stmt, const std::string &name, const Json &body)
 True when stmt aliases name to a function defined in body.
template<class Json>
static bool is_dynamically_typed_name (const Json &arg, const Json &scope)
 A bare name that scope assigns incompatible literal kinds, which must reach a method as a tagged value rather than as the first kind it takes.

Variables

static const char *const untyped_name_return = "?"
 Marks a return <name> whose type is unknown. Not a valid type name.

Function Documentation

◆ aliases_function()

template<class Json>
bool aliases_function ( const Json & stmt,
const std::string & name,
const Json & body )
static

True when stmt aliases name to a function defined in body.

◆ all_pointer_sized_scalars()

bool all_pointer_sized_scalars ( const std::set< std::string > & types)
static

Whether types is non-empty and holds only types whose values an untyped (pointer-sized) return slot can carry; a float cannot.

◆ call_site_types_agree()

bool call_site_types_agree ( const std::string & a,
const std::string & b )
static

Whether two call-site types agree: equal, or the same container where one spells only the bare kind ([] beside list[int]), as the call-site inference already treats them.

◆ count_attr_writers()

template<class Json>
void count_attr_writers ( const Json & node,
const std::string & attr,
const std::string & name,
size_t & stores,
size_t & name_reads )
static

Counts the nodes under node that may store to an attribute named attr, a setattr call or a __class__ read, and the uses of name outside annotations.

◆ find_first_append_arg()

template<class Json>
Json find_first_append_arg ( const Json & node,
const std::string & name )
static

◆ has_bare_tuple()

bool has_bare_tuple ( const std::string & type)
inline

True when type spells a tuple without its element types anywhere.

A later round of call-site inference may still resolve the elements.

◆ is_dynamically_typed_name()

template<class Json>
bool is_dynamically_typed_name ( const Json & arg,
const Json & scope )
static

A bare name that scope assigns incompatible literal kinds, which must reach a method as a tagged value rather than as the first kind it takes.

◆ is_empty_list_literal()

template<class Json>
bool is_empty_list_literal ( const Json & node)

True when node binds the empty list literal [], which is how a comprehension's result list starts before its appends.

◆ is_imported_numpy_module_alias()

bool is_imported_numpy_module_alias ( const nlohmann::json & ast,
const std::string & name )

◆ is_unresolved_arg_type()

bool is_unresolved_arg_type ( const std::string & type)
inline

True when an argument type says too little to annotate a parameter with (see collect_function_call_arg_types).

◆ name_only_indexed()

template<class Json>
bool name_only_indexed ( const Json & node,
const std::string & name )
static

Whether every read of name under node indexes it (name[i]), so no store, method call or alias can change the elements it holds.

◆ rebound_in_function()

template<class Json>
bool rebound_in_function ( const std::string & name,
const std::string & ctx,
const Json & ast )
static

Whether the function at ctx, or the enclosing one that binds name, assigns name after binding it, so its declaration says nothing of the value at a later call.

◆ subscript_result_type()

std::string subscript_result_type ( const std::string & container,
bool is_slice )
inline

The type a subscript of a container-typed value yields, or empty.

◆ union_has_none()

template<class Json>
bool union_has_none ( const Json & slice)
static

Whether a Union[...] slice lists None among its members.

◆ unpacked_name_element_type()

std::string unpacked_name_element_type ( const std::string & type,
size_t index )
inline

The type of element index of a value typed type: the matching parameter of tuple[...], the element of list[T], else "Any".

Variable Documentation

◆ untyped_name_return

const char* const untyped_name_return = "?"
static

Marks a return <name> whose type is unknown. Not a valid type name.