source: src/SymTab/Indexer.h @ 4e284ea6

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 4e284ea6 was 4040425, checked in by Peter A. Buhr <pabuhr@…>, 8 years ago

change keyword type to otype and context to trait

  • Property mode set to 100644
File size: 3.5 KB
Line 
1//
2// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
3//
4// The contents of this file are covered under the licence agreement in the
5// file "LICENCE" distributed with Cforall.
6//
7// Indexer.h --
8//
9// Author           : Richard C. Bilson
10// Created On       : Sun May 17 21:38:55 2015
11// Last Modified By : Peter A. Buhr
12// Last Modified On : Wed Mar  2 17:34:14 2016
13// Update Count     : 6
14//
15
16#ifndef INDEXER_H
17#define INDEXER_H
18
19#include <list>
20#include <string>
21
22#include "SynTree/Visitor.h"
23#include "IdTable.h"
24#include "AggregateTable.h"
25#include "TypeTable.h"
26
27namespace SymTab {
28        class Indexer : public Visitor {
29          public:
30                Indexer( bool useDebug = false );
31                virtual ~Indexer();
32
33                //using Visitor::visit;
34                virtual void visit( ObjectDecl *objectDecl );
35                virtual void visit( FunctionDecl *functionDecl );
36                virtual void visit( TypeDecl *typeDecl );
37                virtual void visit( TypedefDecl *typeDecl );
38                virtual void visit( StructDecl *aggregateDecl );
39                virtual void visit( UnionDecl *aggregateDecl );
40                virtual void visit( EnumDecl *aggregateDecl );
41                virtual void visit( TraitDecl *aggregateDecl );
42
43                virtual void visit( CompoundStmt *compoundStmt );
44
45                virtual void visit( ApplicationExpr *applicationExpr );
46                virtual void visit( UntypedExpr *untypedExpr );
47                virtual void visit( NameExpr *nameExpr );
48                virtual void visit( CastExpr *castExpr );
49                virtual void visit( AddressExpr *addressExpr );
50                virtual void visit( LabelAddressExpr *labAddressExpr );
51                virtual void visit( UntypedMemberExpr *memberExpr );
52                virtual void visit( MemberExpr *memberExpr );
53                virtual void visit( VariableExpr *variableExpr );
54                virtual void visit( ConstantExpr *constantExpr ); 
55                virtual void visit( SizeofExpr *sizeofExpr );
56                virtual void visit( AlignofExpr *alignofExpr );
57                virtual void visit( UntypedOffsetofExpr *offsetofExpr );
58                virtual void visit( OffsetofExpr *offsetofExpr );
59                virtual void visit( AttrExpr *attrExpr );
60                virtual void visit( LogicalExpr *logicalExpr );
61                virtual void visit( ConditionalExpr *conditionalExpr );
62                virtual void visit( CommaExpr *commaExpr );
63                virtual void visit( TupleExpr *tupleExpr );
64                virtual void visit( SolvedTupleExpr *tupleExpr );
65                virtual void visit( TypeExpr *typeExpr );
66                virtual void visit( AsmExpr *asmExpr );
67                virtual void visit( UntypedValofExpr *valofExpr );
68
69                virtual void visit( TraitInstType *contextInst );
70                virtual void visit( StructInstType *contextInst );
71                virtual void visit( UnionInstType *contextInst );
72
73                virtual void visit( ForStmt *forStmt );
74
75                // when using an indexer manually (e.g., within a mutator traversal), it is necessary to tell the indexer
76                // explicitly when scopes begin and end
77                void enterScope();
78                void leaveScope();
79
80                void lookupId( const std::string &id, std::list< DeclarationWithType* >& ) const;
81                DeclarationWithType* lookupId( const std::string &id) const;
82                NamedTypeDecl *lookupType( const std::string &id ) const;
83                StructDecl *lookupStruct( const std::string &id ) const;
84                EnumDecl *lookupEnum( const std::string &id ) const;
85                UnionDecl *lookupUnion( const std::string &id ) const;
86                TraitDecl *lookupTrait( const std::string &id ) const;
87 
88                void print( std::ostream &os, int indent = 0 ) const;
89          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
98        };
99} // namespace SymTab
100
101#endif // INDEXER_H
102
103// Local Variables: //
104// tab-width: 4 //
105// mode: c++ //
106// compile-command: "make install" //
107// End: //
Note: See TracBrowser for help on using the repository browser.