Changeset 620cb95 for src/InitTweak
- Timestamp:
- Mar 3, 2016, 4:50:48 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:
- 972e6f7
- Parents:
- 071a31a
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/InitTweak/RemoveInit.cc
r071a31a r620cb95 23 23 #include "SynTree/Initializer.h" 24 24 #include "SynTree/Mutator.h" 25 #include "SymTab/Autogen.h" 25 26 #include "GenPoly/PolyMutator.h" 26 27 … … 194 195 if ( ArrayType * at = dynamic_cast< ArrayType * >( objDecl->get_type() ) ) { 195 196 // call into makeArrayFunction from validate.cc to generate calls to ctor/dtor for each element of array 197 // TODO: walk initializer and generate appropriate copy ctor if element has initializer 198 SymTab::makeArrayFunction( NULL, new VariableExpr( objDecl ), at, "?{}", back_inserter( stmtsToAddAfter ) ); 199 SymTab::makeArrayFunction( NULL, new VariableExpr( objDecl ), at, "^?{}", front_inserter( destructorStmts ), false ); 196 200 } else { 197 201 // it's sufficient to attempt to call the ctor/dtor for the given object and its initializer … … 228 232 229 233 CompoundStmt * CtorDtor::mutate( CompoundStmt * compoundStmt ) { 234 // don't want to dump all destructors when block is left, 235 // just the destructors associated with variables defined in this block 236 std::list< Statement * > oldDestructorStmts = destructorStmts; 237 destructorStmts = std::list<Statement *>(); 238 230 239 CompoundStmt * ret = PolyMutator::mutate( compoundStmt ); 231 240 std::list< Statement * > &statements = ret->get_kids(); … … 235 244 statements.splice( statements.end(), destructorStmts ); 236 245 } // if 246 247 destructorStmts = oldDestructorStmts; 237 248 return ret; 238 249 }
Note: See TracChangeset
for help on using the changeset viewer.