Ignore:
Timestamp:
Dec 5, 2017, 1:36:23 PM (6 years ago)
Author:
Thierry Delisle <tdelisle@…>
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:
12d2dc8
Parents:
f3b9efc (diff), 5da9d6a (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/ControlStruct/LabelFixer.cc

    rf3b9efc r86ad276  
    3737        }
    3838
    39         void LabelFixer::visit( FunctionDecl *functionDecl ) {
     39        void LabelFixer::previsit( FunctionDecl * ) {
    4040                // need to go into a nested function in a fresh state
    41                 std::map < Label, Entry *> oldLabelTable = labelTable;
     41                GuardValue( labelTable );
    4242                labelTable.clear();
     43        }
    4344
    44                 maybeAccept( functionDecl->get_statements(), *this );
    45 
     45        void LabelFixer::postvisit( FunctionDecl * functionDecl ) {
    4646                MLEMutator mlemut( resolveJumps(), generator );
    4747                functionDecl->acceptMutator( mlemut );
    48 
    49                 // and remember the outer function's labels when
    50                 // returning to it
    51                 labelTable = oldLabelTable;
    5248        }
    5349
    5450        // prune to at most one label definition for each statement
    55         void LabelFixer::visit( Statement *stmt ) {
     51        void LabelFixer::previsit( Statement *stmt ) {
    5652                std::list< Label > &labels = stmt->get_labels();
    5753
     
    6258        }
    6359
    64         void LabelFixer::visit( BranchStmt *branchStmt ) {
    65                 visit ( ( Statement * )branchStmt );
     60        void LabelFixer::previsit( BranchStmt *branchStmt ) {
     61                previsit( ( Statement *)branchStmt );
    6662
    6763                // for labeled branches, add an entry to the label table
     
    7268        }
    7369
    74         void LabelFixer::visit( UntypedExpr *untyped ) {
    75                 if ( NameExpr * func = dynamic_cast< NameExpr * >( untyped->get_function() ) ) {
    76                         if ( func->get_name() == "&&" ) {
    77                                 NameExpr * arg = dynamic_cast< NameExpr * >( untyped->get_args().front() );
    78                                 Label target = arg->get_name();
    79                                 assert( target != "" );
    80                                 setLabelsUsg( target, untyped );
    81                         } else {
    82                                 Visitor::visit( untyped );
    83                         }
    84                 }
     70        void LabelFixer::previsit( LabelAddressExpr * addrExpr ) {
     71                Label & target = addrExpr->arg;
     72                assert( target != "" );
     73                setLabelsUsg( target, addrExpr );
    8574        }
    8675
Note: See TracChangeset for help on using the changeset viewer.