Changeset 436c0de for src/InitTweak


Ignore:
Timestamp:
Jun 18, 2017, 9:22:22 AM (9 years ago)
Author:
Rob Schluntz <rschlunt@…>
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:
f1e80d8
Parents:
ade20d0 (diff), 42b0d73 (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:/u/cforall/software/cfa/cfa-cc

Conflicts:

src/InitTweak/GenInit.cc

Location:
src/InitTweak
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/InitTweak/FixInit.cc

    rade20d0 r436c0de  
    902902                }
    903903
    904                 void InsertDtors::visit( ReturnStmt * returnStmt ) {
     904                void InsertDtors::visit( __attribute((unused)) ReturnStmt * returnStmt ) {
    905905                        // return exits all scopes, so dump destructors for all scopes
    906906                        for ( OrderedDecls & od : reverseDeclOrder ) {
  • src/InitTweak/GenInit.cc

    rade20d0 r436c0de  
    3939
    4040namespace InitTweak {
    41         class ReturnFixer final : public GenPoly::PolyMutator {
     41        namespace {
     42                const std::list<Label> noLabels;
     43                const std::list<Expression *> noDesignators;
     44        }
     45
     46        class ReturnFixer : public WithStmtsToAdd, public WithScopes {
    4247          public:
    4348                /// consistently allocates a temporary variable for the return value
     
    4651                static void makeReturnTemp( std::list< Declaration * > &translationUnit );
    4752
    48                 typedef GenPoly::PolyMutator Parent;
    49                 using Parent::mutate;
    50                 virtual DeclarationWithType * mutate( FunctionDecl *functionDecl ) override;
    51                 virtual Statement * mutate( ReturnStmt * returnStmt ) override;
     53                void premutate( FunctionDecl *functionDecl );
     54                void premutate( ReturnStmt * returnStmt );
    5255
    5356          protected:
     
    131134
    132135        void ReturnFixer::makeReturnTemp( std::list< Declaration * > & translationUnit ) {
    133                 ReturnFixer fixer;
     136                PassVisitor<ReturnFixer> fixer;
    134137                mutateAll( translationUnit, fixer );
    135138        }
    136139
    137         Statement *ReturnFixer::mutate( ReturnStmt *returnStmt ) {
     140        void ReturnFixer::premutate( ReturnStmt *returnStmt ) {
    138141                std::list< DeclarationWithType * > & returnVals = ftype->get_returnVals();
    139142                assert( returnVals.size() == 0 || returnVals.size() == 1 );
     
    146149                        construct->get_args().push_back( new AddressExpr( new VariableExpr( returnVals.front() ) ) );
    147150                        construct->get_args().push_back( returnStmt->get_expr() );
    148                         stmtsToAdd.push_back(new ExprStmt(noLabels, construct));
     151                        stmtsToAddBefore.push_back(new ExprStmt(noLabels, construct));
    149152
    150153                        // return the retVal object
    151154                        returnStmt->set_expr( new VariableExpr( returnVals.front() ) );
    152155                } // if
    153                 return returnStmt;
    154         }
    155 
    156         DeclarationWithType* ReturnFixer::mutate( FunctionDecl *functionDecl ) {
    157                 ValueGuard< FunctionType * > oldFtype( ftype );
    158                 ValueGuard< std::string > oldFuncName( funcName );
     156        }
     157
     158        void ReturnFixer::premutate( FunctionDecl *functionDecl ) {
     159                GuardValue( ftype );
     160                GuardValue( funcName );
    159161
    160162                ftype = functionDecl->get_functionType();
    161163                funcName = functionDecl->get_name();
    162                 return Parent::mutate( functionDecl );
    163164        }
    164165
Note: See TracChangeset for help on using the changeset viewer.