Changes in src/InitTweak/FixGlobalInit.cc [f1b1e4c:7b3f66b]
- File:
-
- 1 edited
-
src/InitTweak/FixGlobalInit.cc (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/InitTweak/FixGlobalInit.cc
rf1b1e4c r7b3f66b 125 125 std::list< Statement * > & destroyStatements = destroyFunction->get_statements()->get_kids(); 126 126 127 // if ( objDecl->get_init() == NULL ) return; 127 128 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 variable 128 130 if ( objDecl->get_storageClass() == DeclarationNode::Extern ) return; 129 131 // C allows you to initialize objects with constant expressions … … 144 146 init->get_args().push_back( new AddressExpr( new VariableExpr( objDecl ) ) ); 145 147 init->get_args().push_back( new VariableExpr( newObj ) ); 146 initStatements.push_back( new ImplicitCtorDtorStmt( new ExprStmt( noLabels, init )) );148 initStatements.push_back( new ExprStmt( noLabels, init ) ); 147 149 148 150 // add destructor calls to global destroy function 149 151 UntypedExpr * destroy = new UntypedExpr( new NameExpr( "^?{}" ) ); 150 152 destroy->get_args().push_back( new AddressExpr( new VariableExpr( objDecl ) ) ); 151 destroyStatements.push_front( new ImplicitCtorDtorStmt( new ExprStmt( noLabels, destroy )) );153 destroyStatements.push_front( new ExprStmt( noLabels, destroy ) ); 152 154 } 153 155 }
Note:
See TracChangeset
for help on using the changeset viewer.