Changes in src/InitTweak/FixInit.cc [64ac636:233e4d9]
- File:
-
- 1 edited
-
src/InitTweak/FixInit.cc (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/InitTweak/FixInit.cc
r64ac636 r233e4d9 10 10 // Created On : Wed Jan 13 16:29:30 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Mar 16 08:08:04201713 // Update Count : 6712 // Last Modified On : Fri Mar 17 09:13:47 2017 13 // Update Count : 71 14 14 // 15 15 … … 434 434 env->apply( result ); 435 435 ObjectDecl * tmp = new ObjectDecl( tempNamer.newName(), Type::StorageClasses(), LinkageSpec::C, 0, result, 0 ); 436 tmp->get_type()->set_ isConst( false );436 tmp->get_type()->set_const( false ); 437 437 438 438 // create and resolve copy constructor … … 480 480 env->apply( result ); 481 481 ObjectDecl * ret = new ObjectDecl( retNamer.newName(), Type::StorageClasses(), LinkageSpec::C, 0, result, 0 ); 482 ret->get_type()->set_ isConst( false );482 ret->get_type()->set_const( false ); 483 483 impCpCtorExpr->get_returnDecls().push_back( ret ); 484 484 CP_CTOR_PRINT( std::cerr << "makeCtorDtor for a return" << std::endl; ) 485 if ( ! result->get_ isLvalue() ) {485 if ( ! result->get_lvalue() ) { 486 486 // destructing lvalue returns is bad because it can cause multiple destructor calls to the same object - the returned object is not a temporary 487 487 destructRet( ret, impCpCtorExpr ); … … 503 503 env->apply( result ); 504 504 ObjectDecl * ret = new ObjectDecl( retNamer.newName(), Type::StorageClasses(), LinkageSpec::C, 0, result, 0 ); 505 ret->get_type()->set_ isConst( false );505 ret->get_type()->set_const( false ); 506 506 stmtExpr->get_returnDecls().push_front( ret ); 507 507 … … 534 534 } else { 535 535 // expr isn't a call expr, so create a new temporary variable to use to hold the value of the unique expression 536 unqExpr->set_object( new ObjectDecl( toString("_unq _expr_", unqExpr->get_id()), Type::StorageClasses(), LinkageSpec::C, nullptr, unqExpr->get_result()->clone(), nullptr ) );536 unqExpr->set_object( new ObjectDecl( toString("_unq", unqExpr->get_id()), Type::StorageClasses(), LinkageSpec::C, nullptr, unqExpr->get_result()->clone(), nullptr ) ); 537 537 unqExpr->set_var( new VariableExpr( unqExpr->get_object() ) ); 538 538 } … … 584 584 585 585 Expression * retExpr = new CommaExpr( assign, new VariableExpr( returnDecl ) ); 586 if ( callExpr->get_result()->get_ isLvalue() ) {586 if ( callExpr->get_result()->get_lvalue() ) { 587 587 // lvalue returning functions are funny. Lvalue.cc inserts a *? in front of any lvalue returning 588 588 // non-intrinsic function. Add an AddressExpr to the call to negate the derefence and change the … … 764 764 } 765 765 } else { 766 stmtsToAddAfter.push_back( ctor ); 766 ImplicitCtorDtorStmt * implicit = safe_dynamic_cast< ImplicitCtorDtorStmt * > ( ctor ); 767 ExprStmt * ctorStmt = dynamic_cast< ExprStmt * >( implicit->get_callStmt() ); 768 ApplicationExpr * ctorCall = nullptr; 769 if ( ctorStmt && (ctorCall = isIntrinsicCallExpr( ctorStmt->get_expr() )) && ctorCall->get_args().size() == 2 ) { 770 // clean up intrinsic copy constructor calls by making them into SingleInits 771 objDecl->set_init( new SingleInit( ctorCall->get_args().back() ) ); 772 ctorCall->get_args().pop_back(); 773 } else { 774 stmtsToAddAfter.push_back( ctor ); 775 objDecl->set_init( NULL ); 776 ctorInit->set_ctor( NULL ); 777 } 767 778 } // if 768 objDecl->set_init( NULL );769 ctorInit->set_ctor( NULL );770 779 } else if ( Initializer * init = ctorInit->get_init() ) { 771 780 objDecl->set_init( init );
Note:
See TracChangeset
for help on using the changeset viewer.