Changeset 17cd4eb for translator/SymTab/Indexer.h
- Timestamp:
- Jan 7, 2015, 6:04:42 PM (10 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:
- 0b8cd722
- Parents:
- d9a0e76
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
translator/SymTab/Indexer.h
rd9a0e76 r17cd4eb 1 /*2 * This file is part of the Cforall project3 *4 * A class that indexes the syntax tree. It is intended to be subclassed by a visitor class5 * that wants to use the index.6 *7 * $Id: Indexer.h,v 1.9 2005/08/29 20:14:18 rcbilson Exp $8 *9 */10 11 1 #ifndef SYMTAB_INDEXER_H 12 2 #define SYMTAB_INDEXER_H … … 22 12 23 13 namespace SymTab { 14 class Indexer : public Visitor { 15 public: 16 Indexer( bool useDebug = false ); 17 virtual ~Indexer(); 24 18 25 class Indexer : public Visitor 26 { 27 public: 28 Indexer( bool useDebug = false ); 29 virtual ~Indexer(); 19 //using Visitor::visit; 20 virtual void visit( ObjectDecl *objectDecl ); 21 virtual void visit( FunctionDecl *functionDecl ); 22 virtual void visit( TypeDecl *typeDecl ); 23 virtual void visit( TypedefDecl *typeDecl ); 24 virtual void visit( StructDecl *aggregateDecl ); 25 virtual void visit( UnionDecl *aggregateDecl ); 26 virtual void visit( EnumDecl *aggregateDecl ); 27 virtual void visit( ContextDecl *aggregateDecl ); 30 28 31 /// using Visitor::visit; 32 virtual void visit( ObjectDecl *objectDecl ); 33 virtual void visit( FunctionDecl *functionDecl ); 34 virtual void visit( TypeDecl *typeDecl ); 35 virtual void visit( TypedefDecl *typeDecl ); 36 virtual void visit( StructDecl *aggregateDecl ); 37 virtual void visit( UnionDecl *aggregateDecl ); 38 virtual void visit( EnumDecl *aggregateDecl ); 39 virtual void visit( ContextDecl *aggregateDecl ); 29 virtual void visit( CompoundStmt *compoundStmt ); 40 30 41 virtual void visit( CompoundStmt *compoundStmt ); 31 virtual void visit( ContextInstType *contextInst ); 32 virtual void visit( StructInstType *contextInst ); 33 virtual void visit( UnionInstType *contextInst ); 34 35 // when using an indexer manually (e.g., within a mutator traversal), it is necessary to tell the indexer 36 // explicitly when scopes begin and end 37 void enterScope(); 38 void leaveScope(); 42 39 43 virtual void visit( ContextInstType *contextInst ); 44 virtual void visit( StructInstType *contextInst ); 45 virtual void visit( UnionInstType *contextInst ); 40 void lookupId( const std::string &id, std::list< DeclarationWithType* >& ) const; 41 NamedTypeDecl *lookupType( const std::string &id ) const; 42 StructDecl *lookupStruct( const std::string &id ) const; 43 EnumDecl *lookupEnum( const std::string &id ) const; 44 UnionDecl *lookupUnion( const std::string &id ) const; 45 ContextDecl *lookupContext( const std::string &id ) const; 46 46 47 // when using an indexer manually (e.g., within a mutator traversal), it is 48 // necessary to tell the indexer explicitly when scopes begin and end 49 void enterScope(); 50 void leaveScope(); 51 52 void lookupId( const std::string &id, std::list< DeclarationWithType* >& ) const; 53 NamedTypeDecl *lookupType( const std::string &id ) const; 54 StructDecl *lookupStruct( const std::string &id ) const; 55 EnumDecl *lookupEnum( const std::string &id ) const; 56 UnionDecl *lookupUnion( const std::string &id ) const; 57 ContextDecl *lookupContext( const std::string &id ) const; 47 void print( std::ostream &os, int indent = 0 ) const; 48 private: 49 IdTable idTable; 50 TypeTable typeTable; 51 StructTable structTable; 52 EnumTable enumTable; 53 UnionTable unionTable; 54 ContextTable contextTable; 58 55 59 void print( std::ostream &os, int indent = 0 ) const; 60 61 private: 62 IdTable idTable; 63 TypeTable typeTable; 64 StructTable structTable; 65 EnumTable enumTable; 66 UnionTable unionTable; 67 ContextTable contextTable; 68 69 bool doDebug; // display debugging trace 70 }; 71 56 bool doDebug; // display debugging trace 57 }; 72 58 } // namespace SymTab 73 59
Note: See TracChangeset
for help on using the changeset viewer.