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

expr_annotator.h

Go to the documentation of this file.
00001 // AUTOMATICALLY GENERATED -- DO NOT EDIT!         -*- c++ -*-
00002 
00003 #ifndef expr_annotator_h
00004 #define expr_annotator_h
00005 
00006 #include "paranoid_visitor.h"
00007 #include "expr_result.h"
00008 
00009 //
00010 // INTERFACE definition follows 
00011 //
00012 
00013 
00014 class Source;
00015 class Symbol_table;
00016 class Function_symbol;
00017 class Abstract_scope;
00018 class Overload_resolver;
00029 class Expr_annotator : public Paranoid_visitor<Expr_result> {
00030     Abstract_scope* current_scope;
00031  public:
00032     static const int PTR_DELEGATION_LIMIT = 100;
00033 
00034 public:  
00035   /***************************** Expr_annotator ****************************/
00036   Expr_annotator(Abstract_scope* scope, Source* source);
00037   
00040   Expr_result visit_infix(PtreeInfixExpr *p);
00041   
00042   /************************* Atoms (literal, names) ************************/
00043   
00045   Expr_result visit_leaf(Leaf* l);
00046   
00049   Expr_result visit_name(Ptree* p);
00050   
00052   Expr_result visit_this(LeafThis* p);
00053   
00054   /****************************** Parentheses ******************************/
00055   
00058   Expr_result visit_paren(PtreeParenExpr* e);
00059   
00060   /*************************** Postfix operators ***************************/
00061   
00066   Expr_result visit_postfix(PtreePostfixExpr* e);
00067   
00069   Expr_result visit_unary(PtreeUnaryExpr* e);
00070   
00072   Expr_result visit_delete(PtreeDeleteExpr* pde);
00073   
00074   /********************************** New **********************************/
00075   
00077   Expr_result visit_new(PtreeNewExpr* p_);
00078   
00080   Expr_result visit_sizeof(PtreeSizeofExpr* e);
00081   
00083   Expr_result visit_throw(PtreeThrowExpr* p);
00084   
00086   Expr_result visit_dotmember(PtreeDotMemberExpr* e);
00087   
00090   Expr_result visit_arrowmember(PtreeArrowMemberExpr* e);
00091   
00093   Expr_result visit_pm(PtreePmExpr* e);
00094   
00096   Expr_result visit_cond(PtreeCondExpr* p);
00097   
00101   Expr_result do_fstyle_cast(Type target, Ptree* arglist);
00102   
00103   void add_parms_from_arglist(Overload_resolver* resolver, Ptree* p);
00104   
00106   Expr_result visit_fstylecastexpr(PtreeFstyleCastExpr* e);
00107   
00109   Expr_result visit_funcall(PtreeFuncallExpr* e);
00110   
00112   Expr_result visit_cast(PtreeCastExpr* p);
00113   
00114   /* Visit brace. This simplifies initializer handling. */
00115   Expr_result visit_brace(PtreeBrace* b);
00116   
00118   Expr_result visit_assign(PtreeAssignExpr* p);
00119   
00120   Expr_result visit_array(PtreeArrayExpr* p);
00121 
00122 private:  
00126   Expr_result visit_comma(PtreeCommaExpr* e);
00127   
00129   Expr_result process_binary_operator(Ptree* oper, Expr_result l, Expr_result r);
00130   
00131   // static Type
00132   // cast_to_enum_predicate(Type t)
00133   // {
00134   //     if (t.is_int() || t.is_enum_type())
00135   //         return make_unary_function_type(t, t);
00136   //     return Type();
00137   // }
00138   
00142   Expr_result process_unary_operator(Ptree* oper, Expr_result arg);
00143   
00144   /**************************** Member reference ***************************/
00145   
00147   Expr_result process_member_access(Expr_result lhs, Ptree* rhs_tree);
00148   
00150   Expr_result process_pm_expr(Expr_result lhs, const Expr_result& rhs);
00151   
00152   /************************ Function Call and Casts ************************/
00153   /**************************** Helper functions ***************************/
00154   
00155   // bool
00156   // convert_expr_to_bool(Expr_result* res)
00157   // {
00158   //     Implicit_conversion* ics = generate_implicit_conversion(*res, bool_type, 0,
00159   //                                                             true, false, false);
00160   //     if (!ics)
00161   //         return false;
00162   
00163   //     *res = ics->make_tree(*res);
00164   //     return true;
00165   // }
00166   
00167   // bool
00168   // convert_expr_to_integral(Expr_result* res)
00169   // {
00170   //     if (res->get_type().is_class_type()) {
00171   //         Overload_resolver resolver;
00172   //         resolver.add_arg(*res);
00173   //         resolver.add_builtin_unary_ops(cast_to_enum_predicate);
00174   //         if (!resolver.get_best(0))
00175   //             return false;
00176   //         *res = resolver.get_arg(0);
00177   //         return true;
00178   //     }
00179   //     if (res->get_type().is_int() || res->get_type().is_enum_type())
00180   //         return true;
00181   //     return false;
00182   // }
00183   
00185   Type get_cast_type(Ptree* type_args);
00186   
00188   Expr_result get_cast_expr(Ptree* tree);
00189   
00191   bool try_static_cast(Type target, bool enforce_const, Expr_result* res);
00192   
00193   /************************ These generate the trees ***********************/
00194   Expr_result do_dynamic_cast(Ptree* type_args, Ptree* cast_args);
00195   
00196   Expr_result do_reinterpret_cast(Ptree* type_args, Ptree* cast_args);
00197   
00198   Expr_result do_static_cast(Ptree* type_args, Ptree* cast_args);
00199   
00200   Expr_result do_const_cast(Ptree* type_args, Ptree* cast_args);
00201   
00205   Expr_result do_ccast(Type t, Ptree* arg);
00206   
00211   Expr_result do_funcall(Expr_result lhs, Ptree* arglist);
00212 };
00213 
00215 bool try_reinterpret_cast(Type t, bool enforce_const, Expr_result* res);
00216 
00217 /******************************* Assignment ******************************/
00218 
00221 Type binary_multeq_predicate(Type l, Type r);
00222 
00226 Type binary_addeq_predicate(Type l, Type r);
00227 
00230 Type binary_inteq_predicate(Type l, Type r);
00231 
00232 #endif // expr_annotator_h

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