Ignore:
Timestamp:
Dec 14, 2016, 2:23:11 PM (5 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
aaron-thesis, arm-eh, cleanup-dtors, deferred_resn, demangler, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, resolv-new, with_gc
Children:
1486116
Parents:
1aa4b71
Message:

ensure that unique address expressions are not exploded twice

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Tuples/Explode.cc

    r1aa4b71 ra64644c  
    2323                        Expression * applyAddr( Expression * expr, bool first = true ) {
    2424                                if ( TupleExpr * tupleExpr = dynamic_cast< TupleExpr * >( expr ) ){
     25                                        foundUniqueExpr = true;
    2526                                        std::list< Expression * > exprs;
    2627                                        for ( Expression *& expr : tupleExpr->get_exprs() ) {
     
    4647                                // should now be a tuple of addresses rather than the address of a tuple.
    4748                                // Still, this code is a bit awkward, and could use some improvement.
    48                                 foundUniqueExpr = true;
     49                                if ( dynamic_cast< AddressExpr * > ( uniqueExpr->get_expr() ) ) {
     50                                        // this unique expression has already been mutated or otherwise shouldn't be (can't take the address-of an address-of expression)
     51                                        return uniqueExpr;
     52                                }
    4953                                UniqueExpr * newUniqueExpr = new UniqueExpr( applyAddr( uniqueExpr->get_expr() ), uniqueExpr->get_id() );
    5054                                delete uniqueExpr;
Note: See TracChangeset for help on using the changeset viewer.