#include "expr_annotator.h"
#include "expr_annotator_i.h"
Include dependency graph for expr_annotator.cc:
Go to the source code of this file.
Functions | |
bool | has_type (Expr_result *l, const Type &t) |
True if expression l has type t. More... | |
Type | get_merged_cv_type (Type l, Type r) |
Give two similar types, merge their cv qualifiers. More... | |
Type | get_composite_pointer_type (Expr_result *l, Expr_result *r) |
Get composite type for pointer comparison (5.9p2). More... | |
Type | get_composite_mptr_type (Expr_result *l, Expr_result *r) |
Get composite type for pointer comparison (5.9p2). More... | |
void | do_pointer_arith_conversions (Expr_result *l, Expr_result *r) |
Do conversions for pointer arithmetic, to bring both to a common type. More... | |
void | do_mptr_arith_conversions (Expr_result *l, Expr_result *r) |
Do conversions for member pointer comparison, to bring both to a common type. More... | |
void | do_usual_conversions (Expr_result *l, Expr_result *r) |
Do the "usual arithmetic conversions", 5p9. More... | |
Annotated< PtreeUnaryExpr > * | make_this_star (Type t) |
Generate tree for expression "*this". More... | |
Annotated< PtreeInfixExpr > * | make_infix_expr (Type rt, Ptree *lhs, Ptree *op, Ptree *rhs) |
Generate infix operator expression. More... | |
Annotated< PtreeUnaryExpr > * | make_prefix_expr (Type rt, Ptree *op, Ptree *arg) |
Generate prefix operator expression. More... | |
void | check_ptr_arith (Type t) |
Type | unary_deref_predicate (Type t) |
Predicate for unary "*" operator. More... | |
Type | unary_plus_predicate (Type t) |
Predicate for unary "+" operator. More... | |
Type | unary_minus_predicate (Type t) |
Predicate for unary "-" operator. More... | |
Type | unary_bitnot_predicate (Type t) |
Predicate for unary "~" operator. More... | |
Type | unary_delete_or_arrow_predicate (Type t) |
Predicate for builtin "->" operator, and for "delete". More... | |
Expr_result | make_sizeof_expr (Type t) |
Make a "sizeof" expression for type t (i.e. More... | |
Annotated< PtreeCondExpr > * | make_cond_expr (Type ty, Ptree *i, Ptree *t, Ptree *e) |
Make ternary operator expression. More... | |
Implicit_conversion * | generate_ics_for_ternary (Expr_result e1, Expr_result e2) |
Type | index_predicate (Type l, Type r) |
Predicate for [] operator. More... | |
bool | try_reinterpret_cast (Type t, bool enforce_const, Expr_result *res) |
Attempt to do reinterpret_cast. More... | |
Type | binary_multeq_predicate (Type l, Type r) |
Predicate for *= and /=. More... | |
Type | binary_addeq_predicate (Type l, Type r) |
Predicate for += and -=. More... | |
Type | binary_inteq_predicate (Type l, Type r) |
Predicate for %=, <<=, etc. More... |
|
Predicate for += and -=. These accept "cv-arith&" on the LHS, and "arith" or "enum" on the RHS; or "cv-obj*&" on the LHS and ptrdiff_t on the RHS. Definition at line 2594 of file expr_annotator.cc. References Type::get_basis_type(), Type::get_kind(), Type::get_promoted_integer(), Type::is_arithmetic_type(), Type::is_enum_type(), Type::is_int(), Type::is_object_type(), Type::k_Pointer, Type::k_Reference, make_binary_function_type(), and Type::sans_reference(). |
|
Predicate for %=, <<=, etc. These accept "cv-integral&" on the LHS, and "arith" or "enum" on the RHS. Definition at line 2617 of file expr_annotator.cc. References Type::get_basis_type(), Type::get_kind(), Type::get_promoted_integer(), Type::is_enum_type(), Type::is_int(), Type::k_Reference, make_binary_function_type(), and Type::sans_reference(). |
|
Predicate for *= and /=. These accept "cv-arith&" on the LHS, and "arith" or "enum" on the RHS. Definition at line 2571 of file expr_annotator.cc. References Type::get_basis_type(), Type::get_kind(), Type::get_promoted_integer(), Type::is_arithmetic_type(), Type::is_enum_type(), Type::is_float(), Type::is_int(), Type::is_same_unqualified_type(), Type::k_Reference, make_binary_function_type(), and Type::sans_reference(). |
|
Definition at line 406 of file expr_annotator.cc. References compile_error(), Type::get_basis_type(), Type::is_complete(), and Type::is_object_type(). Referenced by Expr_annotator::process_binary_operator(), Expr_annotator::visit_array(), and Expr_annotator::visit_assign(). |
|
Do conversions for member pointer comparison, to bring both to a common type.
Definition at line 273 of file expr_annotator.cc. References Expr_result::convert_to(), get_composite_mptr_type(), Type::get_kind(), Expr_result::get_type(), Expr_result::is_npc(), and Type::k_Member. Referenced by Expr_annotator::process_binary_operator(), and Expr_annotator::visit_cond(). |
|
Do conversions for pointer arithmetic, to bring both to a common type.
Definition at line 258 of file expr_annotator.cc. References Expr_result::convert_to(), get_composite_pointer_type(), Type::get_kind(), Expr_result::get_type(), Expr_result::is_npc(), and Type::k_Pointer. Referenced by Expr_annotator::process_binary_operator(), and Expr_annotator::visit_cond(). |
|
Do the "usual arithmetic conversions", 5p9.
Definition at line 287 of file expr_annotator.cc. References Expr_result::convert_to(), Expr_result::do_integral_promotions(), Expr_result::get_type(), has_type(), Type::is_arithmetic_type(), and Type::is_enum_type(). Referenced by Expr_annotator::process_binary_operator(), and Expr_annotator::visit_cond(). |
|
Definition at line 1838 of file expr_annotator.cc. References Expr_result::convert_to_rvalue(), generate_implicit_conversion(), Expr_result::get_type(), Expr_result::is_lvalue(), Type::make_reference_type(), and Implicit_conversion::uses_temporary(). Referenced by Expr_annotator::visit_cond(). |
|
Get composite type for pointer comparison (5.9p2).
Definition at line 219 of file expr_annotator.cc. References compile_error(), Type::get_class_type(), Type::get_kind(), Type::get_member_type(), get_merged_cv_type(), Expr_result::get_type(), Type::get_type_symbol(), Class_symbol::is_base_class_of(), Expr_result::is_npc(), Type::is_same_unqualified_type(), Type::k_Member, Type::make_member_type(), and Type::with_qualifiers(). Referenced by do_mptr_arith_conversions(). |
|
Get composite type for pointer comparison (5.9p2).
Definition at line 169 of file expr_annotator.cc. References compile_error(), Type::get_basis_type(), Type::get_kind(), get_merged_cv_type(), Symbol::get_name(), Expr_result::get_type(), Type::get_type_symbol(), Type::is_class_type(), Expr_result::is_npc(), Type::is_same_unqualified_type(), Class_symbol::is_unique_base_class_of(), Type::is_void(), Type::k_Function, Type::k_Pointer, Type::make_pointer_type(), and Type::with_qualifiers(). Referenced by do_pointer_arith_conversions(). |
|
Give two similar types, merge their cv qualifiers. For example, given "int const **" and "int ** const", this returns "int const ** const". Throws if types are not similar. Definition at line 148 of file expr_annotator.cc. References compile_error(), Type::get_basis_type(), Type::get_class_type(), Type::get_kind(), Type::get_member_type(), Type::is_same_unqualified_type(), Type::k_Member, Type::k_Pointer, Type::make_member_type(), Type::make_pointer_type(), and Type::with_qualifiers(). Referenced by get_composite_mptr_type(), and get_composite_pointer_type(). |
|
True if expression l has type t.
Definition at line 137 of file expr_annotator.cc. References Expr_result::get_type(), and Type::is_same_unqualified_type(). Referenced by do_usual_conversions(). |
|
Predicate for [] operator. This one takes a pointer or array and an arithmetic type. Definition at line 2833 of file expr_annotator.cc. References Type::get_basis_type(), Type::get_kind(), Type::is_arithmetic_type(), Type::is_enum_type(), Type::k_Array, Type::k_Pointer, make_binary_function_type(), Type::make_pointer_type(), and Type::sans_reference(). |
|
Make ternary operator expression.
Definition at line 1826 of file expr_annotator.cc. References Ptree::List(), and make_static_leaf(). Referenced by Expr_annotator::visit_cond(). |
|
Generate infix operator expression.
Definition at line 386 of file expr_annotator.cc. References Ptree::List(). Referenced by Expr_annotator::process_binary_operator(). |
|
Generate prefix operator expression.
Definition at line 395 of file expr_annotator.cc. References Ptree::List(). Referenced by Expr_annotator::process_unary_operator(), Expr_annotator::visit_arrowmember(), Expr_annotator::visit_pm(), and Expr_annotator::visit_unary(). |
|
Make a "sizeof" expression for type t (i.e. "sizeof(T)"). Definition at line 1482 of file expr_annotator.cc. References compile_error(), Type::get_encoded_type(), Type::get_kind(), Type::is_complete(), Type::is_valid(), Type::k_Function, Expr_result::k_RValue, Ptree::List(), make_name(), and make_static_leaf(). Referenced by Expr_annotator::visit_new(), and Expr_annotator::visit_sizeof(). |
|
Generate tree for expression "*this".
Definition at line 375 of file expr_annotator.cc. References Ptree::List(), make_static_leaf(), and make_this(). Referenced by Expr_annotator::do_funcall(), and Expr_annotator::visit_name(). |
|
Attempt to do reinterpret_cast.
Definition at line 2086 of file expr_annotator.cc. References Expr_result::convert_to(), Expr_result::convert_to_fpointer(), Expr_result::convert_to_pointer(), Type::get_basis_type(), Type::get_class_type(), Type::get_kind(), Type::get_member_type(), Expr_result::get_type(), Type::is_enum_type(), Type::is_int(), Expr_result::is_lvalue(), Type::is_more_qualified_than(), Type::is_valid(), Type::k_Array, Type::k_Function, Type::k_Member, Type::k_Pointer, and Type::k_Reference. Referenced by Expr_annotator::do_ccast(), and Expr_annotator::do_reinterpret_cast(). |
|
Predicate for unary "~" operator. There is one for every promoted integral type. Definition at line 997 of file expr_annotator.cc. References Type::get_promoted_integer(), Type::is_enum_type(), Type::is_int(), and make_unary_function_type(). |
|
Predicate for builtin "->" operator, and for "delete". Those need a pointer to object on the left-hand side. The return type is irrelevant for overload resolution. Definition at line 1259 of file expr_annotator.cc. References Type::get_basis_type(), Type::get_kind(), Type::is_object_type(), Type::k_Pointer, and make_unary_function_type(). |
|
Predicate for unary "*" operator. There is one "operator *(T *)" for every function and object pointer. Definition at line 952 of file expr_annotator.cc. References Type::get_basis_type(), Type::get_kind(), Type::is_object_type(), Type::k_Function, Type::k_Pointer, Type::make_reference_type(), and make_unary_function_type(). |
|
Predicate for unary "-" operator. There is one "operator-(T)" for every promoted arithmetic type. Definition at line 983 of file expr_annotator.cc. References Type::get_promoted_integer(), Type::is_arithmetic_type(), Type::is_enum_type(), and make_unary_function_type(). |
|
Predicate for unary "+" operator. There is one "operator+(T)" for every pointer and promoted arithmetic type. Definition at line 967 of file expr_annotator.cc. References Type::get_kind(), Type::get_promoted_integer(), Type::is_arithmetic_type(), Type::is_enum_type(), Type::k_Pointer, and make_unary_function_type(). |