Ignore:
Timestamp:
Oct 3, 2017, 5:12:35 PM (7 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:
6840e7c
Parents:
1bc749f (diff), b0f601fa (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 'new-branch-stashed' into cleanup-dtors

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/InitTweak/FixInit.cc

    r1bc749f rb96ec83  
    213213                        void emit( CodeLocation, const Params &... params );
    214214
    215                         FunctionDecl * function = 0;
     215                        FunctionDecl * function = nullptr;
    216216                        std::set< DeclarationWithType * > unhandled;
    217217                        std::map< DeclarationWithType *, CodeLocation > usedUninit;
    218                         ObjectDecl * thisParam = 0;
     218                        ObjectDecl * thisParam = nullptr;
    219219                        bool isCtor = false; // true if current function is a constructor
    220                         StructDecl * structDecl = 0;
     220                        StructDecl * structDecl = nullptr;
    221221                };
    222222
     
    750750                                        } else {
    751751                                                ImplicitCtorDtorStmt * implicit = strict_dynamic_cast< ImplicitCtorDtorStmt * > ( ctor );
    752                                                 ExprStmt * ctorStmt = dynamic_cast< ExprStmt * >( implicit->get_callStmt() );
     752                                                ExprStmt * ctorStmt = dynamic_cast< ExprStmt * >( implicit->callStmt );
    753753                                                ApplicationExpr * ctorCall = nullptr;
    754                                                 if ( ctorStmt && (ctorCall = isIntrinsicCallExpr( ctorStmt->get_expr() )) && ctorCall->get_args().size() == 2 ) {
     754                                                if ( ctorStmt && (ctorCall = isIntrinsicCallExpr( ctorStmt->expr )) && ctorCall->get_args().size() == 2 ) {
    755755                                                        // clean up intrinsic copy constructor calls by making them into SingleInits
    756                                                         objDecl->set_init( new SingleInit( ctorCall->get_args().back() ) );
    757                                                         ctorCall->get_args().pop_back();
     756                                                        objDecl->init = new SingleInit( ctorCall->args.back() );
     757                                                        ctorCall->args.pop_back();
    758758                                                } else {
    759759                                                        stmtsToAddAfter.push_back( ctor );
    760                                                         objDecl->set_init( nullptr );
    761                                                         ctorInit->set_ctor( nullptr );
     760                                                        objDecl->init = nullptr;
     761                                                        ctorInit->ctor = nullptr;
    762762                                                }
    763763
     
    777777                                                }
    778778                                        } // if
    779                                 } else if ( Initializer * init = ctorInit->get_init() ) {
    780                                         objDecl->set_init( init );
    781                                         ctorInit->set_init( nullptr );
     779                                } else if ( Initializer * init = ctorInit->init ) {
     780                                        objDecl->init = init;
     781                                        ctorInit->init = nullptr;
    782782                                } else {
    783783                                        // no constructor and no initializer, which is okay
    784                                         objDecl->set_init( nullptr );
     784                                        objDecl->init = nullptr;
    785785                                } // if
    786786                                delete ctorInit;
     
    880880                }
    881881
     882                void addIds( SymTab::Indexer & indexer, const std::list< DeclarationWithType * > & decls ) {
     883                        for ( auto d : decls ) {
     884                                indexer.addId( d );
     885                        }
     886                }
     887
     888                void addTypes( SymTab::Indexer & indexer, const std::list< TypeDecl * > & tds ) {
     889                        for ( auto td : tds ) {
     890                                indexer.addType( td );
     891                                addIds( indexer, td->assertions );
     892                        }
     893                }
     894
    882895                void GenStructMemberCalls::previsit( FunctionDecl * funcDecl ) {
    883                         GuardValue( funcDecl );
     896                        GuardValue( function );
    884897                        GuardValue( unhandled );
    885898                        GuardValue( usedUninit );
     
    914927                }
    915928
    916                 void addIds( SymTab::Indexer & indexer, const std::list< DeclarationWithType * > & decls ) {
    917                         for ( auto d : decls ) {
    918                                 indexer.addId( d );
    919                         }
    920                 }
    921 
    922                 void addTypes( SymTab::Indexer & indexer, const std::list< TypeDecl * > & tds ) {
    923                         for ( auto td : tds ) {
    924                                 indexer.addType( td );
    925                                 addIds( indexer, td->assertions );
    926                         }
    927                 }
    928 
    929929                void GenStructMemberCalls::postvisit( FunctionDecl * funcDecl ) {
    930930                        // remove the unhandled objects from usedUninit, because a call is inserted
Note: See TracChangeset for help on using the changeset viewer.