Changes in src/SymTab/Indexer.cc [6fc5c14:33a25f9]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/SymTab/Indexer.cc
r6fc5c14 r33a25f9 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 42 55 typedef std::unordered_map< std::string, DeclarationWithType* > MangleTable; 43 56 typedef std::unordered_map< std::string, MangleTable > IdTable; … … 185 198 } 186 199 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) {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 ) { 192 205 that.tables = 0; 193 206 } … … 407 420 makeWritable(); 408 421 409 const std::string &name = decl-> name;422 const std::string &name = decl->get_name(); 410 423 std::string mangleName; 411 if ( LinkageSpec::isOverridable( decl-> linkage) ) {424 if ( LinkageSpec::isOverridable( decl->get_linkage() ) ) { 412 425 // mangle the name without including the appropriate suffix, so overridable routines are placed into the 413 426 // same "bucket" as their user defined versions. … … 418 431 419 432 // this ensures that no two declarations with the same unmangled name at the same scope both have C linkage 420 if ( ! LinkageSpec::isMangled( decl-> linkage) ) {433 if ( ! LinkageSpec::isMangled( decl->get_linkage() ) ) { 421 434 // NOTE this is broken in Richard's original code in such a way that it never triggers (it 422 435 // doesn't check decls that have the same manglename, and all C-linkage decls are defined to … … 571 584 572 585 if ( doDebug ) { 573 std::c err<< "--- Entering scope " << scope << std::endl;586 std::cout << "--- Entering scope " << scope << std::endl; 574 587 } 575 588 } 576 589 577 590 void Indexer::leaveScope() { 578 using std::c err;591 using std::cout; 579 592 580 593 assert( scope > 0 && "cannot leave initial scope" ); 581 if ( doDebug ) {582 cerr << "--- Leaving scope " << scope << " containing" << std::endl;583 }584 594 --scope; 585 595 586 596 while ( tables && tables->scope > scope ) { 587 597 if ( doDebug ) { 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 ); 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 ); 594 605 } 595 606
Note:
See TracChangeset
for help on using the changeset viewer.