Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/AST/Pass.impl.hpp

    re21f253 r6b2d444  
    3333        /* call the implementation of the previsit of this pass */ \
    3434        __pass::previsit( core, node, 0 );
     35
     36#define VISIT( code... ) \
     37        /* if this node should visit its children */ \
     38        if ( __visit_children() ) { \
     39                /* visit the children */ \
     40                code \
     41        }
    3542
    3643#define VISIT_END( type, node ) \
     
    445452        VISIT_START( node );
    446453
    447         if ( __visit_children() ) {
     454        VISIT(
    448455                {
    449456                        guard_symtab guard { *this };
     
    453460                maybe_accept( node, &ObjectDecl::bitfieldWidth );
    454461                maybe_accept( node, &ObjectDecl::attributes    );
    455         }
     462        )
    456463
    457464        __pass::symtab::addId( core, 0, node );
     
    468475        __pass::symtab::addId( core, 0, node );
    469476
    470         if ( __visit_children() ) {
    471                 maybe_accept( node, &FunctionDecl::withExprs );
    472         }
     477        VISIT(maybe_accept( node, &FunctionDecl::withExprs );)
    473478        {
    474479                // with clause introduces a level of scope (for the with expression members).
     
    488493                        } };
    489494                        __pass::symtab::addId( core, 0, func );
    490                         if ( __visit_children() ) {
     495                        VISIT(
    491496                                // parameter declarations
    492497                                maybe_accept( node, &FunctionDecl::params );
     
    504509                                maybe_accept( node, &FunctionDecl::stmts );
    505510                                maybe_accept( node, &FunctionDecl::attributes );
    506                         }
     511                        )
    507512                }
    508513        }
     
    521526        __pass::symtab::addStructFwd( core, 0, node );
    522527
    523         if ( __visit_children() ) {
     528        VISIT({
    524529                guard_symtab guard { * this };
    525530                maybe_accept( node, &StructDecl::params     );
    526531                maybe_accept( node, &StructDecl::members    );
    527532                maybe_accept( node, &StructDecl::attributes );
    528         }
     533        })
    529534
    530535        // this addition replaces the forward declaration
     
    543548        __pass::symtab::addUnionFwd( core, 0, node );
    544549
    545         if ( __visit_children() ) {
     550        VISIT({
    546551                guard_symtab guard { * this };
    547552                maybe_accept( node, &UnionDecl::params     );
    548553                maybe_accept( node, &UnionDecl::members    );
    549554                maybe_accept( node, &UnionDecl::attributes );
    550         }
     555        })
    551556
    552557        __pass::symtab::addUnion( core, 0, node );
     
    563568        __pass::symtab::addEnum( core, 0, node );
    564569
    565         if ( __visit_children() ) {
     570        VISIT(
    566571                // unlike structs, traits, and unions, enums inject their members into the global scope
    567572                maybe_accept( node, &EnumDecl::params     );
    568573                maybe_accept( node, &EnumDecl::members    );
    569574                maybe_accept( node, &EnumDecl::attributes );
    570         }
     575        )
    571576
    572577        VISIT_END( Decl, node );
     
    579584        VISIT_START( node );
    580585
    581         if ( __visit_children() ) {
     586        VISIT({
    582587                guard_symtab guard { *this };
    583588                maybe_accept( node, &TraitDecl::params     );
    584589                maybe_accept( node, &TraitDecl::members    );
    585590                maybe_accept( node, &TraitDecl::attributes );
    586         }
     591        })
    587592
    588593        __pass::symtab::addTrait( core, 0, node );
     
    597602        VISIT_START( node );
    598603
    599         if ( __visit_children() ) {
     604        VISIT({
    600605                guard_symtab guard { *this };
    601606                maybe_accept( node, &TypeDecl::base   );
    602         }
     607        })
    603608
    604609        // see A NOTE ON THE ORDER OF TRAVERSAL, above
     
    607612        __pass::symtab::addType( core, 0, node );
    608613
    609         if ( __visit_children() ) {
     614        VISIT(
    610615                maybe_accept( node, &TypeDecl::assertions );
    611616
     
    614619                        maybe_accept( node, &TypeDecl::init );
    615620                }
    616         }
     621        )
    617622
    618623        VISIT_END( Decl, node );
     
    625630        VISIT_START( node );
    626631
    627         if ( __visit_children() ) {
     632        VISIT({
    628633                guard_symtab guard { *this };
    629634                maybe_accept( node, &TypedefDecl::base   );
    630         }
     635        })
    631636
    632637        __pass::symtab::addType( core, 0, node );
    633638
    634         if ( __visit_children() ) {
    635                 maybe_accept( node, &TypedefDecl::assertions );
    636         }
     639        VISIT( maybe_accept( node, &TypedefDecl::assertions ); )
    637640
    638641        VISIT_END( Decl, node );
     
    645648        VISIT_START( node );
    646649
    647         if ( __visit_children() ) {
     650        VISIT(
    648651                maybe_accept( node, &AsmDecl::stmt );
    649         }
     652        )
    650653
    651654        VISIT_END( AsmDecl, node );
     
    658661        VISIT_START( node );
    659662
    660         if ( __visit_children() ) {
     663        VISIT(
    661664                maybe_accept( node, &DirectiveDecl::stmt );
    662         }
     665        )
    663666
    664667        VISIT_END( DirectiveDecl, node );
     
    671674        VISIT_START( node );
    672675
    673         if ( __visit_children() ) {
     676        VISIT(
    674677                maybe_accept( node, &StaticAssertDecl::cond );
    675678                maybe_accept( node, &StaticAssertDecl::msg  );
    676         }
     679        )
    677680
    678681        VISIT_END( StaticAssertDecl, node );
     
    684687const ast::CompoundStmt * ast::Pass< core_t >::visit( const ast::CompoundStmt * node ) {
    685688        VISIT_START( node );
    686 
    687         if ( __visit_children() ) {
     689        VISIT(
    688690                // Do not enter (or leave) a new scope if atFunctionTop. Remember to save the result.
    689691                auto guard1 = makeFuncGuard( [this, enterScope = !this->atFunctionTop]() {
     
    702704                guard_scope guard3 { *this };
    703705                maybe_accept( node, &CompoundStmt::kids );
    704         }
    705 
     706        )
    706707        VISIT_END( CompoundStmt, node );
    707708}
     
    713714        VISIT_START( node );
    714715
    715         if ( __visit_children() ) {
     716        VISIT(
    716717                maybe_accept( node, &ExprStmt::expr );
    717         }
     718        )
    718719
    719720        VISIT_END( Stmt, node );
     
    726727        VISIT_START( node )
    727728
    728         if ( __visit_children() ) {
     729        VISIT(
    729730                maybe_accept( node, &AsmStmt::instruction );
    730731                maybe_accept( node, &AsmStmt::output      );
    731732                maybe_accept( node, &AsmStmt::input       );
    732733                maybe_accept( node, &AsmStmt::clobber     );
    733         }
     734        )
    734735
    735736        VISIT_END( Stmt, node );
     
    751752        VISIT_START( node );
    752753
    753         if ( __visit_children() ) {
     754        VISIT({
    754755                // if statements introduce a level of scope (for the initialization)
    755756                guard_symtab guard { *this };
     
    758759                maybe_accept_as_compound( node, &IfStmt::thenPart );
    759760                maybe_accept_as_compound( node, &IfStmt::elsePart );
    760         }
     761        })
    761762
    762763        VISIT_END( Stmt, node );
     
    769770        VISIT_START( node );
    770771
    771         if ( __visit_children() ) {
     772        VISIT({
    772773                // while statements introduce a level of scope (for the initialization)
    773774                guard_symtab guard { *this };
     
    775776                maybe_accept( node, &WhileStmt::cond  );
    776777                maybe_accept_as_compound( node, &WhileStmt::body  );
    777         }
     778        })
    778779
    779780        VISIT_END( Stmt, node );
     
    786787        VISIT_START( node );
    787788
    788         if ( __visit_children() ) {
     789        VISIT({
    789790                // for statements introduce a level of scope (for the initialization)
    790791                guard_symtab guard { *this };
     
    794795                maybe_accept( node, &ForStmt::inc   );
    795796                maybe_accept_as_compound( node, &ForStmt::body  );
    796         }
     797        })
    797798
    798799        VISIT_END( Stmt, node );
     
    805806        VISIT_START( node );
    806807
    807         if ( __visit_children() ) {
     808        VISIT(
    808809                maybe_accept( node, &SwitchStmt::cond  );
    809810                maybe_accept( node, &SwitchStmt::stmts );
    810         }
     811        )
    811812
    812813        VISIT_END( Stmt, node );
     
    819820        VISIT_START( node );
    820821
    821         if ( __visit_children() ) {
     822        VISIT(
    822823                maybe_accept( node, &CaseStmt::cond  );
    823824                maybe_accept( node, &CaseStmt::stmts );
    824         }
     825        )
    825826
    826827        VISIT_END( Stmt, node );
     
    841842        VISIT_START( node );
    842843
    843         if ( __visit_children() ) {
     844        VISIT(
    844845                maybe_accept( node, &ReturnStmt::expr );
    845         }
     846        )
    846847
    847848        VISIT_END( Stmt, node );
     
    854855        VISIT_START( node );
    855856
    856         if ( __visit_children() ) {
     857        VISIT(
    857858                maybe_accept( node, &ThrowStmt::expr   );
    858859                maybe_accept( node, &ThrowStmt::target );
    859         }
     860        )
    860861
    861862        VISIT_END( Stmt, node );
     
    868869        VISIT_START( node );
    869870
    870         if ( __visit_children() ) {
     871        VISIT(
    871872                maybe_accept( node, &TryStmt::body     );
    872873                maybe_accept( node, &TryStmt::handlers );
    873874                maybe_accept( node, &TryStmt::finally  );
    874         }
     875        )
    875876
    876877        VISIT_END( Stmt, node );
     
    883884        VISIT_START( node );
    884885
    885         if ( __visit_children() ) {
     886        VISIT({
    886887                // catch statements introduce a level of scope (for the caught exception)
    887888                guard_symtab guard { *this };
     
    889890                maybe_accept( node, &CatchStmt::cond );
    890891                maybe_accept_as_compound( node, &CatchStmt::body );
    891         }
     892        })
    892893
    893894        VISIT_END( Stmt, node );
     
    900901        VISIT_START( node );
    901902
    902         if ( __visit_children() ) {
     903        VISIT(
    903904                maybe_accept( node, &FinallyStmt::body );
    904         }
     905        )
    905906
    906907        VISIT_END( Stmt, node );
     
    913914        VISIT_START( node );
    914915
    915         if ( __visit_children() ) {
     916        VISIT(
    916917                maybe_accept( node, &SuspendStmt::then   );
    917         }
     918        )
    918919
    919920        VISIT_END( Stmt, node );
     
    933934                // }
    934935
    935         if ( __visit_children() ) {
     936        VISIT({
    936937                std::vector<WaitForStmt::Clause> new_clauses;
    937938                new_clauses.reserve( node->clauses.size() );
     
    964965                        node = n;
    965966                }
    966         }
     967        })
    967968
    968969        #define maybe_accept(field) \
     
    976977                }
    977978
    978         if ( __visit_children() ) {
     979        VISIT(
    979980                maybe_accept( timeout.time );
    980981                maybe_accept( timeout.stmt );
     
    982983                maybe_accept( orElse.stmt  );
    983984                maybe_accept( orElse.cond  );
    984         }
     985        )
    985986
    986987        #undef maybe_accept
     
    995996        VISIT_START( node );
    996997
    997         if ( __visit_children() ) {
     998        VISIT(
    998999                maybe_accept( node, &WithStmt::exprs );
    9991000                {
     
    10031004                        maybe_accept( node, &WithStmt::stmt );
    10041005                }
    1005         }
    1006 
     1006        )
    10071007        VISIT_END( Stmt, node );
    10081008}
     
    10221022        VISIT_START( node );
    10231023
    1024         if ( __visit_children() ) {
     1024        VISIT(
    10251025                maybe_accept( node, &DeclStmt::decl );
    1026         }
     1026        )
    10271027
    10281028        VISIT_END( Stmt, node );
     
    10371037        // For now this isn't visited, it is unclear if this causes problem
    10381038        // if all tests are known to pass, remove this code
    1039         if ( __visit_children() ) {
     1039        VISIT(
    10401040                maybe_accept( node, &ImplicitCtorDtorStmt::callStmt );
    1041         }
     1041        )
    10421042
    10431043        VISIT_END( Stmt, node );
     
    10501050        VISIT_START( node );
    10511051
    1052         if ( __visit_children() ) {
    1053                 // mutex statements introduce a level of scope (for the initialization)
    1054                 guard_symtab guard { *this };
    1055                 maybe_accept( node, &MutexStmt::stmt );
     1052        VISIT(
    10561053                maybe_accept( node, &MutexStmt::mutexObjs );
    1057         }
     1054                {
     1055                        // mutex statements introduce a level of scope (for the initialization)
     1056                        guard_symtab guard { *this };
     1057                        maybe_accept( node, &MutexStmt::stmt );
     1058                       
     1059                }
     1060        )
    10581061
    10591062        VISIT_END( Stmt, node );
     
    10661069        VISIT_START( node );
    10671070
    1068         if ( __visit_children() ) {
     1071        VISIT(
    10691072                {
    10701073                        guard_symtab guard { *this };
     
    10731076                maybe_accept( node, &ApplicationExpr::func );
    10741077                maybe_accept( node, &ApplicationExpr::args );
    1075         }
     1078        )
    10761079
    10771080        VISIT_END( Expr, node );
     
    10841087        VISIT_START( node );
    10851088
    1086         if ( __visit_children() ) {
     1089        VISIT(
    10871090                {
    10881091                        guard_symtab guard { *this };
     
    10911094
    10921095                maybe_accept( node, &UntypedExpr::args );
    1093         }
     1096        )
    10941097
    10951098        VISIT_END( Expr, node );
     
    11021105        VISIT_START( node );
    11031106
    1104         if ( __visit_children() ) {
     1107        VISIT({
    11051108                guard_symtab guard { *this };
    11061109                maybe_accept( node, &NameExpr::result );
    1107         }
     1110        })
    11081111
    11091112        VISIT_END( Expr, node );
     
    11161119        VISIT_START( node );
    11171120
    1118         if ( __visit_children() ) {
    1119                 {
     1121        VISIT({
    11201122                        guard_symtab guard { *this };
    11211123                        maybe_accept( node, &CastExpr::result );
    11221124                }
    11231125                maybe_accept( node, &CastExpr::arg );
    1124         }
     1126        )
    11251127
    11261128        VISIT_END( Expr, node );
     
    11331135        VISIT_START( node );
    11341136
    1135         if ( __visit_children() ) {
    1136                 {
     1137        VISIT({
    11371138                        guard_symtab guard { *this };
    11381139                        maybe_accept( node, &KeywordCastExpr::result );
    11391140                }
    11401141                maybe_accept( node, &KeywordCastExpr::arg );
    1141         }
     1142        )
    11421143
    11431144        VISIT_END( Expr, node );
     
    11501151        VISIT_START( node );
    11511152
    1152         if ( __visit_children() ) {
    1153                 {
     1153        VISIT({
    11541154                        guard_symtab guard { *this };
    11551155                        maybe_accept( node, &VirtualCastExpr::result );
    11561156                }
    11571157                maybe_accept( node, &VirtualCastExpr::arg );
    1158         }
     1158        )
    11591159
    11601160        VISIT_END( Expr, node );
     
    11671167        VISIT_START( node );
    11681168
    1169         if ( __visit_children() ) {
    1170                 {
     1169        VISIT({
    11711170                        guard_symtab guard { *this };
    11721171                        maybe_accept( node, &AddressExpr::result );
    11731172                }
    11741173                maybe_accept( node, &AddressExpr::arg );
    1175         }
     1174        )
    11761175
    11771176        VISIT_END( Expr, node );
     
    11841183        VISIT_START( node );
    11851184
    1186         if ( __visit_children() ) {
     1185        VISIT({
    11871186                guard_symtab guard { *this };
    11881187                maybe_accept( node, &LabelAddressExpr::result );
    1189         }
     1188        })
    11901189
    11911190        VISIT_END( Expr, node );
     
    11981197        VISIT_START( node );
    11991198
    1200         if ( __visit_children() ) {
    1201                 {
     1199        VISIT({
    12021200                        guard_symtab guard { *this };
    12031201                        maybe_accept( node, &UntypedMemberExpr::result );
     
    12051203                maybe_accept( node, &UntypedMemberExpr::aggregate );
    12061204                maybe_accept( node, &UntypedMemberExpr::member    );
    1207         }
     1205        )
    12081206
    12091207        VISIT_END( Expr, node );
     
    12161214        VISIT_START( node );
    12171215
    1218         if ( __visit_children() ) {
    1219                 {
     1216        VISIT({
    12201217                        guard_symtab guard { *this };
    12211218                        maybe_accept( node, &MemberExpr::result );
    12221219                }
    12231220                maybe_accept( node, &MemberExpr::aggregate );
    1224         }
     1221        )
    12251222
    12261223        VISIT_END( Expr, node );
     
    12331230        VISIT_START( node );
    12341231
    1235         if ( __visit_children() ) {
     1232        VISIT({
    12361233                guard_symtab guard { *this };
    12371234                maybe_accept( node, &VariableExpr::result );
    1238         }
     1235        })
    12391236
    12401237        VISIT_END( Expr, node );
     
    12471244        VISIT_START( node );
    12481245
    1249         if ( __visit_children() ) {
     1246        VISIT({
    12501247                guard_symtab guard { *this };
    12511248                maybe_accept( node, &ConstantExpr::result );
    1252         }
     1249        })
    12531250
    12541251        VISIT_END( Expr, node );
     
    12611258        VISIT_START( node );
    12621259
    1263         if ( __visit_children() ) {
    1264                 {
     1260        VISIT({
    12651261                        guard_symtab guard { *this };
    12661262                        maybe_accept( node, &SizeofExpr::result );
     
    12711267                        maybe_accept( node, &SizeofExpr::expr );
    12721268                }
    1273         }
     1269        )
    12741270
    12751271        VISIT_END( Expr, node );
     
    12821278        VISIT_START( node );
    12831279
    1284         if ( __visit_children() ) {
    1285                 {
     1280        VISIT({
    12861281                        guard_symtab guard { *this };
    12871282                        maybe_accept( node, &AlignofExpr::result );
     
    12921287                        maybe_accept( node, &AlignofExpr::expr );
    12931288                }
    1294         }
     1289        )
    12951290
    12961291        VISIT_END( Expr, node );
     
    13031298        VISIT_START( node );
    13041299
    1305         if ( __visit_children() ) {
    1306                 {
     1300        VISIT({
    13071301                        guard_symtab guard { *this };
    13081302                        maybe_accept( node, &UntypedOffsetofExpr::result );
    13091303                }
    13101304                maybe_accept( node, &UntypedOffsetofExpr::type   );
    1311         }
     1305        )
    13121306
    13131307        VISIT_END( Expr, node );
     
    13201314        VISIT_START( node );
    13211315
    1322         if ( __visit_children() ) {
    1323                 {
     1316        VISIT({
    13241317                        guard_symtab guard { *this };
    13251318                        maybe_accept( node, &OffsetofExpr::result );
    13261319                }
    13271320                maybe_accept( node, &OffsetofExpr::type   );
    1328         }
     1321        )
    13291322
    13301323        VISIT_END( Expr, node );
     
    13371330        VISIT_START( node );
    13381331
    1339         if ( __visit_children() ) {
    1340                 {
     1332        VISIT({
    13411333                        guard_symtab guard { *this };
    13421334                        maybe_accept( node, &OffsetPackExpr::result );
    13431335                }
    13441336                maybe_accept( node, &OffsetPackExpr::type   );
    1345         }
     1337        )
    13461338
    13471339        VISIT_END( Expr, node );
     
    13541346        VISIT_START( node );
    13551347
    1356         if ( __visit_children() ) {
    1357                 {
     1348        VISIT({
    13581349                        guard_symtab guard { *this };
    13591350                        maybe_accept( node, &LogicalExpr::result );
     
    13611352                maybe_accept( node, &LogicalExpr::arg1 );
    13621353                maybe_accept( node, &LogicalExpr::arg2 );
    1363         }
     1354        )
    13641355
    13651356        VISIT_END( Expr, node );
     
    13721363        VISIT_START( node );
    13731364
    1374         if ( __visit_children() ) {
    1375                 {
     1365        VISIT({
    13761366                        guard_symtab guard { *this };
    13771367                        maybe_accept( node, &ConditionalExpr::result );
     
    13801370                maybe_accept( node, &ConditionalExpr::arg2 );
    13811371                maybe_accept( node, &ConditionalExpr::arg3 );
    1382         }
     1372        )
    13831373
    13841374        VISIT_END( Expr, node );
     
    13911381        VISIT_START( node );
    13921382
    1393         if ( __visit_children() ) {
    1394                 {
     1383        VISIT({
    13951384                        guard_symtab guard { *this };
    13961385                        maybe_accept( node, &CommaExpr::result );
     
    13981387                maybe_accept( node, &CommaExpr::arg1 );
    13991388                maybe_accept( node, &CommaExpr::arg2 );
    1400         }
     1389        )
    14011390
    14021391        VISIT_END( Expr, node );
     
    14091398        VISIT_START( node );
    14101399
    1411         if ( __visit_children() ) {
    1412                 {
     1400        VISIT({
    14131401                        guard_symtab guard { *this };
    14141402                        maybe_accept( node, &TypeExpr::result );
    14151403                }
    14161404                maybe_accept( node, &TypeExpr::type );
    1417         }
     1405        )
    14181406
    14191407        VISIT_END( Expr, node );
     
    14261414        VISIT_START( node );
    14271415
    1428         if ( __visit_children() ) {
    1429                 {
     1416        VISIT({
    14301417                        guard_symtab guard { *this };
    14311418                        maybe_accept( node, &AsmExpr::result );
     
    14331420                maybe_accept( node, &AsmExpr::constraint );
    14341421                maybe_accept( node, &AsmExpr::operand    );
    1435         }
     1422        )
    14361423
    14371424        VISIT_END( Expr, node );
     
    14441431        VISIT_START( node );
    14451432
    1446         if ( __visit_children() ) {
    1447                 {
     1433        VISIT({
    14481434                        guard_symtab guard { *this };
    14491435                        maybe_accept( node, &ImplicitCopyCtorExpr::result );
    14501436                }
    14511437                maybe_accept( node, &ImplicitCopyCtorExpr::callExpr    );
    1452         }
     1438        )
    14531439
    14541440        VISIT_END( Expr, node );
     
    14611447        VISIT_START( node );
    14621448
    1463         if ( __visit_children() ) {
    1464                 {
     1449        VISIT({
    14651450                        guard_symtab guard { *this };
    14661451                        maybe_accept( node, &ConstructorExpr::result );
    14671452                }
    14681453                maybe_accept( node, &ConstructorExpr::callExpr );
    1469         }
     1454        )
    14701455
    14711456        VISIT_END( Expr, node );
     
    14781463        VISIT_START( node );
    14791464
    1480         if ( __visit_children() ) {
    1481                 {
     1465        VISIT({
    14821466                        guard_symtab guard { *this };
    14831467                        maybe_accept( node, &CompoundLiteralExpr::result );
    14841468                }
    14851469                maybe_accept( node, &CompoundLiteralExpr::init );
    1486         }
     1470        )
    14871471
    14881472        VISIT_END( Expr, node );
     
    14951479        VISIT_START( node );
    14961480
    1497         if ( __visit_children() ) {
    1498                 {
     1481        VISIT({
    14991482                        guard_symtab guard { *this };
    15001483                        maybe_accept( node, &RangeExpr::result );
     
    15021485                maybe_accept( node, &RangeExpr::low    );
    15031486                maybe_accept( node, &RangeExpr::high   );
    1504         }
     1487        )
    15051488
    15061489        VISIT_END( Expr, node );
     
    15131496        VISIT_START( node );
    15141497
    1515         if ( __visit_children() ) {
    1516                 {
     1498        VISIT({
    15171499                        guard_symtab guard { *this };
    15181500                        maybe_accept( node, &UntypedTupleExpr::result );
    15191501                }
    15201502                maybe_accept( node, &UntypedTupleExpr::exprs  );
    1521         }
     1503        )
    15221504
    15231505        VISIT_END( Expr, node );
     
    15301512        VISIT_START( node );
    15311513
    1532         if ( __visit_children() ) {
    1533                 {
     1514        VISIT({
    15341515                        guard_symtab guard { *this };
    15351516                        maybe_accept( node, &TupleExpr::result );
    15361517                }
    15371518                maybe_accept( node, &TupleExpr::exprs  );
    1538         }
     1519        )
    15391520
    15401521        VISIT_END( Expr, node );
     
    15471528        VISIT_START( node );
    15481529
    1549         if ( __visit_children() ) {
    1550                 {
     1530        VISIT({
    15511531                        guard_symtab guard { *this };
    15521532                        maybe_accept( node, &TupleIndexExpr::result );
    15531533                }
    15541534                maybe_accept( node, &TupleIndexExpr::tuple  );
    1555         }
     1535        )
    15561536
    15571537        VISIT_END( Expr, node );
     
    15641544        VISIT_START( node );
    15651545
    1566         if ( __visit_children() ) {
    1567                 {
     1546        VISIT({
    15681547                        guard_symtab guard { *this };
    15691548                        maybe_accept( node, &TupleAssignExpr::result );
    15701549                }
    15711550                maybe_accept( node, &TupleAssignExpr::stmtExpr );
    1572         }
     1551        )
    15731552
    15741553        VISIT_END( Expr, node );
     
    15811560        VISIT_START( node );
    15821561
    1583         if ( __visit_children() ) {
    1584                 // don't want statements from outer CompoundStmts to be added to this StmtExpr
     1562        VISIT(// don't want statements from outer CompoundStmts to be added to this StmtExpr
    15851563                // get the stmts that will need to be spliced in
    15861564                auto stmts_before = __pass::stmtsToAddBefore( core, 0);
     
    15991577                maybe_accept( node, &StmtExpr::returnDecls );
    16001578                maybe_accept( node, &StmtExpr::dtors       );
    1601         }
     1579        )
    16021580
    16031581        VISIT_END( Expr, node );
     
    16101588        VISIT_START( node );
    16111589
    1612         if ( __visit_children() ) {
    1613                 {
     1590        VISIT({
    16141591                        guard_symtab guard { *this };
    16151592                        maybe_accept( node, &UniqueExpr::result );
    16161593                }
    16171594                maybe_accept( node, &UniqueExpr::expr   );
    1618         }
     1595        )
    16191596
    16201597        VISIT_END( Expr, node );
     
    16271604        VISIT_START( node );
    16281605
    1629         if ( __visit_children() ) {
    1630                 {
     1606        VISIT({
    16311607                        guard_symtab guard { *this };
    16321608                        maybe_accept( node, &UntypedInitExpr::result );
     
    16341610                maybe_accept( node, &UntypedInitExpr::expr   );
    16351611                // not currently visiting initAlts, but this doesn't matter since this node is only used in the resolver.
    1636         }
     1612        )
    16371613
    16381614        VISIT_END( Expr, node );
     
    16451621        VISIT_START( node );
    16461622
    1647         if ( __visit_children() ) {
    1648                 {
     1623        VISIT({
    16491624                        guard_symtab guard { *this };
    16501625                        maybe_accept( node, &InitExpr::result );
     
    16521627                maybe_accept( node, &InitExpr::expr   );
    16531628                maybe_accept( node, &InitExpr::designation );
    1654         }
     1629        )
    16551630
    16561631        VISIT_END( Expr, node );
     
    16631638        VISIT_START( node );
    16641639
    1665         if ( __visit_children() ) {
    1666                 {
     1640        VISIT({
    16671641                        guard_symtab guard { *this };
    16681642                        maybe_accept( node, &DeletedExpr::result );
     
    16701644                maybe_accept( node, &DeletedExpr::expr );
    16711645                // don't visit deleteStmt, because it is a pointer to somewhere else in the tree.
    1672         }
     1646        )
    16731647
    16741648        VISIT_END( Expr, node );
     
    16811655        VISIT_START( node );
    16821656
    1683         if ( __visit_children() ) {
    1684                 {
     1657        VISIT({
    16851658                        guard_symtab guard { *this };
    16861659                        maybe_accept( node, &DefaultArgExpr::result );
    16871660                }
    16881661                maybe_accept( node, &DefaultArgExpr::expr );
    1689         }
     1662        )
    16901663
    16911664        VISIT_END( Expr, node );
     
    16981671        VISIT_START( node );
    16991672
    1700         if ( __visit_children() ) {
    1701                 {
     1673        VISIT({
    17021674                        guard_symtab guard { *this };
    17031675                        maybe_accept( node, &GenericExpr::result );
     
    17281700                        node = n;
    17291701                }
    1730         }
     1702        )
    17311703
    17321704        VISIT_END( Expr, node );
     
    17571729        VISIT_START( node );
    17581730
    1759         if ( __visit_children() ) {
     1731        VISIT(
    17601732                // xxx - should PointerType visit/mutate dimension?
    17611733                maybe_accept( node, &PointerType::base );
    1762         }
     1734        )
    17631735
    17641736        VISIT_END( Type, node );
     
    17711743        VISIT_START( node );
    17721744
    1773         if ( __visit_children() ) {
     1745        VISIT(
    17741746                maybe_accept( node, &ArrayType::dimension );
    17751747                maybe_accept( node, &ArrayType::base );
    1776         }
     1748        )
    17771749
    17781750        VISIT_END( Type, node );
     
    17851757        VISIT_START( node );
    17861758
    1787         if ( __visit_children() ) {
     1759        VISIT(
    17881760                maybe_accept( node, &ReferenceType::base );
    1789         }
     1761        )
    17901762
    17911763        VISIT_END( Type, node );
     
    17981770        VISIT_START( node );
    17991771
    1800         if ( __visit_children() ) {
     1772        VISIT(
    18011773                maybe_accept( node, &QualifiedType::parent );
    18021774                maybe_accept( node, &QualifiedType::child );
    1803         }
     1775        )
    18041776
    18051777        VISIT_END( Type, node );
     
    18121784        VISIT_START( node );
    18131785
    1814         if ( __visit_children() ) {
     1786        VISIT({
    18151787                // guard_forall_subs forall_guard { *this, node };
    18161788                // mutate_forall( node );
     
    18181790                maybe_accept( node, &FunctionType::returns );
    18191791                maybe_accept( node, &FunctionType::params  );
    1820         }
     1792        })
    18211793
    18221794        VISIT_END( Type, node );
     
    18311803        __pass::symtab::addStruct( core, 0, node->name );
    18321804
    1833         if ( __visit_children() ) {
     1805        VISIT({
    18341806                guard_symtab guard { *this };
    18351807                maybe_accept( node, &StructInstType::params );
    1836         }
     1808        })
    18371809
    18381810        VISIT_END( Type, node );
     
    18471819        __pass::symtab::addUnion( core, 0, node->name );
    18481820
    1849         if ( __visit_children() ) {
     1821        VISIT({
    18501822                guard_symtab guard { *this };
    18511823                maybe_accept( node, &UnionInstType::params );
    1852         }
     1824        })
    18531825
    18541826        VISIT_END( Type, node );
     
    18611833        VISIT_START( node );
    18621834
    1863         if ( __visit_children() ) {
     1835        VISIT({
    18641836                maybe_accept( node, &EnumInstType::params );
    1865         }
     1837        })
    18661838
    18671839        VISIT_END( Type, node );
     
    18741846        VISIT_START( node );
    18751847
    1876         if ( __visit_children() ) {
     1848        VISIT({
    18771849                maybe_accept( node, &TraitInstType::params );
    1878         }
     1850        })
    18791851
    18801852        VISIT_END( Type, node );
     
    18871859        VISIT_START( node );
    18881860
    1889         if ( __visit_children() ) {
     1861        VISIT(
    18901862                {
    18911863                        maybe_accept( node, &TypeInstType::params );
     
    18931865                // ensure that base re-bound if doing substitution
    18941866                __pass::forall::replace( core, 0, node );
    1895         }
     1867        )
    18961868
    18971869        VISIT_END( Type, node );
     
    19041876        VISIT_START( node );
    19051877
    1906         if ( __visit_children() ) {
     1878        VISIT(
    19071879                maybe_accept( node, &TupleType::types );
    19081880                maybe_accept( node, &TupleType::members );
    1909         }
     1881        )
    19101882
    19111883        VISIT_END( Type, node );
     
    19181890        VISIT_START( node );
    19191891
    1920         if ( __visit_children() ) {
     1892        VISIT(
    19211893                maybe_accept( node, &TypeofType::expr );
    1922         }
     1894        )
    19231895
    19241896        VISIT_END( Type, node );
     
    19311903        VISIT_START( node );
    19321904
    1933         if ( __visit_children() ) {
     1905        VISIT(
    19341906                maybe_accept( node, &VTableType::base );
    1935         }
     1907        )
    19361908
    19371909        VISIT_END( Type, node );
     
    19811953        VISIT_START( node );
    19821954
    1983         if ( __visit_children() ) {
    1984                 maybe_accept( node, &Designation::designators );
    1985         }
     1955        VISIT( maybe_accept( node, &Designation::designators ); )
    19861956
    19871957        VISIT_END( Designation, node );
     
    19941964        VISIT_START( node );
    19951965
    1996         if ( __visit_children() ) {
     1966        VISIT(
    19971967                maybe_accept( node, &SingleInit::value );
    1998         }
     1968        )
    19991969
    20001970        VISIT_END( Init, node );
     
    20071977        VISIT_START( node );
    20081978
    2009         if ( __visit_children() ) {
     1979        VISIT(
    20101980                maybe_accept( node, &ListInit::designations );
    20111981                maybe_accept( node, &ListInit::initializers );
    2012         }
     1982        )
    20131983
    20141984        VISIT_END( Init, node );
     
    20211991        VISIT_START( node );
    20221992
    2023         if ( __visit_children() ) {
     1993        VISIT(
    20241994                maybe_accept( node, &ConstructorInit::ctor );
    20251995                maybe_accept( node, &ConstructorInit::dtor );
    20261996                maybe_accept( node, &ConstructorInit::init );
    2027         }
     1997        )
    20281998
    20291999        VISIT_END( Init, node );
     
    20362006        VISIT_START( node );
    20372007
    2038         if ( __visit_children() ) {
     2008        VISIT(
    20392009                maybe_accept( node, &Attribute::params );
    2040         }
     2010        )
    20412011
    20422012        VISIT_END( Attribute, node );
     
    20492019        VISIT_START( node );
    20502020
    2051         if ( __visit_children() ) {
     2021        VISIT(
    20522022                {
    20532023                        bool mutated = false;
     
    20652035                        }
    20662036                }
    2067         }
     2037        )
    20682038
    20692039        VISIT_END( TypeSubstitution, node );
     
    20712041
    20722042#undef VISIT_START
     2043#undef VISIT
    20732044#undef VISIT_END
Note: See TracChangeset for help on using the changeset viewer.