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

Overload_resolver Class Reference

#include <overload_resolver.h>

List of all members.

Public Types

typedef Overload_candidate Candidate

Public Methods

 Overload_resolver (bool is_operator)
void add_arg (const Expr_result &res)
void set_object (const Expr_result &res)
bool is_object () const
void add_signature (Function_signature *sig)
 Add signature to candidate set, if it is viable. More...

void add_signature_with_type (Function_signature *sig, Type t)
void add_builtin_incdec (bool is_increment)
 Add builtin "++" and "--" operators to the result set. More...

void add_builtin_unary_ops (Type(*predicate)(Type t))
 Add built-in unary operators. More...

void add_builtin_binary_ops (Type(*predicate)(Type t1, Type t2))
 Add built-in binary operators. More...

void add_function (Function_symbol *fsym, bool allow_dups)
 Add all signatures of a function to candidate set. More...

Overload_candidateget_best (bool *is_ambig)
unsigned get_arg_count () const
void dump (std::ostream &os)
Expr_resultget_arg (int i)

Private Methods

bool have_signature (Function_signature *fsig, unsigned limit)

Private Attributes

std::vector< Candidate * > candidates
bool have_object
bool is_operator
std::vector< Expr_resultargs

Friends

class Overload_candidate


Member Typedef Documentation

typedef Overload_candidate Overload_resolver::Candidate
 

Definition at line 43 of file overload_resolver.h.

Referenced by add_signature_with_type().


Constructor & Destructor Documentation

Overload_resolver::Overload_resolver bool    is_operator
 

Definition at line 12 of file overload_resolver.cc.


Member Function Documentation

void Overload_resolver::add_arg const Expr_result   res
 

Definition at line 19 of file overload_resolver.cc.

References args.

Referenced by Expr_annotator::add_parms_from_arglist(), Expr_annotator::do_funcall(), Expr_annotator::visit_array(), Expr_annotator::visit_arrowmember(), Expr_annotator::visit_assign(), Expr_annotator::visit_comma(), Expr_annotator::visit_delete(), Expr_annotator::visit_new(), Expr_annotator::visit_postfix(), and Expr_annotator::visit_unary().

void Overload_resolver::add_builtin_binary_ops Type(*    predicate)(Type t1, Type t2)
 

Add built-in binary operators.

Unloke add_builtin_unary_ops, this one will also feed reference types into the predicate (i.e. "int&" and "long" in a "+=" expression).

Parameters:
predicate  a function which checks whether there is a builtin operator which can take operands of types t1 and t2. If yes, returns the function type of the operator (i.e. "int&(int&,long)"), otherwise returns a null type ("Type()").

Definition at line 225 of file overload_resolver.cc.

References add_signature(), args, Conversion_op_map, enumerate_conversion_ops(), Type::get_return_type(), Type::is_valid(), Function_signature::make_builtin(), and Type::make_reference_type().

Referenced by Expr_annotator::visit_array(), and Expr_annotator::visit_assign().

void Overload_resolver::add_builtin_incdec bool    is_increment
 

Add builtin "++" and "--" operators to the result set.

There are builtin ++ and -- operators for types "volatile T&" and "T&", where "T" is either an arithmetic type or pointer-to-object type

Definition at line 159 of file overload_resolver.cc.

References Function_type_maker::add_parameter(), add_signature(), args, Conversion_op_map, enumerate_conversion_ops(), Type::get_basis_type(), Type::get_kind(), Function_signature::get_proto_type(), Type::get_return_type(), Type::get_unqualified_type(), have_object, Type::is_arithmetic_type(), Type::is_object_type(), Type::is_qualified(), Type::is_same_unqualified_type(), Type::k_Pointer, Type::k_Reference, Function_signature::make_builtin(), Function_type_maker::make_function_type(), Type::make_reference_type(), and Type::q_Const.

Referenced by Expr_annotator::visit_postfix(), and Expr_annotator::visit_unary().

void Overload_resolver::add_builtin_unary_ops Type(*    predicate)(Type t)
 

Add built-in unary operators.

Note that this one is only usable for operators which expect rvalues; it will never feed reference types into predicate.

Parameters:
predicate  a function which checks whether an argument of type t is a valid parameter for the operator. The predicate returns either Type() if the parameter is invalid, otherwise the signature of the operator (e.g. "bool->bool").

Definition at line 203 of file overload_resolver.cc.

References add_signature(), args, Conversion_op_map, enumerate_conversion_ops(), Type::is_valid(), and Function_signature::make_builtin().

Referenced by Expr_annotator::visit_arrowmember(), Expr_annotator::visit_delete(), and Expr_annotator::visit_unary().

void Overload_resolver::add_function Function_symbol   fsym,
bool    allow_dups
 

Add all signatures of a function to candidate set.

If allow_dups is true, a function which already is in the set will be added again; this will cause an ambiguity should that function be chosen. If allow_dups is false, duplicates will not be added. If the Function_symbol itself contains dupes, those will make it into the set, though (this is a feature).

Definition at line 269 of file overload_resolver.cc.

