source: translator/SymTab/Indexer.h @ 6c3744e

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 6c3744e was 17cd4eb, checked in by Peter A. Buhr <pabuhr@…>, 10 years ago

fixed restrict, fixed parameter copy, introduced name table for types, changed variable after to string

  • Property mode set to 100644
File size: 1.8 KB
RevLine 
[51b7345]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 {
[17cd4eb]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 );
[51b7345]34 
[17cd4eb]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();
39
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;
[51b7345]46 
[17cd4eb]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;
[51b7345]55 
[17cd4eb]56        bool doDebug;                                   // display debugging trace
57    };
[51b7345]58} // namespace SymTab
59
60#endif /* #ifndef SYMTAB_INDEXER_H */
Note: See TracBrowser for help on using the repository browser.