00001 // AUTOMATICALLY GENERATED -- DO NOT EDIT! -*- c++ -*- 00002 00003 #ifndef overload_resolver_h 00004 #define overload_resolver_h 00005 00006 #include <vector> 00007 #include <types.h> 00008 #include <iosfwd> 00009 #include "expr_result.h" 00010 00011 // 00012 // INTERFACE definition follows 00013 // 00014 00015 00016 class Implicit_conversion; 00017 class Function_signature; 00018 class Function_symbol; 00019 class Overload_resolver; 00025 struct Overload_candidate : public LightObject { 00026 Function_signature* fsig; 00027 std::vector<Implicit_conversion*> args; 00028 00029 public: 00030 /********************** Overload_resolver::Candidate *********************/ 00031 Overload_candidate(Function_signature* sig); 00032 00033 ~Overload_candidate(); 00034 00036 bool is_better_than(Overload_candidate* other); 00037 00038 void fill_in_tree(Overload_resolver* resolver); 00039 }; 00040 00041 class Overload_resolver { 00042 public: 00043 typedef Overload_candidate Candidate; 00044 private: 00045 std::vector<Candidate*> candidates; 00046 00047 bool have_object; 00048 bool is_operator; 00049 /* parameters. If there is an implicit object argument, it 00050 is first in this list. */ 00051 std::vector<Expr_result> args; 00052 00053 friend class Overload_candidate; 00054 00055 public: 00056 /*************************** Overload_resolver ***************************/ 00057 Overload_resolver(bool is_operator); 00058 00059 void add_arg(const Expr_result& res); 00060 00061 void set_object(const Expr_result& res); 00062 00063 bool is_object() const; 00064 00068 void add_signature(Function_signature* sig); 00069 00070 void add_signature_with_type(Function_signature* sig, Type t); 00071 00075 void add_builtin_incdec(bool is_increment); 00076 00082 void add_builtin_unary_ops(Type (*predicate)(Type t)); 00083 00091 void add_builtin_binary_ops(Type (*predicate)(Type t1, Type t2)); 00092 00099 void add_function(Function_symbol* fsym, bool allow_dups); 00100 00101 Overload_candidate* get_best(bool* is_ambig); 00102 00103 unsigned get_arg_count() const; 00104 00105 void dump(std::ostream& os); 00106 00107 Expr_result& get_arg(int i); 00108 00109 private: 00110 bool have_signature(Function_signature* fsig, unsigned limit); 00111 }; 00112 00113 // 00114 // IMPLEMENTATION of inline functions (and needed classes) 00115 // 00116 00117 00118 00119 inline bool 00120 Overload_resolver::is_object() const 00121 { 00122 return have_object; 00123 } 00124 00125 00126 inline unsigned 00127 Overload_resolver::get_arg_count() const 00128 { 00129 return args.size(); 00130 } 00131 00132 00133 inline Expr_result& 00134 Overload_resolver::get_arg(int i) 00135 { 00136 return args[i]; 00137 } 00138 00139 #endif // overload_resolver_h