Changeset aa8f9df for src/InitTweak
- Timestamp:
- Sep 15, 2016, 3:22:50 PM (8 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:
- 4ab9536
- Parents:
- fd782b2 (diff), 906e24d (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. - Location:
- src/InitTweak
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/InitTweak/FixInit.cc
rfd782b2 raa8f9df 391 391 CP_CTOR_PRINT( std::cerr << "Type Substitution: " << *impCpCtorExpr->get_env() << std::endl; ) 392 392 // xxx - need to handle tuple arguments 393 assert( ! arg->get_results().empty() );394 Type * result = arg->get_result s().front();393 assert( arg->has_result() ); 394 Type * result = arg->get_result(); 395 395 if ( skipCopyConstruct( result ) ) continue; // skip certain non-copyable types 396 396 // type may involve type variables, so apply type substitution to get temporary variable's actual type … … 423 423 // level. Trying to pass that environment along. 424 424 callExpr->set_env( impCpCtorExpr->get_env()->clone() ); 425 for ( Type * result : appExpr->get_results() ) { 425 Type * result = appExpr->get_result(); 426 if ( ! result->isVoid() ) { 427 // need to flatten result type and construct each 426 428 result = result->clone(); 427 429 impCpCtorExpr->get_env()->apply( result ); … … 479 481 // know the result type of the assignment is the type of the LHS (minus the pointer), so 480 482 // add that onto the assignment expression so that later steps have the necessary information 481 assign-> add_result( returnDecl->get_type()->clone() );483 assign->set_result( returnDecl->get_type()->clone() ); 482 484 483 485 Expression * retExpr = new CommaExpr( assign, new VariableExpr( returnDecl ) ); 484 if ( callExpr->get_result s().front()->get_isLvalue() ) {486 if ( callExpr->get_result()->get_isLvalue() ) { 485 487 // lvalue returning functions are funny. Lvalue.cc inserts a *? in front of any lvalue returning 486 488 // non-intrinsic function. Add an AddressExpr to the call to negate the derefence and change the … … 500 502 UntypedExpr * deref = new UntypedExpr( new NameExpr( "*?" ) ); 501 503 deref->get_args().push_back( retExpr ); 502 deref-> add_result( resultType );504 deref->set_result( resultType ); 503 505 retExpr = deref; 504 506 } // if … … 939 941 Expression * FixCtorExprs::mutate( ConstructorExpr * ctorExpr ) { 940 942 static UniqueName tempNamer( "_tmp_ctor_expr" ); 941 assert( ctorExpr-> get_results().size() == 1 );942 ObjectDecl * tmp = new ObjectDecl( tempNamer.newName(), DeclarationNode::NoStorageClass, LinkageSpec::C, nullptr, ctorExpr->get_result s().front()->clone(), nullptr );943 assert( ctorExpr->has_result() && ctorExpr->get_result()->size() == 1 ); 944 ObjectDecl * tmp = new ObjectDecl( tempNamer.newName(), DeclarationNode::NoStorageClass, LinkageSpec::C, nullptr, ctorExpr->get_result()->clone(), nullptr ); 943 945 addDeclaration( tmp ); 944 946 … … 952 954 assign->get_args().push_back( new VariableExpr( tmp ) ); 953 955 assign->get_args().push_back( firstArg ); 954 cloneAll( ctorExpr->get_results(), assign->get_results() );956 assign->set_result( ctorExpr->get_result()->clone() ); 955 957 firstArg = assign; 956 958 -
src/InitTweak/InitTweak.cc
rfd782b2 raa8f9df 340 340 return allofCtorDtor( stmt, []( Expression * callExpr ){ 341 341 if ( ApplicationExpr * appExpr = isIntrinsicCallExpr( callExpr ) ) { 342 assert( ! appExpr->get_function()->get_results().empty() ); 343 FunctionType *funcType = GenPoly::getFunctionType( appExpr->get_function()->get_results().front() ); 342 FunctionType *funcType = GenPoly::getFunctionType( appExpr->get_function()->get_result() ); 344 343 assert( funcType ); 345 344 return funcType->get_parameters().size() == 1;
Note: See TracChangeset
for help on using the changeset viewer.