Changeset de62360d for src/Parser/TypedefTable.cc
- Timestamp:
- Jun 24, 2015, 4:04:19 PM (10 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, string, with_gc
- Children:
- 94e0864d
- Parents:
- a1d5d2a
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/TypedefTable.cc
ra1d5d2a rde62360d 10 10 // Created On : Sat May 16 15:20:13 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : S at May 16 15:24:03201513 // Update Count : 212 // Last Modified On : Sun Jun 21 11:46:15 2015 13 // Update Count : 7 14 14 // 15 15 … … 29 29 TypedefTable::TypedefTable() : currentScope( 0 ) {} 30 30 31 bool TypedefTable::isKind( stringidentifier, kind_t kind ) const {31 bool TypedefTable::isKind( const string &identifier, kind_t kind ) const { 32 32 tableType::const_iterator id_pos = table.find( identifier ); 33 if ( id_pos == table.end() ) {33 if ( id_pos == table.end() ) { 34 34 return true; 35 35 } else { 36 36 return (*((*id_pos ).second.begin())).kind == kind; 37 } 37 } // if 38 38 } 39 39 40 bool TypedefTable::isIdentifier( stringidentifier ) const {40 bool TypedefTable::isIdentifier( const string &identifier ) const { 41 41 return isKind( identifier, ID ); 42 42 } 43 43 44 bool TypedefTable::isTypedef( stringidentifier ) const {44 bool TypedefTable::isTypedef( const string &identifier ) const { 45 45 return isKind( identifier, TD ); 46 46 } 47 47 48 bool TypedefTable::isTypegen( stringidentifier ) const {48 bool TypedefTable::isTypegen( const string &identifier ) const { 49 49 return isKind( identifier, TG ); 50 50 } … … 66 66 while ( listPos != (*curPos ).second.end() && listPos->scope > scope ) { 67 67 listPos++; 68 } 68 } // while 69 69 (*curPos ).second.insert( listPos, newEntry ); 70 } 71 } 70 } // if 71 } // if 72 72 } 73 73 … … 102 102 } 103 103 104 void TypedefTable::openContext( std::stringcontextName ) {104 void TypedefTable::openContext( const std::string &contextName ) { 105 105 map< string, deferListType >::iterator i = contexts.find( contextName ); 106 106 if ( i != contexts.end() ) { … … 108 108 for ( deferListType::iterator i = entries.begin(); i != entries.end(); i++) { 109 109 addToEnclosingScope( i->identifier, i->kind ); 110 } 111 } 110 } // for 111 } // if 112 112 } 113 113 114 void TypedefTable::enterScope( void) {114 void TypedefTable::enterScope() { 115 115 currentScope += 1; 116 116 deferListStack.push( deferListType() ); … … 119 119 } 120 120 121 void TypedefTable::leaveScope( void) {121 void TypedefTable::leaveScope() { 122 122 debugPrint( "Leaving scope " << currentScope << endl ); 123 123 for ( tableType::iterator i = table.begin(); i != table.end(); ) { … … 129 129 table.erase( i++ ); 130 130 } else ++i; 131 } 131 } // for 132 132 currentScope -= 1; 133 133 for ( deferListType::iterator i = deferListStack.top().begin(); i != deferListStack.top().end(); i++) { 134 134 addToCurrentScope( i->identifier, i->kind ); 135 } 135 } // for 136 136 deferListStack.pop(); 137 137 debugPrint( "nextIdentifiers size is " << nextIdentifiers.size() << " top is " << nextIdentifiers.top() << endl ); … … 139 139 } 140 140 141 void TypedefTable::enterContext( std::stringcontextName ) {141 void TypedefTable::enterContext( const std::string &contextName ) { 142 142 currentContext = contextName; 143 143 contextScope = currentScope; 144 144 } 145 145 146 void TypedefTable::leaveContext( void) {146 void TypedefTable::leaveContext() { 147 147 currentContext = ""; 148 148 } … … 156 156 } 157 157 debugPrint( endl ); 158 } 158 } // for 159 159 } 160 160
Note: See TracChangeset
for help on using the changeset viewer.