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

implicit_conversion.h File Reference

#include <vector>
#include <map>
#include <types.h>
#include "expr_result.h"

Include dependency graph for implicit_conversion.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Compounds

struct  ICS_Step
struct  ICS_Types
class  Implicit_conversion
 Implicit Conversion Sequence (ICS). More...


Typedefs

typedef std::map< Function_signature *,
int > 
Conversion_op_map

Functions

void enumerate_conversion_ops (const Expr_result &expr, Conversion_op_map *output)
void gen_candidates (Expr_result expr, Type arg_type, Function_signature *symbol_hint, bool with_userdef, bool is_object, std::vector< Implicit_conversion * > *candidates)
 Generate all implicit conversion candidates for an expression. More...

Implicit_conversiongenerate_implicit_conversion (Expr_result expr, Type arg_type, Function_signature *symbol_hint, bool with_userdef, bool is_copy_initialisation, bool is_implicit_object_arg)
 Generate all ICS's and return the best one. More...


Typedef Documentation

typedef std::map<Function_signature*, int> Conversion_op_map
 

Definition at line 27 of file implicit_conversion.h.

Referenced by Overload_resolver::add_builtin_binary_ops(), Overload_resolver::add_builtin_incdec(), Overload_resolver::add_builtin_unary_ops(), Expr_annotator::do_funcall(), enumerate_conversion_ops(), gen_conv_ops(), and Annotator::visit_switch().


Function Documentation

void enumerate_conversion_ops const Expr_result   expr,
Conversion_op_map   output
 

Definition at line 977 of file implicit_conversion.cc.

References Class_symbol::bases_t, compile_error(), Conversion_op_map, Symbol_name::CONVERSION_OPERATOR_NAME, Class_symbol::enumerate_base_classes(), Type::get_kind(), Symbol::get_name(), Expr_result::get_type(), Type::get_type_symbol(), Symbol::is_defined(), Class_op_lookup_helper::is_visible_in(), Type::k_Userdef, Type::make_member_type(), Function_symbol::sig_begin(), Function_symbol::sig_end(), and Function_symbol::Sig_it.

Referenced by Overload_resolver::add_builtin_binary_ops(), Overload_resolver::add_builtin_incdec(), Overload_resolver::add_builtin_unary_ops(), Expr_annotator::do_funcall(), gen_conv_ops(), and Annotator::visit_switch().

void gen_candidates Expr_result    expr,
Type    arg_type,
Function_signature   symbol_hint,
bool    with_userdef,
bool    is_object,
std::vector< Implicit_conversion * > *    candidates
 

Generate all implicit conversion candidates for an expression.

Parameters:
expr  the "input" expression
arg_type  the target type to convert to
symbol_hint  value to put into the ICS as symbol hint. This is used for expressions like "f(g)" where "g" is an overloaded function. Normally, the "g" node of "expr.tree" should be annotated with "symbol_hint", but we don't know that until we do overload resolution.
with_userdef  include user-defined conversions
candidates  output space

Definition at line 1079 of file implicit_conversion.cc.

References ICS_Types::a_BindReferenceToTemporary, Implicit_conversion::add_step(), Implicit_conversion::convert_reference(), gen_builtin_conversions(), gen_constructors(), gen_conv_ops(), generate_implicit_conversion(), Type::get_basis_type(), Expr_result::get_function(), Type::get_kind(), Expr_result::get_tree(), Expr_result::get_type(), Type::get_unqualified_type(), Expr_result::is_bound_member(), Expr_result::is_function(), Expr_result::is_lvalue(), Type::is_qualified(), Type::is_valid(), Expr_result::k_LValue, Type::k_Reference, Type::k_Userdef, Type::q_Const, Type::q_Volatile, Expr_result::set_value(), Function_symbol::sig_begin(), Function_symbol::sig_end(), and Function_symbol::Sig_it.

Referenced by generate_implicit_conversion().

Implicit_conversion* generate_implicit_conversion Expr_result    expr,
Type    arg_type,
Function_signature   symbol_hint,
bool    with_userdef,
bool    is_copy_initialisation,
bool    is_implicit_object_arg
 

Generate all ICS's and return the best one.

Returns an ambiguous sequence if conversion is ambiguous, null if impossible.

Definition at line 1171 of file implicit_conversion.cc.

References ICS_Types::c_CompareBeforeUserConversion, ICS_Types::c_CompareWithInitRules, ICS_Types::Compare, gen_candidates(), Expr_result::get_type(), Implicit_conversion::is_better_than(), Type::is_class_type(), Type::is_same_unqualified_type(), Type::is_void(), and Implicit_conversion::set_ambiguous().

Referenced by Overload_resolver::add_signature_with_type(), gen_candidates(), gen_constructors(), gen_conv_ops(), generate_ics_for_ternary(), 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().


Generated on Mon Feb 10 17:33:59 2003 for VFiasco Semantics Compiler by doxygen1.2.15