source: translator/SymTab/Indexer.h @ d0e8cfe4

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 d0e8cfe4 was 51b7345, checked in by Peter A. Buhr <pabuhr@…>, 10 years ago

initial commit

  • Property mode set to 100644
File size: 2.1 KB
RevLine 
[51b7345]1/*
2 * This file is part of the Cforall project
3 *
4 * A class that indexes the syntax tree.  It is intended to be subclassed by a visitor class
5 * 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#ifndef SYMTAB_INDEXER_H
12#define SYMTAB_INDEXER_H
13
14#include <list>
15#include <string>
16#include <map>
17
18#include "SynTree/Visitor.h"
19#include "IdTable.h"
20#include "AggregateTable.h"
21#include "TypeTable.h"
22
23namespace SymTab {
24
25class Indexer : public Visitor
26{
27public:
28  Indexer( bool useDebug = false );
29  virtual ~Indexer();
30
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 );
40
41  virtual void visit( CompoundStmt *compoundStmt );
42
43  virtual void visit( ContextInstType *contextInst );
44  virtual void visit( StructInstType *contextInst );
45  virtual void visit( UnionInstType *contextInst );
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;
58 
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
72} // namespace SymTab
73
74#endif /* #ifndef SYMTAB_INDEXER_H */
Note: See TracBrowser for help on using the repository browser.