Ignore:
Timestamp:
Nov 8, 2017, 5:43:33 PM (8 years ago)
Author:
Aaron Moss <a3moss@…>
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.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SymTab/Indexer.cc

    r78315272 r3f7e12cb  
    4040
    4141namespace 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 
    5542        typedef std::unordered_map< std::string, DeclarationWithType* > MangleTable;
    5643        typedef std::unordered_map< std::string, MangleTable > IdTable;
     
    198185        }
    199186
    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 ) {
    205192                that.tables = 0;
    206193        }
     
    420407                makeWritable();
    421408
    422                 const std::string &name = decl->get_name();
     409                const std::string &name = decl->name;
    423410                std::string mangleName;
    424                 if ( LinkageSpec::isOverridable( decl->get_linkage() ) ) {
     411                if ( LinkageSpec::isOverridable( decl->linkage ) ) {
    425412                        // mangle the name without including the appropriate suffix, so overridable routines are placed into the
    426413                        // same "bucket" as their user defined versions.
     
    431418
    432419                // 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 ) ) {
    434421                        // NOTE this is broken in Richard's original code in such a way that it never triggers (it
    435422                        // doesn't check decls that have the same manglename, and all C-linkage decls are defined to
     
    584571
    585572                if ( doDebug ) {
    586                         std::cout << "--- Entering scope " << scope << std::endl;
     573                        std::cerr << "--- Entering scope " << scope << std::endl;
    587574                }
    588575        }
    589576
    590577        void Indexer::leaveScope() {
    591                 using std::cout;
     578                using std::cerr;
    592579
    593580                assert( scope > 0 && "cannot leave initial scope" );
     581                if ( doDebug ) {
     582                        cerr << "--- Leaving scope " << scope << " containing" << std::endl;
     583                }
    594584                --scope;
    595585
    596586                while ( tables && tables->scope > scope ) {
    597587                        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 );
    605594                        }
    606595
Note: See TracChangeset for help on using the changeset viewer.