Changeset f0121d7 for src/Tuples
- Timestamp:
- Oct 26, 2016, 10:56:46 AM (8 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, resolv-new, with_gc
- Children:
- a1e67dd
- Parents:
- bf32bb8
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified src/Tuples/TupleExpansion.cc ¶
rbf32bb8 rf0121d7 28 28 #include "Common/ScopedMap.h" 29 29 #include "ResolvExpr/typeops.h" 30 #include "InitTweak/GenInit.h" 30 31 31 32 namespace Tuples { … … 133 134 return tupleExpr; 134 135 } else { 135 return memberExpr; 136 // there may be a tuple expr buried in the aggregate 137 // xxx - this is a memory leak 138 return new UntypedMemberExpr( memberExpr->get_member()->clone(), memberExpr->get_aggregate()->acceptMutator( *this ) ); 136 139 } 137 140 } … … 142 145 if ( ! decls.count( unqExpr->get_id() ) ) { 143 146 // xxx - it's possible (likely?) that expressions can appear in the wrong order because of this. Need to ensure they're placed in the correct location. 144 // xxx - is it possible to make the decl's type const? 145 ObjectDecl * decl = new ObjectDecl( tempNamer.newName(), DeclarationNode::NoStorageClass, LinkageSpec::Cforall, nullptr, unqExpr->get_result()->clone(), new SingleInit( unqExpr->get_expr()->clone() ) ); 146 decls[unqExpr->get_id()] = decl; 147 addDeclaration( decl ); 147 148 // xxx - this doesn't work, because it would need to be placed after fixInit, but fixInit doesn't know (and shouldn't have to know) about the existance of UniqueExprs - i.e. it will visit them twice 149 // need to construct/destruct unique exprs in general - maybe it's not worth it and fixInit should handle UniqueExpr explicitly? 150 // currently, tmp is being destructed before unqExpr is used, which suggests there should be a separate lifetime for unqExpr from the tmp_ret 151 152 // if ( CommaExpr * commaExpr = dynamic_cast< CommaExpr * >( unqExpr->get_expr() ) ) { 153 // if ( VariableExpr * varExpr = dynamic_cast< VariableExpr * >( commaExpr->get_arg2() ) ) { 154 // // steal existing decl from expr 155 // if ( ObjectDecl * decl = dynamic_cast< ObjectDecl * >( varExpr->get_var() ) ) { 156 // decls[unqExpr->get_id()] = decl; 157 // return unqExpr->get_expr()->clone(); 158 // } 159 // } 160 // } 161 162 // xxx - attach a resolved ConstructorInit node? 163 // xxx - is it possible to make the objDecl's type const? 164 ObjectDecl * objDecl = new ObjectDecl( tempNamer.newName(), DeclarationNode::NoStorageClass, LinkageSpec::Cforall, nullptr, unqExpr->get_result()->clone(), nullptr ); 165 // must be done on two lines because genCtorInit accesses objDecl's fields 166 objDecl->set_init( InitTweak::genCtorInit( objDecl ) ); 167 168 decls[unqExpr->get_id()] = objDecl; 169 addDeclaration( objDecl ); 148 170 } 149 171 return new VariableExpr( decls[unqExpr->get_id()] );
Note: See TracChangeset
for help on using the changeset viewer.