Ignore:
File:
1 edited

Legend:

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

    re21f253 rc600df1  
    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() ) {
     1052        VISIT({
    10531053                // mutex statements introduce a level of scope (for the initialization)
    10541054                guard_symtab guard { *this };
    10551055                maybe_accept( node, &MutexStmt::stmt );
    10561056                maybe_accept( node, &MutexStmt::mutexObjs );
    1057         }
     1057        })
    10581058
    10591059        VISIT_END( Stmt, node );
     
    10661066        VISIT_START( node );
    10671067
    1068         if ( __visit_children() ) {
     1068        VISIT(
    10691069                {
    10701070                        guard_symtab guard { *this };
     
    10731073                maybe_accept( node, &ApplicationExpr::func );
    10741074                maybe_accept( node, &ApplicationExpr::args );
    1075         }
     1075        )
    10761076
    10771077        VISIT_END( Expr, node );
     
    10841084        VISIT_START( node );
    10851085
    1086         if ( __visit_children() ) {
     1086        VISIT(
    10871087                {
    10881088                        guard_symtab guard { *this };
     
    10911091
    10921092                maybe_accept( node, &UntypedExpr::args );
    1093         }
     1093        )
    10941094
    10951095        VISIT_END( Expr, node );
     
    11021102        VISIT_START( node );
    11031103
    1104         if ( __visit_children() ) {
     1104        VISIT({
    11051105                guard_symtab guard { *this };
    11061106                maybe_accept( node, &NameExpr::result );
    1107         }
     1107        })
    11081108
    11091109        VISIT_END( Expr, node );
     
    11161116        VISIT_START( node );
    11171117
    1118         if ( __visit_children() ) {
    1119                 {
     1118        VISIT({
    11201119                        guard_symtab guard { *this };
    11211120                        maybe_accept( node, &CastExpr::result );
    11221121                }
    11231122                maybe_accept( node, &CastExpr::arg );
    1124         }
     1123        )
    11251124
    11261125        VISIT_END( Expr, node );
     
    11331132        VISIT_START( node );
    11341133
    1135         if ( __visit_children() ) {
    1136                 {
     1134        VISIT({
    11371135                        guard_symtab guard { *this };
    11381136                        maybe_accept( node, &KeywordCastExpr::result );
    11391137                }
    11401138                maybe_accept( node, &KeywordCastExpr::arg );
    1141         }
     1139        )
    11421140
    11431141        VISIT_END( Expr, node );
     
    11501148        VISIT_START( node );
    11511149
    1152         if ( __visit_children() ) {
    1153                 {
     1150        VISIT({
    11541151                        guard_symtab guard { *this };
    11551152                        maybe_accept( node, &VirtualCastExpr::result );
    11561153                }
    11571154                maybe_accept( node, &VirtualCastExpr::arg );
    1158         }
     1155        )
    11591156
    11601157        VISIT_END( Expr, node );
     
    11671164        VISIT_START( node );
    11681165
    1169         if ( __visit_children() ) {
    1170                 {
     1166        VISIT({
    11711167                        guard_symtab guard { *this };
    11721168                        maybe_accept( node, &AddressExpr::result );
    11731169                }
    11741170                maybe_accept( node, &AddressExpr::arg );
    1175         }
     1171        )
    11761172
    11771173        VISIT_END( Expr, node );
     
    11841180        VISIT_START( node );
    11851181
    1186         if ( __visit_children() ) {
     1182        VISIT({
    11871183                guard_symtab guard { *this };
    11881184                maybe_accept( node, &LabelAddressExpr::result );
    1189         }
     1185        })
    11901186
    11911187        VISIT_END( Expr, node );
     
    11981194        VISIT_START( node );
    11991195
    1200         if ( __visit_children() ) {
    1201                 {
     1196        VISIT({
    12021197                        guard_symtab guard { *this };
    12031198                        maybe_accept( node, &UntypedMemberExpr::result );
     
    12051200                maybe_accept( node, &UntypedMemberExpr::aggregate );
    12061201                maybe_accept( node, &UntypedMemberExpr::member    );
    1207         }
     1202        )
    12081203
    12091204        VISIT_END( Expr, node );
     
    12161211        VISIT_START( node );
    12171212
    1218         if ( __visit_children() ) {
    1219                 {
     1213        VISIT({
    12201214                        guard_symtab guard { *this };
    12211215                        maybe_accept( node, &MemberExpr::result );
    12221216                }
    12231217                maybe_accept( node, &MemberExpr::aggregate );
    1224         }
     1218        )
    12251219
    12261220        VISIT_END( Expr, node );
     
    12331227        VISIT_START( node );
    12341228
    1235         if ( __visit_children() ) {
     1229        VISIT({
    12361230                guard_symtab guard { *this };
    12371231                maybe_accept( node, &VariableExpr::result );
    1238         }
     1232        })
    12391233
    12401234        VISIT_END( Expr, node );
     
    12471241        VISIT_START( node );
    12481242
    1249         if ( __visit_children() ) {
     1243        VISIT({
    12501244                guard_symtab guard { *this };
    12511245                maybe_accept( node, &ConstantExpr::result );
    1252         }
     1246        })
    12531247
    12541248        VISIT_END( Expr, node );
     
    12611255        VISIT_START( node );
    12621256
    1263         if ( __visit_children() ) {
    1264                 {
     1257        VISIT({
    12651258                        guard_symtab guard { *this };
    12661259                        maybe_accept( node, &SizeofExpr::result );
     
    12711264                        maybe_accept( node, &SizeofExpr::expr );
    12721265                }
    1273         }
     1266        )
    12741267
    12751268        VISIT_END( Expr, node );
     
    12821275        VISIT_START( node );
    12831276
    1284         if ( __visit_children() ) {
    1285                 {
     1277        VISIT({
    12861278                        guard_symtab guard { *this };
    12871279                        maybe_accept( node, &AlignofExpr::result );
     
    12921284                        maybe_accept( node, &AlignofExpr::expr );
    12931285                }
    1294         }
     1286        )
    12951287
    12961288        VISIT_END( Expr, node );
     
    13031295        VISIT_START( node );
    13041296
    1305         if ( __visit_children() ) {
    1306                 {
     1297        VISIT({
    13071298                        guard_symtab guard { *this };
    13081299                        maybe_accept( node, &UntypedOffsetofExpr::result );
    13091300                }
    13101301                maybe_accept( node, &UntypedOffsetofExpr::type   );
    1311         }
     1302        )
    13121303
    13131304        VISIT_END( Expr, node );
     
    13201311        VISIT_START( node );
    13211312
    1322         if ( __visit_children() ) {
    1323                 {
     1313        VISIT({
    13241314                        guard_symtab guard { *this };
    13251315                        maybe_accept( node, &OffsetofExpr::result );
    13261316                }
    13271317                maybe_accept( node, &OffsetofExpr::type   );
    1328         }
     1318        )
    13291319
    13301320        VISIT_END( Expr, node );
     
    13371327        VISIT_START( node );
    13381328
    1339         if ( __visit_children() ) {
    1340                 {
     1329        VISIT({
    13411330                        guard_symtab guard { *this };
    13421331                        maybe_accept( node, &OffsetPackExpr::result );
    13431332                }
    13441333                maybe_accept( node, &OffsetPackExpr::type   );
    1345         }
     1334        )
    13461335
    13471336        VISIT_END( Expr, node );
     
    13541343        VISIT_START( node );
    13551344
    1356         if ( __visit_children() ) {
    1357                 {
     1345        VISIT({
    13581346                        guard_symtab guard { *this };
    13591347                        maybe_accept( node, &LogicalExpr::result );
     
    13611349                maybe_accept( node, &LogicalExpr::arg1 );
    13621350                maybe_accept( node, &LogicalExpr::arg2 );
    1363         }
     1351        )
    13641352
    13651353        VISIT_END( Expr, node );
     
    13721360        VISIT_START( node );
    13731361
    1374         if ( __visit_children() ) {
    1375                 {
     1362        VISIT({
    13761363                        guard_symtab guard { *this };
    13771364                        maybe_accept( node, &ConditionalExpr::result );
     
    13801367                maybe_accept( node, &ConditionalExpr::arg2 );
    13811368                maybe_accept( node, &ConditionalExpr::arg3 );
    1382         }
     1369        )
    13831370
    13841371        VISIT_END( Expr, node );
     
    13911378        VISIT_START( node );
    13921379
    1393         if ( __visit_children() ) {
    1394                 {
     1380        VISIT({
    13951381                        guard_symtab guard { *this };
    13961382                        maybe_accept( node, &CommaExpr::result );
     
    13981384                maybe_accept( node, &CommaExpr::arg1 );
    13991385                maybe_accept( node, &CommaExpr::arg2 );
    1400         }
     1386        )
    14011387
    14021388        VISIT_END( Expr, node );
     
    14091395        VISIT_START( node );
    14101396
    1411         if ( __visit_children() ) {
    1412                 {
     1397        VISIT({
    14131398                        guard_symtab guard { *this };
    14141399                        maybe_accept( node, &TypeExpr::result );
    14151400                }
    14161401                maybe_accept( node, &TypeExpr::type );
    1417         }
     1402        )
    14181403
    14191404        VISIT_END( Expr, node );
     
    14261411        VISIT_START( node );
    14271412
    1428         if ( __visit_children() ) {
    1429                 {
     1413        VISIT({
    14301414                        guard_symtab guard { *this };
    14311415                        maybe_accept( node, &AsmExpr::result );
     
    14331417                maybe_accept( node, &AsmExpr::constraint );
    14341418                maybe_accept( node, &AsmExpr::operand    );
    1435         }
     1419        )
    14361420
    14371421        VISIT_END( Expr, node );
     
    14441428        VISIT_START( node );
    14451429
    1446         if ( __visit_children() ) {
    1447                 {
     1430        VISIT({
    14481431                        guard_symtab guard { *this };
    14491432                        maybe_accept( node, &ImplicitCopyCtorExpr::result );
    14501433                }
    14511434                maybe_accept( node, &ImplicitCopyCtorExpr::callExpr    );
    1452         }
     1435        )
    14531436
    14541437        VISIT_END( Expr, node );
     
    14611444        VISIT_START( node );
    14621445
    1463         if ( __visit_children() ) {
    1464                 {
     1446        VISIT({
    14651447                        guard_symtab guard { *this };
    14661448                        maybe_accept( node, &ConstructorExpr::result );
    14671449                }
    14681450                maybe_accept( node, &ConstructorExpr::callExpr );
    1469         }
     1451        )
    14701452
    14711453        VISIT_END( Expr, node );
     
    14781460        VISIT_START( node );
    14791461
    1480         if ( __visit_children() ) {
    1481                 {
     1462        VISIT({
    14821463                        guard_symtab guard { *this };
    14831464                        maybe_accept( node, &CompoundLiteralExpr::result );
    14841465                }
    14851466                maybe_accept( node, &CompoundLiteralExpr::init );
    1486         }
     1467        )
    14871468
    14881469        VISIT_END( Expr, node );
     
    14951476        VISIT_START( node );
    14961477
    1497         if ( __visit_children() ) {
    1498                 {
     1478        VISIT({
    14991479                        guard_symtab guard { *this };
    15001480                        maybe_accept( node, &RangeExpr::result );
     
    15021482                maybe_accept( node, &RangeExpr::low    );
    15031483                maybe_accept( node, &RangeExpr::high   );
    1504         }
     1484        )
    15051485
    15061486        VISIT_END( Expr, node );
     
    15131493        VISIT_START( node );
    15141494
    1515         if ( __visit_children() ) {
    1516                 {
     1495        VISIT({
    15171496                        guard_symtab guard { *this };
    15181497                        maybe_accept( node, &UntypedTupleExpr::result );
    15191498                }
    15201499                maybe_accept( node, &UntypedTupleExpr::exprs  );
    1521         }
     1500        )
    15221501
    15231502        VISIT_END( Expr, node );
     
    15301509        VISIT_START( node );
    15311510
    1532         if ( __visit_children() ) {
    1533                 {
     1511        VISIT({
    15341512                        guard_symtab guard { *this };
    15351513                        maybe_accept( node, &TupleExpr::result );
    15361514                }
    15371515                maybe_accept( node, &TupleExpr::exprs  );
    1538         }
     1516        )
    15391517
    15401518        VISIT_END( Expr, node );
     
    15471525        VISIT_START( node );
    15481526
    1549         if ( __visit_children() ) {
    1550                 {
     1527        VISIT({
    15511528                        guard_symtab guard { *this };
    15521529                        maybe_accept( node, &TupleIndexExpr::result );
    15531530                }
    15541531                maybe_accept( node, &TupleIndexExpr::tuple  );
    1555         }
     1532        )
    15561533
    15571534        VISIT_END( Expr, node );
     
    15641541        VISIT_START( node );
    15651542
    1566         if ( __visit_children() ) {
    1567                 {
     1543        VISIT({
    15681544                        guard_symtab guard { *this };
    15691545                        maybe_accept( node, &TupleAssignExpr::result );
    15701546                }
    15711547                maybe_accept( node, &TupleAssignExpr::stmtExpr );
    1572         }
     1548        )
    15731549
    15741550        VISIT_END( Expr, node );
     
    15811557        VISIT_START( node );
    15821558
    1583         if ( __visit_children() ) {
    1584                 // don't want statements from outer CompoundStmts to be added to this StmtExpr
     1559        VISIT(// don't want statements from outer CompoundStmts to be added to this StmtExpr
    15851560                // get the stmts that will need to be spliced in
    15861561                auto stmts_before = __pass::stmtsToAddBefore( core, 0);
     
    15991574                maybe_accept( node, &StmtExpr::returnDecls );
    16001575                maybe_accept( node, &StmtExpr::dtors       );
    1601         }
     1576        )
    16021577
    16031578        VISIT_END( Expr, node );
     
    16101585        VISIT_START( node );
    16111586
    1612         if ( __visit_children() ) {
    1613                 {
     1587        VISIT({
    16141588                        guard_symtab guard { *this };
    16151589                        maybe_accept( node, &UniqueExpr::result );
    16161590                }
    16171591                maybe_accept( node, &UniqueExpr::expr   );
    1618         }
     1592        )
    16191593
    16201594        VISIT_END( Expr, node );
     
    16271601        VISIT_START( node );
    16281602
    1629         if ( __visit_children() ) {
    1630                 {
     1603        VISIT({
    16311604                        guard_symtab guard { *this };
    16321605                        maybe_accept( node, &UntypedInitExpr::result );
     
    16341607                maybe_accept( node, &UntypedInitExpr::expr   );
    16351608                // not currently visiting initAlts, but this doesn't matter since this node is only used in the resolver.
    1636         }
     1609        )
    16371610
    16381611        VISIT_END( Expr, node );
     
    16451618        VISIT_START( node );
    16461619
    1647         if ( __visit_children() ) {
    1648                 {
     1620        VISIT({
    16491621                        guard_symtab guard { *this };
    16501622                        maybe_accept( node, &InitExpr::result );
     
    16521624                maybe_accept( node, &InitExpr::expr   );
    16531625                maybe_accept( node, &InitExpr::designation );
    1654         }
     1626        )
    16551627
    16561628        VISIT_END( Expr, node );
     
    16631635        VISIT_START( node );
    16641636
    1665         if ( __visit_children() ) {
    1666                 {
     1637        VISIT({
    16671638                        guard_symtab guard { *this };
    16681639                        maybe_accept( node, &DeletedExpr::result );
     
    16701641                maybe_accept( node, &DeletedExpr::expr );
    16711642                // don't visit deleteStmt, because it is a pointer to somewhere else in the tree.
    1672         }
     1643        )
    16731644
    16741645        VISIT_END( Expr, node );
     
    16811652        VISIT_START( node );
    16821653
    1683         if ( __visit_children() ) {
    1684                 {
     1654        VISIT({
    16851655                        guard_symtab guard { *this };
    16861656                        maybe_accept( node, &DefaultArgExpr::result );
    16871657                }
    16881658                maybe_accept( node, &DefaultArgExpr::expr );
    1689         }
     1659        )
    16901660
    16911661        VISIT_END( Expr, node );
     
    16981668        VISIT_START( node );
    16991669
    1700         if ( __visit_children() ) {
    1701                 {
     1670        VISIT({
    17021671                        guard_symtab guard { *this };
    17031672                        maybe_accept( node, &GenericExpr::result );
     
    17281697                        node = n;
    17291698                }
    1730         }
     1699        )
    17311700
    17321701        VISIT_END( Expr, node );
     
    17571726        VISIT_START( node );
    17581727
    1759         if ( __visit_children() ) {
     1728        VISIT(
    17601729                // xxx - should PointerType visit/mutate dimension?
    17611730                maybe_accept( node, &PointerType::base );
    1762         }
     1731        )
    17631732
    17641733        VISIT_END( Type, node );
     
    17711740        VISIT_START( node );
    17721741
    1773         if ( __visit_children() ) {
     1742        VISIT(
    17741743                maybe_accept( node, &ArrayType::dimension );
    17751744                maybe_accept( node, &ArrayType::base );
    1776         }
     1745        )
    17771746
    17781747        VISIT_END( Type, node );
     
    17851754        VISIT_START( node );
    17861755
    1787         if ( __visit_children() ) {
     1756        VISIT(
    17881757                maybe_accept( node, &ReferenceType::base );
    1789         }
     1758        )
    17901759
    17911760        VISIT_END( Type, node );
     
    17981767        VISIT_START( node );
    17991768
    1800         if ( __visit_children() ) {
     1769        VISIT(
    18011770                maybe_accept( node, &QualifiedType::parent );
    18021771                maybe_accept( node, &QualifiedType::child );
    1803         }
     1772        )
    18041773
    18051774        VISIT_END( Type, node );
     
    18121781        VISIT_START( node );
    18131782
    1814         if ( __visit_children() ) {
     1783        VISIT({
    18151784                // guard_forall_subs forall_guard { *this, node };
    18161785                // mutate_forall( node );
     
    18181787                maybe_accept( node, &FunctionType::returns );
    18191788                maybe_accept( node, &FunctionType::params  );
    1820         }
     1789        })
    18211790
    18221791        VISIT_END( Type, node );
     
    18311800        __pass::symtab::addStruct( core, 0, node->name );
    18321801
    1833         if ( __visit_children() ) {
     1802        VISIT({
    18341803                guard_symtab guard { *this };
    18351804                maybe_accept( node, &StructInstType::params );
    1836         }
     1805        })
    18371806
    18381807        VISIT_END( Type, node );
     
    18471816        __pass::symtab::addUnion( core, 0, node->name );
    18481817
    1849         if ( __visit_children() ) {
     1818        VISIT({
    18501819                guard_symtab guard { *this };
    18511820                maybe_accept( node, &UnionInstType::params );
    1852         }
     1821        })
    18531822
    18541823        VISIT_END( Type, node );
     
    18611830        VISIT_START( node );
    18621831
    1863         if ( __visit_children() ) {
     1832        VISIT({
    18641833                maybe_accept( node, &EnumInstType::params );
    1865         }
     1834        })
    18661835
    18671836        VISIT_END( Type, node );
     
    18741843        VISIT_START( node );
    18751844
    1876         if ( __visit_children() ) {
     1845        VISIT({
    18771846                maybe_accept( node, &TraitInstType::params );
    1878         }
     1847        })
    18791848
    18801849        VISIT_END( Type, node );
     
    18871856        VISIT_START( node );
    18881857
    1889         if ( __visit_children() ) {
     1858        VISIT(
    18901859                {
    18911860                        maybe_accept( node, &TypeInstType::params );
     
    18931862                // ensure that base re-bound if doing substitution
    18941863                __pass::forall::replace( core, 0, node );
    1895         }
     1864        )
    18961865
    18971866        VISIT_END( Type, node );
     
    19041873        VISIT_START( node );
    19051874
    1906         if ( __visit_children() ) {
     1875        VISIT(
    19071876                maybe_accept( node, &TupleType::types );
    19081877                maybe_accept( node, &TupleType::members );
    1909         }
     1878        )
    19101879
    19111880        VISIT_END( Type, node );
     
    19181887        VISIT_START( node );
    19191888
    1920         if ( __visit_children() ) {
     1889        VISIT(
    19211890                maybe_accept( node, &TypeofType::expr );
    1922         }
     1891        )
    19231892
    19241893        VISIT_END( Type, node );
     
    19311900        VISIT_START( node );
    19321901
    1933         if ( __visit_children() ) {
     1902        VISIT(
    19341903                maybe_accept( node, &VTableType::base );
    1935         }
     1904        )
    19361905
    19371906        VISIT_END( Type, node );
     
    19811950        VISIT_START( node );
    19821951
    1983         if ( __visit_children() ) {
    1984                 maybe_accept( node, &Designation::designators );
    1985         }
     1952        VISIT( maybe_accept( node, &Designation::designators ); )
    19861953
    19871954        VISIT_END( Designation, node );
     
    19941961        VISIT_START( node );
    19951962
    1996         if ( __visit_children() ) {
     1963        VISIT(
    19971964                maybe_accept( node, &SingleInit::value );
    1998         }
     1965        )
    19991966
    20001967        VISIT_END( Init, node );
     
    20071974        VISIT_START( node );
    20081975
    2009         if ( __visit_children() ) {
     1976        VISIT(
    20101977                maybe_accept( node, &ListInit::designations );
    20111978                maybe_accept( node, &ListInit::initializers );
    2012         }
     1979        )
    20131980
    20141981        VISIT_END( Init, node );
     
    20211988        VISIT_START( node );
    20221989
    2023         if ( __visit_children() ) {
     1990        VISIT(
    20241991                maybe_accept( node, &ConstructorInit::ctor );
    20251992                maybe_accept( node, &ConstructorInit::dtor );
    20261993                maybe_accept( node, &ConstructorInit::init );
    2027         }
     1994        )
    20281995
    20291996        VISIT_END( Init, node );
     
    20362003        VISIT_START( node );
    20372004
    2038         if ( __visit_children() ) {
     2005        VISIT(
    20392006                maybe_accept( node, &Attribute::params );
    2040         }
     2007        )
    20412008
    20422009        VISIT_END( Attribute, node );
     
    20492016        VISIT_START( node );
    20502017
    2051         if ( __visit_children() ) {
     2018        VISIT(
    20522019                {
    20532020                        bool mutated = false;
     
    20652032                        }
    20662033                }
    2067         }
     2034        )
    20682035
    20692036        VISIT_END( TypeSubstitution, node );
     
    20712038
    20722039#undef VISIT_START
     2040#undef VISIT
    20732041#undef VISIT_END
Note: See TracChangeset for help on using the changeset viewer.