Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

Implicit_conversion Class Reference

Implicit Conversion Sequence (ICS). More...

#include <implicit_conversion.h>

Inheritance diagram for Implicit_conversion:

Inheritance graph
[legend]
Collaboration diagram for Implicit_conversion:

Collaboration graph
[legend]
List of all members.

Public Types

typedef ICS_Step Step
typedef std::vector< StepStep_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::Stepget_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

Detailed Description

Implicit Conversion Sequence (ICS).

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.


Member Typedef Documentation

typedef ICS_Step Implicit_conversion::Step
 

Definition at line 127 of file implicit_conversion.h.

Referenced by add_conversion(), convert_to_rvalue(), gen_constructors(), gen_conv_ops(), and Implicit_conversion().

typedef std::vector<Step> Implicit_conversion::Step_vec
 

Definition at line 128 of file implicit_conversion.h.


Constructor & Destructor Documentation

Implicit_conversion::Implicit_conversion const Expr_result   result,
Function_signature   symbol_hint
 

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.

Implicit_conversion::~Implicit_conversion  
 

Definition at line 90 of file implicit_conversion.cc.


Member Function Documentation

void Implicit_conversion::add_conversion Action    a,
Type    t
 

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().

void Implicit_conversion::add_step Step    s
 

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().

void Implicit_conversion::append_from Implicit_conversion *    other
 

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().

bool Implicit_conversion::convert_reference Type    target
 

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().

bool Implicit_conversion::convert_to_rvalue Type    target
 

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().

void Implicit_conversion::dump std::ostream &    os
 

Display this ICS on /os/.

Definition at line 177 of file implicit_conversion.cc.

References steps.

const Implicit_conversion::Step & Implicit_conversion::get_current   [inline]
 

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().

Form Implicit_conversion::get_form   const [inline]
 

Definition at line 141 of file implicit_conversion.h.

References form, and ICS_Types::Form.

Referenced by is_better_than().

Rank Implicit_conversion::get_rank   const [inline]
 

Definition at line 142 of file implicit_conversion.h.

References rank, and ICS_Types::Rank.

bool Implicit_conversion::is_ambiguous   const [inline]
 

Definition at line 143 of file implicit_conversion.h.

References ambiguous.

Referenced by make_tree().

bool Implicit_conversion::is_better_than Implicit_conversion *    other,
Compare    comparison_type
 

True iff this ICS is better than /other/.

Parameters:
is_initialisation  true iff this is an initialisation, i.e. compare conversion operator calls according to 13.3.3. False iff this is normal overload resolution.
Returns:
true if this ICS is better, false if it is worse or incomparable.

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().

bool Implicit_conversion::is_npc   const [inline]
 

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().

Expr_result Implicit_conversion::make_tree Expr_result    expr
 

Called before this implicit conversion is used.

Displays warnings, and bombs out if this use is not allowed.

Definition at line 416 of file implicit_conversion.cc.

References ICS_Types::a_ArrayToPointer, ICS_Types::a_BindReferenceToTemporary, ICS_Types::a_BoolConversion, ICS_Types::a_ConversionOp, ICS_Types::a_CtorCall, ICS_Types::a_DerivedToBaseConversion, ICS_Types::a_Ellipsis, ICS_Types::a_FloatingConversion, ICS_Types::a_FloatingIntegralConversion, ICS_Types::a_FloatingPromotion, ICS_Types::a_FunctionToPointer, ICS_Types::a_IntegralConversion, ICS_Types::a_IntegralPromotion, ICS_Types::a_LValueToRValue, ICS_Types::a_NullStep, ICS_Types::a_PointerConversion, ICS_Types::a_PtrMemConversion, ICS_Types::a_QualificationAdjustment, compile_error(), compile_warning(), fill_in_overload_annotation(), Expr_result::get_tree(), is_ambiguous(), Expr_result::is_function(), make_cast_expr_unchecked(), make_name(), make_unary_funcall(), Expr_result::set_kind(), Expr_result::set_value(), steps, and warnings.

Referenced by Init_handler::get_default_initializer_for_type(), Init_handler::make_constructor_call(), Init_handler::process_brace(), Init_handler::process_class(), Expr_annotator::try_static_cast(), Expr_annotator::visit_assign(), Expr_annotator::visit_cond(), Annotator::visit_do(), Annotator::visit_for(), Annotator::visit_if(), Annotator::visit_return(), Annotator::visit_switch(), and Annotator::visit_while().

bool Implicit_conversion::scs_is_better_than Step_vec::const_iterator    a1,
Step_vec::const_iterator    e1,
Step_vec::const_iterator    a2,
Step_vec::const_iterator    e2
[static, private]
 

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().

void Implicit_conversion::set_ambiguous   [inline]
 

Definition at line 144 of file implicit_conversion.h.

References ambiguous.

Referenced by append_from(), gen_conv_ops(), and generate_implicit_conversion().

bool Implicit_conversion::uses_temporary   const
 

Definition at line 189 of file implicit_conversion.cc.

References ICS_Types::a_BindReferenceToTemporary, and steps.

Referenced by generate_ics_for_ternary().

void Implicit_conversion::warn_if_used std::string    s
 

Ensure that a warning is displayed when this ICS is used.

Definition at line 97 of file implicit_conversion.cc.

References warnings.


Member Data Documentation

bool Implicit_conversion::ambiguous [private]
 

Definition at line 139 of file implicit_conversion.h.

Referenced by is_ambiguous(), and set_ambiguous().

Form Implicit_conversion::form [private]
 

Definition at line 137 of file implicit_conversion.h.

Referenced by add_step(), and get_form().

bool Implicit_conversion::maybe_npc [private]
 

Definition at line 134 of file implicit_conversion.h.

Referenced by Implicit_conversion(), and is_npc().

Rank Implicit_conversion::rank [private]
 

Definition at line 138 of file implicit_conversion.h.

Referenced by add_step(), and get_rank().

Step_vec Implicit_conversion::steps [private]
 

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().

std::string Implicit_conversion::warnings [private]
 

Definition at line 132 of file implicit_conversion.h.

Referenced by make_tree(), and warn_if_used().


The documentation for this class was generated from the following files:
Generated on Mon Feb 10 17:35:40 2003 for VFiasco Semantics Compiler by doxygen1.2.15