Ignore:
Timestamp:
Nov 22, 2017, 5:06:06 PM (6 years ago)
Author:
Rob Schluntz <rschlunt@…>
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:
8dceeb7
Parents:
f203a7a (diff), 4d5e57b (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.
Message:

Merge branch 'fix-bug-51'

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/InitTweak/FixInit.cc

    rf203a7a r1ba5803  
    393393                        if ( skipCopyConstruct( result ) ) return; // skip certain non-copyable types
    394394
    395                         // type may involve type variables, so apply type substitution to get temporary variable's actual type.
     395                        // type may involve type variables, so apply type substitution to get temporary variable's actual type,
     396                        // since result type may not be substituted (e.g., if the type does not appear in the parameter list)
    396397                        // Use applyFree so that types bound in function pointers are not substituted, e.g. in forall(dtype T) void (*)(T).
    397                         result = result->clone();
    398398                        env->applyFree( result );
    399399                        ObjectDecl * tmp = ObjectDecl::newObject( "__tmp", result, nullptr );
     
    570570
    571571                        if ( returnDecl ) {
    572                                 UntypedExpr * assign = new UntypedExpr( new NameExpr( "?=?" ) );
    573                                 assign->get_args().push_back( new VariableExpr( returnDecl ) );
    574                                 assign->get_args().push_back( callExpr );
    575                                 // know the result type of the assignment is the type of the LHS (minus the pointer), so
    576                                 // add that onto the assignment expression so that later steps have the necessary information
    577                                 assign->set_result( returnDecl->get_type()->clone() );
    578 
     572                                ApplicationExpr * assign = createBitwiseAssignment( new VariableExpr( returnDecl ), callExpr );
    579573                                Expression * retExpr = new CommaExpr( assign, new VariableExpr( returnDecl ) );
    580574                                // move env from callExpr to retExpr
     
    11461140                        assert( ctorExpr->result && ctorExpr->get_result()->size() == 1 );
    11471141
    1148                         // 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.
    1149                         ObjectDecl * tmp = ObjectDecl::newObject( tempNamer.newName(), ctorExpr->get_result()->clone(), nullptr );
    1150                         declsToAddBefore.push_back( tmp );
    1151 
    11521142                        // xxx - this can be TupleAssignExpr now. Need to properly handle this case.
    11531143                        ApplicationExpr * callExpr = strict_dynamic_cast< ApplicationExpr * > ( ctorExpr->get_callExpr() );
     
    11551145                        ctorExpr->set_callExpr( nullptr );
    11561146                        ctorExpr->set_env( nullptr );
     1147
     1148                        // 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.
     1149                        ObjectDecl * tmp = ObjectDecl::newObject( tempNamer.newName(), callExpr->args.front()->result->clone(), nullptr );
     1150                        declsToAddBefore.push_back( tmp );
    11571151                        delete ctorExpr;
    11581152
Note: See TracChangeset for help on using the changeset viewer.