Changeset 136ccd7 for src/InitTweak/FixInit.cc
- Timestamp:
- Nov 3, 2017, 3:01:31 PM (7 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, cleanup-dtors, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 4ee36bf0
- Parents:
- 4ee1efb (diff), 760ba67 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/InitTweak/FixInit.cc
r4ee1efb r136ccd7 504 504 } 505 505 506 // to prevent warnings (‘_unq0’ may be used uninitialized in this function), 507 // insert an appropriate zero initializer for UniqueExpr temporaries. 508 Initializer * makeInit( Type * t ) { 509 if ( StructInstType * inst = dynamic_cast< StructInstType * >( t ) ) { 510 // initizer for empty struct must be empty 511 if ( inst->baseStruct->members.empty() ) return new ListInit({}); 512 } else if ( UnionInstType * inst = dynamic_cast< UnionInstType * >( t ) ) { 513 // initizer for empty union must be empty 514 if ( inst->baseUnion->members.empty() ) return new ListInit({}); 515 } 516 517 return new ListInit( { new SingleInit( new ConstantExpr( Constant::from_int( 0 ) ) ) } ); 518 } 519 506 520 void ResolveCopyCtors::postvisit( UniqueExpr * unqExpr ) { 507 521 if ( vars.count( unqExpr->get_id() ) ) { … … 518 532 } else { 519 533 // expr isn't a call expr, so create a new temporary variable to use to hold the value of the unique expression 520 unqExpr->set_object( ObjectDecl::newObject( toString("_unq", unqExpr->get_id()), unqExpr->get_result()->clone(), nullptr) );534 unqExpr->set_object( ObjectDecl::newObject( toString("_unq", unqExpr->get_id()), unqExpr->get_result()->clone(), makeInit( unqExpr->get_result() ) ) ); 521 535 unqExpr->set_var( new VariableExpr( unqExpr->get_object() ) ); 522 536 }
Note: See TracChangeset
for help on using the changeset viewer.