Changeset 5fe35d6


Ignore:
Timestamp:
Nov 22, 2017, 4:52:09 PM (6 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
83882e9
Parents:
452747a
Message:

Move addIds and addTypes to Indexer

Location:
src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/InitTweak/FixInit.cc

    r452747a r5fe35d6  
    943943                }
    944944
    945                 void addIds( SymTab::Indexer & indexer, const std::list< DeclarationWithType * > & decls ) {
    946                         for ( auto d : decls ) {
    947                                 indexer.addId( d );
    948                         }
    949                 }
    950 
    951                 void addTypes( SymTab::Indexer & indexer, const std::list< TypeDecl * > & tds ) {
    952                         for ( auto td : tds ) {
    953                                 indexer.addType( td );
    954                                 addIds( indexer, td->assertions );
    955                         }
    956                 }
    957 
    958945                void GenStructMemberCalls::previsit( FunctionDecl * funcDecl ) {
    959946                        GuardValue( function );
     
    1012999                                // need to explicitly re-add function parameters to the indexer in order to resolve copy constructors
    10131000                                auto guard = makeFuncGuard( [this]() { indexer.enterScope(); }, [this]() { indexer.leaveScope(); } );
    1014                                 addTypes( indexer, function->type->forall );
    1015                                 addIds( indexer, function->type->returnVals );
    1016                                 addIds( indexer, function->type->parameters );
     1001                                indexer.addFunctionType( function->type );
    10171002
    10181003                                // need to iterate through members in reverse in order for
     
    10291014                                        // insert and resolve default/copy constructor call for each field that's unhandled
    10301015                                        std::list< Statement * > stmt;
    1031                                         Expression * arg2 = 0;
     1016                                        Expression * arg2 = nullptr;
    10321017                                        if ( isCopyConstructor( function ) ) {
    10331018                                                // if copy ctor, need to pass second-param-of-this-function.field
  • src/SymTab/Indexer.cc

    r452747a r5fe35d6  
    567567        }
    568568
     569        void Indexer::addIds( const std::list< DeclarationWithType * > & decls ) {
     570                for ( auto d : decls ) {
     571                        addId( d );
     572                }
     573        }
     574
     575        void Indexer::addTypes( const std::list< TypeDecl * > & tds ) {
     576                for ( auto td : tds ) {
     577                        addType( td );
     578                        addIds( td->assertions );
     579                }
     580        }
     581
     582        void Indexer::addFunctionType( FunctionType * ftype ) {
     583                addTypes( ftype->forall );
     584                addIds( ftype->returnVals );
     585                addIds( ftype->parameters );
     586        }
     587
    569588        void Indexer::enterScope() {
    570589                ++scope;
  • src/SymTab/Indexer.h

    r452747a r5fe35d6  
    7676                void addTrait( TraitDecl *decl );
    7777
     78                /// convenience function for adding a list of Ids to the indexer
     79                void addIds( const std::list< DeclarationWithType * > & decls );
     80
     81                /// convenience function for adding a list of forall parameters to the indexer
     82                void addTypes( const std::list< TypeDecl * > & tds );
     83
     84                /// convenience function for adding all of the declarations in a function type to the indexer
     85                void addFunctionType( FunctionType * ftype );
     86
    7887                bool doDebug = false; ///< Display debugging trace?
    7988          private:
Note: See TracChangeset for help on using the changeset viewer.