source: translator/SymTab/Indexer.h @ c11e31c

ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsctordeferred_resndemanglerenumforall-pointer-decaygc_noraiijacob/cs343-translationjenkins-sandboxmemorynew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumresolv-newstringwith_gc
Last change on this file since c11e31c was d4778a6, checked in by Rob Schluntz <rschlunt@…>, 9 years ago

for loop initializers are hoisted properly and for loops a level of scope

  • Property mode set to 100644
File size: 1.9 KB
Line 
1#ifndef SYMTAB_INDEXER_H
2#define SYMTAB_INDEXER_H
3
4#include <list>
5#include <string>
6#include <map>
7
8#include "SynTree/Visitor.h"
9#include "IdTable.h"
10#include "AggregateTable.h"
11#include "TypeTable.h"
12
13namespace SymTab {
14    class Indexer : public Visitor {
15      public:
16        Indexer( bool useDebug = false );
17        virtual ~Indexer();
18
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 );
28
29        virtual void visit( CompoundStmt *compoundStmt );
30
31        virtual void visit( ContextInstType *contextInst );
32        virtual void visit( StructInstType *contextInst );
33        virtual void visit( UnionInstType *contextInst );
34
35        virtual void visit( ForStmt *forStmt );
36
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
39        void enterScope();
40        void leaveScope();
41
42        void lookupId( const std::string &id, std::list< DeclarationWithType* >& ) const;
43        DeclarationWithType* lookupId( const std::string &id) const;
44        NamedTypeDecl *lookupType( const std::string &id ) const;
45        StructDecl *lookupStruct( const std::string &id ) const;
46        EnumDecl *lookupEnum( const std::string &id ) const;
47        UnionDecl *lookupUnion( const std::string &id ) const;
48        ContextDecl *lookupContext( const std::string &id ) const;
49 
50        void print( std::ostream &os, int indent = 0 ) const;
51      private:
52        IdTable idTable;
53        TypeTable typeTable;
54        StructTable structTable;
55        EnumTable enumTable;
56        UnionTable unionTable;
57        ContextTable contextTable;
58 
59        bool doDebug;                                   // display debugging trace
60    };
61} // namespace SymTab
62
63#endif // SYMTAB_INDEXER_H
Note: See TracBrowser for help on using the repository browser.