Changeset 6f72453
- Timestamp:
- Jul 11, 2016, 5:25:12 PM (8 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:
- 1b8c156, 7d5e243
- Parents:
- c0588909 (diff), 919d1ba (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. - Location:
- src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
src/InitTweak/GenInit.cc
rc0588909 r6f72453 162 162 // but it seems reasonable at the moment for this to be done by makeArrayFunction 163 163 // itself 164 assert( ctor.size() == 1 );165 assert( dtor.size() == 1 );166 objDecl->set_init( new ConstructorInit( new ImplicitCtorDtorStmt( ctor.front() ), new ImplicitCtorDtorStmt( dtor.front()), objDecl->get_init() ) );164 assert( ctor.size() == 1 && dynamic_cast< ImplicitCtorDtorStmt * >( ctor.front() ) ); 165 assert( dtor.size() == 1 && dynamic_cast< ImplicitCtorDtorStmt * >( dtor.front() ) ); 166 objDecl->set_init( new ConstructorInit( ctor.front(), dtor.front(), objDecl->get_init() ) ); 167 167 } else { 168 168 // array came with an initializer list: initialize each element -
src/InitTweak/InitTweak.cc
rc0588909 r6f72453 66 66 } else if ( CompoundStmt * compoundStmt = dynamic_cast< CompoundStmt * >( stmt ) ) { 67 67 // could also be a compound statement with a loop, in the case of an array 68 assert( compoundStmt->get_kids().size() == 2 ); // loop variable and loop 69 ForStmt * forStmt = dynamic_cast< ForStmt * >( compoundStmt->get_kids().back() ); 70 assert( forStmt && forStmt->get_body() ); 71 return getCtorDtorCall( forStmt->get_body() ); 68 if( compoundStmt->get_kids().size() == 2 ) { 69 // loop variable and loop 70 ForStmt * forStmt = dynamic_cast< ForStmt * >( compoundStmt->get_kids().back() ); 71 assert( forStmt && forStmt->get_body() ); 72 return getCtorDtorCall( forStmt->get_body() ); 73 } else if ( compoundStmt->get_kids().size() == 1 ) { 74 // should be the call statement, but in any case there's only one option 75 return getCtorDtorCall( compoundStmt->get_kids().front() ); 76 } else { 77 assert( false && "too many statements in compoundStmt for getCtorDtorCall" ); 78 } 72 79 } if ( ImplicitCtorDtorStmt * impCtorDtorStmt = dynamic_cast< ImplicitCtorDtorStmt * > ( stmt ) ) { 73 80 return getCtorDtorCall( impCtorDtorStmt->get_callStmt() ); -
src/ResolvExpr/Resolver.cc
rc0588909 r6f72453 550 550 // get Variable <array>, then get the base type of the VariableExpr - this is the type that needs to be fixed 551 551 Expression * arr = InitTweak::getCallArg( plusExpr, 0 ); 552 assert( dynamic_cast< VariableExpr * >( arr ) );552 assert( dynamic_cast< VariableExpr * >( arr ) || dynamic_cast< MemberExpr *>( arr ) ); 553 553 assert( arr && arr->get_results().size() == 1 ); 554 554 type = arr->get_results().front()->clone(); … … 559 559 assert( constructee->get_results().size() == 1 ); 560 560 AddressExpr * addrExpr = dynamic_cast< AddressExpr * > ( constructee ); 561 assert( addrExpr && addrExpr->get_results().size() == 1 );561 assert( addrExpr && addrExpr->get_results().size() == 1 ); 562 562 type = addrExpr->get_results().front()->clone(); 563 563 } -
src/SymTab/Autogen.cc
rc0588909 r6f72453 84 84 } 85 85 86 *out++ = new ExprStmt( noLabels, fExpr ); 86 Statement * callStmt = new ExprStmt( noLabels, fExpr ); 87 if ( (fname == "?{}" || fname == "^?{}") && ( !obj || ( obj && obj->get_bitfieldWidth() == NULL ) ) ) { 88 // implicitly generated ctor/dtor calls should be wrapped 89 // so that later passes are aware they were generated. 90 // xxx - don't mark as an implicit ctor/dtor if obj is a bitfield, 91 // because this causes the address to be taken at codegen, which is illegal in C. 92 callStmt = new ImplicitCtorDtorStmt( callStmt ); 93 } 94 *out++ = callStmt; 87 95 } 88 96 … … 244 252 } 245 253 246 if ( type->get_qualifiers().isConst ) {247 // don't assign const members 254 if ( type->get_qualifiers().isConst && func->get_name() == "?=?" ) { 255 // don't assign const members, but do construct/destruct 248 256 continue; 249 257 } -
src/SymTab/Autogen.h
rc0588909 r6f72453 91 91 block->get_kids().push_back( new DeclStmt( noLabels, index ) ); 92 92 block->get_kids().push_back( new ForStmt( noLabels, initList, cond, inc, new ExprStmt( noLabels, fExpr ) ) ); 93 *out++ = block; 93 94 Statement * stmt = block; 95 if ( fname == "?{}" || fname == "^?{}" ) { 96 // implicitly generated ctor/dtor calls should be wrapped 97 // so that later passes are aware they were generated 98 stmt = new ImplicitCtorDtorStmt( stmt ); 99 } 100 *out++ = stmt; 94 101 } 95 102 } // namespace SymTab -
src/tests/.expect/extension.txt
rc0588909 r6f72453 20 20 } 21 21 static inline void ___constructor__F_P2sS_autogen___1(struct S *___dst__P2sS_1){ 22 ((void)((* ___dst__P2sS_1).__a__i_1) /* ?{} */);23 ((void)((* ___dst__P2sS_1).__b__i_1) /* ?{} */);24 ((void)((* ___dst__P2sS_1).__c__i_1) /* ?{} */);22 ((void)((*((int *)(&(*___dst__P2sS_1).__a__i_1)))) /* ?{} */); 23 ((void)((*((int *)(&(*___dst__P2sS_1).__b__i_1)))) /* ?{} */); 24 ((void)((*((int *)(&(*___dst__P2sS_1).__c__i_1)))) /* ?{} */); 25 25 } 26 26 static inline void ___constructor__F_P2sS2sS_autogen___1(struct S *___dst__P2sS_1, struct S ___src__2sS_1){ 27 ((void)((* ___dst__P2sS_1).__a__i_1=___src__2sS_1.__a__i_1) /* ?{} */);28 ((void)((* ___dst__P2sS_1).__b__i_1=___src__2sS_1.__b__i_1) /* ?{} */);29 ((void)((* ___dst__P2sS_1).__c__i_1=___src__2sS_1.__c__i_1) /* ?{} */);27 ((void)((*((int *)(&(*___dst__P2sS_1).__a__i_1)))=___src__2sS_1.__a__i_1) /* ?{} */); 28 ((void)((*((int *)(&(*___dst__P2sS_1).__b__i_1)))=___src__2sS_1.__b__i_1) /* ?{} */); 29 ((void)((*((int *)(&(*___dst__P2sS_1).__c__i_1)))=___src__2sS_1.__c__i_1) /* ?{} */); 30 30 } 31 31 static inline void ___destructor__F_P2sS_autogen___1(struct S *___dst__P2sS_1){ 32 ((void)((* ___dst__P2sS_1).__c__i_1) /* ^?{} */);33 ((void)((* ___dst__P2sS_1).__b__i_1) /* ^?{} */);34 ((void)((* ___dst__P2sS_1).__a__i_1) /* ^?{} */);32 ((void)((*((int *)(&(*___dst__P2sS_1).__c__i_1)))) /* ^?{} */); 33 ((void)((*((int *)(&(*___dst__P2sS_1).__b__i_1)))) /* ^?{} */); 34 ((void)((*((int *)(&(*___dst__P2sS_1).__a__i_1)))) /* ^?{} */); 35 35 } 36 36 static inline void ___constructor__F_P2sSi_autogen___1(struct S *___dst__P2sS_1, int __a__i_1){ 37 ((void)((* ___dst__P2sS_1).__a__i_1=__a__i_1) /* ?{} */);38 ((void)((* ___dst__P2sS_1).__b__i_1) /* ?{} */);39 ((void)((* ___dst__P2sS_1).__c__i_1) /* ?{} */);37 ((void)((*((int *)(&(*___dst__P2sS_1).__a__i_1)))=__a__i_1) /* ?{} */); 38 ((void)((*((int *)(&(*___dst__P2sS_1).__b__i_1)))) /* ?{} */); 39 ((void)((*((int *)(&(*___dst__P2sS_1).__c__i_1)))) /* ?{} */); 40 40 } 41 41 static inline void ___constructor__F_P2sSii_autogen___1(struct S *___dst__P2sS_1, int __a__i_1, int __b__i_1){ 42 ((void)((* ___dst__P2sS_1).__a__i_1=__a__i_1) /* ?{} */);43 ((void)((* ___dst__P2sS_1).__b__i_1=__b__i_1) /* ?{} */);44 ((void)((* ___dst__P2sS_1).__c__i_1) /* ?{} */);42 ((void)((*((int *)(&(*___dst__P2sS_1).__a__i_1)))=__a__i_1) /* ?{} */); 43 ((void)((*((int *)(&(*___dst__P2sS_1).__b__i_1)))=__b__i_1) /* ?{} */); 44 ((void)((*((int *)(&(*___dst__P2sS_1).__c__i_1)))) /* ?{} */); 45 45 } 46 46 static inline void ___constructor__F_P2sSiii_autogen___1(struct S *___dst__P2sS_1, int __a__i_1, int __b__i_1, int __c__i_1){ 47 ((void)((* ___dst__P2sS_1).__a__i_1=__a__i_1) /* ?{} */);48 ((void)((* ___dst__P2sS_1).__b__i_1=__b__i_1) /* ?{} */);49 ((void)((* ___dst__P2sS_1).__c__i_1=__c__i_1) /* ?{} */);47 ((void)((*((int *)(&(*___dst__P2sS_1).__a__i_1)))=__a__i_1) /* ?{} */); 48 ((void)((*((int *)(&(*___dst__P2sS_1).__b__i_1)))=__b__i_1) /* ?{} */); 49 ((void)((*((int *)(&(*___dst__P2sS_1).__c__i_1)))=__c__i_1) /* ?{} */); 50 50 } 51 51 __extension__ union U {
Note: See TracChangeset
for help on using the changeset viewer.