Changeset b96ec83 for src/InitTweak/FixInit.cc
- Timestamp:
- Oct 3, 2017, 5:12:35 PM (7 years ago)
- 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. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/InitTweak/FixInit.cc
r1bc749f rb96ec83 213 213 void emit( CodeLocation, const Params &... params ); 214 214 215 FunctionDecl * function = 0;215 FunctionDecl * function = nullptr; 216 216 std::set< DeclarationWithType * > unhandled; 217 217 std::map< DeclarationWithType *, CodeLocation > usedUninit; 218 ObjectDecl * thisParam = 0;218 ObjectDecl * thisParam = nullptr; 219 219 bool isCtor = false; // true if current function is a constructor 220 StructDecl * structDecl = 0;220 StructDecl * structDecl = nullptr; 221 221 }; 222 222 … … 750 750 } else { 751 751 ImplicitCtorDtorStmt * implicit = strict_dynamic_cast< ImplicitCtorDtorStmt * > ( ctor ); 752 ExprStmt * ctorStmt = dynamic_cast< ExprStmt * >( implicit-> get_callStmt());752 ExprStmt * ctorStmt = dynamic_cast< ExprStmt * >( implicit->callStmt ); 753 753 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 ) { 755 755 // 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(); 758 758 } else { 759 759 stmtsToAddAfter.push_back( ctor ); 760 objDecl-> set_init( nullptr );761 ctorInit-> set_ctor( nullptr );760 objDecl->init = nullptr; 761 ctorInit->ctor = nullptr; 762 762 } 763 763 … … 777 777 } 778 778 } // 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; 782 782 } else { 783 783 // no constructor and no initializer, which is okay 784 objDecl-> set_init( nullptr );784 objDecl->init = nullptr; 785 785 } // if 786 786 delete ctorInit; … … 880 880 } 881 881 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 882 895 void GenStructMemberCalls::previsit( FunctionDecl * funcDecl ) { 883 GuardValue( func Decl);896 GuardValue( function ); 884 897 GuardValue( unhandled ); 885 898 GuardValue( usedUninit ); … … 914 927 } 915 928 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 929 929 void GenStructMemberCalls::postvisit( FunctionDecl * funcDecl ) { 930 930 // remove the unhandled objects from usedUninit, because a call is inserted
Note: See TracChangeset
for help on using the changeset viewer.