Changeset f1b1e4c for src/InitTweak/FixGlobalInit.cc
- Timestamp:
- Jun 1, 2016, 11:54:23 AM (8 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:
- be945ac
- Parents:
- 70f89d00
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/InitTweak/FixGlobalInit.cc
r70f89d00 rf1b1e4c 125 125 std::list< Statement * > & destroyStatements = destroyFunction->get_statements()->get_kids(); 126 126 127 // if ( objDecl->get_init() == NULL ) return;128 127 if ( ! tryConstruct( objDecl ) ) return; // don't construct @= or designated objects 129 if ( objDecl->get_type()->get_isConst() ) return; // temporary: can't assign to a const variable130 128 if ( objDecl->get_storageClass() == DeclarationNode::Extern ) return; 131 129 // C allows you to initialize objects with constant expressions … … 146 144 init->get_args().push_back( new AddressExpr( new VariableExpr( objDecl ) ) ); 147 145 init->get_args().push_back( new VariableExpr( newObj ) ); 148 initStatements.push_back( new ExprStmt( noLabels, init) );146 initStatements.push_back( new ImplicitCtorDtorStmt( new ExprStmt( noLabels, init ) ) ); 149 147 150 148 // add destructor calls to global destroy function 151 149 UntypedExpr * destroy = new UntypedExpr( new NameExpr( "^?{}" ) ); 152 150 destroy->get_args().push_back( new AddressExpr( new VariableExpr( objDecl ) ) ); 153 destroyStatements.push_front( new ExprStmt( noLabels, destroy) );151 destroyStatements.push_front( new ImplicitCtorDtorStmt( new ExprStmt( noLabels, destroy ) ) ); 154 152 } 155 153 }
Note: See TracChangeset
for help on using the changeset viewer.