Changeset 2be1023 for src/InitTweak
- Timestamp:
- Jul 18, 2016, 4:13:51 PM (9 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, 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:
- 5f98ce5
- Parents:
- 956a9c77
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/InitTweak/GenInit.cc
r956a9c77 r2be1023 145 145 if ( ArrayType * at = dynamic_cast< ArrayType * >( objDecl->get_type() ) ) { 146 146 // call into makeArrayFunction from validate.cc to generate calls to ctor/dtor for each element of array 147 // TODO: walk initializer and generate appropriate copy ctor if element has initializer 147 // TODO: walk initializers and generate appropriate ctor if element has initializer. 148 // Initializer could be nested (depends on the depth of the array type on the object) 149 148 150 std::list< Expression * > args = makeInitList( objDecl->get_init() ); 149 151 if ( args.empty() ) { … … 151 153 std::list< Statement * > dtor; 152 154 153 SymTab:: makeArrayFunction( NULL, new VariableExpr( objDecl ), at, "?{}", back_inserter( ctor ));154 SymTab:: makeArrayFunction( NULL, new VariableExpr( objDecl ), at, "^?{}", front_inserter( dtor ), false );155 156 // Currently makeArrayFunctionproduces a single Statement - a CompoundStmt155 SymTab::genImplicitCall( NULL, new VariableExpr( objDecl ), "?{}", back_inserter( ctor ), objDecl ); 156 SymTab::genImplicitCall( NULL, new VariableExpr( objDecl ), "^?{}", front_inserter( dtor ), objDecl, false ); 157 158 // Currently genArrayCall produces a single Statement - a CompoundStmt 157 159 // which wraps everything that needs to happen. As such, it's technically 158 160 // possible to use a Statement ** in the above calls, but this is inherently … … 160 162 // immediately informed if somehow the above assumption is broken. In this case, 161 163 // we could always wrap the list of statements at this point with a CompoundStmt, 162 // but it seems reasonable at the moment for this to be done by makeArrayFunction164 // but it seems reasonable at the moment for this to be done by genArrayCall 163 165 // itself 164 166 assert( ctor.size() == 1 && dynamic_cast< ImplicitCtorDtorStmt * >( ctor.front() ) ); … … 170 172 // we haven't exceeded size. This requires precomputing the size because it might be a side-effecting 171 173 // computation. 172 // may have fewer initializers than ele emnts in the array - need to default construct174 // may have fewer initializers than elements in the array - need to default construct 173 175 // remaining elements. 174 176 // might be able to merge this with the case above. 177 175 178 } 176 179 } else {
Note:
See TracChangeset
for help on using the changeset viewer.