cprover
|
#include <cpp_typecheck.h>
Classes | |
class | instantiation_levelt |
class | instantiationt |
struct | method_bodyt |
Public Member Functions | |
cpp_typecheckt (cpp_parse_treet &_cpp_parse_tree, symbol_tablet &_symbol_table, const std::string &_module, message_handlert &message_handler) | |
cpp_typecheckt (cpp_parse_treet &_cpp_parse_tree, symbol_tablet &_symbol_table1, const symbol_tablet &_symbol_table2, const std::string &_module, message_handlert &message_handler) | |
~cpp_typecheckt () override | |
void | typecheck () override |
typechecking main method | |
std::string | to_string (const typet &) override |
std::string | to_string (const exprt &) override |
exprt | resolve (const cpp_namet &cpp_name, const cpp_typecheck_resolvet::wantt want, const cpp_typecheck_fargst &fargs, bool fail_with_exception=true) |
void | typecheck_expr (exprt &) override |
bool | cpp_is_pod (const typet &type) const |
optionalt< codet > | cpp_constructor (const source_locationt &source_location, const exprt &object, const exprt::operandst &operands) |
bool | standard_conversion_lvalue_to_rvalue (const exprt &expr, exprt &new_expr) const |
Lvalue-to-rvalue conversion. | |
bool | standard_conversion_array_to_pointer (const exprt &expr, exprt &new_expr) const |
Array-to-pointer conversion. | |
bool | standard_conversion_function_to_pointer (const exprt &expr, exprt &new_expr) const |
Function-to-pointer conversion. | |
bool | standard_conversion_qualification (const exprt &expr, const typet &, exprt &new_expr) const |
Qualification conversion. | |
bool | standard_conversion_integral_promotion (const exprt &expr, exprt &new_expr) const |
Integral-promotion conversion. | |
bool | standard_conversion_floating_point_promotion (const exprt &expr, exprt &new_expr) const |
Floating-point-promotion conversion. | |
bool | standard_conversion_integral_conversion (const exprt &expr, const typet &type, exprt &new_expr) const |
Integral conversion. | |
bool | standard_conversion_floating_integral_conversion (const exprt &expr, const typet &type, exprt &new_expr) const |
Floating-integral conversion. | |
bool | standard_conversion_floating_point_conversion (const exprt &expr, const typet &type, exprt &new_expr) const |
Floating-point conversion. | |
bool | standard_conversion_pointer (const exprt &expr, const typet &type, exprt &new_expr) |
Pointer conversion. | |
bool | standard_conversion_pointer_to_member (const exprt &expr, const typet &type, exprt &new_expr) |
Pointer-to-member conversion. | |
bool | standard_conversion_boolean (const exprt &expr, exprt &new_expr) const |
Boolean conversion. | |
bool | standard_conversion_sequence (const exprt &expr, const typet &type, exprt &new_expr, unsigned &rank) |
Standard Conversion Sequence. | |
bool | user_defined_conversion_sequence (const exprt &expr, const typet &type, exprt &new_expr, unsigned &rank) |
User-defined conversion sequence. | |
bool | reference_related (const exprt &expr, const typet &type) const |
Reference-related. | |
bool | reference_compatible (const exprt &expr, const typet &type, unsigned &rank) const |
Reference-compatible. | |
bool | reference_binding (exprt expr, const typet &type, exprt &new_expr, unsigned &rank) |
Reference binding. | |
bool | implicit_conversion_sequence (const exprt &expr, const typet &type, exprt &new_expr, unsigned &rank) |
implicit conversion sequence | |
bool | implicit_conversion_sequence (const exprt &expr, const typet &type, unsigned &rank) |
implicit conversion sequence | |
bool | implicit_conversion_sequence (const exprt &expr, const typet &type, exprt &new_expr) |
implicit conversion sequence | |
void | reference_initializer (exprt &expr, const typet &type) |
A reference to type "cv1 T1" is initialized by an expression of type "cv2 T2" as follows: | |
void | implicit_typecast (exprt &expr, const typet &type) override |
void | get_bases (const struct_typet &type, std::set< irep_idt > &set_bases) const |
void | get_virtual_bases (const struct_typet &type, std::list< irep_idt > &vbases) const |
bool | subtype_typecast (const struct_typet &from, const struct_typet &to) const |
void | make_ptr_typecast (exprt &expr, const typet &dest_type) |
bool | const_typecast (const exprt &expr, const typet &type, exprt &new_expr) |
bool | dynamic_typecast (const exprt &expr, const typet &type, exprt &new_expr) |
bool | reinterpret_typecast (const exprt &expr, const typet &type, exprt &new_expr, bool check_constantness=true) |
bool | static_typecast (const exprt &expr, const typet &type, exprt &new_expr, bool check_constantness=true) |
bool | contains_cpp_name (const exprt &) |
![]() | |
c_typecheck_baset (symbol_tablet &_symbol_table, const std::string &_module, message_handlert &_message_handler) | |
c_typecheck_baset (symbol_tablet &_symbol_table1, const symbol_tablet &_symbol_table2, const std::string &_module, message_handlert &_message_handler) | |
virtual | ~c_typecheck_baset () |
![]() | |
typecheckt (message_handlert &_message_handler) | |
virtual | ~typecheckt () |
virtual bool | typecheck_main () |
![]() | |
namespacet (const symbol_table_baset &_symbol_table) | |
namespacet (const symbol_table_baset &_symbol_table1, const symbol_table_baset &_symbol_table2) | |
namespacet (const symbol_table_baset *_symbol_table1, const symbol_table_baset *_symbol_table2) | |
bool | lookup (const irep_idt &name, const symbolt *&symbol) const override |
See documentation for namespace_baset::lookup(). | |
std::size_t | smallest_unused_suffix (const std::string &prefix) const override |
See documentation for namespace_baset::smallest_unused_suffix(). | |
const symbol_table_baset & | get_symbol_table () const |
Return first symbol table registered with the namespace. | |
const symbolt & | lookup (const irep_idt &name) const |
Lookup a symbol in the namespace. | |
const symbolt & | lookup (const symbol_exprt &) const |
Generic lookup function for a symbol expression in a symbol table. | |
const symbolt & | lookup (const tag_typet &) const |
Generic lookup function for a tag type in a symbol table. | |
virtual bool | lookup (const irep_idt &name, const symbolt *&symbol) const=0 |
Searches for a symbol named name . | |
![]() | |
const symbolt & | lookup (const irep_idt &name) const |
Lookup a symbol in the namespace. | |
const symbolt & | lookup (const symbol_exprt &) const |
Generic lookup function for a symbol expression in a symbol table. | |
const symbolt & | lookup (const tag_typet &) const |
Generic lookup function for a tag type in a symbol table. | |
virtual | ~namespace_baset () |
void | follow_macros (exprt &) const |
Follow macros to their values in a given expression. | |
const typet & | follow (const typet &) const |
Resolve type symbol to the type it points to. | |
const union_typet & | follow_tag (const union_tag_typet &) const |
Follow type tag of union type. | |
const struct_typet & | follow_tag (const struct_tag_typet &) const |
Follow type tag of struct type. | |
const c_enum_typet & | follow_tag (const c_enum_tag_typet &) const |
Follow type tag of enum type. | |
Protected Types | |
typedef std::list< instantiationt > | instantiation_stackt |
typedef std::list< method_bodyt > | method_bodiest |
![]() | |
typedef std::unordered_map< irep_idt, typet > | id_type_mapt |
typedef std::unordered_map< irep_idt, irep_idt > | asm_label_mapt |
Static Protected Member Functions | |
static bool | has_const (const typet &type) |
static bool | has_volatile (const typet &type) |
static bool | has_auto (const typet &type) |
![]() | |
static void | add_rounding_mode (exprt &) |
static bool | is_numeric_type (const typet &src) |
Protected Attributes | |
cpp_scopest | cpp_scopes |
cpp_parse_treet & | cpp_parse_tree |
irep_idt | current_linkage_spec |
instantiation_stackt | instantiation_stack |
unsigned | template_counter |
unsigned | anon_counter |
template_mapt | template_map |
std::set< irep_idt > | methods_seen |
method_bodiest | method_bodies |
![]() | |
symbol_tablet & | symbol_table |
const irep_idt const irep_idt | mode |
symbolt | current_symbol |
id_type_mapt | parameter_map |
bool | break_is_allowed |
bool | continue_is_allowed |
bool | case_is_allowed |
typet | switch_op_type |
typet | return_type |
std::map< irep_idt, source_locationt > | labels_defined |
std::map< irep_idt, source_locationt > | labels_used |
std::list< codet > | clean_code |
asm_label_mapt | asm_label_map |
![]() | |
const symbol_table_baset * | symbol_table1 |
const symbol_table_baset * | symbol_table2 |
Private Types | |
typedef std::list< irep_idt > | dynamic_initializationst |
Private Attributes | |
dynamic_initializationst | dynamic_initializations |
bool | disable_access_control |
std::unordered_set< irep_idt > | deferred_typechecking |
Friends | |
class | cpp_typecheck_resolvet |
class | cpp_declarator_convertert |
Additional Inherited Members |
Definition at line 39 of file cpp_typecheck.h.
|
private |
Definition at line 587 of file cpp_typecheck.h.
|
protected |
Definition at line 176 of file cpp_typecheck.h.
|
protected |
Definition at line 337 of file cpp_typecheck.h.
|
inline |
Definition at line 42 of file cpp_typecheck.h.
|
inline |
Definition at line 55 of file cpp_typecheck.h.
|
inlineoverride |
Definition at line 70 of file cpp_typecheck.h.
|
protected |
Definition at line 1388 of file cpp_typecheck_compound_type.cpp.
|
protected |
Definition at line 119 of file cpp_typecheck_bases.cpp.
Definition at line 1484 of file cpp_typecheck_expr.cpp.
Definition at line 51 of file cpp_typecheck_method_bodies.cpp.
|
protected |
Definition at line 1359 of file cpp_typecheck_compound_type.cpp.
Definition at line 326 of file cpp_typecheck.cpp.
Definition at line 1570 of file cpp_typecheck_conversions.cpp.
|
protected |
Definition at line 1589 of file cpp_typecheck_compound_type.cpp.
check that an array has fixed size
Definition at line 777 of file cpp_typecheck_compound_type.cpp.
|
protected |
Check a constructor initialization-list.
An initializer has to be a data member declared in this class or a direct-parent constructor. If an invalid initializer is found, then the method outputs an error message and throws a 0 exception.
bases | the parents of the class |
components | the components of the class |
initializers | the constructor initializers |
Definition at line 417 of file cpp_typecheck_constructor.cpp.
|
protected |
Definition at line 423 of file cpp_typecheck_template.cpp.
|
protected |
Definition at line 146 of file cpp_instantiate_template.cpp.
|
protected |
Definition at line 266 of file cpp_typecheck.cpp.
Definition at line 1635 of file cpp_typecheck_conversions.cpp.
Definition at line 331 of file cpp_typecheck.cpp.
|
protected |
Definition at line 20 of file cpp_typecheck_declaration.cpp.
|
protected |
Definition at line 26 of file cpp_typecheck.cpp.
|
protected |
Definition at line 14 of file cpp_typecheck_linkage_spec.cpp.
|
protected |
Definition at line 16 of file cpp_typecheck_namespace.cpp.
|
protected |
Definition at line 16 of file cpp_typecheck_static_assert.cpp.
|
protected |
Definition at line 16 of file cpp_typecheck_using.cpp.
|
protected |
Definition at line 1438 of file cpp_typecheck_compound_type.cpp.
|
protected |
Definition at line 37 of file cpp_typecheck_declaration.cpp.
|
protected |
Definition at line 499 of file cpp_typecheck_template.cpp.
Definition at line 82 of file cpp_typecheck_function.cpp.
Initialize an object with a value.
Definition at line 26 of file cpp_typecheck_initializer.cpp.
|
protected |
Definition at line 99 of file cpp_typecheck_declaration.cpp.
|
protected |
Definition at line 19 of file cpp_typecheck_function.cpp.
|
protected |
Definition at line 68 of file cpp_typecheck_function.cpp.
Definition at line 2175 of file cpp_typecheck_expr.cpp.
|
protected |
Definition at line 967 of file cpp_typecheck_template.cpp.
|
protected |
Definition at line 617 of file cpp_typecheck_template.cpp.
optionalt< codet > cpp_typecheckt::cpp_constructor | ( | const source_locationt & | source_location, |
const exprt & | object, | ||
const exprt::operandst & | operands | ||
) |
source_location | source location for generated code |
object | non-typechecked object |
operands | non-typechecked operands |
Definition at line 22 of file cpp_constructor.cpp.
|
protected |
Definition at line 19 of file cpp_destructor.cpp.
Definition at line 16 of file cpp_is_pod.cpp.
|
protected |
Generate declaration of the implicit default assignment operator.
Definition at line 277 of file cpp_typecheck_constructor.cpp.
|
protected |
Generate code for the implicit default assignment operator.
Definition at line 344 of file cpp_typecheck_constructor.cpp.
|
protected |
Generate code for implicit default copy constructor.
Definition at line 140 of file cpp_typecheck_constructor.cpp.
|
protected |
Generate code for implicit default constructors.
Definition at line 118 of file cpp_typecheck_constructor.cpp.
|
protected |
Note:
Definition at line 30 of file cpp_typecheck_destructor.cpp.
|
protected |
Definition at line 214 of file cpp_typecheck.cpp.
Definition at line 18 of file cpp_typecheck_virtual_table.cpp.
|
protected |
produces destructor code for a class object
Definition at line 52 of file cpp_typecheck_destructor.cpp.
Definition at line 1693 of file cpp_typecheck_conversions.cpp.
|
protected |
elaborate class template instances
Definition at line 221 of file cpp_instantiate_template.cpp.
Definition at line 2275 of file cpp_typecheck_expr.cpp.
Definition at line 812 of file cpp_typecheck_constructor.cpp.
Definition at line 759 of file cpp_typecheck_constructor.cpp.
Definition at line 18 of file cpp_typecheck_destructor.cpp.
|
protected |
Definition at line 34 of file cpp_typecheck_expr.cpp.
|
protected |
Build the full initialization list of the constructor.
First, all the direct-parent constructors are called. Second, all the non-pod data members are initialized.
Note: The initialization order follows the declaration order.
struct_union_type | the class/struct/union | |
[out] | initializers | the constructor initializers |
Definition at line 542 of file cpp_typecheck_constructor.cpp.
for function overloading
Definition at line 163 of file cpp_typecheck_function.cpp.
|
protected |
Definition at line 482 of file cpp_typecheck_template.cpp.
void cpp_typecheckt::get_bases | ( | const struct_typet & | type, |
std::set< irep_idt > & | set_bases | ||
) | const |
Definition at line 1650 of file cpp_typecheck_compound_type.cpp.
|
protected |
Definition at line 1491 of file cpp_typecheck_compound_type.cpp.
void cpp_typecheckt::get_virtual_bases | ( | const struct_typet & | type, |
std::list< irep_idt > & | vbases | ||
) | const |
Definition at line 1665 of file cpp_typecheck_compound_type.cpp.
Definition at line 67 of file cpp_typecheck_compound_type.cpp.
Definition at line 31 of file cpp_typecheck_compound_type.cpp.
Definition at line 49 of file cpp_typecheck_compound_type.cpp.
bool cpp_typecheckt::implicit_conversion_sequence | ( | const exprt & | expr, |
const typet & | type, | ||
exprt & | new_expr | ||
) |
implicit conversion sequence
Definition at line 1460 of file cpp_typecheck_conversions.cpp.
bool cpp_typecheckt::implicit_conversion_sequence | ( | const exprt & | expr, |
const typet & | type, | ||
exprt & | new_expr, | ||
unsigned & | rank | ||
) |
implicit conversion sequence
Definition at line 1418 of file cpp_typecheck_conversions.cpp.
bool cpp_typecheckt::implicit_conversion_sequence | ( | const exprt & | expr, |
const typet & | type, | ||
unsigned & | rank | ||
) |
implicit conversion sequence
Definition at line 1474 of file cpp_typecheck_conversions.cpp.
Reimplemented from c_typecheck_baset.
Definition at line 1483 of file cpp_typecheck_conversions.cpp.
|
protected |
Definition at line 250 of file cpp_instantiate_template.cpp.
Definition at line 1699 of file cpp_typecheck_compound_type.cpp.
|
protected |
Definition at line 1234 of file cpp_typecheck_compound_type.cpp.
|
protected |
Definition at line 293 of file cpp_constructor.cpp.
|
protected |
Definition at line 263 of file cpp_constructor.cpp.
Definition at line 458 of file cpp_typecheck_expr.cpp.
Definition at line 402 of file cpp_typecheck_expr.cpp.
|
protected |
Definition at line 802 of file cpp_typecheck_compound_type.cpp.
bool cpp_typecheckt::reference_binding | ( | exprt | expr, |
const typet & | type, | ||
exprt & | new_expr, | ||
unsigned & | rank | ||
) |
Reference binding.
When a parameter of reference type binds directly (8.5.3) to an argument expression, the implicit conversion sequence is the identity conversion, unless the argument expression has a type that is a derived class of the parameter type, in which case the implicit conversion sequence is a derived-to-base Conversion (13.3.3.1).
If the parameter binds directly to the result of applying a conversion function to the argument expression, the implicit conversion sequence is a user-defined conversion sequence (13.3.3.1.2), with the second standard conversion sequence either an identity conversion or, if the conversion function returns an entity of a type that is a derived class of the parameter type, a derived-to-base Conversion.
When a parameter of reference type is not bound directly to an argument expression, the conversion sequence is the one required to convert the argument expression to the underlying type of the reference according to 13.3.3.1. Conceptually, this conversion sequence corresponds to copy-initializing a temporary of the underlying type with the argument expression. Any difference in top-level cv-qualification is subsumed by the initialization itself and does not constitute a conversion.
A standard conversion sequence cannot be formed if it requires binding a reference to non-const to an rvalue (except when binding an implicit object parameter; see the special rules for that case in 13.3.1).
Definition at line 1214 of file cpp_typecheck_conversions.cpp.
bool cpp_typecheckt::reference_compatible | ( | const exprt & | expr, |
const typet & | type, | ||
unsigned & | rank | ||
) | const |
Reference-compatible.
Definition at line 1151 of file cpp_typecheck_conversions.cpp.
A reference to type "cv1 T1" is initialized by an expression of type "cv2 T2" as follows:
If the initializer expression
then the reference is bound directly to the initializer expression lvalue in the first case, and the reference is bound to the lvalue result of the conversion in the second case. In these cases the reference is said to bind directly to the initializer expression.
If the initializer expression is an rvalue, with T2 a class type, and "cv1 T1" is reference-compatible with "cv2 T2," the reference is bound in one of the following ways (the choice is implementation-defined):
The constructor that would be used to make the copy shall be callable whether or not the copy is actually done.
Otherwise, a temporary of type "cv1 T1" is created and initialized from the initializer expression using the rules for a non-reference copy initialization (8.5). The reference is then bound to the temporary. If T1 is reference-related to T2, cv1 must be the same cv-qualification as, or greater cvqualification than, cv2; otherwise, the program is ill-formed.
Definition at line 1550 of file cpp_typecheck_conversions.cpp.
Reference-related.
Definition at line 1114 of file cpp_typecheck_conversions.cpp.
bool cpp_typecheckt::reinterpret_typecast | ( | const exprt & | expr, |
const typet & | type, | ||
exprt & | new_expr, | ||
bool | check_constantness = true |
||
) |
Definition at line 1745 of file cpp_typecheck_conversions.cpp.
|
inline |
Definition at line 83 of file cpp_typecheck.h.
|
protected |
Definition at line 23 of file cpp_typecheck_template.cpp.
|
protected |
Definition at line 90 of file cpp_instantiate_template.cpp.
bool cpp_typecheckt::standard_conversion_array_to_pointer | ( | const exprt & | expr, |
exprt & | new_expr | ||
) | const |
Array-to-pointer conversion.
An lvalue or rvalue of type "array of N T" or "array of unknown bound of T" can be converted to an rvalue of type "pointer to T." The result is a pointer to the first element of the array.
Definition at line 77 of file cpp_typecheck_conversions.cpp.
Boolean conversion.
An rvalue of arithmetic, enumeration, pointer, or pointer to member type can be converted to an rvalue of type bool. A zero value, null pointer value, or null member pointer value is converted to false; any other value is converted to true.
Definition at line 635 of file cpp_typecheck_conversions.cpp.
bool cpp_typecheckt::standard_conversion_floating_integral_conversion | ( | const exprt & | expr, |
const typet & | type, | ||
exprt & | new_expr | ||
) | const |
Floating-integral conversion.
An rvalue of a floating point type can be converted to an rvalue of an integer type. The conversion truncates; that is, the fractional part is discarded. The behavior is undefined if the truncated value cannot be represented in the destination type. [Note: If the destination type is bool, see 4.12. ]
An rvalue of an integer type or of an enumeration type can be converted to an rvalue of a floating point type. The result is exact if possible. Otherwise, it is an implementation-defined choice of either the next lower or higher representable value. [Note: loss of precision occurs if the integral value cannot be represented exactly as a value of the floating type. ] If the source type is bool, the value false is converted to zero and the value true is converted to one.
Definition at line 347 of file cpp_typecheck_conversions.cpp.
bool cpp_typecheckt::standard_conversion_floating_point_conversion | ( | const exprt & | expr, |
const typet & | type, | ||
exprt & | new_expr | ||
) | const |
Floating-point conversion.
An rvalue of floating point type can be converted to an rvalue of another floating point type. If the source value can be exactly represented in the destination type, the result of the conversion is that exact representation. If the source value is between two adjacent destination values, the result of the conversion is an implementation-defined choice of either of those values. Otherwise, the behavior is undefined.
The conversions allowed as floating point promotions are excluded from the set of floating point conversions.
Definition at line 398 of file cpp_typecheck_conversions.cpp.
bool cpp_typecheckt::standard_conversion_floating_point_promotion | ( | const exprt & | expr, |
exprt & | new_expr | ||
) | const |
Floating-point-promotion conversion.
An rvalue of type float can be converted to an rvalue of type double. The value is unchanged.
Definition at line 246 of file cpp_typecheck_conversions.cpp.
bool cpp_typecheckt::standard_conversion_function_to_pointer | ( | const exprt & | expr, |
exprt & | new_expr | ||
) | const |
Function-to-pointer conversion.
An lvalue of function type T can be converted to an rvalue of type "pointer to T." The result is a pointer to the function.50)
Definition at line 99 of file cpp_typecheck_conversions.cpp.
bool cpp_typecheckt::standard_conversion_integral_conversion | ( | const exprt & | expr, |
const typet & | type, | ||
exprt & | new_expr | ||
) | const |
Integral conversion.
An rvalue of type char, signed char, unsigned char, short int, An rvalue of an integer type can be converted to an rvalue of another integer type. An rvalue of an enumeration type can be converted to an rvalue of an integer type.
If the destination type is unsigned, the resulting value is the least unsigned integer congruent to the source integer (modulo 2n where n is the number of bits used to represent the unsigned type). [Note: In a two's complement representation, this conversion is conceptual and there is no change in the bit pattern (if there is no truncation). ]
If the destination type is signed, the value is unchanged if it can be represented in the destination type (and bit-field width); otherwise, the value is implementation-defined.
If the destination type is bool, see 4.12. If the source type is bool, the value false is converted to zero and the value true is converted to one.
The conversions allowed as integral promotions are excluded from the set of integral conversions.
Definition at line 300 of file cpp_typecheck_conversions.cpp.
bool cpp_typecheckt::standard_conversion_integral_promotion | ( | const exprt & | expr, |
exprt & | new_expr | ||
) | const |
Integral-promotion conversion.
An rvalue of type char, signed char, unsigned char, short int, or unsigned short int can be converted to an rvalue of type int if int can represent all the values of the source type; otherwise, the source rvalue can be converted to an rvalue of type unsigned int.
An rvalue of type wchar_t (3.9.1) or an enumeration type (7.2) can be converted to an rvalue of the first of the following types that can represent all the values of its underlying type: int, unsigned int, long, or unsigned long.
An rvalue for an integral bit-field (9.6) can be converted to an rvalue of type int if int can represent all the values of the bit-field; otherwise, it can be converted to unsigned int if unsigned int can represent all the values of the bit-field. If the bit-field is larger yet, no integral promotion applies to it. If the bit-field has an enumerated type, it is treated as any other value of that type for promotion purposes.
An rvalue of type bool can be converted to an rvalue of type int, with false becoming zero and true becoming one.
Definition at line 193 of file cpp_typecheck_conversions.cpp.
bool cpp_typecheckt::standard_conversion_lvalue_to_rvalue | ( | const exprt & | expr, |
exprt & | new_expr | ||
) | const |
Lvalue-to-rvalue conversion.
An lvalue (3.10) of a non-function, non-array type T can be converted to an rvalue. If T is an incomplete type, a program that necessitates this conversion is ill-formed. If the object to which the lvalue refers is not an object of type T and is not an object of a type derived from T, or if the object is uninitialized, a program that necessitates this conversion has undefined behavior. If T is a non-class type, the type of the rvalue is the cv-unqualified version of T. Otherwise, the type of the rvalue is T.
The value contained in the object indicated by the lvalue is the rvalue result. When an lvalue-to-rvalue conversion occurs within the operand of sizeof (5.3.3) the value contained in the referenced object is not accessed, since that operator does not evaluate its operand.
Definition at line 46 of file cpp_typecheck_conversions.cpp.
bool cpp_typecheckt::standard_conversion_pointer | ( | const exprt & | expr, |
const typet & | type, | ||
exprt & | new_expr | ||
) |
Pointer conversion.
A null pointer constant is an integral constant expression (5.19) rvalue of integer type that evaluates to zero. A null pointer constant can be converted to a pointer type; the result is the null pointer value of that type and is distinguishable from every other value of pointer to object or pointer to function type. Two null pointer values of the same type shall compare equal. The conversion of a null pointer constant to a pointer to cv-qualified type is a single conversion, and not the sequence of a pointer conversion followed by a qualification conversion (4.4).
An rvalue of type "pointer to cv T," where T is an object type, can be converted to an rvalue of type "pointer to cv void." The result of converting a "pointer to cv T" to a "pointer to cv void" points to the start of the storage location where the object of type T resides, as if the object is a most derived object (1.8) of type T (that is, not a base class subobject).
An rvalue of type "pointer to cv D," where D is a class type, can be converted to an rvalue of type "pointer to cv B," where B is a base class (clause 10) of D. If B is an inaccessible (clause 11) or ambiguous (10.2) base class of D, a program that necessitates this conversion is ill-formed. The result of the conversion is a pointer to the base class sub-object of the derived class object. The null pointer value is converted to the null pointer value of the destination type.
Definition at line 455 of file cpp_typecheck_conversions.cpp.
bool cpp_typecheckt::standard_conversion_pointer_to_member | ( | const exprt & | expr, |
const typet & | type, | ||
exprt & | new_expr | ||
) |
Pointer-to-member conversion.
A null pointer constant (4.10) can be converted to a pointer to member type; the result is the null member pointer value of that type and is distinguishable from any pointer to member not created from a null pointer constant. Two null member pointer values of the same type shall compare equal. The conversion of a null pointer constant to a pointer to member of cv-qualified type is a single conversion, and not the sequence of a pointer to member conversion followed by a qualification conversion (4.4).
An rvalue of type "pointer to member of B of type cv T," where B is a class type, can be converted to an rvalue of type "pointer to member of D of type cv T," where D is a derived class (clause 10) of B. If B is an inaccessible (clause 11), ambiguous (10.2) or virtual (10.1) base class of D, a program that necessitates this conversion is ill-formed. The result of the conversion refers to the same member as the pointer to member before the conversion took place, but it refers to the base class member as if it were a member of the derived class. The result refers to the member in D"s instance of B. Since the result has type "pointer to member of D of type cv T," it can be dereferenced with a D object. The result is the same as if the pointer to member of B were dereferenced with the B sub-object of D. The null member pointer value is converted to the null member pointer value of the destination type.52)
Definition at line 553 of file cpp_typecheck_conversions.cpp.
bool cpp_typecheckt::standard_conversion_qualification | ( | const exprt & | expr, |
const typet & | type, | ||
exprt & | new_expr | ||
) | const |
Qualification conversion.
Definition at line 115 of file cpp_typecheck_conversions.cpp.
bool cpp_typecheckt::standard_conversion_sequence | ( | const exprt & | expr, |
const typet & | type, | ||
exprt & | new_expr, | ||
unsigned & | rank | ||
) |
Standard Conversion Sequence.
A standard conversion sequence is a sequence of standard conversions in the following order:
Definition at line 679 of file cpp_typecheck_conversions.cpp.
|
protected |
Initialization of static objects:
"Objects with static storage duration (3.7.1) shall be zero-initialized (8.5) before any other initialization takes place. Zero-initialization and initialization with a constant expression are collectively called static initialization; all other initialization is dynamic initialization. Objects of POD types (3.9) with static storage duration initialized with constant expressions (5.19) shall be initialized before any dynamic initialization takes place. Objects with static storage duration defined in namespace scope in the same translation unit and dynamically initialized shall be initialized in the order in which their definition appears in the translation unit. [Note: 8.5.1 describes the order in which aggregate members are initialized. The initialization of local static objects is described in 6.7. ]"
Definition at line 149 of file cpp_typecheck.cpp.
bool cpp_typecheckt::static_typecast | ( | const exprt & | expr, |
const typet & | type, | ||
exprt & | new_expr, | ||
bool | check_constantness = true |
||
) |
Definition at line 1841 of file cpp_typecheck_conversions.cpp.
|
protected |
Set up a scope as subscope of the template scope.
Definition at line 113 of file cpp_instantiate_template.cpp.
bool cpp_typecheckt::subtype_typecast | ( | const struct_typet & | from, |
const struct_typet & | to | ||
) | const |
Definition at line 1685 of file cpp_typecheck_compound_type.cpp.
|
protected |
Definition at line 87 of file cpp_typecheck_compound_type.cpp.
|
protected |
Definition at line 23 of file cpp_instantiate_template.cpp.
|
protected |
Definition at line 64 of file cpp_typecheck.cpp.
|
overridevirtual |
Reimplemented from c_typecheck_baset.
Definition at line 77 of file cpp_typecheck.cpp.
|
overridevirtual |
Reimplemented from c_typecheck_baset.
Definition at line 82 of file cpp_typecheck.cpp.
|
overridevirtual |
typechecking main method
Implements c_typecheck_baset.
Definition at line 47 of file cpp_typecheck.cpp.
|
overrideprotectedvirtual |
Reimplemented from c_typecheck_baset.
Definition at line 501 of file cpp_typecheck_code.cpp.
Definition at line 1273 of file cpp_typecheck_expr.cpp.
|
protected |
Definition at line 44 of file cpp_typecheck_template.cpp.
|
protected |
typecheck class template members; these can be methods or static members
Definition at line 312 of file cpp_typecheck_template.cpp.
Reimplemented from c_typecheck_baset.
Definition at line 24 of file cpp_typecheck_code.cpp.
|
protected |
Definition at line 18 of file cpp_typecheck_bases.cpp.
|
inlineoverrideprotectedvirtual |
Reimplemented from c_typecheck_baset.
Definition at line 379 of file cpp_typecheck.h.
Definition at line 946 of file cpp_typecheck_compound_type.cpp.
|
protected |
Definition at line 299 of file cpp_typecheck_compound_type.cpp.
|
overrideprotectedvirtual |
Reimplemented from c_typecheck_baset.
Definition at line 126 of file cpp_typecheck_compound_type.cpp.
Reimplemented from c_typecheck_baset.
Definition at line 396 of file cpp_typecheck_code.cpp.
Definition at line 22 of file cpp_typecheck_enum_type.cpp.
Definition at line 87 of file cpp_typecheck_enum_type.cpp.
Reimplemented from c_typecheck_baset.
Definition at line 2254 of file cpp_typecheck_expr.cpp.
Reimplemented from c_typecheck_baset.
Definition at line 664 of file cpp_typecheck_expr.cpp.
Reimplemented from c_typecheck_baset.
Definition at line 2332 of file cpp_typecheck_expr.cpp.
Reimplemented from c_typecheck_baset.
Definition at line 2352 of file cpp_typecheck_expr.cpp.
|
protected |
Definition at line 1377 of file cpp_typecheck_expr.cpp.
Definition at line 994 of file cpp_typecheck_expr.cpp.
Reimplemented from c_typecheck_baset.
Definition at line 2152 of file cpp_typecheck_expr.cpp.
Definition at line 954 of file cpp_typecheck_expr.cpp.
Definition at line 845 of file cpp_typecheck_expr.cpp.
Reimplemented from c_typecheck_baset.
Definition at line 2237 of file cpp_typecheck_expr.cpp.
Reimplemented from c_typecheck_baset.
Definition at line 2347 of file cpp_typecheck_expr.cpp.
Called after the operands are done.
Reimplemented from c_typecheck_baset.
Definition at line 53 of file cpp_typecheck_expr.cpp.
Reimplemented from c_typecheck_baset.
Definition at line 288 of file cpp_typecheck_expr.cpp.
|
protected |
Definition at line 1060 of file cpp_typecheck_expr.cpp.
Definition at line 752 of file cpp_typecheck_expr.cpp.
Reimplemented from c_typecheck_baset.
Definition at line 350 of file cpp_typecheck_expr.cpp.
|
protected |
Definition at line 1235 of file cpp_typecheck_expr.cpp.
|
overrideprotectedvirtual |
Reimplemented from c_typecheck_baset.
Definition at line 2371 of file cpp_typecheck_expr.cpp.
|
overrideprotectedvirtual |
Reimplemented from c_typecheck_baset.
Definition at line 1885 of file cpp_typecheck_expr.cpp.
Reimplemented from c_typecheck_baset.
Definition at line 295 of file cpp_typecheck_expr.cpp.
Definition at line 975 of file cpp_typecheck_expr.cpp.
Definition at line 727 of file cpp_typecheck_expr.cpp.
Reimplemented from c_typecheck_baset.
Definition at line 134 of file cpp_typecheck_expr.cpp.
Reimplemented from c_typecheck_baset.
Definition at line 1051 of file cpp_typecheck_expr.cpp.
|
protected |
Definition at line 874 of file cpp_typecheck_compound_type.cpp.
|
overrideprotectedvirtual |
expr | function call whose arguments need to be checked |
Reimplemented from c_typecheck_baset.
Definition at line 1835 of file cpp_typecheck_expr.cpp.
|
protected |
Definition at line 355 of file cpp_typecheck_expr.cpp.
|
protected |
typecheck function templates
Definition at line 208 of file cpp_typecheck_template.cpp.
|
overrideprotectedvirtual |
Reimplemented from c_typecheck_baset.
Definition at line 155 of file cpp_typecheck_code.cpp.
|
protected |
Definition at line 1275 of file cpp_typecheck_compound_type.cpp.
Definition at line 213 of file cpp_typecheck_code.cpp.
|
protected |
Definition at line 1919 of file cpp_typecheck_expr.cpp.
|
protected |
Definition at line 18 of file cpp_typecheck_method_bodies.cpp.
|
overrideprotectedvirtual |
Reimplemented from c_typecheck_baset.
Definition at line 2000 of file cpp_typecheck_expr.cpp.
|
overrideprotectedvirtual |
Reimplemented from c_typecheck_baset.
Definition at line 1497 of file cpp_typecheck_expr.cpp.
|
protected |
Definition at line 2082 of file cpp_typecheck_expr.cpp.
Reimplemented from c_typecheck_baset.
Definition at line 183 of file cpp_typecheck_code.cpp.
|
protected |
Definition at line 826 of file cpp_typecheck_template.cpp.
|
protected |
Definition at line 708 of file cpp_typecheck_template.cpp.
Definition at line 91 of file cpp_typecheck_code.cpp.
Reimplemented from c_typecheck_baset.
Definition at line 23 of file cpp_typecheck_type.cpp.
|
overrideprotectedvirtual |
Reimplemented from c_typecheck_baset.
Definition at line 169 of file cpp_typecheck_code.cpp.
bool cpp_typecheckt::user_defined_conversion_sequence | ( | const exprt & | expr, |
const typet & | type, | ||
exprt & | new_expr, | ||
unsigned & | rank | ||
) |
User-defined conversion sequence.
Definition at line 855 of file cpp_typecheck_conversions.cpp.
|
protected |
Definition at line 196 of file cpp_typecheck_initializer.cpp.
|
friend |
Definition at line 81 of file cpp_typecheck.h.
|
friend |
Definition at line 80 of file cpp_typecheck.h.
|
protected |
Definition at line 221 of file cpp_typecheck.h.
|
protected |
Definition at line 106 of file cpp_typecheck.h.
|
protected |
Definition at line 104 of file cpp_typecheck.h.
|
protected |
Definition at line 107 of file cpp_typecheck.h.
|
private |
Definition at line 590 of file cpp_typecheck.h.
|
private |
Definition at line 589 of file cpp_typecheck.h.
|
private |
Definition at line 588 of file cpp_typecheck.h.
|
protected |
Definition at line 177 of file cpp_typecheck.h.
|
protected |
Definition at line 339 of file cpp_typecheck.h.
|
protected |
Definition at line 338 of file cpp_typecheck.h.
|
protected |
Definition at line 220 of file cpp_typecheck.h.
|
protected |
Definition at line 223 of file cpp_typecheck.h.