Changeset 5363fdf for src/InitTweak
- Timestamp:
- Sep 27, 2017, 4:25:28 PM (7 years ago)
- 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:
- fa16264
- Parents:
- 1189946
- git-author:
- Rob Schluntz <rschlunt@…> (09/27/17 16:11:50)
- git-committer:
- Rob Schluntz <rschlunt@…> (09/27/17 16:25:28)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/InitTweak/FixInit.cc
r1189946 r5363fdf 214 214 void emit( CodeLocation, const Params &... params ); 215 215 216 FunctionDecl * function = 0;216 FunctionDecl * function = nullptr; 217 217 std::set< DeclarationWithType * > unhandled; 218 218 std::map< DeclarationWithType *, CodeLocation > usedUninit; 219 ObjectDecl * thisParam = 0;219 ObjectDecl * thisParam = nullptr; 220 220 bool isCtor = false; // true if current function is a constructor 221 StructDecl * structDecl = 0;221 StructDecl * structDecl = nullptr; 222 222 }; 223 223 … … 624 624 } 625 625 626 DeclarationWithType * FixInit::postmutate( ObjectDecl *objDecl ) {626 DeclarationWithType * FixInit::postmutate( ObjectDecl *objDecl ) { 627 627 // since this removes the init field from objDecl, it must occur after children are mutated (i.e. postmutate) 628 628 if ( ConstructorInit * ctorInit = dynamic_cast< ConstructorInit * >( objDecl->get_init() ) ) { … … 722 722 } else { 723 723 ImplicitCtorDtorStmt * implicit = strict_dynamic_cast< ImplicitCtorDtorStmt * > ( ctor ); 724 ExprStmt * ctorStmt = dynamic_cast< ExprStmt * >( implicit-> get_callStmt());724 ExprStmt * ctorStmt = dynamic_cast< ExprStmt * >( implicit->callStmt ); 725 725 ApplicationExpr * ctorCall = nullptr; 726 if ( ctorStmt && (ctorCall = isIntrinsicCallExpr( ctorStmt-> get_expr())) && ctorCall->get_args().size() == 2 ) {726 if ( ctorStmt && (ctorCall = isIntrinsicCallExpr( ctorStmt->expr )) && ctorCall->get_args().size() == 2 ) { 727 727 // clean up intrinsic copy constructor calls by making them into SingleInits 728 objDecl-> set_init( new SingleInit( ctorCall->get_args().back()) );729 ctorCall-> get_args().pop_back();728 objDecl->init = new SingleInit( ctorCall->args.back() ); 729 ctorCall->args.pop_back(); 730 730 } else { 731 731 stmtsToAddAfter.push_back( ctor ); 732 objDecl-> set_init( nullptr );733 ctorInit-> set_ctor( nullptr );732 objDecl->init = nullptr; 733 ctorInit->ctor = nullptr; 734 734 } 735 735 } // if 736 } else if ( Initializer * init = ctorInit-> get_init()) {737 objDecl-> set_init( init );738 ctorInit-> set_init( nullptr );736 } else if ( Initializer * init = ctorInit->init ) { 737 objDecl->init = init; 738 ctorInit->init = nullptr; 739 739 } else { 740 740 // no constructor and no initializer, which is okay 741 objDecl-> set_init( nullptr );741 objDecl->init = nullptr; 742 742 } // if 743 743 delete ctorInit; … … 912 912 } 913 913 914 void addIds( SymTab::Indexer & indexer, const std::list< DeclarationWithType * > & decls ) { 915 for ( auto d : decls ) { 916 indexer.addId( d ); 917 } 918 } 919 920 void addTypes( SymTab::Indexer & indexer, const std::list< TypeDecl * > & tds ) { 921 for ( auto td : tds ) { 922 indexer.addType( td ); 923 addIds( indexer, td->assertions ); 924 } 925 } 926 914 927 void GenStructMemberCalls::previsit( FunctionDecl * funcDecl ) { 915 GuardValue( func Decl);928 GuardValue( function ); 916 929 GuardValue( unhandled ); 917 930 GuardValue( usedUninit ); … … 946 959 } 947 960 948 void addIds( SymTab::Indexer & indexer, const std::list< DeclarationWithType * > & decls ) {949 for ( auto d : decls ) {950 indexer.addId( d );951 }952 }953 954 void addTypes( SymTab::Indexer & indexer, const std::list< TypeDecl * > & tds ) {955 for ( auto td : tds ) {956 indexer.addType( td );957 addIds( indexer, td->assertions );958 }959 }960 961 961 void GenStructMemberCalls::postvisit( FunctionDecl * funcDecl ) { 962 962 // remove the unhandled objects from usedUninit, because a call is inserted
Note: See TracChangeset
for help on using the changeset viewer.