Changeset e6d39fe for src/ResolvExpr


Ignore:
Timestamp:
Apr 20, 2018, 9:04:41 AM (6 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, 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, with_gc
Children:
22bdc34
Parents:
9181f1d (diff), 88f15ae (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/AlternativeFinder.cc

    r9181f1d re6d39fe  
    12471247        }
    12481248
    1249         Expression * restructureCast( Expression * argExpr, Type * toType ) {
     1249        Expression * restructureCast( Expression * argExpr, Type * toType, bool isGenerated ) {
    12501250                if ( argExpr->get_result()->size() > 1 && ! toType->isVoid() && ! dynamic_cast<ReferenceType *>( toType ) ) {
    12511251                        // Argument expression is a tuple and the target type is not void and not a reference type.
     
    12621262                                // cast each component
    12631263                                TupleIndexExpr * idx = new TupleIndexExpr( argExpr->clone(), i );
    1264                                 componentExprs.push_back( restructureCast( idx, toType->getComponent( i ) ) );
     1264                                componentExprs.push_back( restructureCast( idx, toType->getComponent( i ), isGenerated ) );
    12651265                        }
    12661266                        delete argExpr;
     
    12701270                } else {
    12711271                        // handle normally
    1272                         return new CastExpr( argExpr, toType->clone() );
     1272                        CastExpr * ret = new CastExpr( argExpr, toType->clone() );
     1273                        ret->isGenerated = isGenerated;
     1274                        return ret;
    12731275                }
    12741276        }
     
    13141316                                // count one safe conversion for each value that is thrown away
    13151317                                thisCost.incSafe( discardedValues );
    1316                                 Alternative newAlt( restructureCast( alt.expr->clone(), toType ), alt.env,
     1318                                Alternative newAlt( restructureCast( alt.expr->clone(), toType, castExpr->isGenerated ), alt.env,
    13171319                                        alt.cost, thisCost );
    13181320                                inferParameters( needAssertions, haveAssertions, newAlt, openVars,
     
    17301732                                        // count one safe conversion for each value that is thrown away
    17311733                                        thisCost.incSafe( discardedValues );
    1732                                         Alternative newAlt( new InitExpr( restructureCast( alt.expr->clone(), toType ), initAlt.designation->clone() ), newEnv, alt.cost, thisCost );
     1734                                        Alternative newAlt( new InitExpr( restructureCast( alt.expr->clone(), toType, true ), initAlt.designation->clone() ), newEnv, alt.cost, thisCost );
    17331735                                        inferParameters( needAssertions, haveAssertions, newAlt, openVars, back_inserter( candidates ) );
    17341736                                }
Note: See TracChangeset for help on using the changeset viewer.