Changeset b617e4b


Ignore:
Timestamp:
Apr 14, 2016, 5:33:37 PM (6 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
aaron-thesis, arm-eh, cleanup-dtors, ctor, deferred_resn, demangler, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, resolv-new, with_gc
Children:
dc2e7e0
Parents:
356189a
Message:

ensure temporaries created for copy construction are not const

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/InitTweak/FixInit.cc

    r356189a rb617e4b  
    1010// Created On       : Wed Jan 13 16:29:30 2016
    1111// Last Modified By : Rob Schluntz
    12 // Last Modified On : Thu Apr 14 15:19:11 2016
     12// Last Modified On : Thu Apr 14 17:29:21 2016
    1313// Update Count     : 30
    1414//
     
    152152
    153153                // resolve function call
    154                 Expression * newExpr = ResolvExpr::findVoidExpression( impCpCtorExpr->get_callExpr(), *this );
     154                ApplicationExpr * appExpr = dynamic_cast< ApplicationExpr * >( ResolvExpr::findVoidExpression( impCpCtorExpr->get_callExpr(), *this ) );
     155                assert( appExpr );
    155156                delete impCpCtorExpr->get_callExpr();
    156                 ApplicationExpr * appExpr = dynamic_cast< ApplicationExpr * >( newExpr );
    157                 assert( appExpr );
    158157                impCpCtorExpr->set_callExpr( appExpr );
     158
     159                // Visitor::visit( impCpCtorExpr );
    159160
    160161                // take each argument and attempt to copy construct it.
     
    163164                        assert( ! arg->get_results().empty() );
    164165                        ObjectDecl * tmp = new ObjectDecl( tempNamer.newName(), DeclarationNode::NoStorageClass, LinkageSpec::C, 0, arg->get_results().front()->clone(), 0 );
     166                        tmp->get_type()->set_isConst( false );
    165167
    166168                        // create and resolve copy constructor
     
    186188                for ( Type * result : appExpr->get_results() ) {
    187189                        ObjectDecl * ret = new ObjectDecl( retNamer.newName(), DeclarationNode::NoStorageClass, LinkageSpec::C, 0, result->clone(), new SingleInit( impCpCtorExpr->get_callExpr() ) );
     190                        ret->get_type()->set_isConst( false );
    188191                        impCpCtorExpr->get_returnDecls().push_back( ret );
    189192                        impCpCtorExpr->get_dtors().push_front( makeCtorDtor( "^?{}", ret ) );
     
    195198                impCpCtorExpr = dynamic_cast< ImplicitCopyCtorExpr * >( Mutator::mutate( impCpCtorExpr ) );
    196199                assert( impCpCtorExpr );
    197                 std::cerr << "Running FixCopyCtors on implicit copy ctor..." << std::endl;
    198200
    199201                std::list< Expression * > & copyCtors = impCpCtorExpr->get_copyCtors();
Note: See TracChangeset for help on using the changeset viewer.