Changeset 9a7a3b6


Ignore:
Timestamp:
Jun 19, 2018, 2:13:34 PM (3 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
aaron-thesis, arm-eh, cleanup-dtors, deferred_resn, demangler, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, no_list, persistent-indexer
Children:
c194661
Parents:
47498bd
git-author:
Rob Schluntz <rschlunt@…> (06/19/18 14:13:29)
git-committer:
Rob Schluntz <rschlunt@…> (06/19/18 14:13:34)
Message:

Fix lookup{SUE}AtScope? functions to look in only a specific scope and provide lookupAtGlobalScope functions

Location:
src/SymTab
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/SymTab/Indexer.cc

    r47498bd r9a7a3b6  
    272272        }
    273273
     274        StructDecl *Indexer::globalLookupStruct( const std::string &id ) const {
     275                return lookupStructAtScope( id, 0 );
     276        }
     277
     278        UnionDecl *Indexer::globalLookupUnion( const std::string &id ) const {
     279                return lookupUnionAtScope( id, 0 );
     280        }
     281
     282        EnumDecl *Indexer::globalLookupEnum( const std::string &id ) const {
     283                return lookupEnumAtScope( id, 0 );
     284        }
     285
    274286        EnumDecl *Indexer::lookupEnum( const std::string &id ) const {
    275287                if ( ! tables ) return 0;
     
    347359                if ( ! tables ) return 0;
    348360                if ( tables->scope < scope ) return 0;
     361                if ( tables->scope > scope ) return tables->base.lookupTypeAtScope( id, scope );
    349362
    350363                TypeTable::const_iterator ret = tables->typeTable.find( id );
     
    355368                if ( ! tables ) return 0;
    356369                if ( tables->scope < scope ) return 0;
     370                if ( tables->scope > scope ) return tables->base.lookupStructAtScope( id, scope );
    357371
    358372                StructTable::const_iterator ret = tables->structTable.find( id );
     
    363377                if ( ! tables ) return 0;
    364378                if ( tables->scope < scope ) return 0;
     379                if ( tables->scope > scope ) return tables->base.lookupEnumAtScope( id, scope );
    365380
    366381                EnumTable::const_iterator ret = tables->enumTable.find( id );
     
    371386                if ( ! tables ) return 0;
    372387                if ( tables->scope < scope ) return 0;
     388                if ( tables->scope > scope ) return tables->base.lookupUnionAtScope( id, scope );
    373389
    374390                UnionTable::const_iterator ret = tables->unionTable.find( id );
     
    379395                if ( ! tables ) return 0;
    380396                if ( tables->scope < scope ) return 0;
     397                if ( tables->scope > scope ) return tables->base.lookupTraitAtScope( id, scope );
    381398
    382399                TraitTable::const_iterator ret = tables->traitTable.find( id );
  • src/SymTab/Indexer.h

    r47498bd r9a7a3b6  
    7070                /// Gets the top-most trait declaration with the given ID
    7171                TraitDecl *lookupTrait( const std::string &id ) const;
     72
     73                /// Gets the struct declaration with the given ID at global scope
     74                StructDecl *globalLookupStruct( const std::string &id ) const;
     75                /// Gets the union declaration with the given ID at global scope
     76                UnionDecl *globalLookupUnion( const std::string &id ) const;
     77                /// Gets the enum declaration with the given ID at global scope
     78                EnumDecl *globalLookupEnum( const std::string &id ) const;
    7279
    7380                void print( std::ostream &os, int indent = 0 ) const;
Note: See TracChangeset for help on using the changeset viewer.