Changeset ae357ec for src/SymTab/Indexer.h
- Timestamp:
- Mar 8, 2016, 10:25:06 PM (8 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, string, with_gc
- Children:
- 5447e09
- Parents:
- b63e376 (diff), bed4c63e (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. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/SymTab/Indexer.h
rb63e376 rae357ec 21 21 22 22 #include "SynTree/Visitor.h" 23 #include "IdTable.h"24 #include "AggregateTable.h"25 #include "TypeTable.h"26 23 27 24 namespace SymTab { … … 29 26 public: 30 27 Indexer( bool useDebug = false ); 28 29 Indexer( const Indexer &that ); 30 Indexer( Indexer &&that ); 31 31 virtual ~Indexer(); 32 Indexer& operator= ( const Indexer &that ); 33 Indexer& operator= ( Indexer &&that ); 32 34 33 35 //using Visitor::visit; … … 78 80 void leaveScope(); 79 81 80 void lookupId( const std::string &id, std::list< DeclarationWithType* >& ) const; 81 DeclarationWithType* lookupId( const std::string &id) const; 82 /// Gets all declarations with the given ID 83 void lookupId( const std::string &id, std::list< DeclarationWithType* > &out ) const; 84 /// Gets the top-most type declaration with the given ID 82 85 NamedTypeDecl *lookupType( const std::string &id ) const; 86 /// Gets the top-most struct declaration with the given ID 83 87 StructDecl *lookupStruct( const std::string &id ) const; 88 /// Gets the top-most enum declaration with the given ID 84 89 EnumDecl *lookupEnum( const std::string &id ) const; 90 /// Gets the top-most union declaration with the given ID 85 91 UnionDecl *lookupUnion( const std::string &id ) const; 92 /// Gets the top-most trait declaration with the given ID 86 93 TraitDecl *lookupTrait( const std::string &id ) const; 87 94 88 95 void print( std::ostream &os, int indent = 0 ) const; 89 96 private: 90 IdTable idTable; 91 TypeTable typeTable; 92 StructTable structTable; 93 EnumTable enumTable; 94 UnionTable unionTable; 95 TraitTable contextTable; 96 97 bool doDebug; // display debugging trace 97 /// looks up a specific mangled ID at the given scope 98 DeclarationWithType *lookupIdAtScope( const std::string &id, const std::string &mangleName, unsigned long scope ) const; 99 /// returns true if there exists a declaration with C linkage and the given name 100 bool hasCDeclWithName( const std::string &id ) const; 101 // equivalents to lookup functions that only look at tables at scope `scope` (which should be >= tables->scope) 102 NamedTypeDecl *lookupTypeAtScope( const std::string &id, unsigned long scope ) const; 103 StructDecl *lookupStructAtScope( const std::string &id, unsigned long scope ) const; 104 EnumDecl *lookupEnumAtScope( const std::string &id, unsigned long scope ) const; 105 UnionDecl *lookupUnionAtScope( const std::string &id, unsigned long scope ) const; 106 TraitDecl *lookupTraitAtScope( const std::string &id, unsigned long scope ) const; 107 108 void addId( DeclarationWithType *decl ); 109 void addType( NamedTypeDecl *decl ); 110 void addStruct( const std::string &id ); 111 void addStruct( StructDecl *decl ); 112 void addEnum( EnumDecl *decl ); 113 void addUnion( const std::string &id ); 114 void addUnion( UnionDecl *decl ); 115 void addTrait( TraitDecl *decl ); 116 117 struct Impl; 118 Impl *tables; ///< Copy-on-write instance of table data structure 119 unsigned long scope; ///< Scope index of this pointer 120 bool doDebug; ///< Display debugging trace? 121 122 /// Takes a new ref to a table (returns null if null) 123 static Impl *newRef( Impl *toClone ); 124 /// Clears a ref to a table (does nothing if null) 125 static void deleteRef( Impl *toFree ); 126 127 /// Ensures that tables variable is writable (i.e. allocated, uniquely owned by this Indexer, and at the current scope) 128 void makeWritable(); 98 129 }; 99 130 } // namespace SymTab
Note: See TracChangeset
for help on using the changeset viewer.