Changes in src/InitTweak/FixInit.cc [ddae809:e41306d]
- File:
-
- 1 edited
-
src/InitTweak/FixInit.cc (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/InitTweak/FixInit.cc
rddae809 re41306d 501 501 } 502 502 503 // to prevent warnings (‘_unq0’ may be used uninitialized in this function),504 // insert an appropriate zero initializer for UniqueExpr temporaries.505 Initializer * makeInit( Type * t ) {506 if ( StructInstType * inst = dynamic_cast< StructInstType * >( t ) ) {507 // initizer for empty struct must be empty508 if ( inst->baseStruct->members.empty() ) return new ListInit({});509 } else if ( UnionInstType * inst = dynamic_cast< UnionInstType * >( t ) ) {510 // initizer for empty union must be empty511 if ( inst->baseUnion->members.empty() ) return new ListInit({});512 }513 514 return new ListInit( { new SingleInit( new ConstantExpr( Constant::from_int( 0 ) ) ) } );515 }516 517 503 void ResolveCopyCtors::postvisit( UniqueExpr * unqExpr ) { 518 504 if ( vars.count( unqExpr->get_id() ) ) { … … 529 515 } else { 530 516 // expr isn't a call expr, so create a new temporary variable to use to hold the value of the unique expression 531 unqExpr->set_object( ObjectDecl::newObject( toString("_unq", unqExpr->get_id()), unqExpr->get_result()->clone(), makeInit( unqExpr->get_result() )) );517 unqExpr->set_object( ObjectDecl::newObject( toString("_unq", unqExpr->get_id()), unqExpr->get_result()->clone(), nullptr ) ); 532 518 unqExpr->set_var( new VariableExpr( unqExpr->get_object() ) ); 533 519 }
Note:
See TracChangeset
for help on using the changeset viewer.