Changeset 90152a4 for src/SymTab/Indexer.h
- Timestamp:
- Aug 27, 2018, 4:40:34 PM (6 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, cleanup-dtors, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- b7c89aa
- Parents:
- f9feab8 (diff), 305581d (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/SymTab/Indexer.h
rf9feab8 r90152a4 19 19 #include <list> // for list 20 20 #include <string> // for string 21 #include <functional> // for function 21 22 22 23 #include "SynTree/Visitor.h" // for Visitor 23 24 #include "SynTree/SynTree.h" // for AST nodes 25 26 namespace ResolvExpr { 27 class Cost; 28 } 24 29 25 30 namespace SymTab { … … 40 45 41 46 struct IdData { 42 DeclarationWithType * id ;43 Expression * baseExpr ; // WithExpr47 DeclarationWithType * id = nullptr; 48 Expression * baseExpr = nullptr; // WithExpr 44 49 45 Expression * combine() const; 50 /// non-null if this declaration is deleted 51 BaseSyntaxNode * deleteStmt = nullptr; 52 53 // NOTE: shouldn't need either of these constructors, but gcc-4 does not properly support initializer lists with default members. 54 IdData() = default; 55 IdData( DeclarationWithType * id, Expression * baseExpr, BaseSyntaxNode * deleteStmt ) : id( id ), baseExpr( baseExpr ), deleteStmt( deleteStmt ) {} 56 57 Expression * combine( ResolvExpr::Cost & cost ) const; 46 58 }; 47 59 … … 59 71 TraitDecl *lookupTrait( const std::string &id ) const; 60 72 73 /// Gets the type declaration with the given ID at global scope 74 NamedTypeDecl *globalLookupType( const std::string &id ) const; 75 /// Gets the struct declaration with the given ID at global scope 76 StructDecl *globalLookupStruct( const std::string &id ) const; 77 /// Gets the union declaration with the given ID at global scope 78 UnionDecl *globalLookupUnion( const std::string &id ) const; 79 /// Gets the enum declaration with the given ID at global scope 80 EnumDecl *globalLookupEnum( const std::string &id ) const; 81 61 82 void print( std::ostream &os, int indent = 0 ) const; 62 83 63 84 /// looks up a specific mangled ID at the given scope 64 DeclarationWithType *lookupIdAtScope( const std::string &id, const std::string &mangleName, unsigned long scope ) const; 85 IdData * lookupIdAtScope( const std::string &id, const std::string &mangleName, unsigned long scope ); 86 const IdData * lookupIdAtScope( const std::string &id, const std::string &mangleName, unsigned long scope ) const; 65 87 /// returns true if there exists a declaration with C linkage and the given name with a different mangled name 66 88 bool hasIncompatibleCDecl( const std::string &id, const std::string &mangleName, unsigned long scope ) const; … … 74 96 TraitDecl *lookupTraitAtScope( const std::string &id, unsigned long scope ) const; 75 97 76 void addId( DeclarationWithType *decl, Expression * baseExpr = nullptr ); 98 typedef std::function<bool(IdData &, const std::string &)> ConflictFunction; 99 100 void addId( DeclarationWithType * decl, Expression * baseExpr = nullptr ); 101 void addDeletedId( DeclarationWithType * decl, BaseSyntaxNode * deleteStmt ); 102 77 103 void addType( NamedTypeDecl *decl ); 78 104 void addStruct( const std::string &id ); … … 84 110 85 111 /// adds all of the IDs from WithStmt exprs 86 void addWith( WithStmt * ); 112 void addWith( std::list< Expression * > & withExprs, BaseSyntaxNode * withStmt ); 113 114 /// adds all of the members of the Aggregate (addWith helper) 115 void addMembers( AggregateDecl * aggr, Expression * expr, ConflictFunction ); 87 116 88 117 /// convenience function for adding a list of Ids to the indexer … … 114 143 /// Ensures that tables variable is writable (i.e. allocated, uniquely owned by this Indexer, and at the current scope) 115 144 void makeWritable(); 145 146 /// common code for addId, addDeletedId, etc. 147 void addId( DeclarationWithType * decl, ConflictFunction, Expression * baseExpr = nullptr, BaseSyntaxNode * deleteStmt = nullptr ); 116 148 }; 117 149 } // namespace SymTab
Note: See TracChangeset
for help on using the changeset viewer.