Changeset 7eabc25 for src


Ignore:
Timestamp:
Apr 11, 2016, 6:01:27 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, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
db4ecc5
Parents:
7a69460
Message:

use VariableExpr? instead of NameExpr? when creating implicit ctor/dtor calls

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/InitTweak/RemoveInit.cc

    r7a69460 r7eabc25  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Rob Schluntz
    12 // Last Modified On : Mon Apr 04 17:18:03 2016
     12// Last Modified On : Mon Apr 11 17:28:43 2016
    1313// Update Count     : 166
    1414//
     
    9595                                // xxx this can be more complicated - consider ListInit
    9696                                UntypedExpr *assign = new UntypedExpr( new NameExpr( "?{}" ) );
    97                                 assign->get_args().push_back( new AddressExpr (new NameExpr( objDecl->get_name() ) ) );
     97                                assign->get_args().push_back( new AddressExpr( new VariableExpr( objDecl ) ) );
    9898                                assign->get_args().push_back( single->get_value()->clone() );
    9999                                stmtsToAddAfter.push_back(new ExprStmt(noLabels, assign));
     
    108108                // hands off if the function returns an lvalue - we don't want to allocate a temporary if a variable's address
    109109                // is being returned
    110                 if ( returnStmt->get_expr() && returnVals.size() == 1 && funcName != "?=?" && ! returnVals.front()->get_type()->get_isLvalue()  ) {
     110                if ( returnStmt->get_expr() && returnVals.size() == 1 && funcName != "?=?" && ! returnVals.front()->get_type()->get_isLvalue() ) {
    111111                        // ensure return value is not destructed by explicitly creating
    112112                        // an empty SingleInit node wherein maybeConstruct is false
     
    116116                        // and explicitly create the constructor expression separately
    117117                        UntypedExpr *construct = new UntypedExpr( new NameExpr( "?{}" ) );
    118                         construct->get_args().push_back( new AddressExpr (new NameExpr( newObj->get_name() ) ) );
     118                        construct->get_args().push_back( new AddressExpr( new VariableExpr( newObj ) ) );
    119119                        construct->get_args().push_back( returnStmt->get_expr() );
    120120                        stmtsToAdd.push_back(new ExprStmt(noLabels, construct));
Note: See TracChangeset for help on using the changeset viewer.