#include <implicit_conversion.h>
Inheritance diagram for Implicit_conversion:
Public Types | |
typedef ICS_Step | Step |
typedef std::vector< Step > | Step_vec |
Public Methods | |
Form | get_form () const |
Rank | get_rank () const |
bool | is_ambiguous () const |
void | set_ambiguous () |
Implicit_conversion (const Expr_result &result, Function_signature *symbol_hint) | |
Make an implicit conversion sequence starting at /result/. More... | |
~Implicit_conversion () | |
const Implicit_conversion::Step & | get_current () |
Get current final step. More... | |
bool | is_npc () const |
True iff the initial expression is a possible null pointer constant. More... | |
void | warn_if_used (std::string s) |
Ensure that a warning is displayed when this ICS is used. More... | |
void | add_step (Step s) |
Add a step. More... | |
void | add_conversion (Action a, Type t) |
Add conversion to a type. More... | |
bool | convert_to_rvalue (Type target) |
Convert to lvalue, and add qualifiers. More... | |
void | dump (std::ostream &os) |
Display this ICS on /os/. More... | |
bool | uses_temporary () const |
bool | is_better_than (Implicit_conversion *other, Compare comparison_type) |
True iff this ICS is better than /other/. More... | |
Expr_result | make_tree (Expr_result expr) |
Called before this implicit conversion is used. More... | |
bool | convert_reference (Type target) |
Assuming this is a reference, convert it to "reference to target". More... | |
void | append_from (Implicit_conversion *other) |
Static Private Methods | |
bool | scs_is_better_than (Step_vec::const_iterator a1, Step_vec::const_iterator e1, Step_vec::const_iterator a2, Step_vec::const_iterator e2) |
Compare two standard conversion sequences. More... | |
Private Attributes | |
Step_vec | steps |
std::string | warnings |
bool | maybe_npc |
Form | form |
Rank | rank |
bool | ambiguous |
Every ICS starts with a null step (a_NullStep) followed by any number of conversion steps. Each step contains the target type of its conversion, the source type for that step is the target of the previous one (that's what the null step is for).
The first step may contain a Function_signature pointer in its /function/ member, when the expression to convert is an overloaded function.
Definition at line 125 of file implicit_conversion.h.
|
Definition at line 127 of file implicit_conversion.h. Referenced by add_conversion(), convert_to_rvalue(), gen_constructors(), gen_conv_ops(), and Implicit_conversion(). |
|
Definition at line 128 of file implicit_conversion.h. |
|
Make an implicit conversion sequence starting at /result/.
Definition at line 78 of file implicit_conversion.cc. References ICS_Types::a_NullStep, Expr_result::get_kind(), Expr_result::get_type(), Expr_result::is_npc(), Expr_result::is_value(), maybe_npc, Step, and steps. |
|
Definition at line 90 of file implicit_conversion.cc. |
|
Add conversion to a type. Conversions don't change lvalueness etc. Definition at line 125 of file implicit_conversion.cc. References add_step(), get_current(), and Step. Referenced by Overload_resolver::add_signature_with_type(), convert_reference(), and gen_builtin_conversions(). |
|
Add a step.
Definition at line 108 of file implicit_conversion.cc. References form, ICS_Types::Form, ICS_Step::get_form(), ICS_Step::get_rank(), rank, ICS_Types::Rank, and steps. Referenced by add_conversion(), append_from(), convert_to_rvalue(), gen_candidates(), gen_constructors(), and gen_conv_ops(). |
|
Definition at line 519 of file implicit_conversion.cc. References ICS_Types::a_NullStep, add_step(), set_ambiguous(), and steps. Referenced by gen_conv_ops(). |
|
Assuming this is a reference, convert it to "reference to target". Return false if impossible. Definition at line 493 of file implicit_conversion.cc. References ICS_Types::a_DerivedToBaseConversion, ICS_Types::a_QualificationAdjustment, add_conversion(), get_current(), Type::get_kind(), Type::get_type_symbol(), Type::get_unqualified_type(), Class_symbol::is_base_class_of(), Type::is_more_qualified_than(), Type::is_same_unqualified_type(), Type::k_Userdef, and Type::with_qualifiers(). Referenced by gen_candidates(), and gen_conv_ops(). |
|
Convert to lvalue, and add qualifiers. This also applies the array-to-pointer and function-to-pointer conversions. Definition at line 136 of file implicit_conversion.cc. References ICS_Types::a_ArrayToPointer, ICS_Types::a_FunctionToPointer, ICS_Types::a_LValueToRValue, ICS_Types::a_QualificationAdjustment, add_step(), Type::copy_qualifiers(), Type::get_basis_type(), get_current(), Type::get_kind(), Type::get_unqualified_type(), Type::is_class_type(), Type::is_more_qualified_than(), Type::k_Array, Type::k_Function, Expr_result::k_RValue, Type::make_pointer_type(), Step, and Type::with_qualifiers(). Referenced by gen_builtin_conversions(), and gen_constructors(). |
|
Display this ICS on /os/.
Definition at line 177 of file implicit_conversion.cc. References steps. |
|
Get current final step. This one contains the current type. Definition at line 241 of file implicit_conversion.h. References steps. Referenced by add_conversion(), convert_reference(), convert_to_rvalue(), and gen_builtin_conversions(). |
|
Definition at line 141 of file implicit_conversion.h. References form, and ICS_Types::Form. Referenced by is_better_than(). |
|
Definition at line 142 of file implicit_conversion.h. References rank, and ICS_Types::Rank. |
|
Definition at line 143 of file implicit_conversion.h. References ambiguous. Referenced by make_tree(). |
|
True iff this ICS is better than /other/.
Definition at line 344 of file implicit_conversion.cc. References ICS_Types::a_ConversionOp, ICS_Types::c_CompareBeforeUserConversion, ICS_Types::c_CompareWithInitRules, ICS_Types::f_Standard, ICS_Types::f_Userdef, get_form(), scs_is_better_than(), and steps. Referenced by generate_implicit_conversion(). |
|
True iff the initial expression is a possible null pointer constant.
Definition at line 249 of file implicit_conversion.h. References maybe_npc. Referenced by gen_builtin_conversions(). |
|
|
Compare two standard conversion sequences. Returns true iff [a1,e1) is better than [a2,e2) according to the rules in 13.3.3.2. Definition at line 213 of file implicit_conversion.cc. References ICS_Types::a_DerivedToBaseConversion, ICS_Types::a_NullStep, ICS_Types::a_PointerConversion, ICS_Types::a_PtrMemConversion, class_or_null(), Type::get_basis_type(), Type::get_class_type(), Type::get_kind(), Class_symbol::is_base_class_of(), is_ptr_to_bool(), Type::k_Member, Type::k_Pointer, ICS_Types::r_Exact, and ICS_Types::Rank. Referenced by is_better_than(). |
|
Definition at line 144 of file implicit_conversion.h. References ambiguous. Referenced by append_from(), gen_conv_ops(), and generate_implicit_conversion(). |
|
Definition at line 189 of file implicit_conversion.cc. References ICS_Types::a_BindReferenceToTemporary, and steps. Referenced by generate_ics_for_ternary(). |
|
Ensure that a warning is displayed when this ICS is used.
Definition at line 97 of file implicit_conversion.cc. References warnings. |
|
Definition at line 139 of file implicit_conversion.h. Referenced by is_ambiguous(), and set_ambiguous(). |
|
Definition at line 137 of file implicit_conversion.h. |
|
Definition at line 134 of file implicit_conversion.h. Referenced by Implicit_conversion(), and is_npc(). |
|
Definition at line 138 of file implicit_conversion.h. |
|
Definition at line 130 of file implicit_conversion.h. Referenced by add_step(), append_from(), dump(), get_current(), Implicit_conversion(), is_better_than(), make_tree(), and uses_temporary(). |
|
Definition at line 132 of file implicit_conversion.h. Referenced by make_tree(), and warn_if_used(). |