Changes in src/InitTweak/FixGlobalInit.cc [7b3f66b:f1b1e4c]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/InitTweak/FixGlobalInit.cc
r7b3f66b 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.