Ignore:
Timestamp:
Jun 5, 2019, 8:36:48 PM (5 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
866545b
Parents:
67130fe (diff), 3cd5fdd (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

fix conflicit

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/AST/Pass.proto.hpp

    r67130fe rc6a1e8a  
    265265        };
    266266
    267         // Finally certain pass desire an up to date indexer automatically
    268         // detect the presence of a member name indexer and call all the members appropriately
    269         namespace indexer {
     267        // Finally certain pass desire an up to date symbol table automatically
     268        // detect the presence of a member name `symtab` and call all the members appropriately
     269        namespace symtab {
    270270                // Some simple scoping rules
    271271                template<typename pass_t>
    272                 static inline auto enter( pass_t & pass, int ) -> decltype( pass.indexer.enterScope(), void() ) {
    273                         pass.indexer.enterScope();
     272                static inline auto enter( pass_t & pass, int ) -> decltype( pass.symtab.enterScope(), void() ) {
     273                        pass.symtab.enterScope();
    274274                }
    275275
     
    278278
    279279                template<typename pass_t>
    280                 static inline auto leave( pass_t & pass, int ) -> decltype( pass.indexer.leaveScope(), void() ) {
    281                         pass.indexer.leaveScope();
     280                static inline auto leave( pass_t & pass, int ) -> decltype( pass.symtab.leaveScope(), void() ) {
     281                        pass.symtab.leaveScope();
    282282                }
    283283
     
    285285                static inline auto leave( pass_t &, long ) {}
    286286
    287                 // The indexer has 2 kind of functions mostly, 1 argument and 2 arguments
     287                // The symbol table has 2 kind of functions mostly, 1 argument and 2 arguments
    288288                // Create macro to condense these common patterns
    289                 #define INDEXER_FUNC1( func, type ) \
     289                #define SYMTAB_FUNC1( func, type ) \
    290290                template<typename pass_t> \
    291                 static inline auto func( pass_t & pass, int, type arg ) -> decltype( pass.indexer.func( arg ), void() ) {\
    292                         pass.indexer.func( arg ); \
     291                static inline auto func( pass_t & pass, int, type arg ) -> decltype( pass.symtab.func( arg ), void() ) {\
     292                        pass.symtab.func( arg ); \
    293293                } \
    294294                \
     
    296296                static inline void func( pass_t &, long, type ) {}
    297297
    298                 #define INDEXER_FUNC2( func, type1, type2 ) \
     298                #define SYMTAB_FUNC2( func, type1, type2 ) \
    299299                template<typename pass_t> \
    300                 static inline auto func( pass_t & pass, int, type1 arg1, type2 arg2 ) -> decltype( pass.indexer.func( arg1, arg2 ), void () ) {\
    301                         pass.indexer.func( arg1, arg2 ); \
     300                static inline auto func( pass_t & pass, int, type1 arg1, type2 arg2 ) -> decltype( pass.symtab.func( arg1, arg2 ), void () ) {\
     301                        pass.symtab.func( arg1, arg2 ); \
    302302                } \
    303303                        \
     
    305305                static inline void func( pass_t &, long, type1, type2 ) {}
    306306
    307                 INDEXER_FUNC1( addId     , const DeclWithType *  );
    308                 INDEXER_FUNC1( addType   , const NamedTypeDecl * );
    309                 INDEXER_FUNC1( addStruct , const StructDecl *    );
    310                 INDEXER_FUNC1( addEnum   , const EnumDecl *      );
    311                 INDEXER_FUNC1( addUnion  , const UnionDecl *     );
    312                 INDEXER_FUNC1( addTrait  , const TraitDecl *     );
    313                 INDEXER_FUNC2( addWith   , const std::vector< ptr<Expr> > &, const Node * );
     307                SYMTAB_FUNC1( addId     , const DeclWithType *  );
     308                SYMTAB_FUNC1( addType   , const NamedTypeDecl * );
     309                SYMTAB_FUNC1( addStruct , const StructDecl *    );
     310                SYMTAB_FUNC1( addEnum   , const EnumDecl *      );
     311                SYMTAB_FUNC1( addUnion  , const UnionDecl *     );
     312                SYMTAB_FUNC1( addTrait  , const TraitDecl *     );
     313                SYMTAB_FUNC2( addWith   , const std::vector< ptr<Expr> > &, const Node * );
    314314
    315315                // A few extra functions have more complicated behaviour, they are hand written
    316316                template<typename pass_t>
    317                 static inline auto addStructFwd( pass_t & pass, int, const ast::StructDecl * decl ) -> decltype( pass.indexer.addStruct( decl ), void() ) {
     317                static inline auto addStructFwd( pass_t & pass, int, const ast::StructDecl * decl ) -> decltype( pass.symtab.addStruct( decl ), void() ) {
    318318                        ast::StructDecl * fwd = new ast::StructDecl( decl->location, decl->name );
    319319                        fwd->params = decl->params;
    320                         pass.indexer.addStruct( fwd );
     320                        pass.symtab.addStruct( fwd );
    321321                }
    322322
     
    325325
    326326                template<typename pass_t>
    327                 static inline auto addUnionFwd( pass_t & pass, int, const ast::UnionDecl * decl ) -> decltype( pass.indexer.addUnion( decl ), void() ) {
     327                static inline auto addUnionFwd( pass_t & pass, int, const ast::UnionDecl * decl ) -> decltype( pass.symtab.addUnion( decl ), void() ) {
    328328                        UnionDecl * fwd = new UnionDecl( decl->location, decl->name );
    329329                        fwd->params = decl->params;
    330                         pass.indexer.addUnion( fwd );
     330                        pass.symtab.addUnion( fwd );
    331331                }
    332332
     
    335335
    336336                template<typename pass_t>
    337                 static inline auto addStruct( pass_t & pass, int, const std::string & str ) -> decltype( pass.indexer.addStruct( str ), void() ) {
    338                         if ( ! pass.indexer.lookupStruct( str ) ) {
    339                                 pass.indexer.addStruct( str );
     337                static inline auto addStruct( pass_t & pass, int, const std::string & str ) -> decltype( pass.symtab.addStruct( str ), void() ) {
     338                        if ( ! pass.symtab.lookupStruct( str ) ) {
     339                                pass.symtab.addStruct( str );
    340340                        }
    341341                }
     
    345345
    346346                template<typename pass_t>
    347                 static inline auto addUnion( pass_t & pass, int, const std::string & str ) -> decltype( pass.indexer.addUnion( str ), void() ) {
    348                         if ( ! pass.indexer.lookupUnion( str ) ) {
    349                                 pass.indexer.addUnion( str );
     347                static inline auto addUnion( pass_t & pass, int, const std::string & str ) -> decltype( pass.symtab.addUnion( str ), void() ) {
     348                        if ( ! pass.symtab.lookupUnion( str ) ) {
     349                                pass.symtab.addUnion( str );
    350350                        }
    351351                }
     
    354354                static inline void addUnion( pass_t &, long, const std::string & ) {}
    355355
    356                 #undef INDEXER_FUNC1
    357                 #undef INDEXER_FUNC2
     356                #undef SYMTAB_FUNC1
     357                #undef SYMTAB_FUNC2
    358358        };
    359359};
Note: See TracChangeset for help on using the changeset viewer.