|
ESBMC
Efficient SMT-based Context-Bounded Model Checker
|
#include <cassert>#include <util/expr/base_type.h>#include <util/lang/c_qualifiers.h>#include <util/lang/c_typecast.h>#include <util/lang/c_types.h>#include <util/config/config.h>#include <util/expr/expr_util.h>#include <irep2/irep2_utils.h>#include <util/irep/migrate.h>#include <util/irep/std_expr.h>#include <util/expr/string2array.h>Functions | |
| bool | c_implicit_typecast (exprt &expr, const typet &dest_type, const namespacet &ns) |
| bool | c_implicit_typecast (expr2tc &expr, const type2tc &dest_type, const namespacet &ns) |
| bool | check_c_implicit_typecast (const typet &src_type, const typet &dest_type, const namespacet &ns) |
| bool | check_c_implicit_typecast (const type2tc &src_type, const type2tc &dest_type, const namespacet &ns) |
| bool | c_implicit_typecast_arithmetic (exprt &expr1, exprt &expr2, const namespacet &ns) |
| bool | c_implicit_typecast_arithmetic (expr2tc &expr1, expr2tc &expr2, const namespacet &ns) |
| bool | check_c_implicit_typecast (const typet &src_type, const typet &dest_type) |
| static bool | is_numeric_type (const type2tc &t) |
| bool | check_c_implicit_typecast (const type2tc &src_type, const type2tc &dest_type) |
| static void | take_reference_address (exprt &expr) |
Build the pointer that models a reference bound to expr. | |
| static bool | is_reference_type (const type2tc &type) |
| IREP2 form of is_lvalue_or_rvalue_reference (std_types.cpp), kept local until a second caller wants it. | |
| void | take_reference_address (expr2tc &expr, pointer_ref_kindt rk) |
| IREP2 form of take_reference_address; see the irept copy for why a conditional takes the address per arm ([expr.cond], #6291). | |
| static bool | pointer_subtypes_compatible (const type2tc &src_subtype, const type2tc &dest_subtype, const namespacet &ns) |
| How generous C is between pointer subtypes: void either way, a common base type, two function pointers, or two scalars. | |
| static bool | same_c_type (const type2tc &a, const type2tc &b) |
| The pointer-destination arm. | |
| bool c_implicit_typecast | ( | expr2tc & | expr, |
| const type2tc & | dest_type, | ||
| const namespacet & | ns ) |
| bool c_implicit_typecast | ( | exprt & | expr, |
| const typet & | dest_type, | ||
| const namespacet & | ns ) |
| bool c_implicit_typecast_arithmetic | ( | expr2tc & | expr1, |
| expr2tc & | expr2, | ||
| const namespacet & | ns ) |
| bool c_implicit_typecast_arithmetic | ( | exprt & | expr1, |
| exprt & | expr2, | ||
| const namespacet & | ns ) |
| bool check_c_implicit_typecast | ( | const type2tc & | src_type, |
| const type2tc & | dest_type, | ||
| const namespacet & | ns ) |
| bool check_c_implicit_typecast | ( | const typet & | src_type, |
| const typet & | dest_type, | ||
| const namespacet & | ns ) |
IREP2 form of is_lvalue_or_rvalue_reference (std_types.cpp), kept local until a second caller wants it.
|
static |
How generous C is between pointer subtypes: void either way, a common base type, two function pointers, or two scalars.
Anything else warns.
The pointer-destination arm.
Returns true when the conversion is complete – the irept copy's return; // ok – and false to fall through to the tail. Whether two types are the same C type, treating a function's parameter names as not part of it – C11 6.7.6.3p15 requires compatible return types and agreeing parameter type lists, and says nothing of their names. code_type2t reflects argument_names, so int (*)(int x) and int (*)(int) compare unequal as IREP2 nodes; inserting a cast between them is a divergence from the irept copy, which inserts none (docs/roadmap/scope-clang-c-irep2.md ยง143.1).
| void take_reference_address | ( | expr2tc & | expr, |
| pointer_ref_kindt | rk ) |
IREP2 form of take_reference_address; see the irept copy for why a conditional takes the address per arm ([expr.cond], #6291).
Take the address of an object bound to a reference; see c_typecast.cpp for why a conditional takes it per arm and why rk matters.
rk must be the destination's own kind. irept can hardcode #reference because its operator== skips comment attributes, so T& and T&& compare equal there; ref_kind is a real field, so a wrong kind leaves do_typecast's dest_type != type guard true and appends a cast irept never produces.
|
static |
Build the pointer that models a reference bound to expr.
A conditional whose arms are lvalues is itself an lvalue ([expr.cond]), so the address has to be taken per arm: &(c ? a : b) is c ? &a : &b. Left as address_of(if(...)) the pointer analysis resolves neither arm and the bound reference silently designates the wrong object (#6291, #3387).