Ignore:
Timestamp:
Dec 5, 2017, 2:35:03 PM (6 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
ADT, arm-eh, ast-experimental, cleanup-dtors, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
f9feab8
Parents:
9c35431 (diff), 65197c2 (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' into cleanup-dtors

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/InitTweak/FixInit.cc

    r9c35431 rc13e8dc8  
    4949#include "SynTree/Expression.h"        // for UniqueExpr, VariableExpr, Unty...
    5050#include "SynTree/Initializer.h"       // for ConstructorInit, SingleInit
    51 #include "SynTree/Label.h"             // for Label, noLabels, operator<
     51#include "SynTree/Label.h"             // for Label, operator<
    5252#include "SynTree/Mutator.h"           // for mutateAll, Mutator, maybeMutate
    5353#include "SynTree/Statement.h"         // for ExprStmt, CompoundStmt, Branch...
     
    547547                        // add all temporary declarations and their constructors
    548548                        for ( ObjectDecl * obj : tempDecls ) {
    549                                 stmtsToAddBefore.push_back( new DeclStmt( noLabels, obj ) );
     549                                stmtsToAddBefore.push_back( new DeclStmt( obj ) );
    550550                        } // for
    551551                        for ( ObjectDecl * obj : returnDecls ) {
    552                                 stmtsToAddBefore.push_back( new DeclStmt( noLabels, obj ) );
     552                                stmtsToAddBefore.push_back( new DeclStmt( obj ) );
    553553                        } // for
    554554
    555555                        // add destructors after current statement
    556556                        for ( Expression * dtor : dtors ) {
    557                                 stmtsToAddAfter.push_back( new ExprStmt( noLabels, dtor ) );
     557                                stmtsToAddAfter.push_back( new ExprStmt( dtor ) );
    558558                        } // for
    559559
     
    601601                        if ( ! result->isVoid() ) {
    602602                                for ( ObjectDecl * obj : stmtExpr->get_returnDecls() ) {
    603                                         stmtsToAddBefore.push_back( new DeclStmt( noLabels, obj ) );
     603                                        stmtsToAddBefore.push_back( new DeclStmt( obj ) );
    604604                                } // for
    605605                                // add destructors after current statement
    606606                                for ( Expression * dtor : stmtExpr->get_dtors() ) {
    607                                         stmtsToAddAfter.push_back( new ExprStmt( noLabels, dtor ) );
     607                                        stmtsToAddAfter.push_back( new ExprStmt( dtor ) );
    608608                                } // for
    609609                                // must have a non-empty body, otherwise it wouldn't have a result
    610610                                assert( ! stmts.empty() );
    611611                                assert( ! stmtExpr->get_returnDecls().empty() );
    612                                 stmts.push_back( new ExprStmt( noLabels, new VariableExpr( stmtExpr->get_returnDecls().front() ) ) );
     612                                stmts.push_back( new ExprStmt( new VariableExpr( stmtExpr->get_returnDecls().front() ) ) );
    613613                                stmtExpr->get_returnDecls().clear();
    614614                                stmtExpr->get_dtors().clear();
     
    739739
    740740                                                // generate body of if
    741                                                 CompoundStmt * initStmts = new CompoundStmt( noLabels );
     741                                                CompoundStmt * initStmts = new CompoundStmt();
    742742                                                std::list< Statement * > & body = initStmts->get_kids();
    743743                                                body.push_back( ctor );
    744                                                 body.push_back( new ExprStmt( noLabels, setTrue ) );
     744                                                body.push_back( new ExprStmt( setTrue ) );
    745745
    746746                                                // put it all together
    747                                                 IfStmt * ifStmt = new IfStmt( noLabels, new VariableExpr( isUninitializedVar ), initStmts, 0 );
    748                                                 stmtsToAddAfter.push_back( new DeclStmt( noLabels, isUninitializedVar ) );
     747                                                IfStmt * ifStmt = new IfStmt( new VariableExpr( isUninitializedVar ), initStmts, 0 );
     748                                                stmtsToAddAfter.push_back( new DeclStmt( isUninitializedVar ) );
    749749                                                stmtsToAddAfter.push_back( ifStmt );
    750750
     
    761761
    762762                                                        // void __objName_dtor_atexitN(...) {...}
    763                                                         FunctionDecl * dtorCaller = new FunctionDecl( objDecl->get_mangleName() + dtorCallerNamer.newName(), Type::StorageClasses( Type::Static ), LinkageSpec::C, new FunctionType( Type::Qualifiers(), false ), new CompoundStmt( noLabels ) );
     763                                                        FunctionDecl * dtorCaller = new FunctionDecl( objDecl->get_mangleName() + dtorCallerNamer.newName(), Type::StorageClasses( Type::Static ), LinkageSpec::C, new FunctionType( Type::Qualifiers(), false ), new CompoundStmt() );
    764764                                                        dtorCaller->fixUniqueId();
    765765                                                        dtorCaller->get_statements()->push_back( dtorStmt );
     
    769769                                                        callAtexit->get_args().push_back( new VariableExpr( dtorCaller ) );
    770770
    771                                                         body.push_back( new ExprStmt( noLabels, callAtexit ) );
     771                                                        body.push_back( new ExprStmt( callAtexit ) );
    772772
    773773                                                        // hoist variable and dtor caller decls to list of decls that will be added into global scope
Note: See TracChangeset for help on using the changeset viewer.