Changeset 10dc6908 for src/InitTweak
- Timestamp:
- Nov 13, 2017, 10:38:12 AM (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:
- 9d06142
- Parents:
- 20eacb7
- git-author:
- Rob Schluntz <rschlunt@…> (11/13/17 10:38:05)
- git-committer:
- Rob Schluntz <rschlunt@…> (11/13/17 10:38:12)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/InitTweak/FixInit.cc
r20eacb7 r10dc6908 1055 1055 // function->get_statements()->push_back( callStmt ); 1056 1056 1057 // Destructor _dtor0 = { &b.a1, _destroy_A };1057 // Destructor _dtor0 = { &b.a1, (void (*)(void *)_destroy_A }; 1058 1058 std::list< Statement * > stmtsToAdd; 1059 1059 … … 1065 1065 Expression * dtorExpr = new VariableExpr( getDtorFunc( thisParam, callStmt, stmtsToAdd ) ); 1066 1066 1067 ObjectDecl * destructor = ObjectDecl::newObject( memberDtorNamer.newName(), new StructInstType( Type::Qualifiers(), dtorStruct ), new ListInit( { new SingleInit( thisExpr ), new SingleInit( dtorExpr ) } ) ); 1067 // cast destructor pointer to void (*)(void *), to silence GCC incompatible pointer warnings 1068 FunctionType * dtorFtype = new FunctionType( Type::Qualifiers(), false ); 1069 dtorFtype->parameters.push_back( ObjectDecl::newObject( "", new PointerType( Type::Qualifiers(), new VoidType( Type::Qualifiers() ) ), nullptr ) ); 1070 Type * dtorType = new PointerType( Type::Qualifiers(), dtorFtype ); 1071 1072 ObjectDecl * destructor = ObjectDecl::newObject( memberDtorNamer.newName(), new StructInstType( Type::Qualifiers(), dtorStruct ), new ListInit( { new SingleInit( thisExpr ), new SingleInit( new CastExpr( dtorExpr, dtorType ) ) } ) ); 1068 1073 function->statements->push_front( new DeclStmt( noLabels, destructor ) ); 1069 1074 destructor->attributes.push_back( new Attribute( "cleanup", { new VariableExpr( dtorStructDestroy ) } ) );
Note: See TracChangeset
for help on using the changeset viewer.