Ignore:
File:
1 edited

Legend:

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

    r7b13aeb r2a7b3ca  
    11#pragma once
    22
    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() ) { \
     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 ) {                    \
    1422
    1523#define MUTATE_END( type, node )                \
     
    1826
    1927
    20 #define VISIT_BODY( node )    \
    21         VISIT_START( node );  \
    22         Visitor::visit( node ); \
    23         VISIT_END( node ); \
     28#define VISIT_BODY( node )        \
     29        VISIT_START( node );        \
     30        Visitor::visit( node );     \
     31        VISIT_END( node );          \
    2432
    2533
     
    3644}
    3745
    38 typedef std::list< Statement * > StmtList_t;
    39 
    40 template< typename pass_type >
    41 void PassVisitor< pass_type >::visitStatementList( std::list< Statement * > & statements ) {
     46typedef std::list< Statement   * > StmtList_t;
     47typedef std::list< Declaration * > DeclList_t;
     48
     49template<typename iterator_t>
     50static 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
     62template< typename pass_type >
     63static 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
     82template< typename pass_type >
     83static 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
     102template< typename pass_type >
     103template< typename func_t >
     104void PassVisitor< pass_type >::handleStatementList( std::list< Statement * > & statements, func_t func ) {
    42105        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 () );
    43112
    44113        StmtList_t* beforeStmts = get_beforeStmts();
    45114        StmtList_t* afterStmts  = get_afterStmts();
     115        DeclList_t* beforeDecls = get_beforeDecls();
     116        DeclList_t* afterDecls  = get_afterDecls();
    46117
    47118        for ( std::list< Statement* >::iterator i = statements.begin(); i != statements.end(); ++i ) {
     119
     120                if ( !empty( afterDecls ) ) { splice( std::inserter( statements, i ), afterDecls ); }
    48121                if ( !empty( afterStmts ) ) { statements.splice( i, *afterStmts ); }
     122
    49123                try {
    50                         (*i)->accept( *this );
     124                        func( *i );
     125                        assert(( empty( beforeStmts ) && empty( afterStmts ))
     126                            || ( empty( beforeDecls ) && empty( afterDecls )) );
     127
    51128                } catch ( SemanticError &e ) {
    52129                        errors.append( e );
    53130                }
     131
     132                if ( !empty( beforeDecls ) ) { splice( std::inserter( statements, i ), beforeDecls ); }
    54133                if ( !empty( beforeStmts ) ) { statements.splice( i, *beforeStmts ); }
    55134        }
    56135
     136        if ( !empty( afterDecls ) ) { splice( std::back_inserter( statements ), afterDecls); }
    57137        if ( !empty( afterStmts ) ) { statements.splice( statements.end(), *afterStmts ); }
    58138        if ( !errors.isEmpty() ) { throw errors; }
     
    60140
    61141template< typename pass_type >
     142void PassVisitor< pass_type >::visitStatementList( std::list< Statement * > & statements ) {
     143        handleStatementList( statements, [this]( Statement * stmt) {
     144                stmt->accept( *this );
     145        });
     146}
     147
     148template< typename pass_type >
    62149void PassVisitor< pass_type >::mutateStatementList( std::list< Statement * > & statements ) {
    63         SemanticError errors;
     150        handleStatementList( statements, [this]( Statement *& stmt) {
     151                stmt = stmt->acceptMutator( *this );
     152        });
     153}
     154
     155
     156template< typename pass_type >
     157template< typename func_t >
     158Statement * 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 );
    64167
    65168        StmtList_t* beforeStmts = get_beforeStmts();
    66169        StmtList_t* afterStmts  = get_afterStmts();
    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 
    82 template< typename pass_type >
    83 Statement * 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; }
     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 )) );
    95176
    96177        CompoundStmt *compound = new CompoundStmt( noLabels );
     178        if( !empty(beforeDecls) ) { splice( std::back_inserter( compound->get_kids() ), beforeDecls ); }
    97179        if( !empty(beforeStmts) ) { compound->get_kids().splice( compound->get_kids().end(), *beforeStmts ); }
    98         compound->get_kids().push_back( stmt );
     180        compound->get_kids().push_back( newStmt );
     181        if( !empty(afterDecls) ) { splice( std::back_inserter( compound->get_kids() ), afterDecls ); }
    99182        if( !empty(afterStmts) ) { compound->get_kids().splice( compound->get_kids().end(), *afterStmts ); }
    100183        return compound;
     
    102185
    103186template< typename pass_type >
     187Statement * PassVisitor< pass_type >::visitStatement( Statement * stmt ) {
     188        return handleStatement( stmt, [this]( Statement * stmt ) {
     189                maybeAccept( stmt, *this );
     190                return stmt;
     191        });
     192}
     193
     194template< typename pass_type >
    104195Statement * 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 );
    118         if( !empty(beforeStmts) ) { compound->get_kids().splice( compound->get_kids().end(), *beforeStmts ); }
    119         compound->get_kids().push_back( newStmt );
    120         if( !empty(afterStmts) ) { compound->get_kids().splice( compound->get_kids().end(), *afterStmts ); }
    121         return compound;
    122 }
    123 
    124 
    125 
    126 template< typename pass_type >
    127 void PassVisitor< pass_type >::visitExpression( Expression * expr ) {
    128         if( !expr ) return;
     196        return handleStatement( stmt, [this]( Statement * stmt ) {
     197                return maybeMutate( stmt, *this );
     198        });
     199}
     200
     201template< typename pass_type >
     202template< typename func_t >
     203Expression * PassVisitor< pass_type >::handleExpression( Expression * expr, func_t func ) {
     204        if( !expr ) return nullptr;
    129205
    130206        auto env_ptr = get_env_ptr();
     
    132208                *env_ptr = expr->get_env();
    133209        }
    134         // xxx - should env be cloned (or moved) onto the result of the mutate?
    135         expr->accept( *this );
     210
     211        // should env be cloned (or moved) onto the result of the mutate?
     212        return func( expr );
     213}
     214
     215template< typename pass_type >
     216Expression * PassVisitor< pass_type >::visitExpression( Expression * expr ) {
     217        return handleExpression(expr, [this]( Expression * expr ) {
     218                expr->accept( *this );
     219                return expr;
     220        });
    136221}
    137222
    138223template< typename pass_type >
    139224Expression * PassVisitor< pass_type >::mutateExpression( Expression * expr ) {
    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 
     225        return handleExpression(expr, [this]( Expression * expr ) {
     226                return expr->acceptMutator( *this );
     227        });
     228}
    150229
    151230//------------------------------------------------------------------------------------------------------------------------------------------------------------------------
     
    153232template< typename pass_type >
    154233void PassVisitor< pass_type >::visit( ObjectDecl * node ) {
    155         VISIT_BODY( node ); 
     234        VISIT_BODY( node );
    156235}
    157236
    158237template< typename pass_type >
    159238void PassVisitor< pass_type >::visit( FunctionDecl * node ) {
    160         VISIT_BODY( node ); 
     239        VISIT_BODY( node );
    161240}
    162241
    163242template< typename pass_type >
    164243void PassVisitor< pass_type >::visit( StructDecl * node ) {
    165         VISIT_BODY( node ); 
     244        VISIT_BODY( node );
    166245}
    167246
    168247template< typename pass_type >
    169248void PassVisitor< pass_type >::visit( UnionDecl * node ) {
    170         VISIT_BODY( node ); 
     249        VISIT_BODY( node );
    171250}
    172251
    173252template< typename pass_type >
    174253void PassVisitor< pass_type >::visit( EnumDecl * node ) {
    175         VISIT_BODY( node ); 
     254        VISIT_BODY( node );
    176255}
    177256
    178257template< typename pass_type >
    179258void PassVisitor< pass_type >::visit( TraitDecl * node ) {
    180         VISIT_BODY( node ); 
     259        VISIT_BODY( node );
    181260}
    182261
    183262template< typename pass_type >
    184263void PassVisitor< pass_type >::visit( TypeDecl * node ) {
    185         VISIT_BODY( node ); 
     264        VISIT_BODY( node );
    186265}
    187266
    188267template< typename pass_type >
    189268void PassVisitor< pass_type >::visit( TypedefDecl * node ) {
    190         VISIT_BODY( node ); 
     269        VISIT_BODY( node );
    191270}
    192271
    193272template< typename pass_type >
    194273void PassVisitor< pass_type >::visit( AsmDecl * node ) {
    195         VISIT_BODY( node ); 
     274        VISIT_BODY( node );
    196275}
    197276
     
    225304void PassVisitor< pass_type >::visit( ExprStmt * node ) {
    226305        VISIT_START( node );
    227         call_beginScope();
    228306
    229307        visitExpression( node->get_expr() );
    230308
    231         call_endScope();
    232309        VISIT_END( node );
    233310}
     
    242319}
    243320
     321//--------------------------------------------------------------------------
     322// AsmStmt
    244323template< typename pass_type >
    245324void PassVisitor< pass_type >::visit( AsmStmt * node ) {
    246         VISIT_BODY( node );
     325        VISIT_BODY( node );
     326}
     327
     328template< typename pass_type >
     329Statement * PassVisitor< pass_type >::mutate( AsmStmt * node ) {
     330        MUTATE_BODY( Statement, node );
    247331}
    248332
     
    251335template< typename pass_type >
    252336void PassVisitor< pass_type >::visit( IfStmt * node ) {
    253         VISIT_START( node ); 
     337        VISIT_START( node );
    254338
    255339        visitExpression( node->get_condition() );
     
    262346template< typename pass_type >
    263347Statement * PassVisitor< pass_type >::mutate( IfStmt * node ) {
    264         MUTATE_START( node ); 
     348        MUTATE_START( node );
    265349
    266350        node->set_condition( mutateExpression( node->get_condition() ) );
     
    275359template< typename pass_type >
    276360void PassVisitor< pass_type >::visit( WhileStmt * node ) {
    277         VISIT_START( node ); 
     361        VISIT_START( node );
    278362
    279363        visitExpression( node->get_condition() );
     
    285369template< typename pass_type >
    286370Statement * PassVisitor< pass_type >::mutate( WhileStmt * node ) {
    287         MUTATE_START( node ); 
     371        MUTATE_START( node );
    288372
    289373        node->set_condition( mutateExpression( node->get_condition() ) );
     
    294378
    295379//--------------------------------------------------------------------------
    296 // WhileStmt
     380// ForStmt
    297381template< typename pass_type >
    298382void PassVisitor< pass_type >::visit( ForStmt * node ) {
    299         VISIT_START( node ); 
     383        VISIT_START( node );
    300384
    301385        acceptAll( node->get_initialization(), *this );
     
    309393template< typename pass_type >
    310394Statement * PassVisitor< pass_type >::mutate( ForStmt * node ) {
    311         MUTATE_START( node ); 
     395        MUTATE_START( node );
    312396
    313397        mutateAll( node->get_initialization(), *this );
     
    323407template< typename pass_type >
    324408void PassVisitor< pass_type >::visit( SwitchStmt * node ) {
    325         VISIT_START( node ); 
     409        VISIT_START( node );
    326410
    327411        visitExpression( node->get_condition() );
     
    333417template< typename pass_type >
    334418Statement * PassVisitor< pass_type >::mutate( SwitchStmt * node ) {
    335         MUTATE_START( node ); 
    336        
     419        MUTATE_START( node );
     420
    337421        node->set_condition( mutateExpression( node->get_condition() ) );
    338422        mutateStatementList( node->get_statements() );
    339        
     423
    340424        MUTATE_END( Statement, node );
    341425}
    342426
    343427//--------------------------------------------------------------------------
    344 // SwitchStmt
     428// CaseStmt
    345429template< typename pass_type >
    346430void PassVisitor< pass_type >::visit( CaseStmt * node ) {
    347         VISIT_START( node ); 
    348        
     431        VISIT_START( node );
     432
    349433        visitExpression( node->get_condition() );
    350434        visitStatementList( node->get_statements() );
    351        
     435
    352436        VISIT_END( node );
    353437}
     
    355439template< typename pass_type >
    356440Statement * PassVisitor< pass_type >::mutate( CaseStmt * node ) {
    357         MUTATE_START( node ); 
    358        
     441        MUTATE_START( node );
     442
    359443        node->set_condition(  mutateExpression( node->get_condition() ) );
    360444        mutateStatementList( node->get_statements() );
    361        
     445
    362446        MUTATE_END( Statement, node );
    363447}
    364448
     449//--------------------------------------------------------------------------
     450// BranchStmt
    365451template< typename pass_type >
    366452void PassVisitor< pass_type >::visit( BranchStmt * node ) {
    367         VISIT_BODY( node );
     453        VISIT_BODY( node );
     454}
     455
     456template< typename pass_type >
     457Statement * PassVisitor< pass_type >::mutate( BranchStmt * node ) {
     458        MUTATE_BODY( Statement, node );
    368459}
    369460
     
    386477
    387478        MUTATE_END( Statement, node );
     479}
     480
     481//--------------------------------------------------------------------------
     482// ThrowStmt
     483
     484template< typename pass_type >
     485void PassVisitor< pass_type >::visit( ThrowStmt * node ) {
     486        VISIT_BODY( node );
     487}
     488
     489template< typename pass_type >
     490Statement * PassVisitor< pass_type >::mutate( ThrowStmt * node ) {
     491        MUTATE_BODY( Statement, node );
    388492}
    389493
     
    396500        maybeAccept( node->get_block(), *this );
    397501        acceptAll( node->get_catchers(), *this );
     502        maybeAccept( node->get_finally(), *this );
    398503
    399504        VISIT_END( node );
     
    406511        node->set_block(  maybeMutate( node->get_block(), *this ) );
    407512        mutateAll( node->get_catchers(), *this );
    408        
     513        node->set_finally( maybeMutate( node->get_finally(), *this ) );
     514
    409515        MUTATE_END( Statement, node );
    410516}
     
    416522        VISIT_START( node );
    417523
     524        maybeAccept( node->get_decl(), *this );
     525        node->set_cond( visitExpression( node->get_cond() ) );
    418526        node->set_body( visitStatement( node->get_body() ) );
    419         maybeAccept( node->get_decl(), *this );
    420527
    421528        VISIT_END( node );
     
    425532Statement * PassVisitor< pass_type >::mutate( CatchStmt * node ) {
    426533        MUTATE_START( node );
    427        
    428         node->set_body(  mutateStatement( node->get_body() ) );
    429         node->set_decl(  maybeMutate( node->get_decl(), *this ) );
    430        
     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
    431539        MUTATE_END( Statement, node );
    432540}
     
    434542template< typename pass_type >
    435543void PassVisitor< pass_type >::visit( FinallyStmt * node ) {
    436         VISIT_BODY( node ); 
     544        VISIT_BODY( node );
    437545}
    438546
    439547template< typename pass_type >
    440548void PassVisitor< pass_type >::visit( NullStmt * node ) {
    441         VISIT_BODY( node ); 
     549        VISIT_BODY( node );
    442550}
    443551
    444552template< typename pass_type >
    445553void PassVisitor< pass_type >::visit( DeclStmt * node ) {
    446         VISIT_BODY( node ); 
     554        VISIT_BODY( node );
    447555}
    448556
    449557template< typename pass_type >
    450558void PassVisitor< pass_type >::visit( ImplicitCtorDtorStmt * node ) {
    451         VISIT_BODY( node ); 
     559        VISIT_BODY( node );
    452560}
    453561
    454562template< typename pass_type >
    455563void PassVisitor< pass_type >::visit( ApplicationExpr * node ) {
    456         VISIT_BODY( node ); 
     564        VISIT_BODY( node );
    457565}
    458566
     
    462570void PassVisitor< pass_type >::visit( UntypedExpr * node ) {
    463571        VISIT_START( node );
     572
     573        // maybeAccept( node->get_env(), *this );
     574        maybeAccept( node->get_result(), *this );
    464575
    465576        for ( auto expr : node->get_args() ) {
     
    474585        MUTATE_START( node );
    475586
     587        node->set_env( maybeMutate( node->get_env(), *this ) );
     588        node->set_result( maybeMutate( node->get_result(), *this ) );
     589
    476590        for ( auto& expr : node->get_args() ) {
    477591                expr = mutateExpression( expr );
     
    483597template< typename pass_type >
    484598void PassVisitor< pass_type >::visit( NameExpr * node ) {
    485         VISIT_BODY( node ); 
     599        VISIT_BODY( node );
    486600}
    487601
    488602template< typename pass_type >
    489603void PassVisitor< pass_type >::visit( CastExpr * node ) {
    490         VISIT_BODY( node ); 
     604        VISIT_BODY( node );
    491605}
    492606
    493607template< typename pass_type >
    494608void PassVisitor< pass_type >::visit( AddressExpr * node ) {
    495         VISIT_BODY( node ); 
     609        VISIT_BODY( node );
    496610}
    497611
    498612template< typename pass_type >
    499613void PassVisitor< pass_type >::visit( LabelAddressExpr * node ) {
    500         VISIT_BODY( node ); 
     614        VISIT_BODY( node );
    501615}
    502616
    503617template< typename pass_type >
    504618void PassVisitor< pass_type >::visit( UntypedMemberExpr * node ) {
    505         VISIT_BODY( node ); 
     619        VISIT_BODY( node );
    506620}
    507621
    508622template< typename pass_type >
    509623void PassVisitor< pass_type >::visit( MemberExpr * node ) {
    510         VISIT_BODY( node ); 
     624        VISIT_BODY( node );
    511625}
    512626
    513627template< typename pass_type >
    514628void PassVisitor< pass_type >::visit( VariableExpr * node ) {
    515         VISIT_BODY( node ); 
     629        VISIT_BODY( node );
    516630}
    517631
    518632template< typename pass_type >
    519633void PassVisitor< pass_type >::visit( ConstantExpr * node ) {
    520         VISIT_BODY( node ); 
     634        VISIT_BODY( node );
    521635}
    522636
    523637template< typename pass_type >
    524638void PassVisitor< pass_type >::visit( SizeofExpr * node ) {
    525         VISIT_BODY( node ); 
     639        VISIT_BODY( node );
    526640}
    527641
    528642template< typename pass_type >
    529643void PassVisitor< pass_type >::visit( AlignofExpr * node ) {
    530         VISIT_BODY( node ); 
     644        VISIT_BODY( node );
    531645}
    532646
    533647template< typename pass_type >
    534648void PassVisitor< pass_type >::visit( UntypedOffsetofExpr * node ) {
    535         VISIT_BODY( node ); 
     649        VISIT_BODY( node );
    536650}
    537651
    538652template< typename pass_type >
    539653void PassVisitor< pass_type >::visit( OffsetofExpr * node ) {
    540         VISIT_BODY( node ); 
     654        VISIT_BODY( node );
    541655}
    542656
    543657template< typename pass_type >
    544658void PassVisitor< pass_type >::visit( OffsetPackExpr * node ) {
    545         VISIT_BODY( node ); 
     659        VISIT_BODY( node );
    546660}
    547661
    548662template< typename pass_type >
    549663void PassVisitor< pass_type >::visit( AttrExpr * node ) {
    550         VISIT_BODY( node ); 
     664        VISIT_BODY( node );
    551665}
    552666
    553667template< typename pass_type >
    554668void PassVisitor< pass_type >::visit( LogicalExpr * node ) {
    555         VISIT_BODY( node ); 
     669        VISIT_BODY( node );
    556670}
    557671
    558672template< typename pass_type >
    559673void PassVisitor< pass_type >::visit( ConditionalExpr * node ) {
    560         VISIT_BODY( node ); 
     674        VISIT_BODY( node );
    561675}
    562676
    563677template< typename pass_type >
    564678void PassVisitor< pass_type >::visit( CommaExpr * node ) {
    565         VISIT_BODY( node ); 
     679        VISIT_BODY( node );
    566680}
    567681
    568682template< typename pass_type >
    569683void PassVisitor< pass_type >::visit( TypeExpr * node ) {
    570         VISIT_BODY( node ); 
     684        VISIT_BODY( node );
    571685}
    572686
    573687template< typename pass_type >
    574688void PassVisitor< pass_type >::visit( AsmExpr * node ) {
    575         VISIT_BODY( node ); 
     689        VISIT_BODY( node );
    576690}
    577691
    578692template< typename pass_type >
    579693void PassVisitor< pass_type >::visit( ImplicitCopyCtorExpr * node ) {
    580         VISIT_BODY( node ); 
     694        VISIT_BODY( node );
    581695}
    582696
    583697template< typename pass_type >
    584698void PassVisitor< pass_type >::visit( ConstructorExpr * node ) {
    585         VISIT_BODY( node ); 
     699        VISIT_BODY( node );
    586700}
    587701
    588702template< typename pass_type >
    589703void PassVisitor< pass_type >::visit( CompoundLiteralExpr * node ) {
    590         VISIT_BODY( node );
    591 }
    592 
    593 template< typename pass_type >
    594 void PassVisitor< pass_type >::visit( UntypedValofExpr * node ) {
    595         VISIT_BODY( node );
     704        VISIT_BODY( node );
    596705}
    597706
    598707template< typename pass_type >
    599708void PassVisitor< pass_type >::visit( RangeExpr * node ) {
    600         VISIT_BODY( node ); 
     709        VISIT_BODY( node );
    601710}
    602711
    603712template< typename pass_type >
    604713void PassVisitor< pass_type >::visit( UntypedTupleExpr * node ) {
    605         VISIT_BODY( node ); 
     714        VISIT_BODY( node );
    606715}
    607716
    608717template< typename pass_type >
    609718void PassVisitor< pass_type >::visit( TupleExpr * node ) {
    610         VISIT_BODY( node ); 
     719        VISIT_BODY( node );
    611720}
    612721
    613722template< typename pass_type >
    614723void PassVisitor< pass_type >::visit( TupleIndexExpr * node ) {
    615         VISIT_BODY( node );
    616 }
    617 
    618 template< typename pass_type >
    619 void PassVisitor< pass_type >::visit( MemberTupleExpr * node ) {
    620         VISIT_BODY( node );
     724        VISIT_BODY( node );
    621725}
    622726
    623727template< typename pass_type >
    624728void PassVisitor< pass_type >::visit( TupleAssignExpr * node ) {
    625         VISIT_BODY( node ); 
     729        VISIT_BODY( node );
    626730}
    627731
     
    645749Expression * PassVisitor< pass_type >::mutate( StmtExpr * node ) {
    646750        MUTATE_START( node );
    647        
     751
    648752        // don't want statements from outer CompoundStmts to be added to this StmtExpr
    649753        ValueGuardPtr< TypeSubstitution * >      oldEnv        ( get_env_ptr() );
     
    658762template< typename pass_type >
    659763void PassVisitor< pass_type >::visit( UniqueExpr * node ) {
    660         VISIT_BODY( node ); 
     764        VISIT_BODY( node );
    661765}
    662766
    663767template< typename pass_type >
    664768void PassVisitor< pass_type >::visit( VoidType * node ) {
    665         VISIT_BODY( node ); 
     769        VISIT_BODY( node );
    666770}
    667771
    668772template< typename pass_type >
    669773void PassVisitor< pass_type >::visit( BasicType * node ) {
    670         VISIT_BODY( node ); 
     774        VISIT_BODY( node );
    671775}
    672776
    673777template< typename pass_type >
    674778void PassVisitor< pass_type >::visit( PointerType * node ) {
    675         VISIT_BODY( node ); 
     779        VISIT_BODY( node );
    676780}
    677781
    678782template< typename pass_type >
    679783void PassVisitor< pass_type >::visit( ArrayType * node ) {
    680         VISIT_BODY( node ); 
     784        VISIT_BODY( node );
    681785}
    682786
    683787template< typename pass_type >
    684788void PassVisitor< pass_type >::visit( FunctionType * node ) {
    685         VISIT_BODY( node ); 
     789        VISIT_BODY( node );
    686790}
    687791
    688792template< typename pass_type >
    689793void PassVisitor< pass_type >::visit( StructInstType * node ) {
    690         VISIT_BODY( node ); 
     794        VISIT_BODY( node );
    691795}
    692796
    693797template< typename pass_type >
    694798void PassVisitor< pass_type >::visit( UnionInstType * node ) {
    695         VISIT_BODY( node ); 
     799        VISIT_BODY( node );
    696800}
    697801
    698802template< typename pass_type >
    699803void PassVisitor< pass_type >::visit( EnumInstType * node ) {
    700         VISIT_BODY( node ); 
     804        VISIT_BODY( node );
    701805}
    702806
    703807template< typename pass_type >
    704808void PassVisitor< pass_type >::visit( TraitInstType * node ) {
    705         VISIT_BODY( node ); 
     809        VISIT_BODY( node );
    706810}
    707811
    708812template< typename pass_type >
    709813void PassVisitor< pass_type >::visit( TypeInstType * node ) {
    710         VISIT_BODY( node ); 
     814        VISIT_BODY( node );
    711815}
    712816
    713817template< typename pass_type >
    714818void PassVisitor< pass_type >::visit( TupleType * node ) {
    715         VISIT_BODY( node ); 
     819        VISIT_BODY( node );
    716820}
    717821
    718822template< typename pass_type >
    719823void PassVisitor< pass_type >::visit( TypeofType * node ) {
    720         VISIT_BODY( node ); 
     824        VISIT_BODY( node );
    721825}
    722826
    723827template< typename pass_type >
    724828void PassVisitor< pass_type >::visit( AttrType * node ) {
    725         VISIT_BODY( node ); 
     829        VISIT_BODY( node );
    726830}
    727831
    728832template< typename pass_type >
    729833void PassVisitor< pass_type >::visit( VarArgsType * node ) {
    730         VISIT_BODY( node ); 
     834        VISIT_BODY( node );
    731835}
    732836
    733837template< typename pass_type >
    734838void PassVisitor< pass_type >::visit( ZeroType * node ) {
    735         VISIT_BODY( node ); 
     839        VISIT_BODY( node );
    736840}
    737841
    738842template< typename pass_type >
    739843void PassVisitor< pass_type >::visit( OneType * node ) {
    740         VISIT_BODY( node ); 
     844        VISIT_BODY( node );
    741845}
    742846
     
    763867template< typename pass_type >
    764868void PassVisitor< pass_type >::visit( ListInit * node ) {
    765         VISIT_BODY( node ); 
     869        VISIT_BODY( node );
    766870}
    767871
    768872template< typename pass_type >
    769873void PassVisitor< pass_type >::visit( ConstructorInit * node ) {
    770         VISIT_BODY( node ); 
     874        VISIT_BODY( node );
    771875}
    772876
    773877template< typename pass_type >
    774878void PassVisitor< pass_type >::visit( Subrange * node ) {
    775         VISIT_BODY( node ); 
     879        VISIT_BODY( node );
    776880}
    777881
    778882template< typename pass_type >
    779883void PassVisitor< pass_type >::visit( Constant * node ) {
    780         VISIT_BODY( node ); 
     884        VISIT_BODY( node );
    781885}
    782886
     
    829933
    830934template< typename pass_type >
    831 Statement * PassVisitor< pass_type >::mutate( AsmStmt * node ) {
    832         MUTATE_BODY( Statement, node );
    833 }
    834 
    835 template< typename pass_type >
    836 Statement * PassVisitor< pass_type >::mutate( BranchStmt * node ) {
    837         MUTATE_BODY( Statement, node );
    838 }
    839 
    840 template< typename pass_type >
    841935Statement * PassVisitor< pass_type >::mutate( FinallyStmt * node ) {
    842936        MUTATE_BODY( Statement, node );
     
    9741068
    9751069template< typename pass_type >
    976 Expression * PassVisitor< pass_type >::mutate( UntypedValofExpr * node ) {
    977         MUTATE_BODY( Expression, node );
    978 }
    979 
    980 template< typename pass_type >
    9811070Expression * PassVisitor< pass_type >::mutate( RangeExpr * node ) {
    9821071        MUTATE_BODY( Expression, node );
     
    9951084template< typename pass_type >
    9961085Expression * PassVisitor< pass_type >::mutate( TupleIndexExpr * node ) {
    997         MUTATE_BODY( Expression, node );
    998 }
    999 
    1000 template< typename pass_type >
    1001 Expression * PassVisitor< pass_type >::mutate( MemberTupleExpr * node ) {
    10021086        MUTATE_BODY( Expression, node );
    10031087}
Note: See TracChangeset for help on using the changeset viewer.