Ignore:
Timestamp:
Mar 15, 2019, 2:22:25 PM (5 years ago)
Author:
Aaron Moss <a3moss@…>
Branches:
ADT, arm-eh, ast-experimental, cleanup-dtors, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, persistent-indexer, pthread-emulation, qualifiedEnum
Children:
fdae913
Parents:
b8665e3
Message:

Lazy scope initialization for indexer

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SymTab/Indexer.h

    rb8665e3 rb419abb  
    1717
    1818#include <functional>              // for function
    19 #include <iosfwd>                  // for ostream
    2019#include <list>                    // for list
    2120#include <memory>                  // for shared_ptr, enable_shared_from_this
     
    3534                virtual ~Indexer();
    3635
    37                 // when using an indexer manually (e.g., within a mutator traversal), it is necessary to tell the indexer
    38                 // explicitly when scopes begin and end
     36                // when using an indexer manually (e.g., within a mutator traversal), it is necessary to
     37                // tell the indexer explicitly when scopes begin and end
    3938                void enterScope();
    4039                void leaveScope();
     
    7473                TraitDecl *lookupTrait( const std::string &id ) const;
    7574
    76                 // void print( std::ostream &os, int indent = 0 ) const;
    77 
    78                 /// looks up a specific mangled ID in local scope only
    79                 // IdData * lookupIdAtScope( const std::string &id, const std::string &mangleName, unsigned long scope );
    80                 // const IdData * localLookupId( const std::string &id, const std::string &mangleName ) const;
    81                 // equivalents to lookup functions that only look at tables at scope `scope` (which should be >= tables->scope)
    82                 // NamedTypeDecl *lookupTypeAtScope( const std::string &id, unsigned long scope ) const;
    83                 // StructDecl *lookupStructAtScope( const std::string &id, unsigned long scope ) const;
    84                 // EnumDecl *lookupEnumAtScope( const std::string &id, unsigned long scope ) const;
    85                 // UnionDecl *lookupUnionAtScope( const std::string &id, unsigned long scope ) const;
    86                 // TraitDecl *lookupTraitAtScope( const std::string &id, unsigned long scope ) const;
    87 
    8875                /// Gets the type declaration with the given ID at global scope
    8976                NamedTypeDecl *globalLookupType( const std::string &id ) const;
     
    118105                void addFunctionType( FunctionType * ftype );
    119106
    120                 // bool doDebug = false; ///< Display debugging trace?
    121107          private:
    122108                /// Wraps a Decl* with a scope
     
    148134                Ptr prevScope;                 ///< reference to indexer for parent scope
    149135                unsigned long scope;           ///< Scope index of this indexer
     136                unsigned long repScope;        ///< Scope index of currently represented scope
     137
     138                /// Ensures that a proper backtracking scope exists before a mutation
     139                void lazyInitScope();
    150140
    151141                /// Gets the indexer at the given scope
Note: See TracChangeset for help on using the changeset viewer.