ESBMC
Efficient SMT-based Context-Bounded Model Checker
Loading...
Searching...
No Matches
converter_compare.cpp File Reference
Include dependency graph for converter_compare.cpp:

Enumerations

enum class  identity_kind { function , instance , other }

Functions

static bool either_is_string (const exprt &lhs, const exprt &rhs)
static bool is_constant_char_array (const exprt &expr)
static exprt char_pointer_of (const exprt &expr)
static bool raises_on_none_operand (const std::string &op)
 Operators that CPython rejects outright when either operand is None: the arithmetic and ordering ones.
static std::string python_operator_symbol (const std::string &op)
 Python source spelling of an AST operator name, for diagnostics that quote the operator the way CPython does.
static bool is_constant_index (const nlohmann::json &slice)
static bool only_read_by_constant_index (const nlohmann::json &node, const std::string &name)
 True when every read of name in node indexes it by a constant, so no statement can replace one of its elements.
static std::string folded_list_element (const nlohmann::json &module, const nlohmann::json &node)
 The element node reads when the preprocessor folded list[i] to a copy of that element, or "" unless the list is one module-level literal whose elements are never replaced.
static std::string sole_object_owner (const nlohmann::json &module, const nlohmann::json &node)
 The module-level name that owns the object node denotes, or "" when that is not provable from the AST.
static identity_kind identity_kind_of (const expr2tc &operand, bool user_class_pointer)
 A code-typed operand is the def itself only when it is a symbol: a call's result merely carries the code type.
static expr2tc function_identity (const expr2tc &lhs, const expr2tc &rhs, identity_kind lhs_kind, identity_kind rhs_kind)
 is with a function on one side, or nil when neither side is a function.
static bool may_hold_class (const exprt &expr)
static bool is_type_call (const nlohmann::json &node)
static bool undecided_side (const std::optional< std::string > &cls, const nlohmann::json &node, const exprt &expr)
 Whether an operand the fold could not resolve to a class may still be one: an unresolved type(x) denotes a class, and since a class object is lowered to a string, so may a name typed as a string or erased to void * (say a parameter).
static void refuse_possible_class (const std::optional< std::string > &resolved, const nlohmann::json &node, const exprt &expr)

Enumeration Type Documentation

◆ identity_kind

enum class identity_kind
strong
Enumerator
function 
instance 
other 

Function Documentation

◆ char_pointer_of()

exprt char_pointer_of ( const exprt & expr)
static

◆ either_is_string()

bool either_is_string ( const exprt & lhs,
const exprt & rhs )
static

◆ folded_list_element()

std::string folded_list_element ( const nlohmann::json & module,
const nlohmann::json & node )
static

The element node reads when the preprocessor folded list[i] to a copy of that element, or "" unless the list is one module-level literal whose elements are never replaced.

◆ function_identity()

expr2tc function_identity ( const expr2tc & lhs,
const expr2tc & rhs,
identity_kind lhs_kind,
identity_kind rhs_kind )
static

is with a function on one side, or nil when neither side is a function.

A def is a code symbol and a name bound to one a pointer to code, so both compare as addresses and the pointer model decides identity on each path. A class instance is never a function: comparing its address gives False and keeps any call inside the operand. Any other operand may be a function that lost its type in a container, so it is left to the caller.

◆ identity_kind_of()

identity_kind identity_kind_of ( const expr2tc & operand,
bool user_class_pointer )
static

A code-typed operand is the def itself only when it is a symbol: a call's result merely carries the code type.

◆ is_constant_char_array()

bool is_constant_char_array ( const exprt & expr)
static

◆ is_constant_index()

bool is_constant_index ( const nlohmann::json & slice)
static

◆ is_type_call()

bool is_type_call ( const nlohmann::json & node)
static

◆ may_hold_class()

bool may_hold_class ( const exprt & expr)
static

◆ only_read_by_constant_index()

bool only_read_by_constant_index ( const nlohmann::json & node,
const std::string & name )
static

True when every read of name in node indexes it by a constant, so no statement can replace one of its elements.

◆ python_operator_symbol()

std::string python_operator_symbol ( const std::string & op)
static

Python source spelling of an AST operator name, for diagnostics that quote the operator the way CPython does.

Falls back to the AST name.

◆ raises_on_none_operand()

bool raises_on_none_operand ( const std::string & op)
static

Operators that CPython rejects outright when either operand is None: the arithmetic and ordering ones.

Identity and equality are defined on None, and membership takes None as an element (None in [1, 2] is False), so both are absent here by design.

◆ refuse_possible_class()

void refuse_possible_class ( const std::optional< std::string > & resolved,
const nlohmann::json & node,
const exprt & expr )
static

◆ sole_object_owner()

std::string sole_object_owner ( const nlohmann::json & module,
const nlohmann::json & node )
static

The module-level name that owns the object node denotes, or "" when that is not provable from the AST.

Each name on the way must be bound exactly once in the whole module, by a top-level statement, and every name but the owner by name = other_name. Such a name holds one object for the whole run, so two names with one owner are the same object, whatever the value is modelled as: a str is copied on assignment (#8412). A folded list element, or a name bound to one, is owned by that element.

◆ undecided_side()

bool undecided_side ( const std::optional< std::string > & cls,
const nlohmann::json & node,
const exprt & expr )
static

Whether an operand the fold could not resolve to a class may still be one: an unresolved type(x) denotes a class, and since a class object is lowered to a string, so may a name typed as a string or erased to void * (say a parameter).

Such a side is left to the comparison paths that follow.