Changeset 540de412 for src/InitTweak
- Timestamp:
- May 2, 2016, 3:09:08 PM (9 years ago)
- 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:
- fbfde843
- Parents:
- d8ba086
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/InitTweak/FixInit.cc
rd8ba086 r540de412 10 10 // Created On : Wed Jan 13 16:29:30 2016 11 11 // Last Modified By : Rob Schluntz 12 // Last Modified On : Fri Apr 29 12:25:40201612 // Last Modified On : Mon May 02 14:57:45 2016 13 13 // Update Count : 30 14 14 // … … 61 61 /// true if type does not need to be copy constructed to ensure correctness 62 62 bool skipCopyConstruct( Type * ); 63 private: 64 TypeSubstitution * env; 63 65 }; 64 66 … … 151 153 // wrap each function call so that it is easy to identify nodes that have to be copy constructed 152 154 ImplicitCopyCtorExpr * expr = new ImplicitCopyCtorExpr( appExpr ); 153 // save a copy of the type substitution onto the new node so that it is easy to find. 155 // save the type substitution onto the new node so that it is easy to find. 156 // Ensure it is not deleted with the ImplicitCopyCtorExpr by removing it before deletion. 154 157 // The substitution is needed to obtain the type of temporary variables so that copy constructor 155 158 // calls can be resolved. Normally this is what PolyMutator is for, but the pass that resolves 156 159 // copy constructor calls must be an Indexer. We could alternatively make a PolyIndexer which 157 // saves the environment, or compute the types of temporaries here, but it's m oresimpler to160 // saves the environment, or compute the types of temporaries here, but it's much simpler to 158 161 // save the environment here, and more cohesive to compute temporary variables and resolve copy 159 162 // constructor calls together. 160 163 assert( env ); 161 expr->set_env( env ->clone());164 expr->set_env( env ); 162 165 return expr; 163 166 } … … 178 181 PRINT( std::cerr << "ResolvingCtorDtor " << untyped << std::endl; ) 179 182 ApplicationExpr * resolved = dynamic_cast< ApplicationExpr * >( ResolvExpr::findVoidExpression( untyped, *this ) ); 183 if ( resolved->get_env() ) { 184 env->add( *resolved->get_env() ); 185 } 180 186 181 187 assert( resolved ); … … 190 196 PRINT( std::cerr << "ResolveCopyCtors: " << impCpCtorExpr << std::endl; ) 191 197 Visitor::visit( impCpCtorExpr ); 198 env = impCpCtorExpr->get_env(); // xxx - maybe we really should just have a PolyIndexer... 192 199 193 200 ApplicationExpr * appExpr = impCpCtorExpr->get_callExpr(); … … 246 253 PRINT( std::cerr << "FixCopyCtors: " << impCpCtorExpr << std::endl; ) 247 254 248 // assert( impCpCtorExpr->get_callExpr()->get_env() );249 255 impCpCtorExpr = dynamic_cast< ImplicitCopyCtorExpr * >( Mutator::mutate( impCpCtorExpr ) ); 250 256 assert( impCpCtorExpr ); … … 278 284 returnDecls.clear(); 279 285 impCpCtorExpr->set_callExpr( NULL ); 286 impCpCtorExpr->set_env( NULL ); 280 287 delete impCpCtorExpr; 281 288 … … 311 318 retExpr = deref; 312 319 } 320 // xxx - might need to set env on retExpr... 321 // retExpr->set_env( env->clone() ); 313 322 return retExpr; 314 323 } else {
Note: See TracChangeset
for help on using the changeset viewer.