Changes in / [919d1ba:deefdc1]


Ignore:
Location:
src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • src/InitTweak/GenInit.cc

    r919d1ba rdeefdc1  
    162162                                                // but it seems reasonable at the moment for this to be done by makeArrayFunction
    163163                                                // itself
    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() ) );
     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() ) );
    167167                                        } else {
    168168                                                // array came with an initializer list: initialize each element
  • src/InitTweak/InitTweak.cc

    r919d1ba rdeefdc1  
    6666                } else if ( CompoundStmt * compoundStmt = dynamic_cast< CompoundStmt * >( stmt ) ) {
    6767                        // could also be a compound statement with a loop, in the case of an array
    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                         }
     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() );
    7972                } if ( ImplicitCtorDtorStmt * impCtorDtorStmt = dynamic_cast< ImplicitCtorDtorStmt * > ( stmt ) ) {
    8073                        return getCtorDtorCall( impCtorDtorStmt->get_callStmt() );
  • src/ResolvExpr/Resolver.cc

    r919d1ba rdeefdc1  
    550550                        // get Variable <array>, then get the base type of the VariableExpr - this is the type that needs to be fixed
    551551                        Expression * arr = InitTweak::getCallArg( plusExpr, 0 );
    552                         assert( dynamic_cast< VariableExpr * >( arr ) || dynamic_cast< MemberExpr *>( arr ) );
     552                        assert( dynamic_cast< VariableExpr * >( arr ) );
    553553                        assert( arr && arr->get_results().size() == 1 );
    554554                        type = arr->get_results().front()->clone();
     
    559559                        assert( constructee->get_results().size() == 1 );
    560560                        AddressExpr * addrExpr = dynamic_cast< AddressExpr * > ( constructee );
    561                         assert( addrExpr && addrExpr->get_results().size() == 1 );
     561                        assert( addrExpr && addrExpr->get_results().size() == 1);
    562562                        type = addrExpr->get_results().front()->clone();
    563563                }
  • src/SymTab/Autogen.cc

    r919d1ba rdeefdc1  
    8484                }
    8585
    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;
     86                *out++ = new ExprStmt( noLabels, fExpr );
    9587        }
    9688
     
    252244                                }
    253245
    254                                 if ( type->get_qualifiers().isConst && func->get_name() == "?=?" ) {
    255                                         // don't assign const members, but do construct/destruct
     246                                if ( type->get_qualifiers().isConst ) {
     247                                        // don't assign const members
    256248                                        continue;
    257249                                }
  • src/SymTab/Autogen.h

    r919d1ba rdeefdc1  
    9191    block->get_kids().push_back( new DeclStmt( noLabels, index ) );
    9292    block->get_kids().push_back( new ForStmt( noLabels, initList, cond, inc, new ExprStmt( noLabels, fExpr ) ) );
    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;
     93    *out++ = block;
    10194  }
    10295} // namespace SymTab
  • src/tests/.expect/extension.txt

    r919d1ba rdeefdc1  
    2020}
    2121static inline void ___constructor__F_P2sS_autogen___1(struct S *___dst__P2sS_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)))) /* ?{} */);
     22    ((void)((*___dst__P2sS_1).__a__i_1) /* ?{} */);
     23    ((void)((*___dst__P2sS_1).__b__i_1) /* ?{} */);
     24    ((void)((*___dst__P2sS_1).__c__i_1) /* ?{} */);
    2525}
    2626static inline void ___constructor__F_P2sS2sS_autogen___1(struct S *___dst__P2sS_1, struct S ___src__2sS_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) /* ?{} */);
     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) /* ?{} */);
    3030}
    3131static inline void ___destructor__F_P2sS_autogen___1(struct S *___dst__P2sS_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)))) /* ^?{} */);
     32    ((void)((*___dst__P2sS_1).__c__i_1) /* ^?{} */);
     33    ((void)((*___dst__P2sS_1).__b__i_1) /* ^?{} */);
     34    ((void)((*___dst__P2sS_1).__a__i_1) /* ^?{} */);
    3535}
    3636static inline void ___constructor__F_P2sSi_autogen___1(struct S *___dst__P2sS_1, int __a__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)))) /* ?{} */);
     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) /* ?{} */);
    4040}
    4141static inline void ___constructor__F_P2sSii_autogen___1(struct S *___dst__P2sS_1, int __a__i_1, int __b__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)))) /* ?{} */);
     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) /* ?{} */);
    4545}
    4646static 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)((*((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) /* ?{} */);
     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) /* ?{} */);
    5050}
    5151__extension__ union U {
Note: See TracChangeset for help on using the changeset viewer.