Ignore:
Timestamp:
Sep 1, 2016, 4:53:22 PM (8 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, 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:
44f6341
Parents:
fba44f8
Message:

implicitly insert missing copy constructors when appropriate, update test output

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/InitTweak/FixInit.cc

    rfba44f8 r4d4882a  
    787787                                        UntypedExpr * deref = new UntypedExpr( new NameExpr( "*?" ) );
    788788                                        deref->get_args().push_back( new VariableExpr( thisParam ) );
    789                                         InitExpander srcParam( (Initializer *)NULL ); // xxx - if copy ctor, need to pass appropriate argument - second param of this function dot member
     789
     790                                        Expression * arg2 = 0;
     791                                        if ( isCopyConstructor( function ) ) {
     792                                                // if copy ctor, need to pass second-param-of-this-function.member
     793                                                std::list< DeclarationWithType * > & params = function->get_functionType()->get_parameters();
     794                                                assert( params.size() == 2 );
     795                                                arg2 = new MemberExpr( member, new VariableExpr( params.back() ) );
     796                                        }
     797                                        InitExpander srcParam( arg2 );
    790798                                        SymTab::genImplicitCall( srcParam, new MemberExpr( member, deref ), function->get_name(), back_inserter( stmt ), member, isCtor );
    791799
     
    832840                                        handleFirstParam( firstParam );
    833841                                }
    834                         } else if ( fname == "?=?" && isIntrinsicCallExpr( appExpr ) ) {
    835                                 // forgive use of intrinsic assignment to construct, since instrinsic constructors
    836                                 // codegen as assignment anyway.
    837                                 assert( appExpr->get_args().size() == 2 );
    838                                 handleFirstParam( appExpr->get_args().front() );
    839842                        }
    840843
Note: See TracChangeset for help on using the changeset viewer.