Changeset 3aeaecd
- Timestamp:
- Sep 25, 2017, 3:26:03 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:
- 696bf6e
- Parents:
- f265042
- Location:
- src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/InitTweak/FixInit.cc
rf265042 r3aeaecd 404 404 result = result->clone(); 405 405 env->apply( result ); 406 ObjectDecl * tmp = new ObjectDecl( tempNamer.newName(), Type::StorageClasses(), LinkageSpec::C, 0, result, 0);406 ObjectDecl * tmp = ObjectDecl::newObject( "__tmp", result, nullptr ); 407 407 tmp->get_type()->set_const( false ); 408 408 … … 418 418 if ( function->get_var()->get_linkage() == LinkageSpec::Intrinsic ) return; 419 419 } 420 421 // set a unique name for the temporary once it's certain the call is necessary 422 tmp->name = tempNamer.newName(); 420 423 421 424 // replace argument to function call with temporary … … 447 450 result = result->clone(); 448 451 env->apply( result ); 449 ObjectDecl * ret = new ObjectDecl( retNamer.newName(), Type::StorageClasses(), LinkageSpec::C, 0, result, 0);452 ObjectDecl * ret = ObjectDecl::newObject( retNamer.newName(), result, nullptr ); 450 453 ret->get_type()->set_const( false ); 451 454 impCpCtorExpr->get_returnDecls().push_back( ret ); 452 455 CP_CTOR_PRINT( std::cerr << "makeCtorDtor for a return" << std::endl; ) 453 456 if ( ! dynamic_cast< ReferenceType * >( result ) ) { 454 // destructing lvalue returns is bad because it can cause multiple destructor calls to the same object - the returned object is not a temporary457 // destructing reference returns is bad because it can cause multiple destructor calls to the same object - the returned object is not a temporary 455 458 destructRet( ret, impCpCtorExpr ); 456 459 } … … 469 472 result = result->clone(); 470 473 env->apply( result ); 471 ObjectDecl * ret = new ObjectDecl( retNamer.newName(), Type::StorageClasses(), LinkageSpec::C, 0, result, 0);474 ObjectDecl * ret = ObjectDecl::newObject( retNamer.newName(), result, nullptr ); 472 475 ret->get_type()->set_const( false ); 473 476 stmtExpr->get_returnDecls().push_front( ret ); … … 506 509 } else { 507 510 // expr isn't a call expr, so create a new temporary variable to use to hold the value of the unique expression 508 unqExpr->set_object( new ObjectDecl( toString("_unq", unqExpr->get_id()), Type::StorageClasses(), LinkageSpec::C, nullptr, unqExpr->get_result()->clone(), nullptr ) );511 unqExpr->set_object( ObjectDecl::newObject( toString("_unq", unqExpr->get_id()), unqExpr->get_result()->clone(), nullptr ) ); 509 512 unqExpr->set_var( new VariableExpr( unqExpr->get_object() ) ); 510 513 } … … 1149 1152 1150 1153 // xxx - ideally we would reuse the temporary generated from the copy constructor passes from within firstArg if it exists and not generate a temporary if it's unnecessary. 1151 ObjectDecl * tmp = new ObjectDecl( tempNamer.newName(), Type::StorageClasses(), LinkageSpec::C, nullptr, ctorExpr->get_result()->clone(), nullptr );1154 ObjectDecl * tmp = ObjectDecl::newObject( tempNamer.newName(), ctorExpr->get_result()->clone(), nullptr ); 1152 1155 addDeclaration( tmp ); 1153 1156 -
src/tests/.expect/sched-ext-parse.txt
rf265042 r3aeaecd 1055 1055 static inline struct condition ___operator_assign__F10scondition_R10scondition10scondition_autogen___1(struct condition *___dst__R10scondition_1, struct condition ___src__10scondition_1){ 1056 1056 struct condition ___ret__10scondition_1; 1057 struct __condition_blocked_queue_t _tmp_cp 56;1057 struct __condition_blocked_queue_t _tmp_cp4; 1058 1058 struct __condition_blocked_queue_t _tmp_cp_ret29; 1059 ((void)(((void)(_tmp_cp_ret29=___operator_assign__F28s__condition_blocked_queue_t_R28s__condition_blocked_queue_t28s__condition_blocked_queue_t_autogen___1((&(*___dst__R10scondition_1).__blocked__28s__condition_blocked_queue_t_1), (((void)___constructor__F_R28s__condition_blocked_queue_t28s__condition_blocked_queue_t_autogen___1((&_tmp_cp 56), ___src__10scondition_1.__blocked__28s__condition_blocked_queue_t_1)) , _tmp_cp56)))) , _tmp_cp_ret29));1059 ((void)(((void)(_tmp_cp_ret29=___operator_assign__F28s__condition_blocked_queue_t_R28s__condition_blocked_queue_t28s__condition_blocked_queue_t_autogen___1((&(*___dst__R10scondition_1).__blocked__28s__condition_blocked_queue_t_1), (((void)___constructor__F_R28s__condition_blocked_queue_t28s__condition_blocked_queue_t_autogen___1((&_tmp_cp4), ___src__10scondition_1.__blocked__28s__condition_blocked_queue_t_1)) , _tmp_cp4)))) , _tmp_cp_ret29)); 1060 1060 ((void)___destructor__F_R28s__condition_blocked_queue_t_autogen___1((&_tmp_cp_ret29))); 1061 ((void)___destructor__F_R28s__condition_blocked_queue_t_autogen___1((&_tmp_cp 56)));1061 ((void)___destructor__F_R28s__condition_blocked_queue_t_autogen___1((&_tmp_cp4))); 1062 1062 ((void)((*___dst__R10scondition_1).__monitors__PP13smonitor_desc_1=___src__10scondition_1.__monitors__PP13smonitor_desc_1)); 1063 1063 ((void)((*___dst__R10scondition_1).__monitor_count__Us_1=___src__10scondition_1.__monitor_count__Us_1)); … … 1155 1155 static inline struct M ___operator_assign__F2sM_R2sM2sM_autogen___1(struct M *___dst__R2sM_1, struct M ___src__2sM_1){ 1156 1156 struct M ___ret__2sM_1; 1157 struct monitor_desc _tmp_cp 60;1157 struct monitor_desc _tmp_cp5; 1158 1158 struct monitor_desc _tmp_cp_ret31; 1159 ((void)(((void)(_tmp_cp_ret31=___operator_assign__F13smonitor_desc_R13smonitor_desc13smonitor_desc_autogen___1((&(*___dst__R2sM_1).____mon__13smonitor_desc_1), (((void)___constructor__F_R13smonitor_desc13smonitor_desc_autogen___1((&_tmp_cp 60), ___src__2sM_1.____mon__13smonitor_desc_1)) , _tmp_cp60)))) , _tmp_cp_ret31));1159 ((void)(((void)(_tmp_cp_ret31=___operator_assign__F13smonitor_desc_R13smonitor_desc13smonitor_desc_autogen___1((&(*___dst__R2sM_1).____mon__13smonitor_desc_1), (((void)___constructor__F_R13smonitor_desc13smonitor_desc_autogen___1((&_tmp_cp5), ___src__2sM_1.____mon__13smonitor_desc_1)) , _tmp_cp5)))) , _tmp_cp_ret31)); 1160 1160 ((void)___destructor__F_R13smonitor_desc_autogen___1((&_tmp_cp_ret31))); 1161 ((void)___destructor__F_R13smonitor_desc_autogen___1((&_tmp_cp 60)));1161 ((void)___destructor__F_R13smonitor_desc_autogen___1((&_tmp_cp5))); 1162 1162 ((void)___constructor__F_R2sM2sM_autogen___1((&___ret__2sM_1), ___src__2sM_1)); 1163 1163 return ((struct M )___ret__2sM_1);
Note: See TracChangeset
for help on using the changeset viewer.