Ignore:
Timestamp:
Apr 14, 2016, 3:22:42 PM (10 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:
70a06f6
Parents:
7eabc25
Message:

add ImplicitCopyCtorExpr node, implicit copy constructors are inserted into the right places (but there is room for elision)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/Expression.cc

    r7eabc25 rdb4ecc5  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Rob Schluntz
    12 // Last Modified On : Wed Dec 09 14:10:29 2015
     12// Last Modified On : Thu Apr 14 13:02:28 2016
    1313// Update Count     : 34
    1414//
     
    7878
    7979VariableExpr::VariableExpr( DeclarationWithType *_var, Expression *_aname ) : Expression( _aname ), var( _var ) {
     80        assert( var );
     81        assert( var->get_type() );
    8082        add_result( var->get_type()->clone() );
    8183        for ( std::list< Type* >::iterator i = get_results().begin(); i != get_results().end(); ++i ) {
     
    432434}
    433435
     436
     437ImplicitCopyCtorExpr::ImplicitCopyCtorExpr( ApplicationExpr * callExpr ) : callExpr( callExpr ) {
     438        assert( callExpr );
     439        cloneAll( callExpr->get_results(), results );
     440}
     441
     442ImplicitCopyCtorExpr::ImplicitCopyCtorExpr( const ImplicitCopyCtorExpr & other ) : Expression( other ), callExpr( maybeClone( other.callExpr ) ) {
     443        cloneAll( other.results, results );
     444        cloneAll( other.copyCtors, copyCtors );
     445        cloneAll( other.tempDecls, tempDecls );
     446        cloneAll( other.returnDecls, returnDecls );
     447        cloneAll( other.dtors, dtors );
     448}
     449
     450ImplicitCopyCtorExpr::~ImplicitCopyCtorExpr() {
     451        delete callExpr;
     452        deleteAll( copyCtors );
     453        deleteAll( tempDecls );
     454        deleteAll( returnDecls );
     455        deleteAll( dtors );
     456}
     457
     458void ImplicitCopyCtorExpr::print( std::ostream &os, int indent ) const {
     459        os << std::string( indent, ' ' ) <<  "Implicit Copy Constructor Expression: " << std::endl;
     460        assert( callExpr );
     461        callExpr->print( os, indent + 2 );
     462        os << std::endl << std::string( indent, ' ' ) << "with temporaries:" << std::endl;
     463        printAll(tempDecls, os, indent+2);
     464        os << std::endl << std::string( indent, ' ' ) << "with copyCtors:" << std::endl;
     465        printAll(copyCtors, os, indent+2);
     466        Expression::print( os, indent );
     467}
     468
    434469UntypedValofExpr::UntypedValofExpr( const UntypedValofExpr & other ) : Expression( other ), body ( maybeClone( other.body ) ) {}
    435470
Note: See TracChangeset for help on using the changeset viewer.