References add_signature(), candidates, have_signature(), Function_symbol::sig_begin(), Function_symbol::sig_end(), and Function_symbol::Sig_it.

Referenced by Expr_annotator::do_funcall(), Init_handler::get_default_initializer_for_type(), Init_handler::make_constructor_call(), Expr_annotator::visit_array(), Expr_annotator::visit_arrowmember(), Expr_annotator::visit_assign(), Expr_annotator::visit_comma(), Expr_annotator::visit_new(), Expr_annotator::visit_postfix(), and Expr_annotator::visit_unary().

void Overload_resolver::add_signature Function_signature   sig
 

Add signature to candidate set, if it is viable.

as_operator = true => if it is a member function, transform it into a function call (XX.operator(YY) => operator(XX, YY)

Definition at line 42 of file overload_resolver.cc.

References add_signature_with_type(), and Function_signature::get_proto_type().

Referenced by add_builtin_binary_ops(), add_builtin_incdec(), add_builtin_unary_ops(), add_function(), Expr_annotator::do_funcall(), and Expr_annotator::visit_unary().

void Overload_resolver::add_signature_with_type Function_signature   sig,
Type    t
 

Definition at line 50 of file overload_resolver.cc.

References ICS_Types::a_Ellipsis, Implicit_conversion::add_conversion(), Overload_candidate::args, args, Candidate, candidates, generate_implicit_conversion(), Type::get_function_arg(), Type::get_kind(), Type::get_num_function_args(), Function_signature::get_storage_specifier(), Function_signature::get_this_type(), Type::k_Ellipsis, Type::make_reference_type(), and s_Member.

Referenced by add_signature().

void Overload_resolver::dump std::ostream &    os
 

Definition at line 320 of file overload_resolver.cc.

References Overload_candidate::args, candidates, Overload_candidate::fsig, Type::get_encoded_type(), and Function_signature::get_proto_type().

Expr_result & Overload_resolver::get_arg int    i [inline]
 

Definition at line 134 of file overload_resolver.h.

References args.

Referenced by Expr_annotator::do_funcall(), Init_handler::make_constructor_call(), Expr_annotator::visit_array(), Expr_annotator::visit_arrowmember(), Expr_annotator::visit_assign(), Expr_annotator::visit_comma(), Expr_annotator::visit_delete(), Expr_annotator::visit_new(), Expr_annotator::visit_postfix(), and Expr_annotator::visit_unary().

unsigned Overload_resolver::get_arg_count   const [inline]
 

Definition at line 127 of file overload_resolver.h.

References args.

Referenced by Expr_annotator::do_funcall(), Init_handler::make_constructor_call(), and Expr_annotator::visit_new().

Overload_candidate * Overload_resolver::get_best bool *    is_ambig
 

Definition at line 291 of file overload_resolver.cc.

References candidates, Overload_candidate::fill_in_tree(), and Overload_candidate::is_better_than().

Referenced by Expr_annotator::do_funcall(), Init_handler::get_default_initializer_for_type(), Init_handler::make_constructor_call(), Expr_annotator::visit_array(), Expr_annotator::visit_arrowmember(), Expr_annotator::visit_assign(), Expr_annotator::visit_comma(), Expr_annotator::visit_delete(), Expr_annotator::visit_new(), Expr_annotator::visit_postfix(), and Expr_annotator::visit_unary().

bool Overload_resolver::have_signature Function_signature   fsig,
unsigned    limit
[private]
 

Definition at line 280 of file overload_resolver.cc.

References candidates.

Referenced by add_function().

bool Overload_resolver::is_object   const [inline]
 

Definition at line 120 of file overload_resolver.h.

References have_object.

Referenced by Expr_annotator::do_funcall().

void Overload_resolver::set_object const Expr_result   res
 

Definition at line 27 of file overload_resolver.cc.

References args, have_object, and is_operator.

Referenced by Expr_annotator::do_funcall(), and Expr_annotator::visit_assign().


Friends And Related Function Documentation

friend class Overload_candidate [friend]
 

Definition at line 53 of file overload_resolver.h.


Member Data Documentation

std::vector<Expr_result> Overload_resolver::args [private]
 

Definition at line 51 of file overload_resolver.h.

Referenced by add_arg(), add_builtin_binary_ops(), add_builtin_incdec(), add_builtin_unary_ops(), add_signature_with_type(), Overload_candidate::fill_in_tree(), get_arg(), get_arg_count(), and set_object().

std::vector<Candidate*> Overload_resolver::candidates [private]
 

Definition at line 45 of file overload_resolver.h.

Referenced by add_function(), add_signature_with_type(), dump(), get_best(), and have_signature().

bool Overload_resolver::have_object [private]
 

Definition at line 47 of file overload_resolver.h.

Referenced by add_builtin_incdec(), Overload_candidate::fill_in_tree(), is_object(), and set_object().

bool Overload_resolver::is_operator [private]
 

Definition at line 48 of file overload_resolver.h.

Referenced by Overload_candidate::fill_in_tree(), and set_object().


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