Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Common/PassVisitor.impl.h

    r2a7b3ca r7b13aeb  
    11#pragma once
    22
    3 #define VISIT_START( node )                     \
    4         __attribute__((unused))                   \
    5         const auto & guard = init_guard();        \
    6         bool visit_children = true;               \
    7         set_visit_children( visit_children );   \
    8         call_previsit( node );                    \
    9         if( visit_children ) {                    \
    10 
    11 #define VISIT_END( node )                       \
    12         }                                         \
    13         call_postvisit( node );                   \
    14 
    15 #define MUTATE_START( node )                    \
    16         __attribute__((unused))                   \
    17         const auto & guard = init_guard();        \
    18         bool visit_children = true;               \
    19         set_visit_children( visit_children );   \
    20         call_premutate( node );                   \
    21         if( visit_children ) {                    \
     3#define VISIT_START( node )  \
     4        call_previsit( node ); \
     5        if( visit_children() ) { \
     6
     7#define VISIT_END( node )            \
     8        }                              \
     9        return call_postvisit( node ); \
     10
     11#define MUTATE_START( node )  \
     12        call_premutate( node ); \
     13        if( visit_children() ) { \
    2214
    2315#define MUTATE_END( type, node )                \
     
    2618
    2719
    28 #define VISIT_BODY( node )        \
    29         VISIT_START( node );        \
    30         Visitor::visit( node );     \
    31         VISIT_END( node );          \
     20#define VISIT_BODY( node )    \
     21        VISIT_START( node );  \
     22        Visitor::visit( node ); \
     23        VISIT_END( node ); \
    3224
    3325
     
    4436}
    4537
    46 typedef std::list< Statement   * > StmtList_t;
    47 typedef std::list< Declaration * > DeclList_t;
    48 
    49 template<typename iterator_t>
    50 static inline void splice( iterator_t it, DeclList_t * decls ) {
    51         std::transform(
    52                 decls->begin(),
    53                 decls->end(),
    54                 it,
    55                 [](Declaration * decl) -> auto {
    56                         return new DeclStmt( noLabels, decl );
    57                 }
    58         );
    59         decls->clear();
    60 }
    61 
    62 template< typename pass_type >
    63 static inline void acceptAll( std::list< Declaration* > &decls, PassVisitor< pass_type >& visitor ) {
    64 
    65         DeclList_t* beforeDecls = visitor.get_beforeDecls();
    66         DeclList_t* afterDecls  = visitor.get_afterDecls();
    67 
    68         for ( std::list< Declaration* >::iterator i = decls.begin(); ; ++i ) {
    69                 // splice in new declarations after previous decl
    70                 if ( !empty( afterDecls ) ) { decls.splice( i, *afterDecls ); }
    71 
    72                 if ( i == decls.end() ) break;
    73 
    74                 // run mutator on declaration
    75                 maybeAccept( *i, visitor );
    76 
    77                 // splice in new declarations before current decl
    78                 if ( !empty( beforeDecls ) ) { decls.splice( i, *beforeDecls ); }
    79         }
    80 }
    81 
    82 template< typename pass_type >
    83 static inline void mutateAll( std::list< Declaration* > &decls, PassVisitor< pass_type >& mutator ) {
    84 
    85         DeclList_t* beforeDecls = mutator.get_beforeDecls();
    86         DeclList_t* afterDecls  = mutator.get_afterDecls();
    87 
    88         for ( std::list< Declaration* >::iterator i = decls.begin(); ; ++i ) {
    89                 // splice in new declarations after previous decl
    90                 if ( !empty( afterDecls ) ) { decls.splice( i, *afterDecls ); }
    91 
    92                 if ( i == decls.end() ) break;
    93 
    94                 // run mutator on declaration
    95                 *i = maybeMutate( *i, mutator );
    96 
    97                 // splice in new declarations before current decl
    98                 if ( !empty( beforeDecls ) ) { decls.splice( i, *beforeDecls ); }
    99         }
    100 }
    101 
    102 template< typename pass_type >
    103 template< typename func_t >
    104 void PassVisitor< pass_type >::handleStatementList( std::list< Statement * > & statements, func_t func ) {
     38typedef std::list< Statement * > StmtList_t;
     39
     40template< typename pass_type >
     41void PassVisitor< pass_type >::visitStatementList( std::list< Statement * > & statements ) {
    10542        SemanticError errors;
    106 
    107         // don't want statements from outer CompoundStmts to be added to this CompoundStmt
    108         ValueGuardPtr< StmtList_t > oldBeforeStmts( get_beforeStmts() );
    109         ValueGuardPtr< StmtList_t > oldAfterStmts ( get_afterStmts () );
    110         ValueGuardPtr< DeclList_t > oldBeforeDecls( get_beforeDecls() );
    111         ValueGuardPtr< DeclList_t > oldAfterDecls ( get_afterDecls () );
    11243
    11344        StmtList_t* beforeStmts = get_beforeStmts();
    11445        StmtList_t* afterStmts  = get_afterStmts();
    115         DeclList_t* beforeDecls = get_beforeDecls();
    116         DeclList_t* afterDecls  = get_afterDecls();
    11746
    11847        for ( std::list< Statement* >::iterator i = statements.begin(); i != statements.end(); ++i ) {
    119 
    120                 if ( !empty( afterDecls ) ) { splice( std::inserter( statements, i ), afterDecls ); }
    12148                if ( !empty( afterStmts ) ) { statements.splice( i, *afterStmts ); }
    122 
    12349                try {
    124                         func( *i );
    125                         assert(( empty( beforeStmts ) && empty( afterStmts ))
    126                             || ( empty( beforeDecls ) && empty( afterDecls )) );
    127 
     50                        (*i)->accept( *this );
    12851                } catch ( SemanticError &e ) {
    12952                        errors.append( e );
    13053                }
    131 
    132                 if ( !empty( beforeDecls ) ) { splice( std::inserter( statements, i ), beforeDecls ); }
    13354                if ( !empty( beforeStmts ) ) { statements.splice( i, *beforeStmts ); }
    13455        }
    13556
    136         if ( !empty( afterDecls ) ) { splice( std::back_inserter( statements ), afterDecls); }
    13757        if ( !empty( afterStmts ) ) { statements.splice( statements.end(), *afterStmts ); }
    13858        if ( !errors.isEmpty() ) { throw errors; }
     
    14060
    14161template< typename pass_type >
    142 void PassVisitor< pass_type >::visitStatementList( std::list< Statement * > & statements ) {
    143         handleStatementList( statements, [this]( Statement * stmt) {
    144                 stmt->accept( *this );
    145         });
    146 }
    147 
    148 template< typename pass_type >
    14962void PassVisitor< pass_type >::mutateStatementList( std::list< Statement * > & statements ) {
    150         handleStatementList( statements, [this]( Statement *& stmt) {
    151                 stmt = stmt->acceptMutator( *this );
    152         });
    153 }
    154 
    155 
    156 template< typename pass_type >
    157 template< typename func_t >
    158 Statement * PassVisitor< pass_type >::handleStatement( Statement * stmt, func_t func ) {
    159         // don't want statements from outer CompoundStmts to be added to this CompoundStmt
    160         ValueGuardPtr< TypeSubstitution * >  oldEnv        ( get_env_ptr    () );
    161         ValueGuardPtr< DeclList_t >          oldBeforeDecls( get_beforeDecls() );
    162         ValueGuardPtr< DeclList_t >          oldAfterDecls ( get_afterDecls () );
    163         ValueGuardPtr< StmtList_t >          oldBeforeStmts( get_beforeStmts() );
    164         ValueGuardPtr< StmtList_t >          oldAfterStmts ( get_afterStmts () );
    165 
    166         Statement *newStmt = func( stmt );
     63        SemanticError errors;
    16764
    16865        StmtList_t* beforeStmts = get_beforeStmts();
    16966        StmtList_t* afterStmts  = get_afterStmts();
    170         DeclList_t* beforeDecls = get_beforeDecls();
    171         DeclList_t* afterDecls  = get_afterDecls();
    172 
    173         if( empty(beforeStmts) && empty(afterStmts) && empty(beforeDecls) && empty(afterDecls) ) { return newStmt; }
    174         assert(( empty( beforeStmts ) && empty( afterStmts ))
    175             || ( empty( beforeDecls ) && empty( afterDecls )) );
     67
     68        for ( std::list< Statement* >::iterator i = statements.begin(); i != statements.end(); ++i ) {
     69                if ( !empty( afterStmts ) ) { statements.splice( i, *afterStmts ); }
     70                try {
     71                        *i = (*i)->acceptMutator( *this );
     72                } catch ( SemanticError &e ) {
     73                        errors.append( e );
     74                }
     75                if ( !empty( beforeStmts ) ) { statements.splice( i, *beforeStmts ); }
     76        }
     77
     78        if ( !empty( afterStmts ) ) { statements.splice( statements.end(), *afterStmts ); }
     79        if ( !errors.isEmpty() ) { throw errors; }
     80}
     81
     82template< typename pass_type >
     83Statement * PassVisitor< pass_type >::visitStatement( Statement * stmt ) {
     84        // don't want statements from outer CompoundStmts to be added to this CompoundStmt
     85        ValueGuardPtr< TypeSubstitution * >      oldEnv        ( get_env_ptr() );
     86        ValueGuardPtr< std::list< Statement* > > oldBeforeStmts( get_beforeStmts() );
     87        ValueGuardPtr< std::list< Statement* > > oldAfterStmts ( get_afterStmts () );
     88
     89        maybeAccept( stmt, *this );
     90
     91        StmtList_t* beforeStmts = get_beforeStmts();
     92        StmtList_t* afterStmts  = get_afterStmts();
     93
     94        if( empty(beforeStmts) && empty(afterStmts) ) { return stmt; }
    17695
    17796        CompoundStmt *compound = new CompoundStmt( noLabels );
    178         if( !empty(beforeDecls) ) { splice( std::back_inserter( compound->get_kids() ), beforeDecls ); }
     97        if( !empty(beforeStmts) ) { compound->get_kids().splice( compound->get_kids().end(), *beforeStmts ); }
     98        compound->get_kids().push_back( stmt );
     99        if( !empty(afterStmts) ) { compound->get_kids().splice( compound->get_kids().end(), *afterStmts ); }
     100        return compound;
     101}
     102
     103template< typename pass_type >
     104Statement * PassVisitor< pass_type >::mutateStatement( Statement * stmt ) {
     105        // don't want statements from outer CompoundStmts to be added to this CompoundStmt
     106        ValueGuardPtr< TypeSubstitution * >      oldEnv        ( get_env_ptr() );
     107        ValueGuardPtr< std::list< Statement* > > oldBeforeStmts( get_beforeStmts() );
     108        ValueGuardPtr< std::list< Statement* > > oldAfterStmts ( get_afterStmts () );
     109
     110        Statement *newStmt = maybeMutate( stmt, *this );
     111
     112        StmtList_t* beforeStmts = get_beforeStmts();
     113        StmtList_t* afterStmts  = get_afterStmts();
     114
     115        if( empty(beforeStmts) && empty(afterStmts) ) { return newStmt; }
     116
     117        CompoundStmt *compound = new CompoundStmt( noLabels );
    179118        if( !empty(beforeStmts) ) { compound->get_kids().splice( compound->get_kids().end(), *beforeStmts ); }
    180119        compound->get_kids().push_back( newStmt );
    181         if( !empty(afterDecls) ) { splice( std::back_inserter( compound->get_kids() ), afterDecls ); }
    182120        if( !empty(afterStmts) ) { compound->get_kids().splice( compound->get_kids().end(), *afterStmts ); }
    183121        return compound;
    184122}
    185123
    186 template< typename pass_type >
    187 Statement * PassVisitor< pass_type >::visitStatement( Statement * stmt ) {
    188         return handleStatement( stmt, [this]( Statement * stmt ) {
    189                 maybeAccept( stmt, *this );
    190                 return stmt;
    191         });
    192 }
    193 
    194 template< typename pass_type >
    195 Statement * PassVisitor< pass_type >::mutateStatement( Statement * stmt ) {
    196         return handleStatement( stmt, [this]( Statement * stmt ) {
    197                 return maybeMutate( stmt, *this );
    198         });
    199 }
    200 
    201 template< typename pass_type >
    202 template< typename func_t >
    203 Expression * PassVisitor< pass_type >::handleExpression( Expression * expr, func_t func ) {
    204         if( !expr ) return nullptr;
     124
     125
     126template< typename pass_type >
     127void PassVisitor< pass_type >::visitExpression( Expression * expr ) {
     128        if( !expr ) return;
    205129
    206130        auto env_ptr = get_env_ptr();
     
    208132                *env_ptr = expr->get_env();
    209133        }
    210 
    211         // should env be cloned (or moved) onto the result of the mutate?
    212         return func( expr );
    213 }
    214 
    215 template< typename pass_type >
    216 Expression * PassVisitor< pass_type >::visitExpression( Expression * expr ) {
    217         return handleExpression(expr, [this]( Expression * expr ) {
    218                 expr->accept( *this );
    219                 return expr;
    220         });
     134        // xxx - should env be cloned (or moved) onto the result of the mutate?
     135        expr->accept( *this );
    221136}
    222137
    223138template< typename pass_type >
    224139Expression * PassVisitor< pass_type >::mutateExpression( Expression * expr ) {
    225         return handleExpression(expr, [this]( Expression * expr ) {
    226                 return expr->acceptMutator( *this );
    227         });
    228 }
     140        if( !expr ) return nullptr;
     141
     142        auto env_ptr = get_env_ptr();
     143        if ( env_ptr && expr->get_env() ) {
     144                *env_ptr = expr->get_env();
     145        }
     146        // xxx - should env be cloned (or moved) onto the result of the mutate?
     147        return expr->acceptMutator( *this );
     148}
     149
    229150
    230151//------------------------------------------------------------------------------------------------------------------------------------------------------------------------
     
    232153template< typename pass_type >
    233154void PassVisitor< pass_type >::visit( ObjectDecl * node ) {
    234         VISIT_BODY( node );
     155        VISIT_BODY( node ); 
    235156}
    236157
    237158template< typename pass_type >
    238159void PassVisitor< pass_type >::visit( FunctionDecl * node ) {
    239         VISIT_BODY( node );
     160        VISIT_BODY( node ); 
    240161}
    241162
    242163template< typename pass_type >
    243164void PassVisitor< pass_type >::visit( StructDecl * node ) {
    244         VISIT_BODY( node );
     165        VISIT_BODY( node ); 
    245166}
    246167
    247168template< typename pass_type >
    248169void PassVisitor< pass_type >::visit( UnionDecl * node ) {
    249         VISIT_BODY( node );
     170        VISIT_BODY( node ); 
    250171}
    251172
    252173template< typename pass_type >
    253174void PassVisitor< pass_type >::visit( EnumDecl * node ) {
    254         VISIT_BODY( node );
     175        VISIT_BODY( node ); 
    255176}
    256177
    257178template< typename pass_type >
    258179void PassVisitor< pass_type >::visit( TraitDecl * node ) {
    259         VISIT_BODY( node );
     180        VISIT_BODY( node ); 
    260181}
    261182
    262183template< typename pass_type >
    263184void PassVisitor< pass_type >::visit( TypeDecl * node ) {
    264         VISIT_BODY( node );
     185        VISIT_BODY( node ); 
    265186}
    266187
    267188template< typename pass_type >
    268189void PassVisitor< pass_type >::visit( TypedefDecl * node ) {
    269         VISIT_BODY( node );
     190        VISIT_BODY( node ); 
    270191}
    271192
    272193template< typename pass_type >
    273194void PassVisitor< pass_type >::visit( AsmDecl * node ) {
    274         VISIT_BODY( node );
     195        VISIT_BODY( node ); 
    275196}
    276197
     
    304225void PassVisitor< pass_type >::visit( ExprStmt * node ) {
    305226        VISIT_START( node );
     227        call_beginScope();
    306228
    307229        visitExpression( node->get_expr() );
    308230
     231        call_endScope();
    309232        VISIT_END( node );
    310233}
     
    319242}
    320243
    321 //--------------------------------------------------------------------------
    322 // AsmStmt
    323244template< typename pass_type >
    324245void PassVisitor< pass_type >::visit( AsmStmt * node ) {
    325         VISIT_BODY( node );
    326 }
    327 
    328 template< typename pass_type >
    329 Statement * PassVisitor< pass_type >::mutate( AsmStmt * node ) {
    330         MUTATE_BODY( Statement, node );
     246        VISIT_BODY( node );
    331247}
    332248
     
    335251template< typename pass_type >
    336252void PassVisitor< pass_type >::visit( IfStmt * node ) {
    337         VISIT_START( node );
     253        VISIT_START( node ); 
    338254
    339255        visitExpression( node->get_condition() );
     
    346262template< typename pass_type >
    347263Statement * PassVisitor< pass_type >::mutate( IfStmt * node ) {
    348         MUTATE_START( node );
     264        MUTATE_START( node ); 
    349265
    350266        node->set_condition( mutateExpression( node->get_condition() ) );
     
    359275template< typename pass_type >
    360276void PassVisitor< pass_type >::visit( WhileStmt * node ) {
    361         VISIT_START( node );
     277        VISIT_START( node ); 
    362278
    363279        visitExpression( node->get_condition() );
     
    369285template< typename pass_type >
    370286Statement * PassVisitor< pass_type >::mutate( WhileStmt * node ) {
    371         MUTATE_START( node );
     287        MUTATE_START( node ); 
    372288
    373289        node->set_condition( mutateExpression( node->get_condition() ) );
     
    378294
    379295//--------------------------------------------------------------------------
    380 // ForStmt
     296// WhileStmt
    381297template< typename pass_type >
    382298void PassVisitor< pass_type >::visit( ForStmt * node ) {
    383         VISIT_START( node );
     299        VISIT_START( node ); 
    384300
    385301        acceptAll( node->get_initialization(), *this );
     
    393309template< typename pass_type >
    394310Statement * PassVisitor< pass_type >::mutate( ForStmt * node ) {
    395         MUTATE_START( node );
     311        MUTATE_START( node ); 
    396312
    397313        mutateAll( node->get_initialization(), *this );
     
    407323template< typename pass_type >
    408324void PassVisitor< pass_type >::visit( SwitchStmt * node ) {
    409         VISIT_START( node );
     325        VISIT_START( node ); 
    410326
    411327        visitExpression( node->get_condition() );
     
    417333template< typename pass_type >
    418334Statement * PassVisitor< pass_type >::mutate( SwitchStmt * node ) {
    419         MUTATE_START( node );
    420 
     335        MUTATE_START( node ); 
     336       
    421337        node->set_condition( mutateExpression( node->get_condition() ) );
    422338        mutateStatementList( node->get_statements() );
    423 
     339       
    424340        MUTATE_END( Statement, node );
    425341}
    426342
    427343//--------------------------------------------------------------------------
    428 // CaseStmt
     344// SwitchStmt
    429345template< typename pass_type >
    430346void PassVisitor< pass_type >::visit( CaseStmt * node ) {
    431         VISIT_START( node );
    432 
     347        VISIT_START( node ); 
     348       
    433349        visitExpression( node->get_condition() );
    434350        visitStatementList( node->get_statements() );
    435 
     351       
    436352        VISIT_END( node );
    437353}
     
    439355template< typename pass_type >
    440356Statement * PassVisitor< pass_type >::mutate( CaseStmt * node ) {
    441         MUTATE_START( node );
    442 
     357        MUTATE_START( node ); 
     358       
    443359        node->set_condition(  mutateExpression( node->get_condition() ) );
    444360        mutateStatementList( node->get_statements() );
    445 
     361       
    446362        MUTATE_END( Statement, node );
    447363}
    448364
    449 //--------------------------------------------------------------------------
    450 // BranchStmt
    451365template< typename pass_type >
    452366void PassVisitor< pass_type >::visit( BranchStmt * node ) {
    453         VISIT_BODY( node );
    454 }
    455 
    456 template< typename pass_type >
    457 Statement * PassVisitor< pass_type >::mutate( BranchStmt * node ) {
    458         MUTATE_BODY( Statement, node );
     367        VISIT_BODY( node );
    459368}
    460369
     
    480389
    481390//--------------------------------------------------------------------------
    482 // ThrowStmt
    483 
    484 template< typename pass_type >
    485 void PassVisitor< pass_type >::visit( ThrowStmt * node ) {
    486         VISIT_BODY( node );
    487 }
    488 
    489 template< typename pass_type >
    490 Statement * PassVisitor< pass_type >::mutate( ThrowStmt * node ) {
    491         MUTATE_BODY( Statement, node );
    492 }
    493 
    494 //--------------------------------------------------------------------------
    495391// TryStmt
    496392template< typename pass_type >
     
    500396        maybeAccept( node->get_block(), *this );
    501397        acceptAll( node->get_catchers(), *this );
    502         maybeAccept( node->get_finally(), *this );
    503398
    504399        VISIT_END( node );
     
    511406        node->set_block(  maybeMutate( node->get_block(), *this ) );
    512407        mutateAll( node->get_catchers(), *this );
    513         node->set_finally( maybeMutate( node->get_finally(), *this ) );
    514 
     408       
    515409        MUTATE_END( Statement, node );
    516410}
     
    522416        VISIT_START( node );
    523417
     418        node->set_body( visitStatement( node->get_body() ) );
    524419        maybeAccept( node->get_decl(), *this );
    525         node->set_cond( visitExpression( node->get_cond() ) );
    526         node->set_body( visitStatement( node->get_body() ) );
    527420
    528421        VISIT_END( node );
     
    532425Statement * PassVisitor< pass_type >::mutate( CatchStmt * node ) {
    533426        MUTATE_START( node );
    534 
    535         node->set_decl( maybeMutate( node->get_decl(), *this ) );
    536         node->set_cond( mutateExpression( node->get_cond() ) );
    537         node->set_body( mutateStatement( node->get_body() ) );
    538 
     427       
     428        node->set_body(  mutateStatement( node->get_body() ) );
     429        node->set_decl(  maybeMutate( node->get_decl(), *this ) );
     430       
    539431        MUTATE_END( Statement, node );
    540432}
     
    542434template< typename pass_type >
    543435void PassVisitor< pass_type >::visit( FinallyStmt * node ) {
    544         VISIT_BODY( node );
     436        VISIT_BODY( node ); 
    545437}
    546438
    547439template< typename pass_type >
    548440void PassVisitor< pass_type >::visit( NullStmt * node ) {
    549         VISIT_BODY( node );
     441        VISIT_BODY( node ); 
    550442}
    551443
    552444template< typename pass_type >
    553445void PassVisitor< pass_type >::visit( DeclStmt * node ) {
    554         VISIT_BODY( node );
     446        VISIT_BODY( node ); 
    555447}
    556448
    557449template< typename pass_type >
    558450void PassVisitor< pass_type >::visit( ImplicitCtorDtorStmt * node ) {
    559         VISIT_BODY( node );
     451        VISIT_BODY( node ); 
    560452}
    561453
    562454template< typename pass_type >
    563455void PassVisitor< pass_type >::visit( ApplicationExpr * node ) {
    564         VISIT_BODY( node );
     456        VISIT_BODY( node ); 
    565457}
    566458
     
    570462void PassVisitor< pass_type >::visit( UntypedExpr * node ) {
    571463        VISIT_START( node );
    572 
    573         // maybeAccept( node->get_env(), *this );
    574         maybeAccept( node->get_result(), *this );
    575464
    576465        for ( auto expr : node->get_args() ) {
     
    585474        MUTATE_START( node );
    586475
    587         node->set_env( maybeMutate( node->get_env(), *this ) );
    588         node->set_result( maybeMutate( node->get_result(), *this ) );
    589 
    590476        for ( auto& expr : node->get_args() ) {
    591477                expr = mutateExpression( expr );
     
    597483template< typename pass_type >
    598484void PassVisitor< pass_type >::visit( NameExpr * node ) {
    599         VISIT_BODY( node );
     485        VISIT_BODY( node ); 
    600486}
    601487
    602488template< typename pass_type >
    603489void PassVisitor< pass_type >::visit( CastExpr * node ) {
    604         VISIT_BODY( node );
     490        VISIT_BODY( node ); 
    605491}
    606492
    607493template< typename pass_type >
    608494void PassVisitor< pass_type >::visit( AddressExpr * node ) {
    609         VISIT_BODY( node );
     495        VISIT_BODY( node ); 
    610496}
    611497
    612498template< typename pass_type >
    613499void PassVisitor< pass_type >::visit( LabelAddressExpr * node ) {
    614         VISIT_BODY( node );
     500        VISIT_BODY( node ); 
    615501}
    616502
    617503template< typename pass_type >
    618504void PassVisitor< pass_type >::visit( UntypedMemberExpr * node ) {
    619         VISIT_BODY( node );
     505        VISIT_BODY( node ); 
    620506}
    621507
    622508template< typename pass_type >
    623509void PassVisitor< pass_type >::visit( MemberExpr * node ) {
    624         VISIT_BODY( node );
     510        VISIT_BODY( node ); 
    625511}
    626512
    627513template< typename pass_type >
    628514void PassVisitor< pass_type >::visit( VariableExpr * node ) {
    629         VISIT_BODY( node );
     515        VISIT_BODY( node ); 
    630516}
    631517
    632518template< typename pass_type >
    633519void PassVisitor< pass_type >::visit( ConstantExpr * node ) {
    634         VISIT_BODY( node );
     520        VISIT_BODY( node ); 
    635521}
    636522
    637523template< typename pass_type >
    638524void PassVisitor< pass_type >::visit( SizeofExpr * node ) {
    639         VISIT_BODY( node );
     525        VISIT_BODY( node ); 
    640526}
    641527
    642528template< typename pass_type >
    643529void PassVisitor< pass_type >::visit( AlignofExpr * node ) {
    644         VISIT_BODY( node );
     530        VISIT_BODY( node ); 
    645531}
    646532
    647533template< typename pass_type >
    648534void PassVisitor< pass_type >::visit( UntypedOffsetofExpr * node ) {
    649         VISIT_BODY( node );
     535        VISIT_BODY( node ); 
    650536}
    651537
    652538template< typename pass_type >
    653539void PassVisitor< pass_type >::visit( OffsetofExpr * node ) {
    654         VISIT_BODY( node );
     540        VISIT_BODY( node ); 
    655541}
    656542
    657543template< typename pass_type >
    658544void PassVisitor< pass_type >::visit( OffsetPackExpr * node ) {
    659         VISIT_BODY( node );
     545        VISIT_BODY( node ); 
    660546}
    661547
    662548template< typename pass_type >
    663549void PassVisitor< pass_type >::visit( AttrExpr * node ) {
    664         VISIT_BODY( node );
     550        VISIT_BODY( node ); 
    665551}
    666552
    667553template< typename pass_type >
    668554void PassVisitor< pass_type >::visit( LogicalExpr * node ) {
    669         VISIT_BODY( node );
     555        VISIT_BODY( node ); 
    670556}
    671557
    672558template< typename pass_type >
    673559void PassVisitor< pass_type >::visit( ConditionalExpr * node ) {
    674         VISIT_BODY( node );
     560        VISIT_BODY( node ); 
    675561}
    676562
    677563template< typename pass_type >
    678564void PassVisitor< pass_type >::visit( CommaExpr * node ) {
    679         VISIT_BODY( node );
     565        VISIT_BODY( node ); 
    680566}
    681567
    682568template< typename pass_type >
    683569void PassVisitor< pass_type >::visit( TypeExpr * node ) {
    684         VISIT_BODY( node );
     570        VISIT_BODY( node ); 
    685571}
    686572
    687573template< typename pass_type >
    688574void PassVisitor< pass_type >::visit( AsmExpr * node ) {
    689         VISIT_BODY( node );
     575        VISIT_BODY( node ); 
    690576}
    691577
    692578template< typename pass_type >
    693579void PassVisitor< pass_type >::visit( ImplicitCopyCtorExpr * node ) {
    694         VISIT_BODY( node );
     580        VISIT_BODY( node ); 
    695581}
    696582
    697583template< typename pass_type >
    698584void PassVisitor< pass_type >::visit( ConstructorExpr * node ) {
    699         VISIT_BODY( node );
     585        VISIT_BODY( node ); 
    700586}
    701587
    702588template< typename pass_type >
    703589void PassVisitor< pass_type >::visit( CompoundLiteralExpr * node ) {
    704         VISIT_BODY( node );
     590        VISIT_BODY( node );
     591}
     592
     593template< typename pass_type >
     594void PassVisitor< pass_type >::visit( UntypedValofExpr * node ) {
     595        VISIT_BODY( node );
    705596}
    706597
    707598template< typename pass_type >
    708599void PassVisitor< pass_type >::visit( RangeExpr * node ) {
    709         VISIT_BODY( node );
     600        VISIT_BODY( node ); 
    710601}
    711602
    712603template< typename pass_type >
    713604void PassVisitor< pass_type >::visit( UntypedTupleExpr * node ) {
    714         VISIT_BODY( node );
     605        VISIT_BODY( node ); 
    715606}
    716607
    717608template< typename pass_type >
    718609void PassVisitor< pass_type >::visit( TupleExpr * node ) {
    719         VISIT_BODY( node );
     610        VISIT_BODY( node ); 
    720611}
    721612
    722613template< typename pass_type >
    723614void PassVisitor< pass_type >::visit( TupleIndexExpr * node ) {
    724         VISIT_BODY( node );
     615        VISIT_BODY( node );
     616}
     617
     618template< typename pass_type >
     619void PassVisitor< pass_type >::visit( MemberTupleExpr * node ) {
     620        VISIT_BODY( node );
    725621}
    726622
    727623template< typename pass_type >
    728624void PassVisitor< pass_type >::visit( TupleAssignExpr * node ) {
    729         VISIT_BODY( node );
     625        VISIT_BODY( node ); 
    730626}
    731627
     
    749645Expression * PassVisitor< pass_type >::mutate( StmtExpr * node ) {
    750646        MUTATE_START( node );
    751 
     647       
    752648        // don't want statements from outer CompoundStmts to be added to this StmtExpr
    753649        ValueGuardPtr< TypeSubstitution * >      oldEnv        ( get_env_ptr() );
     
    762658template< typename pass_type >
    763659void PassVisitor< pass_type >::visit( UniqueExpr * node ) {
    764         VISIT_BODY( node );
     660        VISIT_BODY( node ); 
    765661}
    766662
    767663template< typename pass_type >
    768664void PassVisitor< pass_type >::visit( VoidType * node ) {
    769         VISIT_BODY( node );
     665        VISIT_BODY( node ); 
    770666}
    771667
    772668template< typename pass_type >
    773669void PassVisitor< pass_type >::visit( BasicType * node ) {
    774         VISIT_BODY( node );
     670        VISIT_BODY( node ); 
    775671}
    776672
    777673template< typename pass_type >
    778674void PassVisitor< pass_type >::visit( PointerType * node ) {
    779         VISIT_BODY( node );
     675        VISIT_BODY( node ); 
    780676}
    781677
    782678template< typename pass_type >
    783679void PassVisitor< pass_type >::visit( ArrayType * node ) {
    784         VISIT_BODY( node );
     680        VISIT_BODY( node ); 
    785681}
    786682
    787683template< typename pass_type >
    788684void PassVisitor< pass_type >::visit( FunctionType * node ) {
    789         VISIT_BODY( node );
     685        VISIT_BODY( node ); 
    790686}
    791687
    792688template< typename pass_type >
    793689void PassVisitor< pass_type >::visit( StructInstType * node ) {
    794         VISIT_BODY( node );
     690        VISIT_BODY( node ); 
    795691}
    796692
    797693template< typename pass_type >
    798694void PassVisitor< pass_type >::visit( UnionInstType * node ) {
    799         VISIT_BODY( node );
     695        VISIT_BODY( node ); 
    800696}
    801697
    802698template< typename pass_type >
    803699void PassVisitor< pass_type >::visit( EnumInstType * node ) {
    804         VISIT_BODY( node );
     700        VISIT_BODY( node ); 
    805701}
    806702
    807703template< typename pass_type >
    808704void PassVisitor< pass_type >::visit( TraitInstType * node ) {
    809         VISIT_BODY( node );
     705        VISIT_BODY( node ); 
    810706}
    811707
    812708template< typename pass_type >
    813709void PassVisitor< pass_type >::visit( TypeInstType * node ) {
    814         VISIT_BODY( node );
     710        VISIT_BODY( node ); 
    815711}
    816712
    817713template< typename pass_type >
    818714void PassVisitor< pass_type >::visit( TupleType * node ) {
    819         VISIT_BODY( node );
     715        VISIT_BODY( node ); 
    820716}
    821717
    822718template< typename pass_type >
    823719void PassVisitor< pass_type >::visit( TypeofType * node ) {
    824         VISIT_BODY( node );
     720        VISIT_BODY( node ); 
    825721}
    826722
    827723template< typename pass_type >
    828724void PassVisitor< pass_type >::visit( AttrType * node ) {
    829         VISIT_BODY( node );
     725        VISIT_BODY( node ); 
    830726}
    831727
    832728template< typename pass_type >
    833729void PassVisitor< pass_type >::visit( VarArgsType * node ) {
    834         VISIT_BODY( node );
     730        VISIT_BODY( node ); 
    835731}
    836732
    837733template< typename pass_type >
    838734void PassVisitor< pass_type >::visit( ZeroType * node ) {
    839         VISIT_BODY( node );
     735        VISIT_BODY( node ); 
    840736}
    841737
    842738template< typename pass_type >
    843739void PassVisitor< pass_type >::visit( OneType * node ) {
    844         VISIT_BODY( node );
     740        VISIT_BODY( node ); 
    845741}
    846742
     
    867763template< typename pass_type >
    868764void PassVisitor< pass_type >::visit( ListInit * node ) {
    869         VISIT_BODY( node );
     765        VISIT_BODY( node ); 
    870766}
    871767
    872768template< typename pass_type >
    873769void PassVisitor< pass_type >::visit( ConstructorInit * node ) {
    874         VISIT_BODY( node );
     770        VISIT_BODY( node ); 
    875771}
    876772
    877773template< typename pass_type >
    878774void PassVisitor< pass_type >::visit( Subrange * node ) {
    879         VISIT_BODY( node );
     775        VISIT_BODY( node ); 
    880776}
    881777
    882778template< typename pass_type >
    883779void PassVisitor< pass_type >::visit( Constant * node ) {
    884         VISIT_BODY( node );
     780        VISIT_BODY( node ); 
    885781}
    886782
     
    933829
    934830template< typename pass_type >
     831Statement * PassVisitor< pass_type >::mutate( AsmStmt * node ) {
     832        MUTATE_BODY( Statement, node );
     833}
     834
     835template< typename pass_type >
     836Statement * PassVisitor< pass_type >::mutate( BranchStmt * node ) {
     837        MUTATE_BODY( Statement, node );
     838}
     839
     840template< typename pass_type >
    935841Statement * PassVisitor< pass_type >::mutate( FinallyStmt * node ) {
    936842        MUTATE_BODY( Statement, node );
     
    1068974
    1069975template< typename pass_type >
     976Expression * PassVisitor< pass_type >::mutate( UntypedValofExpr * node ) {
     977        MUTATE_BODY( Expression, node );
     978}
     979
     980template< typename pass_type >
    1070981Expression * PassVisitor< pass_type >::mutate( RangeExpr * node ) {
    1071982        MUTATE_BODY( Expression, node );
     
    1084995template< typename pass_type >
    1085996Expression * PassVisitor< pass_type >::mutate( TupleIndexExpr * node ) {
     997        MUTATE_BODY( Expression, node );
     998}
     999
     1000template< typename pass_type >
     1001Expression * PassVisitor< pass_type >::mutate( MemberTupleExpr * node ) {
    10861002        MUTATE_BODY( Expression, node );
    10871003}
Note: See TracChangeset for help on using the changeset viewer.