Changeset aee472e for src/Tuples/TupleExpansion.cc
- Timestamp:
- May 17, 2018, 4:37:31 PM (6 years ago)
- 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:
- bfd0a1a
- Parents:
- d20a343
- git-author:
- Rob Schluntz <rschlunt@…> (05/17/18 16:37:16)
- git-committer:
- Rob Schluntz <rschlunt@…> (05/17/18 16:37:31)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Tuples/TupleExpansion.cc
rd20a343 raee472e 30 30 #include "SynTree/Type.h" // for Type, Type::Qualifiers, TupleType 31 31 #include "SynTree/Visitor.h" // for Visitor 32 #include "Tuples.h" 32 33 33 34 class CompoundStmt; … … 128 129 Expression * aggr = memberExpr->aggregate->clone()->acceptMutator( *visitor ); 129 130 // aggregate expressions which might be impure must be wrapped in unique expressions 130 // xxx - if there's a member-tuple expression nested in the aggregate, this currently generates the wrong code if a UniqueExpr is not used, and it's purely an optimization to remove the UniqueExpr 131 // if ( Tuples::maybeImpureIgnoreUnique( memberExpr->get_aggregate() ) ) aggr = new UniqueExpr( aggr ); 132 aggr = new UniqueExpr( aggr ); 131 if ( Tuples::maybeImpureIgnoreUnique( memberExpr->aggregate ) ) aggr = new UniqueExpr( aggr ); 133 132 for ( Expression *& expr : tupleExpr->exprs ) { 134 133 expr = reconstructMemberExpr( expr, aggr, memberExpr->location ); … … 235 234 delete tupleExpr; 236 235 236 if ( TupleExpr * tupleExpr = dynamic_cast< TupleExpr * > ( tuple ) ) { 237 if ( ! maybeImpureIgnoreUnique( tupleExpr ) ) { 238 // optimization: definitely pure tuple expr => can reduce to the only relevant component. 239 assert( tupleExpr->exprs.size() > idx ); 240 Expression *& expr = *std::next(tupleExpr->exprs.begin(), idx); 241 Expression * ret = expr; 242 ret->env = env; 243 expr = nullptr; // remove from list so it can safely be deleted 244 delete tupleExpr; 245 return ret; 246 } 247 } 248 237 249 StructInstType * type = strict_dynamic_cast< StructInstType * >( tuple->result ); 238 250 StructDecl * structDecl = type->baseStruct;
Note: See TracChangeset
for help on using the changeset viewer.