Changeset 071a31a for src/InitTweak
- Timestamp:
- Mar 3, 2016, 2:45:51 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:
- 620cb95
- Parents:
- c14cff1
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/InitTweak/RemoveInit.cc
rc14cff1 r071a31a 192 192 if ( tryConstruct( objDecl ) ) { 193 193 if ( inFunction ) { 194 Expression * ctor = makeCtorDtorExpr( "?{}", objDecl, makeInitList( objDecl->get_init() ) ); 195 Expression * dtor = makeCtorDtorExpr( "^?{}", objDecl, std::list< Expression * >() ); 196 197 // need to remember init expression, in case no ctors exist 198 // if ctor does exist, want to use ctor expression instead of init 199 // push this decision to the resolver 200 objDecl->set_init( new ConstructorInit( ctor, objDecl->get_init() ) ); 201 destructorStmts.push_front( new ExprStmt( noLabels, dtor ) ); 194 if ( ArrayType * at = dynamic_cast< ArrayType * >( objDecl->get_type() ) ) { 195 // call into makeArrayFunction from validate.cc to generate calls to ctor/dtor for each element of array 196 } else { 197 // it's sufficient to attempt to call the ctor/dtor for the given object and its initializer 198 Expression * ctor = makeCtorDtorExpr( "?{}", objDecl, makeInitList( objDecl->get_init() ) ); 199 Expression * dtor = makeCtorDtorExpr( "^?{}", objDecl, std::list< Expression * >() ); 200 201 // need to remember init expression, in case no ctors exist 202 // if ctor does exist, want to use ctor expression instead of init 203 // push this decision to the resolver 204 objDecl->set_init( new ConstructorInit( ctor, objDecl->get_init() ) ); 205 destructorStmts.push_front( new ExprStmt( noLabels, dtor ) ); 206 } 202 207 } else { 203 208 // xxx - find a way to construct/destruct globals 204 209 // hack: implicit "static" initialization routine for each struct type? or something similar? 205 210 // --ties into module system 211 // this can be done by mangling main and replacing it with our own main which calls each 212 // module initialization routine in some decided order (order given in link command?) 213 // and finally calls mangled main 206 214 } 207 215 }
Note: See TracChangeset
for help on using the changeset viewer.