Changeset 3f7e12cb for src/SymTab/Indexer.cc
- Timestamp:
- Nov 8, 2017, 5:43:33 PM (8 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- 954908d
- Parents:
- 78315272 (diff), e35f30a (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.cc
r78315272 r3f7e12cb 40 40 41 41 namespace SymTab { 42 struct NewScope {43 NewScope( SymTab::Indexer & indexer ) : indexer( indexer ) { indexer.enterScope(); }44 ~NewScope() { indexer.leaveScope(); }45 SymTab::Indexer & indexer;46 };47 48 template< typename TreeType, typename VisitorType >49 inline void acceptNewScope( TreeType *tree, VisitorType &visitor ) {50 visitor.enterScope();51 maybeAccept( tree, visitor );52 visitor.leaveScope();53 }54 55 42 typedef std::unordered_map< std::string, DeclarationWithType* > MangleTable; 56 43 typedef std::unordered_map< std::string, MangleTable > IdTable; … … 198 185 } 199 186 200 Indexer::Indexer( bool _doDebug ) : tables( 0 ), scope( 0 ), doDebug( _doDebug) {}201 202 Indexer::Indexer( const Indexer &that ) : tables( newRef( that.tables ) ), scope( that.scope ), doDebug( that.doDebug) {}203 204 Indexer::Indexer( Indexer &&that ) : tables( that.tables ), scope( that.scope ), doDebug( that.doDebug) {187 Indexer::Indexer() : tables( 0 ), scope( 0 ) {} 188 189 Indexer::Indexer( const Indexer &that ) : doDebug( that.doDebug ), tables( newRef( that.tables ) ), scope( that.scope ) {} 190 191 Indexer::Indexer( Indexer &&that ) : doDebug( that.doDebug ), tables( that.tables ), scope( that.scope ) { 205 192 that.tables = 0; 206 193 } … … 420 407 makeWritable(); 421 408 422 const std::string &name = decl-> get_name();409 const std::string &name = decl->name; 423 410 std::string mangleName; 424 if ( LinkageSpec::isOverridable( decl-> get_linkage()) ) {411 if ( LinkageSpec::isOverridable( decl->linkage ) ) { 425 412 // mangle the name without including the appropriate suffix, so overridable routines are placed into the 426 413 // same "bucket" as their user defined versions. … … 431 418 432 419 // this ensures that no two declarations with the same unmangled name at the same scope both have C linkage 433 if ( ! LinkageSpec::isMangled( decl-> get_linkage()) ) {420 if ( ! LinkageSpec::isMangled( decl->linkage ) ) { 434 421 // NOTE this is broken in Richard's original code in such a way that it never triggers (it 435 422 // doesn't check decls that have the same manglename, and all C-linkage decls are defined to … … 584 571 585 572 if ( doDebug ) { 586 std::c out<< "--- Entering scope " << scope << std::endl;573 std::cerr << "--- Entering scope " << scope << std::endl; 587 574 } 588 575 } 589 576 590 577 void Indexer::leaveScope() { 591 using std::c out;578 using std::cerr; 592 579 593 580 assert( scope > 0 && "cannot leave initial scope" ); 581 if ( doDebug ) { 582 cerr << "--- Leaving scope " << scope << " containing" << std::endl; 583 } 594 584 --scope; 595 585 596 586 while ( tables && tables->scope > scope ) { 597 587 if ( doDebug ) { 598 cout << "--- Leaving scope " << tables->scope << " containing" << std::endl; 599 dump( tables->idTable, cout ); 600 dump( tables->typeTable, cout ); 601 dump( tables->structTable, cout ); 602 dump( tables->enumTable, cout ); 603 dump( tables->unionTable, cout ); 604 dump( tables->traitTable, cout ); 588 dump( tables->idTable, cerr ); 589 dump( tables->typeTable, cerr ); 590 dump( tables->structTable, cerr ); 591 dump( tables->enumTable, cerr ); 592 dump( tables->unionTable, cerr ); 593 dump( tables->traitTable, cerr ); 605 594 } 606 595
Note:
See TracChangeset
for help on using the changeset viewer.