Changes in / [982832e:7dc09294]


Ignore:
Location:
src
Files:
3 deleted
38 edited

Legend:

Unmodified
Added
Removed
  • src/Common/PassVisitor.h

    r982832e r7dc09294  
    77#include "SynTree/Mutator.h"
    88#include "SynTree/Visitor.h"
    9 
    10 #include "SymTab/Indexer.h"
    119
    1210#include "SynTree/Initializer.h"
     
    267265
    268266        void set_visit_children( bool& ref ) { bool_ref * ptr = visit_children_impl(pass, 0); if(ptr) ptr->set( ref ); }
    269 
    270         void indexerScopeEnter  ()                             { indexer_impl_enterScope  ( pass, 0       ); }
    271         void indexerScopeLeave  ()                             { indexer_impl_leaveScope  ( pass, 0       ); }
    272         void indexerAddId       ( DeclarationWithType * node ) { indexer_impl_addId       ( pass, 0, node ); }
    273         void indexerAddType     ( NamedTypeDecl       * node ) { indexer_impl_addType     ( pass, 0, node ); }
    274         void indexerAddStruct   ( const std::string   & id   ) { indexer_impl_addStruct   ( pass, 0, id   ); }
    275         void indexerAddStruct   ( StructDecl          * node ) { indexer_impl_addStruct   ( pass, 0, node ); }
    276         void indexerAddStructFwd( StructDecl          * node ) { indexer_impl_addStructFwd( pass, 0, node ); }
    277         void indexerAddEnum     ( EnumDecl            * node ) { indexer_impl_addEnum     ( pass, 0, node ); }
    278         void indexerAddUnion    ( const std::string   & id   ) { indexer_impl_addUnion    ( pass, 0, id   ); }
    279         void indexerAddUnion    ( UnionDecl           * node ) { indexer_impl_addUnion    ( pass, 0, node ); }
    280         void indexerAddUnionFwd ( UnionDecl           * node ) { indexer_impl_addUnionFwd ( pass, 0, node ); }
    281         void indexerAddTrait    ( TraitDecl           * node ) { indexer_impl_addTrait    ( pass, 0, node ); }
    282 
    283         template< typename TreeType, typename VisitorType >
    284         friend inline void indexerScopedAccept( TreeType * tree, VisitorType &visitor );
    285 
    286         template< typename TreeType, typename VisitorType >
    287         friend inline void indexerScopedMutate( TreeType *& tree, VisitorType &visitor );
    288267};
    289268
     
    317296protected:
    318297        WithDeclsToAdd() = default;
    319         ~WithDeclsToAdd() {
    320                 assert( declsToAddBefore.empty() );
    321         }
     298        ~WithDeclsToAdd() = default;
    322299
    323300public:
     
    374351};
    375352
    376 class WithIndexer {
    377 protected:
    378         WithIndexer() {}
    379         ~WithIndexer() {}
    380 
    381 public:
    382         SymTab::Indexer indexer;
    383 };
    384 
    385353#include "PassVisitor.impl.h"
  • src/Common/PassVisitor.impl.h

    r982832e r7dc09294  
    101101}
    102102
    103 template< typename Container, typename VisitorType >
    104 inline void maybeAccept( Container &container, VisitorType &visitor ) {
    105         SemanticError errors;
    106         for ( typename Container::iterator i = container.begin(); i != container.end(); ++i ) {
    107                 try {
    108                         if ( *i ) {
    109                                 (*i)->accept( visitor );
    110                         }
    111                 } catch( SemanticError &e ) {
    112                         e.set_location( (*i)->location );
    113                         errors.append( e );
    114                 }
    115         }
    116         if ( ! errors.isEmpty() ) {
    117                 throw errors;
    118         }
    119 }
    120 
    121 template< typename Container, typename MutatorType >
    122 inline void maybeMutateRef( Container &container, MutatorType &mutator ) {
    123         SemanticError errors;
    124         for ( typename Container::iterator i = container.begin(); i != container.end(); ++i ) {
    125                 try {
    126                         if ( *i ) {
    127 ///                 *i = (*i)->acceptMutator( mutator );
    128                                 *i = dynamic_cast< typename Container::value_type >( (*i)->acceptMutator( mutator ) );
    129                                 assert( *i );
    130                         } // if
    131                 } catch( SemanticError &e ) {
    132                         e.set_location( (*i)->location );
    133                         errors.append( e );
    134                 } // try
    135         } // for
    136         if ( ! errors.isEmpty() ) {
    137                 throw errors;
    138         } // if
    139 }
    140 
    141103template< typename pass_type >
    142104template< typename func_t >
     
    268230
    269231//------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    270 //========================================================================================================================================================================
    271 //========================================================================================================================================================================
    272 //========================================================================================================================================================================
    273 //========================================================================================================================================================================
    274 //========================================================================================================================================================================
    275 //------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    276 
    277 
    278 //--------------------------------------------------------------------------
    279 // ObjectDecl
     232
    280233template< typename pass_type >
    281234void PassVisitor< pass_type >::visit( ObjectDecl * node ) {
    282         VISIT_START( node );
    283 
    284         indexerScopedAccept( node->type         , *this );
    285         maybeAccept        ( node->init         , *this );
    286         maybeAccept        ( node->bitfieldWidth, *this );
    287 
    288         if ( node->name != "" ) {
    289                 indexerAddId( node );
    290         }
    291 
    292         VISIT_END( node );
    293 }
    294 
    295 template< typename pass_type >
    296 DeclarationWithType * PassVisitor< pass_type >::mutate( ObjectDecl * node ) {
    297         MUTATE_START( node );
    298 
    299         indexerScopedMutate( node->type         , *this );
    300         maybeMutateRef     ( node->init         , *this );
    301         maybeMutateRef     ( node->bitfieldWidth, *this );
    302 
    303         if ( node->name != "" ) {
    304                 indexerAddId( node );
    305         }
    306 
    307         MUTATE_END( DeclarationWithType, node );
    308 }
    309 
    310 //--------------------------------------------------------------------------
    311 // FunctionDecl
     235        VISIT_BODY( node );
     236}
     237
    312238template< typename pass_type >
    313239void PassVisitor< pass_type >::visit( FunctionDecl * node ) {
    314         VISIT_START( node );
    315 
    316         if ( node->name != "" ) {
    317                 indexerAddId( node );
    318         }
    319 
    320         {
    321                 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
    322                 maybeAccept( node->type, *this );
    323                 maybeAccept( node->statements, *this );
    324         }
    325 
    326         VISIT_END( node );
    327 }
    328 
    329 template< typename pass_type >
    330 DeclarationWithType * PassVisitor< pass_type >::mutate( FunctionDecl * node ) {
    331         MUTATE_START( node );
    332 
    333         if ( node->name != "" ) {
    334                 indexerAddId( node );
    335         }
    336 
    337         {
    338                 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
    339                 maybeMutateRef( node->type, *this );
    340                 maybeMutateRef( node->statements, *this );
    341         }
    342 
    343         MUTATE_END( DeclarationWithType, node );
    344 }
    345 
    346 //--------------------------------------------------------------------------
    347 // StructDecl
     240        VISIT_BODY( node );
     241}
     242
    348243template< typename pass_type >
    349244void PassVisitor< pass_type >::visit( StructDecl * node ) {
    350         VISIT_START( node );
    351 
    352         // make up a forward declaration and add it before processing the members
    353         // needs to be on the heap because addStruct saves the pointer
    354         indexerAddStructFwd( node );
    355 
    356         {
    357                 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
    358                 maybeAccept( node->parameters, *this );
    359                 maybeAccept( node->members   , *this );
    360         }
    361 
    362         // this addition replaces the forward declaration
    363         indexerAddStruct( node );
    364 
    365         VISIT_END( node );
    366 }
    367 
    368 template< typename pass_type >
    369 Declaration * PassVisitor< pass_type >::mutate( StructDecl * node ) {
    370         MUTATE_START( node );
    371 
    372         // make up a forward declaration and add it before processing the members
    373         // needs to be on the heap because addStruct saves the pointer
    374         indexerAddStructFwd( node );
    375 
    376         {
    377                 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
    378                 maybeMutateRef( node->parameters, *this );
    379                 maybeMutateRef( node->members   , *this );
    380         }
    381 
    382         // this addition replaces the forward declaration
    383         indexerAddStruct( node );
    384 
    385         MUTATE_END( Declaration, node );
    386 }
    387 
    388 //--------------------------------------------------------------------------
    389 // UnionDecl
     245        VISIT_BODY( node );
     246}
     247
    390248template< typename pass_type >
    391249void PassVisitor< pass_type >::visit( UnionDecl * node ) {
    392         VISIT_START( node );
    393 
    394         // make up a forward declaration and add it before processing the members
    395         indexerAddUnionFwd( node );
    396 
    397         {
    398                 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
    399                 maybeAccept( node->parameters, *this );
    400                 maybeAccept( node->members   , *this );
    401         }
    402 
    403         indexerAddUnion( node );
    404 
    405         VISIT_END( node );
    406 }
    407 
    408 template< typename pass_type >
    409 Declaration * PassVisitor< pass_type >::mutate( UnionDecl * node ) {
    410         MUTATE_START( node );
    411 
    412         // make up a forward declaration and add it before processing the members
    413         indexerAddUnionFwd( node );
    414 
    415         {
    416                 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
    417                 maybeMutateRef( node->parameters, *this );
    418                 maybeMutateRef( node->members   , *this );
    419         }
    420 
    421         indexerAddUnion( node );
    422 
    423         MUTATE_END( Declaration, node );
    424 }
    425 
    426 //--------------------------------------------------------------------------
    427 // EnumDecl
     250        VISIT_BODY( node );
     251}
     252
    428253template< typename pass_type >
    429254void PassVisitor< pass_type >::visit( EnumDecl * node ) {
    430         VISIT_START( node );
    431 
    432         indexerAddEnum( node );
    433 
    434         // unlike structs, contexts, and unions, enums inject their members into the global scope
    435         maybeAccept( node->parameters, *this );
    436         maybeAccept( node->members   , *this );
    437 
    438         VISIT_END( node );
    439 }
    440 
    441 template< typename pass_type >
    442 Declaration * PassVisitor< pass_type >::mutate( EnumDecl * node ) {
    443         MUTATE_START( node );
    444 
    445         indexerAddEnum( node );
    446 
    447         // unlike structs, contexts, and unions, enums inject their members into the global scope
    448         maybeMutateRef( node->parameters, *this );
    449         maybeMutateRef( node->members   , *this );
    450 
    451         MUTATE_END( Declaration, node );
    452 }
    453 
    454 //--------------------------------------------------------------------------
    455 // TraitDecl
     255        VISIT_BODY( node );
     256}
     257
    456258template< typename pass_type >
    457259void PassVisitor< pass_type >::visit( TraitDecl * node ) {
    458         VISIT_START( node );
    459 
    460         {
    461                 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
    462                 maybeAccept( node->parameters, *this );
    463                 maybeAccept( node->members   , *this );
    464         }
    465 
    466         indexerAddTrait( node );
    467 
    468         VISIT_END( node );
    469 }
    470 
    471 template< typename pass_type >
    472 Declaration * PassVisitor< pass_type >::mutate( TraitDecl * node ) {
    473         MUTATE_START( node );
    474 
    475         {
    476                 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
    477                 maybeMutateRef( node->parameters, *this );
    478                 maybeMutateRef( node->members   , *this );
    479         }
    480 
    481         indexerAddTrait( node );
    482 
    483         MUTATE_END( Declaration, node );
    484 }
    485 
    486 //--------------------------------------------------------------------------
    487 // TypeDecl
     260        VISIT_BODY( node );
     261}
     262
    488263template< typename pass_type >
    489264void PassVisitor< pass_type >::visit( TypeDecl * node ) {
    490         VISIT_START( node );
    491 
    492         {
    493                 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
    494                 maybeAccept( node->parameters, *this );
    495                 maybeAccept( node->base      , *this );
    496         }
    497 
    498         indexerAddType( node );
    499 
    500         maybeAccept( node->assertions, *this );
    501 
    502         indexerScopedAccept( node->init, *this );
    503 
    504         VISIT_END( node );
    505 }
    506 
    507 template< typename pass_type >
    508 Declaration * PassVisitor< pass_type >::mutate( TypeDecl * node ) {
    509         MUTATE_START( node );
    510 
    511         {
    512                 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
    513                 maybeMutateRef( node->parameters, *this );
    514                 maybeMutateRef( node->base      , *this );
    515         }
    516 
    517         indexerAddType( node );
    518 
    519         maybeMutateRef( node->assertions, *this );
    520 
    521         indexerScopedMutate( node->init, *this );
    522 
    523         MUTATE_END( Declaration, node );
    524 }
    525 
    526 //--------------------------------------------------------------------------
    527 // TypedefDecl
     265        VISIT_BODY( node );
     266}
     267
    528268template< typename pass_type >
    529269void PassVisitor< pass_type >::visit( TypedefDecl * node ) {
    530         VISIT_START( node );
    531 
    532         {
    533                 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
    534                 maybeAccept( node->parameters, *this );
    535                 maybeAccept( node->base      , *this );
    536         }
    537 
    538         indexerAddType( node );
    539 
    540         maybeAccept( node->assertions, *this );
    541 
    542         VISIT_END( node );
    543 }
    544 
    545 template< typename pass_type >
    546 Declaration * PassVisitor< pass_type >::mutate( TypedefDecl * node ) {
    547         MUTATE_START( node );
    548 
    549         {
    550                 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
    551                 maybeMutateRef     ( node->parameters, *this );
    552                 maybeMutateRef( node->base      , *this );
    553         }
    554 
    555         indexerAddType( node );
    556 
    557         maybeMutateRef( node->assertions, *this );
    558 
    559         MUTATE_END( Declaration, node );
    560 }
    561 
    562 //--------------------------------------------------------------------------
    563 // AsmDecl
     270        VISIT_BODY( node );
     271}
     272
    564273template< typename pass_type >
    565274void PassVisitor< pass_type >::visit( AsmDecl * node ) {
    566         VISIT_START( node );
    567 
    568         maybeAccept( node->stmt, *this );
    569 
    570         VISIT_END( node );
    571 }
    572 
    573 template< typename pass_type >
    574 AsmDecl * PassVisitor< pass_type >::mutate( AsmDecl * node ) {
    575         MUTATE_START( node );
    576 
    577         maybeMutateRef( node->stmt, *this );
    578 
    579         MUTATE_END( AsmDecl, node );
     275        VISIT_BODY( node );
    580276}
    581277
     
    585281void PassVisitor< pass_type >::visit( CompoundStmt * node ) {
    586282        VISIT_START( node );
    587         {
    588                 auto guard1 = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
    589                 auto guard2 = makeFuncGuard( [this]() { call_beginScope();   }, [this]() { call_endScope();     } );
    590                 visitStatementList( node->kids );
    591         }
     283        call_beginScope();
     284
     285        visitStatementList( node->get_kids() );
     286
     287        call_endScope();
    592288        VISIT_END( node );
    593289}
     
    596292CompoundStmt * PassVisitor< pass_type >::mutate( CompoundStmt * node ) {
    597293        MUTATE_START( node );
    598         {
    599                 auto guard1 = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
    600                 auto guard2 = makeFuncGuard( [this]() { call_beginScope();   }, [this]() { call_endScope();     } );
    601                 mutateStatementList( node->kids );
    602         }
     294        call_beginScope();
     295
     296        mutateStatementList( node->get_kids() );
     297
     298        call_endScope();
    603299        MUTATE_END( CompoundStmt, node );
    604300}
     
    610306        VISIT_START( node );
    611307
    612         visitExpression( node->expr );
     308        visitExpression( node->get_expr() );
    613309
    614310        VISIT_END( node );
     
    619315        MUTATE_START( node );
    620316
    621         node->expr = mutateExpression( node->expr );
     317        node->set_expr( mutateExpression( node->get_expr() ) );
    622318
    623319        MUTATE_END( Statement, node );
     
    642338        VISIT_START( node );
    643339
    644         visitExpression( node->condition );
    645         node->thenPart = visitStatement( node->thenPart );
    646         node->elsePart = visitStatement( node->elsePart );
     340        visitExpression( node->get_condition() );
     341        node->set_thenPart ( visitStatement( node->get_thenPart() ) );
     342        node->set_elsePart ( visitStatement( node->get_elsePart() ) );
    647343
    648344        VISIT_END( node );
     
    652348Statement * PassVisitor< pass_type >::mutate( IfStmt * node ) {
    653349        MUTATE_START( node );
    654         {
    655                 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
    656                 node->condition = mutateExpression( node->condition );
    657                 node->thenPart  = mutateStatement ( node->thenPart  );
    658                 node->elsePart  = mutateStatement ( node->elsePart  );
    659         }
     350
     351        node->set_condition( mutateExpression( node->get_condition() ) );
     352        node->set_thenPart ( mutateStatement ( node->get_thenPart()  ) );
     353        node->set_elsePart ( mutateStatement ( node->get_elsePart()  ) );
     354
    660355        MUTATE_END( Statement, node );
    661356}
     
    667362        VISIT_START( node );
    668363
    669         visitExpression( node->condition );
    670         node->body = visitStatement( node->body );
     364        visitExpression( node->get_condition() );
     365        node->set_body( visitStatement( node->get_body() ) );
    671366
    672367        VISIT_END( node );
     
    677372        MUTATE_START( node );
    678373
    679         node->condition = mutateExpression( node->condition );
    680         node->body      = mutateStatement ( node->body      );
     374        node->set_condition( mutateExpression( node->get_condition() ) );
     375        node->set_body( mutateStatement( node->get_body() ) );
    681376
    682377        MUTATE_END( Statement, node );
     
    688383void PassVisitor< pass_type >::visit( ForStmt * node ) {
    689384        VISIT_START( node );
    690         {
    691                 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
    692                 maybeAccept( node->initialization, *this );
    693                 visitExpression( node->condition );
    694                 visitExpression( node->increment );
    695                 node->body = visitStatement( node->body );
    696         }
     385
     386        acceptAll( node->get_initialization(), *this );
     387        visitExpression( node->get_condition() );
     388        visitExpression( node->get_increment() );
     389        node->set_body( visitStatement( node->get_body() ) );
     390
    697391        VISIT_END( node );
    698392}
     
    701395Statement * PassVisitor< pass_type >::mutate( ForStmt * node ) {
    702396        MUTATE_START( node );
    703         {
    704                 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
    705                 maybeMutateRef( node->initialization, *this );
    706                 node->condition = mutateExpression( node->condition );
    707                 node->increment = mutateExpression( node->increment );
    708                 node->body      = mutateStatement ( node->body      );
    709         }
     397
     398        mutateAll( node->get_initialization(), *this );
     399        node->set_condition( mutateExpression( node->get_condition() ) );
     400        node->set_increment( mutateExpression( node->get_increment() ) );
     401        node->set_body( mutateStatement( node->get_body() ) );
     402
    710403        MUTATE_END( Statement, node );
    711404}
     
    717410        VISIT_START( node );
    718411
    719         visitExpression   ( node->condition );
    720         visitStatementList( node->statements );
     412        visitExpression( node->get_condition() );
     413        visitStatementList( node->get_statements() );
    721414
    722415        VISIT_END( node );
     
    727420        MUTATE_START( node );
    728421
    729         node->condition = mutateExpression( node->condition );
    730         mutateStatementList( node->statements );
     422        node->set_condition( mutateExpression( node->get_condition() ) );
     423        mutateStatementList( node->get_statements() );
    731424
    732425        MUTATE_END( Statement, node );
     
    739432        VISIT_START( node );
    740433
    741         visitExpression   ( node->condition );
    742         visitStatementList( node->stmts    );
     434        visitExpression( node->get_condition() );
     435        visitStatementList( node->get_statements() );
    743436
    744437        VISIT_END( node );
     
    749442        MUTATE_START( node );
    750443
    751         node->condition = mutateExpression( node->condition );
    752         mutateStatementList( node->stmts );
     444        node->set_condition(  mutateExpression( node->get_condition() ) );
     445        mutateStatementList( node->get_statements() );
    753446
    754447        MUTATE_END( Statement, node );
     
    773466        VISIT_START( node );
    774467
    775         visitExpression( node->expr );
     468        visitExpression( node->get_expr() );
    776469
    777470        VISIT_END( node );
     
    782475        MUTATE_START( node );
    783476
    784         node->expr = mutateExpression( node->expr );
     477        node->set_expr( mutateExpression( node->get_expr() ) );
    785478
    786479        MUTATE_END( Statement, node );
     
    806499        VISIT_START( node );
    807500
    808         maybeAccept( node->block       , *this );
    809         maybeAccept( node->handlers    , *this );
    810         maybeAccept( node->finallyBlock, *this );
     501        maybeAccept( node->get_block(), *this );
     502        acceptAll( node->get_catchers(), *this );
     503        maybeAccept( node->get_finally(), *this );
    811504
    812505        VISIT_END( node );
     
    817510        MUTATE_START( node );
    818511
    819         maybeMutateRef( node->block       , *this );
    820         maybeMutateRef( node->handlers    , *this );
    821         maybeMutateRef( node->finallyBlock, *this );
     512        node->set_block(  maybeMutate( node->get_block(), *this ) );
     513        mutateAll( node->get_catchers(), *this );
     514        node->set_finally( maybeMutate( node->get_finally(), *this ) );
    822515
    823516        MUTATE_END( Statement, node );
     
    829522void PassVisitor< pass_type >::visit( CatchStmt * node ) {
    830523        VISIT_START( node );
    831         {
    832                 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
    833                 maybeAccept( node->decl, *this );
    834                 node->cond = visitExpression( node->cond );
    835                 node->body = visitStatement ( node->body );
    836         }
     524
     525        maybeAccept( node->get_decl(), *this );
     526        node->set_cond( visitExpression( node->get_cond() ) );
     527        node->set_body( visitStatement( node->get_body() ) );
     528
    837529        VISIT_END( node );
    838530}
     
    841533Statement * PassVisitor< pass_type >::mutate( CatchStmt * node ) {
    842534        MUTATE_START( node );
    843         {
    844                 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
    845                 maybeMutateRef( node->decl, *this );
    846                 node->cond = mutateExpression( node->cond );
    847                 node->body = mutateStatement ( node->body );
    848         }
     535
     536        node->set_decl( maybeMutate( node->get_decl(), *this ) );
     537        node->set_cond( mutateExpression( node->get_cond() ) );
     538        node->set_body( mutateStatement( node->get_body() ) );
     539
    849540        MUTATE_END( Statement, node );
    850541}
     
    914605template< typename pass_type >
    915606void PassVisitor< pass_type >::visit( ApplicationExpr * node ) {
    916         VISIT_START( node );
    917 
    918         indexerScopedAccept( node->result  , *this );
    919         maybeAccept        ( node->function, *this );
    920         maybeAccept        ( node->args    , *this );
    921 
    922         VISIT_END( node );
     607        VISIT_BODY( node );
    923608}
    924609
    925610template< typename pass_type >
    926611Expression * PassVisitor< pass_type >::mutate( ApplicationExpr * node ) {
    927         MUTATE_START( node );
    928 
    929         indexerScopedMutate( node->env     , *this );
    930         indexerScopedMutate( node->result  , *this );
    931         maybeMutateRef     ( node->function, *this );
    932         maybeMutateRef     ( node->args    , *this );
    933 
    934         MUTATE_END( Expression, node );
     612        MUTATE_BODY( Expression, node );
    935613}
    936614
     
    942620
    943621        // maybeAccept( node->get_env(), *this );
    944         indexerScopedAccept( node->result, *this );
    945 
    946         for ( auto expr : node->args ) {
     622        maybeAccept( node->get_result(), *this );
     623
     624        for ( auto expr : node->get_args() ) {
    947625                visitExpression( expr );
    948626        }
     
    955633        MUTATE_START( node );
    956634
    957         indexerScopedMutate( node->env   , *this );
    958         indexerScopedMutate( node->result, *this );
    959 
    960         for ( auto& expr : node->args ) {
     635        node->set_env( maybeMutate( node->get_env(), *this ) );
     636        node->set_result( maybeMutate( node->get_result(), *this ) );
     637
     638        for ( auto& expr : node->get_args() ) {
    961639                expr = mutateExpression( expr );
    962640        }
     
    965643}
    966644
    967 //--------------------------------------------------------------------------
    968 // NameExpr
    969645template< typename pass_type >
    970646void PassVisitor< pass_type >::visit( NameExpr * node ) {
    971         VISIT_START( node );
    972 
    973         indexerScopedAccept( node->result, *this );
    974 
    975         VISIT_END( node );
    976 }
    977 
    978 template< typename pass_type >
    979 Expression * PassVisitor< pass_type >::mutate( NameExpr * node ) {
    980         MUTATE_START( node );
    981 
    982         indexerScopedMutate( node->env   , *this );
    983         indexerScopedMutate( node->result, *this );
    984 
    985         MUTATE_END( Expression, node );
    986 }
    987 
    988 //--------------------------------------------------------------------------
    989 // CastExpr
     647        VISIT_BODY( node );
     648}
     649
    990650template< typename pass_type >
    991651void PassVisitor< pass_type >::visit( CastExpr * node ) {
    992         VISIT_START( node );
    993 
    994         indexerScopedAccept( node->result, *this );
    995         maybeAccept        ( node->arg   , *this );
    996 
    997         VISIT_END( node );
    998 }
    999 
    1000 template< typename pass_type >
    1001 Expression * PassVisitor< pass_type >::mutate( CastExpr * node ) {
    1002         MUTATE_START( node );
    1003 
    1004         indexerScopedMutate( node->env   , *this );
    1005         indexerScopedMutate( node->result, *this );
    1006         maybeMutateRef     ( node->arg   , *this );
    1007 
    1008         MUTATE_END( Expression, node );
    1009 }
    1010 
    1011 //--------------------------------------------------------------------------
    1012 // VirtualCastExpr
     652        VISIT_BODY( node );
     653}
     654
    1013655template< typename pass_type >
    1014656void PassVisitor< pass_type >::visit( VirtualCastExpr * node ) {
    1015         VISIT_START( node );
    1016 
    1017         indexerScopedAccept( node->result, *this );
    1018         maybeAccept( node->arg, *this );
    1019 
    1020         VISIT_END( node );
    1021 }
    1022 
    1023 template< typename pass_type >
    1024 Expression * PassVisitor< pass_type >::mutate( VirtualCastExpr * node ) {
    1025         MUTATE_START( node );
    1026 
    1027         indexerScopedMutate( node->env   , *this );
    1028         indexerScopedMutate( node->result, *this );
    1029         maybeMutateRef     ( node->arg   , *this );
    1030 
    1031         MUTATE_END( Expression, node );
    1032 }
    1033 
    1034 //--------------------------------------------------------------------------
    1035 // AddressExpr
     657        VISIT_BODY( node );
     658}
     659
    1036660template< typename pass_type >
    1037661void PassVisitor< pass_type >::visit( AddressExpr * node ) {
    1038         VISIT_START( node );
    1039 
    1040         indexerScopedAccept( node->result, *this );
    1041         maybeAccept        ( node->arg   , *this );
    1042 
    1043         VISIT_END( node );
    1044 }
    1045 
    1046 template< typename pass_type >
    1047 Expression * PassVisitor< pass_type >::mutate( AddressExpr * node ) {
    1048         MUTATE_START( node );
    1049 
    1050         indexerScopedMutate( node->env   , *this );
    1051         indexerScopedMutate( node->result, *this );
    1052         maybeMutateRef     ( node->arg   , *this );
    1053 
    1054         MUTATE_END( Expression, node );
    1055 }
    1056 
    1057 //--------------------------------------------------------------------------
    1058 // LabelAddressExpr
     662        VISIT_BODY( node );
     663}
     664
    1059665template< typename pass_type >
    1060666void PassVisitor< pass_type >::visit( LabelAddressExpr * node ) {
    1061         VISIT_START( node );
    1062 
    1063         indexerScopedAccept( node->result, *this );
    1064 
    1065         VISIT_END( node );
    1066 }
    1067 
    1068 template< typename pass_type >
    1069 Expression * PassVisitor< pass_type >::mutate( LabelAddressExpr * node ) {
    1070         MUTATE_START( node );
    1071 
    1072         indexerScopedMutate( node->env   , *this );
    1073         indexerScopedMutate( node->result, *this );
    1074 
    1075         MUTATE_END( Expression, node );
    1076 }
    1077 
    1078 //--------------------------------------------------------------------------
    1079 // UntypedMemberExpr
     667        VISIT_BODY( node );
     668}
     669
    1080670template< typename pass_type >
    1081671void PassVisitor< pass_type >::visit( UntypedMemberExpr * node ) {
    1082         VISIT_START( node );
    1083 
    1084         indexerScopedAccept( node->result   , *this );
    1085         maybeAccept        ( node->aggregate, *this );
    1086         maybeAccept        ( node->member   , *this );
    1087 
    1088         VISIT_END( node );
    1089 }
    1090 
    1091 template< typename pass_type >
    1092 Expression * PassVisitor< pass_type >::mutate( UntypedMemberExpr * node ) {
    1093         MUTATE_START( node );
    1094 
    1095         indexerScopedMutate( node->env      , *this );
    1096         indexerScopedMutate( node->result   , *this );
    1097         maybeMutateRef     ( node->aggregate, *this );
    1098         maybeMutateRef     ( node->member   , *this );
    1099 
    1100         MUTATE_END( Expression, node );
    1101 }
    1102 
    1103 //--------------------------------------------------------------------------
    1104 // MemberExpr
     672        VISIT_BODY( node );
     673}
     674
    1105675template< typename pass_type >
    1106676void PassVisitor< pass_type >::visit( MemberExpr * node ) {
    1107         VISIT_START( node );
    1108 
    1109         indexerScopedAccept( node->result   , *this );
    1110         maybeAccept        ( node->aggregate, *this );
    1111 
    1112         VISIT_END( node );
    1113 }
    1114 
    1115 template< typename pass_type >
    1116 Expression * PassVisitor< pass_type >::mutate( MemberExpr * node ) {
    1117         MUTATE_START( node );
    1118 
    1119         indexerScopedMutate( node->env      , *this );
    1120         indexerScopedMutate( node->result   , *this );
    1121         maybeMutateRef     ( node->aggregate, *this );
    1122 
    1123         MUTATE_END( Expression, node );
    1124 }
    1125 
    1126 //--------------------------------------------------------------------------
    1127 // VariableExpr
     677        VISIT_BODY( node );
     678}
     679
    1128680template< typename pass_type >
    1129681void PassVisitor< pass_type >::visit( VariableExpr * node ) {
    1130         VISIT_START( node );
    1131 
    1132         indexerScopedAccept( node->result, *this );
    1133 
    1134         VISIT_END( node );
    1135 }
    1136 
    1137 template< typename pass_type >
    1138 Expression * PassVisitor< pass_type >::mutate( VariableExpr * node ) {
    1139         MUTATE_START( node );
    1140 
    1141         indexerScopedMutate( node->env   , *this );
    1142         indexerScopedMutate( node->result, *this );
    1143 
    1144         MUTATE_END( Expression, node );
    1145 }
    1146 
    1147 //--------------------------------------------------------------------------
    1148 // ConstantExpr
     682        VISIT_BODY( node );
     683}
     684
    1149685template< typename pass_type >
    1150686void PassVisitor< pass_type >::visit( ConstantExpr * node ) {
    1151         VISIT_START( node );
    1152 
    1153         indexerScopedAccept( node->result   , *this );
    1154         maybeAccept        ( &node->constant, *this );
    1155 
    1156         VISIT_END( node );
    1157 }
    1158 
    1159 template< typename pass_type >
    1160 Expression * PassVisitor< pass_type >::mutate( ConstantExpr * node ) {
    1161         MUTATE_START( node );
    1162 
    1163         indexerScopedMutate( node->env   , *this );
    1164         indexerScopedMutate( node->result, *this );
    1165         node->constant = *maybeMutate( &node->constant, *this );
    1166 
    1167         MUTATE_END( Expression, node );
    1168 }
    1169 
    1170 //--------------------------------------------------------------------------
    1171 // SizeofExpr
     687        VISIT_BODY( node );
     688}
     689
    1172690template< typename pass_type >
    1173691void PassVisitor< pass_type >::visit( SizeofExpr * node ) {
    1174         VISIT_START( node );
    1175 
    1176         indexerScopedAccept( node->result, *this );
    1177         if ( node->get_isType() ) {
    1178                 maybeAccept( node->type, *this );
    1179         } else {
    1180                 maybeAccept( node->expr, *this );
    1181         }
    1182 
    1183         VISIT_END( node );
    1184 }
    1185 
    1186 template< typename pass_type >
    1187 Expression * PassVisitor< pass_type >::mutate( SizeofExpr * node ) {
    1188         MUTATE_START( node );
    1189 
    1190         indexerScopedMutate( node->env   , *this );
    1191         indexerScopedMutate( node->result, *this );
    1192         if ( node->get_isType() ) {
    1193                 maybeMutateRef( node->type, *this );
    1194         } else {
    1195                 maybeMutateRef( node->expr, *this );
    1196         }
    1197 
    1198         MUTATE_END( Expression, node );
    1199 }
    1200 
    1201 //--------------------------------------------------------------------------
    1202 // AlignofExpr
     692        VISIT_BODY( node );
     693}
     694
    1203695template< typename pass_type >
    1204696void PassVisitor< pass_type >::visit( AlignofExpr * node ) {
    1205         VISIT_START( node );
    1206 
    1207         indexerScopedAccept( node->result, *this );
    1208         if ( node->get_isType() ) {
    1209                 maybeAccept( node->type, *this );
    1210         } else {
    1211                 maybeAccept( node->expr, *this );
    1212         }
    1213 
    1214         VISIT_END( node );
    1215 }
    1216 
    1217 template< typename pass_type >
    1218 Expression * PassVisitor< pass_type >::mutate( AlignofExpr * node ) {
    1219         MUTATE_START( node );
    1220 
    1221         indexerScopedMutate( node->env   , *this );
    1222         indexerScopedMutate( node->result, *this );
    1223         if ( node->get_isType() ) {
    1224                 maybeMutateRef( node->type, *this );
    1225         } else {
    1226                 maybeMutateRef( node->expr, *this );
    1227         }
    1228 
    1229         MUTATE_END( Expression, node );
    1230 }
    1231 
    1232 //--------------------------------------------------------------------------
    1233 // UntypedOffsetofExpr
     697        VISIT_BODY( node );
     698}
     699
    1234700template< typename pass_type >
    1235701void PassVisitor< pass_type >::visit( UntypedOffsetofExpr * node ) {
    1236         VISIT_START( node );
    1237 
    1238         indexerScopedAccept( node->result, *this );
    1239         maybeAccept        ( node->type  , *this );
    1240 
    1241         VISIT_END( node );
    1242 }
    1243 
    1244 template< typename pass_type >
    1245 Expression * PassVisitor< pass_type >::mutate( UntypedOffsetofExpr * node ) {
    1246         MUTATE_START( node );
    1247 
    1248         indexerScopedMutate( node->env   , *this );
    1249         indexerScopedMutate( node->result, *this );
    1250         maybeMutateRef     ( node->type  , *this );
    1251 
    1252         MUTATE_END( Expression, node );
    1253 }
    1254 
    1255 //--------------------------------------------------------------------------
    1256 // OffsetofExpr
     702        VISIT_BODY( node );
     703}
     704
    1257705template< typename pass_type >
    1258706void PassVisitor< pass_type >::visit( OffsetofExpr * node ) {
    1259         VISIT_START( node );
    1260 
    1261         indexerScopedAccept( node->result, *this );
    1262         maybeAccept        ( node->type  , *this );
    1263         maybeAccept        ( node->member, *this );
    1264 
    1265         VISIT_END( node );
    1266 }
    1267 
    1268 template< typename pass_type >
    1269 Expression * PassVisitor< pass_type >::mutate( OffsetofExpr * node ) {
    1270         MUTATE_START( node );
    1271 
    1272         indexerScopedMutate( node->env   , *this );
    1273         indexerScopedMutate( node->result, *this );
    1274         maybeMutateRef     ( node->type  , *this );
    1275         maybeMutateRef     ( node->member, *this );
    1276 
    1277         MUTATE_END( Expression, node );
    1278 }
    1279 
    1280 //--------------------------------------------------------------------------
    1281 // OffsetPackExpr
     707        VISIT_BODY( node );
     708}
     709
    1282710template< typename pass_type >
    1283711void PassVisitor< pass_type >::visit( OffsetPackExpr * node ) {
    1284         VISIT_START( node );
    1285 
    1286         indexerScopedAccept( node->result, *this );
    1287         maybeAccept        ( node->type  , *this );
    1288 
    1289         VISIT_END( node );
    1290 }
    1291 
    1292 template< typename pass_type >
    1293 Expression * PassVisitor< pass_type >::mutate( OffsetPackExpr * node ) {
    1294         MUTATE_START( node );
    1295 
    1296         indexerScopedMutate( node->env   , *this );
    1297         indexerScopedMutate( node->result, *this );
    1298         maybeMutateRef     ( node->type  , *this );
    1299 
    1300         MUTATE_END( Expression, node );
    1301 }
    1302 
    1303 //--------------------------------------------------------------------------
    1304 // AttrExpr
     712        VISIT_BODY( node );
     713}
     714
    1305715template< typename pass_type >
    1306716void PassVisitor< pass_type >::visit( AttrExpr * node ) {
    1307         VISIT_START( node );
    1308 
    1309         indexerScopedAccept( node->result, *this );
    1310         if ( node->get_isType() ) {
    1311                 maybeAccept( node->type, *this );
    1312         } else {
    1313                 maybeAccept( node->expr, *this );
    1314         }
    1315 
    1316         VISIT_END( node );
    1317 }
    1318 
    1319 template< typename pass_type >
    1320 Expression * PassVisitor< pass_type >::mutate( AttrExpr * node ) {
    1321         MUTATE_START( node );
    1322 
    1323         indexerScopedMutate( node->env   , *this );
    1324         indexerScopedMutate( node->result, *this );
    1325         if ( node->get_isType() ) {
    1326                 maybeMutateRef( node->type, *this );
    1327         } else {
    1328                 maybeMutateRef( node->expr, *this );
    1329         }
    1330 
    1331         MUTATE_END( Expression, node );
    1332 }
    1333 
    1334 //--------------------------------------------------------------------------
    1335 // LogicalExpr
     717        VISIT_BODY( node );
     718}
     719
    1336720template< typename pass_type >
    1337721void PassVisitor< pass_type >::visit( LogicalExpr * node ) {
    1338         VISIT_START( node );
    1339 
    1340         indexerScopedAccept( node->result, *this );
    1341         maybeAccept        ( node->arg1  , *this );
    1342         maybeAccept        ( node->arg2  , *this );
    1343 
    1344         VISIT_END( node );
    1345 }
    1346 
    1347 template< typename pass_type >
    1348 Expression * PassVisitor< pass_type >::mutate( LogicalExpr * node ) {
    1349         MUTATE_START( node );
    1350 
    1351         indexerScopedMutate( node->env   , *this );
    1352         indexerScopedMutate( node->result, *this );
    1353         maybeMutateRef     ( node->arg1  , *this );
    1354         maybeMutateRef     ( node->arg2  , *this );
    1355 
    1356         MUTATE_END( Expression, node );
    1357 }
    1358 
    1359 //--------------------------------------------------------------------------
    1360 // ConditionalExpr
     722        VISIT_BODY( node );
     723}
     724
    1361725template< typename pass_type >
    1362726void PassVisitor< pass_type >::visit( ConditionalExpr * node ) {
    1363         VISIT_START( node );
    1364 
    1365         indexerScopedAccept( node->result, *this );
    1366         maybeAccept        ( node->arg1  , *this );
    1367         maybeAccept        ( node->arg2  , *this );
    1368         maybeAccept        ( node->arg3  , *this );
    1369 
    1370         VISIT_END( node );
    1371 }
    1372 
    1373 template< typename pass_type >
    1374 Expression * PassVisitor< pass_type >::mutate( ConditionalExpr * node ) {
    1375         MUTATE_START( node );
    1376 
    1377         indexerScopedMutate( node->env   , *this );
    1378         indexerScopedMutate( node->result, *this );
    1379         maybeMutateRef     ( node->arg1  , *this );
    1380         maybeMutateRef     ( node->arg2  , *this );
    1381         maybeMutateRef     ( node->arg3  , *this );
    1382 
    1383         MUTATE_END( Expression, node );
    1384 }
    1385 
    1386 //--------------------------------------------------------------------------
    1387 // CommaExpr
     727        VISIT_BODY( node );
     728}
     729
    1388730template< typename pass_type >
    1389731void PassVisitor< pass_type >::visit( CommaExpr * node ) {
    1390         VISIT_START( node );
    1391 
    1392         indexerScopedAccept( node->result, *this );
    1393         maybeAccept        ( node->arg1  , *this );
    1394         maybeAccept        ( node->arg2  , *this );
    1395 
    1396         VISIT_END( node );
    1397 }
    1398 
    1399 template< typename pass_type >
    1400 Expression * PassVisitor< pass_type >::mutate( CommaExpr * node ) {
    1401         MUTATE_START( node );
    1402 
    1403         indexerScopedMutate( node->env   , *this );
    1404         indexerScopedMutate( node->result, *this );
    1405         maybeMutateRef     ( node->arg1  , *this );
    1406         maybeMutateRef     ( node->arg2  , *this );
    1407 
    1408         MUTATE_END( Expression, node );
    1409 }
    1410 
    1411 //--------------------------------------------------------------------------
    1412 // TypeExpr
     732        VISIT_BODY( node );
     733}
     734
    1413735template< typename pass_type >
    1414736void PassVisitor< pass_type >::visit( TypeExpr * node ) {
    1415         VISIT_START( node );
    1416 
    1417         indexerScopedAccept( node->result, *this );
    1418         maybeAccept        ( node->type, *this );
    1419 
    1420         VISIT_END( node );
    1421 }
    1422 
    1423 template< typename pass_type >
    1424 Expression * PassVisitor< pass_type >::mutate( TypeExpr * node ) {
    1425         MUTATE_START( node );
    1426 
    1427         indexerScopedMutate( node->env   , *this );
    1428         indexerScopedMutate( node->result, *this );
    1429         maybeMutateRef     ( node->type  , *this );
    1430 
    1431         MUTATE_END( Expression, node );
    1432 }
    1433 
    1434 //--------------------------------------------------------------------------
    1435 // AsmExpr
     737        VISIT_BODY( node );
     738}
     739
    1436740template< typename pass_type >
    1437741void PassVisitor< pass_type >::visit( AsmExpr * node ) {
    1438         VISIT_START( node );
    1439 
    1440         indexerScopedAccept( node->result    , *this );
    1441         maybeAccept        ( node->inout     , *this );
    1442         maybeAccept        ( node->constraint, *this );
    1443         maybeAccept        ( node->operand   , *this );
    1444 
    1445         VISIT_END( node );
    1446 }
    1447 
    1448 template< typename pass_type >
    1449 Expression * PassVisitor< pass_type >::mutate( AsmExpr * node ) {
    1450         MUTATE_START( node );
    1451 
    1452         indexerScopedMutate( node->env       , *this );
    1453         indexerScopedMutate( node->result    , *this );
    1454         maybeMutateRef     ( node->inout     , *this );
    1455         maybeMutateRef     ( node->constraint, *this );
    1456         maybeMutateRef     ( node->operand   , *this );
    1457 
    1458         MUTATE_END( Expression, node );
    1459 }
    1460 
    1461 //--------------------------------------------------------------------------
    1462 // ImplicitCopyCtorExpr
     742        VISIT_BODY( node );
     743}
     744
    1463745template< typename pass_type >
    1464746void PassVisitor< pass_type >::visit( ImplicitCopyCtorExpr * node ) {
    1465         VISIT_START( node );
    1466 
    1467         indexerScopedAccept( node->result     , *this );
    1468         maybeAccept        ( node->callExpr   , *this );
    1469         maybeAccept        ( node->tempDecls  , *this );
    1470         maybeAccept        ( node->returnDecls, *this );
    1471         maybeAccept        ( node->dtors      , *this );
    1472 
    1473         VISIT_END( node );
    1474 }
    1475 
    1476 template< typename pass_type >
    1477 Expression * PassVisitor< pass_type >::mutate( ImplicitCopyCtorExpr * node ) {
    1478         MUTATE_START( node );
    1479 
    1480         indexerScopedMutate( node->env        , *this );
    1481         indexerScopedMutate( node->result     , *this );
    1482         maybeMutateRef     ( node->callExpr   , *this );
    1483         maybeMutateRef     ( node->tempDecls  , *this );
    1484         maybeMutateRef     ( node->returnDecls, *this );
    1485         maybeMutateRef     ( node->dtors      , *this );
    1486 
    1487         MUTATE_END( Expression, node );
    1488 }
    1489 
    1490 //--------------------------------------------------------------------------
    1491 // ConstructorExpr
     747        VISIT_BODY( node );
     748}
     749
    1492750template< typename pass_type >
    1493751void PassVisitor< pass_type >::visit( ConstructorExpr * node ) {
    1494         VISIT_START( node );
    1495 
    1496         indexerScopedAccept( node->result  , *this );
    1497         maybeAccept        ( node->callExpr, *this );
    1498 
    1499         VISIT_END( node );
    1500 }
    1501 
    1502 template< typename pass_type >
    1503 Expression * PassVisitor< pass_type >::mutate( ConstructorExpr * node ) {
    1504         MUTATE_START( node );
    1505 
    1506         indexerScopedMutate( node->env     , *this );
    1507         indexerScopedMutate( node->result  , *this );
    1508         maybeMutateRef     ( node->callExpr, *this );
    1509 
    1510         MUTATE_END( Expression, node );
    1511 }
    1512 
    1513 //--------------------------------------------------------------------------
    1514 // CompoundLiteralExpr
     752        VISIT_BODY( node );
     753}
     754
    1515755template< typename pass_type >
    1516756void PassVisitor< pass_type >::visit( CompoundLiteralExpr * node ) {
    1517         VISIT_START( node );
    1518 
    1519         indexerScopedAccept( node->result     , *this );
    1520         maybeAccept        ( node->initializer, *this );
    1521 
    1522         VISIT_END( node );
    1523 }
    1524 
    1525 template< typename pass_type >
    1526 Expression * PassVisitor< pass_type >::mutate( CompoundLiteralExpr * node ) {
    1527         MUTATE_START( node );
    1528 
    1529         indexerScopedMutate( node->env        , *this );
    1530         indexerScopedMutate( node->result     , *this );
    1531         maybeMutateRef     ( node->initializer, *this );
    1532 
    1533         MUTATE_END( Expression, node );
    1534 }
    1535 
    1536 //--------------------------------------------------------------------------
    1537 // RangeExpr
     757        VISIT_BODY( node );
     758}
     759
    1538760template< typename pass_type >
    1539761void PassVisitor< pass_type >::visit( RangeExpr * node ) {
    1540         VISIT_START( node );
    1541 
    1542         indexerScopedAccept( node->result, *this );
    1543         maybeAccept        ( node->low   , *this );
    1544         maybeAccept        ( node->high  , *this );
    1545 
    1546         VISIT_END( node );
    1547 }
    1548 
    1549 template< typename pass_type >
    1550 Expression * PassVisitor< pass_type >::mutate( RangeExpr * node ) {
    1551         MUTATE_START( node );
    1552 
    1553         indexerScopedMutate( node->env   , *this );
    1554         indexerScopedMutate( node->result, *this );
    1555         maybeMutateRef     ( node->low   , *this );
    1556         maybeMutateRef     ( node->high  , *this );
    1557 
    1558         MUTATE_END( Expression, node );
    1559 }
    1560 
    1561 //--------------------------------------------------------------------------
    1562 // UntypedTupleExpr
     762        VISIT_BODY( node );
     763}
     764
    1563765template< typename pass_type >
    1564766void PassVisitor< pass_type >::visit( UntypedTupleExpr * node ) {
    1565         VISIT_START( node );
    1566 
    1567         indexerScopedAccept( node->result, *this );
    1568         maybeAccept        ( node->exprs , *this );
    1569 
    1570         VISIT_END( node );
    1571 }
    1572 
    1573 template< typename pass_type >
    1574 Expression * PassVisitor< pass_type >::mutate( UntypedTupleExpr * node ) {
    1575         MUTATE_START( node );
    1576 
    1577         indexerScopedMutate( node->env   , *this );
    1578         indexerScopedMutate( node->result, *this );
    1579         maybeMutateRef     ( node->exprs , *this );
    1580 
    1581         MUTATE_END( Expression, node );
    1582 }
    1583 
    1584 //--------------------------------------------------------------------------
    1585 // TupleExpr
     767        VISIT_BODY( node );
     768}
     769
    1586770template< typename pass_type >
    1587771void PassVisitor< pass_type >::visit( TupleExpr * node ) {
    1588         VISIT_START( node );
    1589 
    1590         indexerScopedAccept( node->result, *this );
    1591         maybeAccept          ( node->exprs , *this );
    1592 
    1593         VISIT_END( node );
    1594 }
    1595 
    1596 template< typename pass_type >
    1597 Expression * PassVisitor< pass_type >::mutate( TupleExpr * node ) {
    1598         MUTATE_START( node );
    1599 
    1600         indexerScopedMutate( node->env   , *this );
    1601         indexerScopedMutate( node->result, *this );
    1602         maybeMutateRef     ( node->exprs , *this );
    1603 
    1604         MUTATE_END( Expression, node );
    1605 }
    1606 
    1607 //--------------------------------------------------------------------------
    1608 // TupleIndexExpr
     772        VISIT_BODY( node );
     773}
     774
    1609775template< typename pass_type >
    1610776void PassVisitor< pass_type >::visit( TupleIndexExpr * node ) {
    1611         VISIT_START( node );
    1612 
    1613         indexerScopedAccept( node->result, *this );
    1614         maybeAccept        ( node->tuple , *this );
    1615 
    1616         VISIT_END( node );
    1617 }
    1618 
    1619 template< typename pass_type >
    1620 Expression * PassVisitor< pass_type >::mutate( TupleIndexExpr * node ) {
    1621         MUTATE_START( node );
    1622 
    1623         indexerScopedMutate( node->env   , *this );
    1624         indexerScopedMutate( node->result, *this );
    1625         maybeMutateRef     ( node->tuple , *this );
    1626 
    1627         MUTATE_END( Expression, node );
    1628 }
    1629 
    1630 //--------------------------------------------------------------------------
    1631 // TupleAssignExpr
     777        VISIT_BODY( node );
     778}
     779
    1632780template< typename pass_type >
    1633781void PassVisitor< pass_type >::visit( TupleAssignExpr * node ) {
    1634         VISIT_START( node );
    1635 
    1636         indexerScopedAccept( node->result  , *this );
    1637         maybeAccept        ( node->stmtExpr, *this );
    1638 
    1639         VISIT_END( node );
    1640 }
    1641 
    1642 template< typename pass_type >
    1643 Expression * PassVisitor< pass_type >::mutate( TupleAssignExpr * node ) {
    1644         MUTATE_START( node );
    1645 
    1646         indexerScopedMutate( node->env     , *this );
    1647         indexerScopedMutate( node->result  , *this );
    1648         maybeMutateRef     ( node->stmtExpr, *this );
    1649 
    1650         MUTATE_END( Expression, node );
    1651 }
    1652 
    1653 //--------------------------------------------------------------------------
    1654 // StmtExpr
     782        VISIT_BODY( node );
     783}
     784
     785//--------------------------------------------------------------------------
     786// UntypedExpr
    1655787template< typename pass_type >
    1656788void PassVisitor< pass_type >::visit( StmtExpr * node ) {
     
    1662794        ValueGuardPtr< std::list< Statement* > > oldAfterStmts ( get_afterStmts () );
    1663795
    1664         indexerScopedAccept( node->result     , *this );
    1665         maybeAccept        ( node->statements , *this );
    1666         maybeAccept        ( node->returnDecls, *this );
    1667         maybeAccept        ( node->dtors      , *this );
     796        Visitor::visit( node );
    1668797
    1669798        VISIT_END( node );
     
    1679808        ValueGuardPtr< std::list< Statement* > > oldAfterStmts ( get_afterStmts () );
    1680809
    1681         indexerScopedMutate( node->result     , *this );
    1682         maybeMutateRef     ( node->statements , *this );
    1683         maybeMutateRef     ( node->returnDecls, *this );
    1684         maybeMutateRef     ( node->dtors      , *this );
     810        Mutator::mutate( node );
    1685811
    1686812        MUTATE_END( Expression, node );
    1687813}
    1688814
    1689 //--------------------------------------------------------------------------
    1690 // UniqueExpr
    1691815template< typename pass_type >
    1692816void PassVisitor< pass_type >::visit( UniqueExpr * node ) {
    1693         VISIT_START( node );
    1694 
    1695         indexerScopedAccept( node->result, *this );
    1696         maybeAccept        ( node->expr  , *this );
    1697 
    1698         VISIT_END( node );
    1699 }
    1700 
    1701 template< typename pass_type >
    1702 Expression * PassVisitor< pass_type >::mutate( UniqueExpr * node ) {
    1703         MUTATE_START( node );
    1704 
    1705         indexerScopedMutate( node->env   , *this );
    1706         indexerScopedMutate( node->result, *this );
    1707         maybeMutateRef     ( node->expr  , *this );
    1708 
    1709         MUTATE_END( Expression, node );
     817        VISIT_BODY( node );
    1710818}
    1711819
     
    1740848}
    1741849
    1742 //--------------------------------------------------------------------------
    1743 // StructInstType
    1744850template< typename pass_type >
    1745851void PassVisitor< pass_type >::visit( StructInstType * node ) {
    1746         VISIT_START( node );
    1747 
    1748         indexerAddStruct( node->name );
    1749 
    1750         {
    1751                 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
    1752                 maybeAccept( node->forall    , *this );
    1753                 maybeAccept( node->parameters, *this );
    1754         }
    1755 
    1756         VISIT_END( node );
    1757 }
    1758 
    1759 template< typename pass_type >
    1760 Type * PassVisitor< pass_type >::mutate( StructInstType * node ) {
    1761         MUTATE_START( node );
    1762 
    1763         indexerAddStruct( node->name );
    1764 
    1765         {
    1766                 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
    1767                 maybeMutateRef( node->forall    , *this );
    1768                 maybeMutateRef( node->parameters, *this );
    1769         }
    1770 
    1771         MUTATE_END( Type, node );
    1772 }
    1773 
    1774 //--------------------------------------------------------------------------
    1775 // UnionInstType
     852        VISIT_BODY( node );
     853}
     854
    1776855template< typename pass_type >
    1777856void PassVisitor< pass_type >::visit( UnionInstType * node ) {
    1778         VISIT_START( node );
    1779 
    1780         indexerAddStruct( node->name );
    1781 
    1782         {
    1783                 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
    1784                 maybeAccept( node->forall    , *this );
    1785                 maybeAccept( node->parameters, *this );
    1786         }
    1787 
    1788         VISIT_END( node );
    1789 }
    1790 
    1791 template< typename pass_type >
    1792 Type * PassVisitor< pass_type >::mutate( UnionInstType * node ) {
    1793         MUTATE_START( node );
    1794 
    1795         indexerAddStruct( node->name );
    1796 
    1797         {
    1798                 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
    1799                 maybeMutateRef( node->forall    , *this );
    1800                 maybeMutateRef( node->parameters, *this );
    1801         }
    1802 
    1803         MUTATE_END( Type, node );
    1804 }
    1805 
    1806 //--------------------------------------------------------------------------
    1807 // EnumInstType
     857        VISIT_BODY( node );
     858}
     859
    1808860template< typename pass_type >
    1809861void PassVisitor< pass_type >::visit( EnumInstType * node ) {
     
    1812864
    1813865template< typename pass_type >
    1814 Type * PassVisitor< pass_type >::mutate( EnumInstType * node ) {
    1815         MUTATE_BODY( Type, node );
    1816 }
    1817 
    1818 //--------------------------------------------------------------------------
    1819 // TraitInstType
    1820 template< typename pass_type >
    1821866void PassVisitor< pass_type >::visit( TraitInstType * node ) {
    1822         VISIT_START( node );
    1823 
    1824         maybeAccept( node->forall    , *this );
    1825         maybeAccept( node->parameters, *this );
    1826 
    1827         VISIT_END( node );
    1828 }
    1829 
    1830 template< typename pass_type >
    1831 Type * PassVisitor< pass_type >::mutate( TraitInstType * node ) {
    1832         MUTATE_START( node );
    1833 
    1834         maybeMutateRef( node->forall    , *this );
    1835         maybeMutateRef( node->parameters, *this );
    1836 
    1837         MUTATE_END( Type, node );
    1838 }
    1839 
    1840 //--------------------------------------------------------------------------
    1841 // TypeInstType
     867        VISIT_BODY( node );
     868}
     869
    1842870template< typename pass_type >
    1843871void PassVisitor< pass_type >::visit( TypeInstType * node ) {
     
    1876904
    1877905//--------------------------------------------------------------------------
    1878 // SingleInit
     906// UntypedExpr
    1879907template< typename pass_type >
    1880908void PassVisitor< pass_type >::visit( SingleInit * node ) {
     
    1916944
    1917945//---------------------------------------------------------------------------------------------------------------
     946
     947template< typename pass_type >
     948DeclarationWithType * PassVisitor< pass_type >::mutate( ObjectDecl * node ) {
     949        MUTATE_BODY( DeclarationWithType, node );
     950}
     951
     952template< typename pass_type >
     953DeclarationWithType * PassVisitor< pass_type >::mutate( FunctionDecl * node ) {
     954        MUTATE_BODY( DeclarationWithType, node );
     955}
     956
     957template< typename pass_type >
     958Declaration * PassVisitor< pass_type >::mutate( StructDecl * node ) {
     959        MUTATE_BODY( Declaration, node );
     960}
     961
     962template< typename pass_type >
     963Declaration * PassVisitor< pass_type >::mutate( UnionDecl * node ) {
     964        MUTATE_BODY( Declaration, node );
     965}
     966
     967template< typename pass_type >
     968Declaration * PassVisitor< pass_type >::mutate( EnumDecl * node ) {
     969        MUTATE_BODY( Declaration, node );
     970}
     971
     972template< typename pass_type >
     973Declaration * PassVisitor< pass_type >::mutate( TraitDecl * node ) {
     974        MUTATE_BODY( Declaration, node );
     975}
     976
     977template< typename pass_type >
     978Declaration * PassVisitor< pass_type >::mutate( TypeDecl * node ) {
     979        MUTATE_BODY( Declaration, node );
     980}
     981
     982template< typename pass_type >
     983Declaration * PassVisitor< pass_type >::mutate( TypedefDecl * node ) {
     984        MUTATE_BODY( Declaration, node );
     985}
     986
     987template< typename pass_type >
     988AsmDecl * PassVisitor< pass_type >::mutate( AsmDecl * node ) {
     989        MUTATE_BODY( AsmDecl, node );
     990}
     991
     992template< typename pass_type >
     993Expression * PassVisitor< pass_type >::mutate( NameExpr * node ) {
     994        MUTATE_BODY( Expression, node );
     995}
     996
     997template< typename pass_type >
     998Expression * PassVisitor< pass_type >::mutate( AddressExpr * node ) {
     999        MUTATE_BODY( Expression, node );
     1000}
     1001
     1002template< typename pass_type >
     1003Expression * PassVisitor< pass_type >::mutate( LabelAddressExpr * node ) {
     1004        MUTATE_BODY( Expression, node );
     1005}
     1006
     1007template< typename pass_type >
     1008Expression * PassVisitor< pass_type >::mutate( CastExpr * node ) {
     1009        MUTATE_BODY( Expression, node );
     1010}
     1011
     1012template< typename pass_type >
     1013Expression * PassVisitor< pass_type >::mutate( VirtualCastExpr * node ) {
     1014        MUTATE_BODY( Expression, node );
     1015}
     1016
     1017template< typename pass_type >
     1018Expression * PassVisitor< pass_type >::mutate( UntypedMemberExpr * node ) {
     1019        MUTATE_BODY( Expression, node );
     1020}
     1021
     1022template< typename pass_type >
     1023Expression * PassVisitor< pass_type >::mutate( MemberExpr * node ) {
     1024        MUTATE_BODY( Expression, node );
     1025}
     1026
     1027template< typename pass_type >
     1028Expression * PassVisitor< pass_type >::mutate( VariableExpr * node ) {
     1029        MUTATE_BODY( Expression, node );
     1030}
     1031
     1032template< typename pass_type >
     1033Expression * PassVisitor< pass_type >::mutate( ConstantExpr * node ) {
     1034        MUTATE_BODY( Expression, node );
     1035}
     1036
     1037template< typename pass_type >
     1038Expression * PassVisitor< pass_type >::mutate( SizeofExpr * node ) {
     1039        MUTATE_BODY( Expression, node );
     1040}
     1041
     1042template< typename pass_type >
     1043Expression * PassVisitor< pass_type >::mutate( AlignofExpr * node ) {
     1044        MUTATE_BODY( Expression, node );
     1045}
     1046
     1047template< typename pass_type >
     1048Expression * PassVisitor< pass_type >::mutate( UntypedOffsetofExpr * node ) {
     1049        MUTATE_BODY( Expression, node );
     1050}
     1051
     1052template< typename pass_type >
     1053Expression * PassVisitor< pass_type >::mutate( OffsetofExpr * node ) {
     1054        MUTATE_BODY( Expression, node );
     1055}
     1056
     1057template< typename pass_type >
     1058Expression * PassVisitor< pass_type >::mutate( OffsetPackExpr * node ) {
     1059        MUTATE_BODY( Expression, node );
     1060}
     1061
     1062template< typename pass_type >
     1063Expression * PassVisitor< pass_type >::mutate( AttrExpr * node ) {
     1064        MUTATE_BODY( Expression, node );
     1065}
     1066
     1067template< typename pass_type >
     1068Expression * PassVisitor< pass_type >::mutate( LogicalExpr * node ) {
     1069        MUTATE_BODY( Expression, node );
     1070}
     1071
     1072template< typename pass_type >
     1073Expression * PassVisitor< pass_type >::mutate( ConditionalExpr * node ) {
     1074        MUTATE_BODY( Expression, node );
     1075}
     1076
     1077template< typename pass_type >
     1078Expression * PassVisitor< pass_type >::mutate( CommaExpr * node ) {
     1079        MUTATE_BODY( Expression, node );
     1080}
     1081
     1082template< typename pass_type >
     1083Expression * PassVisitor< pass_type >::mutate( TypeExpr * node ) {
     1084        MUTATE_BODY( Expression, node );
     1085}
     1086
     1087template< typename pass_type >
     1088Expression * PassVisitor< pass_type >::mutate( AsmExpr * node ) {
     1089        MUTATE_BODY( Expression, node );
     1090}
     1091
     1092template< typename pass_type >
     1093Expression * PassVisitor< pass_type >::mutate( ImplicitCopyCtorExpr * node ) {
     1094        MUTATE_BODY( Expression, node );
     1095}
     1096
     1097template< typename pass_type >
     1098Expression * PassVisitor< pass_type >::mutate( ConstructorExpr * node ) {
     1099        MUTATE_BODY( Expression, node );
     1100}
     1101
     1102template< typename pass_type >
     1103Expression * PassVisitor< pass_type >::mutate( CompoundLiteralExpr * node ) {
     1104        MUTATE_BODY( Expression, node );
     1105}
     1106
     1107template< typename pass_type >
     1108Expression * PassVisitor< pass_type >::mutate( RangeExpr * node ) {
     1109        MUTATE_BODY( Expression, node );
     1110}
     1111
     1112template< typename pass_type >
     1113Expression * PassVisitor< pass_type >::mutate( UntypedTupleExpr * node ) {
     1114        MUTATE_BODY( Expression, node );
     1115}
     1116
     1117template< typename pass_type >
     1118Expression * PassVisitor< pass_type >::mutate( TupleExpr * node ) {
     1119        MUTATE_BODY( Expression, node );
     1120}
     1121
     1122template< typename pass_type >
     1123Expression * PassVisitor< pass_type >::mutate( TupleIndexExpr * node ) {
     1124        MUTATE_BODY( Expression, node );
     1125}
     1126
     1127template< typename pass_type >
     1128Expression * PassVisitor< pass_type >::mutate( TupleAssignExpr * node ) {
     1129        MUTATE_BODY( Expression, node );
     1130}
     1131
     1132template< typename pass_type >
     1133Expression * PassVisitor< pass_type >::mutate( UniqueExpr * node ) {
     1134        MUTATE_BODY( Expression, node );
     1135}
     1136
    19181137template< typename pass_type >
    19191138Type * PassVisitor< pass_type >::mutate( VoidType * node ) {
     
    19431162template< typename pass_type >
    19441163Type * PassVisitor< pass_type >::mutate( FunctionType * node ) {
     1164        MUTATE_BODY( Type, node );
     1165}
     1166
     1167template< typename pass_type >
     1168Type * PassVisitor< pass_type >::mutate( StructInstType * node ) {
     1169        MUTATE_BODY( Type, node );
     1170}
     1171
     1172template< typename pass_type >
     1173Type * PassVisitor< pass_type >::mutate( UnionInstType * node ) {
     1174        MUTATE_BODY( Type, node );
     1175}
     1176
     1177template< typename pass_type >
     1178Type * PassVisitor< pass_type >::mutate( EnumInstType * node ) {
     1179        MUTATE_BODY( Type, node );
     1180}
     1181
     1182template< typename pass_type >
     1183Type * PassVisitor< pass_type >::mutate( TraitInstType * node ) {
    19451184        MUTATE_BODY( Type, node );
    19461185}
  • src/Common/PassVisitor.proto.h

    r982832e r7dc09294  
    4141};
    4242
     43
    4344class bool_ref {
    4445public:
     
    5859        bool * m_ref;
    5960};
    60 
    61 template< typename TreeType, typename VisitorType >
    62 inline void indexerScopedAccept( TreeType * tree, VisitorType & visitor ) {
    63         auto guard = makeFuncGuard(
    64                 [&visitor]() { visitor.indexerScopeEnter(); },
    65                 [&visitor]() { visitor.indexerScopeLeave(); }
    66         );
    67         maybeAccept( tree, visitor );
    68 }
    69 
    70 template< typename TreeType, typename MutatorType >
    71 inline void indexerScopedMutate( TreeType *& tree, MutatorType & mutator ) {
    72         auto guard = makeFuncGuard(
    73                 [&mutator]() { mutator.indexerScopeEnter(); },
    74                 [&mutator]() { mutator.indexerScopeLeave(); }
    75         );
    76         tree = maybeMutate( tree, mutator );
    77 }
    78 
    79 template< typename TreeType, typename MutatorType >
    80 inline void maybeMutateRef( TreeType *& tree, MutatorType & mutator ) {
    81         tree = maybeMutate( tree, mutator );
    82 }
    8361
    8462//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
     
    11593static inline void postvisit_impl( __attribute__((unused)) pass_type& pass, __attribute__((unused)) node_type * node, __attribute__((unused)) long unused ) {}
    11694
    117 //---------------------------------------------------------
    11895// Mutate
    11996template<typename pass_type, typename node_type>
     
    134111static inline return_type postmutate_impl( __attribute__((unused)) pass_type& pass, node_type * node, __attribute__((unused)) long unused ) { return node; }
    135112
    136 //---------------------------------------------------------
    137113// Begin/End scope
    138114template<typename pass_type>
     
    153129static inline void end_scope_impl( __attribute__((unused)) pass_type& pass, __attribute__((unused)) long unused ) {}
    154130
    155 //---------------------------------------------------------
    156131// Fields
    157132#define FIELD_PTR( type, name )                                                                                                        \
     
    170145FIELD_PTR( at_cleanup_t, at_cleanup )
    171146FIELD_PTR( PassVisitor<pass_type> * const, visitor )
    172 
    173 //---------------------------------------------------------
    174 // Indexer
    175 template<typename pass_type>
    176 static inline auto indexer_impl_enterScope( pass_type & pass, int ) -> decltype( pass.indexer.enterScope(), void() ) {
    177         pass.indexer.enterScope();
    178 }
    179 
    180 template<typename pass_type>
    181 static inline auto indexer_impl_enterScope( pass_type &, int ) {}
    182 
    183 template<typename pass_type>
    184 static inline auto indexer_impl_leaveScope( pass_type & pass, int ) -> decltype( pass.indexer.leaveScope(), void() ) {
    185         pass.indexer.leaveScope();
    186 }
    187 
    188 template<typename pass_type>
    189 static inline auto indexer_impl_leaveScope( pass_type &, int ) {}
    190 
    191 
    192 #define INDEXER_FUNC( func, type )                                                                                             \
    193 template<typename pass_type>                                                                                                   \
    194 static inline auto indexer_impl_##func ( pass_type & pass, int, type arg ) -> decltype( pass.indexer.func( arg ), void() ) {   \
    195         pass.indexer.func( arg );                                                                                                \
    196 }                                                                                                                              \
    197                                                                                                                                \
    198 template<typename pass_type>                                                                                                   \
    199 static inline void indexer_impl_##func ( pass_type &, long, type ) {}                                                          \
    200 
    201 INDEXER_FUNC( addId     , DeclarationWithType * );
    202 INDEXER_FUNC( addType   , NamedTypeDecl *       );
    203 INDEXER_FUNC( addStruct , StructDecl *          );
    204 INDEXER_FUNC( addEnum   , EnumDecl *            );
    205 INDEXER_FUNC( addUnion  , UnionDecl *           );
    206 INDEXER_FUNC( addTrait  , TraitDecl *           );
    207 
    208 
    209 template<typename pass_type>
    210 static inline auto indexer_impl_addStructFwd( pass_type & pass, int, StructDecl * decl ) -> decltype( pass.indexer.addStruct( decl ), void() ) {
    211         StructDecl * fwd = new StructDecl( decl->name );
    212         cloneAll( decl->parameters, fwd->parameters );
    213         pass.indexer.addStruct( fwd );
    214 }
    215 
    216 template<typename pass_type>
    217 static inline auto indexer_impl_addStructFwd( pass_type &, int, StructDecl * ) {}
    218 
    219 template<typename pass_type>
    220 static inline auto indexer_impl_addUnionFwd( pass_type & pass, int, UnionDecl * decl ) -> decltype( pass.indexer.addUnion( decl ), void() ) {
    221         UnionDecl * fwd = new UnionDecl( decl->name );
    222         cloneAll( decl->parameters, fwd->parameters );
    223         pass.indexer.addUnion( fwd );
    224 }
    225 
    226 template<typename pass_type>
    227 static inline auto indexer_impl_addUnionFwd( pass_type &, int, UnionDecl * ) {}
    228 
    229 template<typename pass_type>
    230 static inline auto indexer_impl_addStruct( pass_type & pass, int, const std::string & str ) -> decltype( pass.indexer.addStruct( str ), void() ) {
    231         if ( ! pass.indexer.lookupStruct( str ) ) {
    232                 pass.indexer.addStruct( str );
    233         }
    234 }
    235 
    236 template<typename pass_type>
    237 static inline auto indexer_impl_addStruct( pass_type &, int, const std::string & ) {}
    238 
    239 template<typename pass_type>
    240 static inline auto indexer_impl_addUnion( pass_type & pass, int, const std::string & str ) -> decltype( pass.indexer.addUnion( str ), void() ) {
    241         if ( ! pass.indexer.lookupUnion( str ) ) {
    242                 pass.indexer.addUnion( str );
    243         }
    244 }
    245 
    246 template<typename pass_type>
    247 static inline auto indexer_impl_addUnion( pass_type &, int, const std::string & ) {}
  • src/Common/utility.h

    r982832e r7dc09294  
    277277        ~ValueGuardPtr() { if( ref ) *ref = old; }
    278278};
    279 
    280 template< typename aT >
    281 struct FuncGuard {
    282         aT m_after;
    283 
    284         template< typename bT >
    285         FuncGuard( bT before, aT after ) : m_after( after ) {
    286                 before();
    287         }
    288 
    289         ~FuncGuard() {
    290                 m_after();
    291         }
    292 };
    293 
    294 template< typename bT, typename aT >
    295 FuncGuard<aT> makeFuncGuard( bT && before, aT && after ) {
    296         return FuncGuard<aT>( std::forward<bT>(before), std::forward<aT>(after) );
    297 }
    298279
    299280template< typename T >
  • src/Concurrency/Keywords.cc

    r982832e r7dc09294  
    259259        //=============================================================================================
    260260        void ConcurrentSueKeyword::postvisit(StructDecl * decl) {
    261                 if( decl->name == type_name && decl->body ) {
     261                if( decl->get_name() == type_name && decl->has_body() ) {
    262262                        assert( !type_decl );
    263263                        type_decl = decl;
     
    270270
    271271        void ConcurrentSueKeyword::handle( StructDecl * decl ) {
    272                 if( ! decl->body ) return;
     272                if( ! decl->has_body() ) return;
    273273
    274274                if( !type_decl ) throw SemanticError( context_error, decl );
     
    418418        void MutexKeyword::postvisit(StructDecl* decl) {
    419419
    420                 if( decl->name == "monitor_desc" ) {
     420                if( decl->get_name() == "monitor_desc" ) {
    421421                        assert( !monitor_decl );
    422422                        monitor_decl = decl;
    423423                }
    424                 else if( decl->name == "monitor_guard_t" ) {
     424                else if( decl->get_name() == "monitor_guard_t" ) {
    425425                        assert( !guard_decl );
    426426                        guard_decl = decl;
     
    524524        //=============================================================================================
    525525        void ThreadStarter::postvisit(FunctionDecl * decl) {
    526                 if( ! CodeGen::isConstructor(decl->name) ) return;
     526                if( ! CodeGen::isConstructor(decl->get_name()) ) return;
    527527
    528528                DeclarationWithType * param = decl->get_functionType()->get_parameters().front();
  • src/Concurrency/module.mk

    r982832e r7dc09294  
    66## file "LICENCE" distributed with Cforall.
    77##
    8 ## module.mk --
     8## module.mk -- 
    99##
    1010## Author           : Thierry Delisle
    1111## Created On       : Mon Mar 13 12:48:40 2017
    12 ## Last Modified By :
    13 ## Last Modified On :
     12## Last Modified By : 
     13## Last Modified On : 
    1414## Update Count     : 0
    1515###############################################################################
    1616
    17 SRC += Concurrency/Keywords.cc \
    18        Concurrency/Waitfor.cc
     17SRC += Concurrency/Keywords.cc
    1918
  • src/GenPoly/Box.cc

    r982832e r7dc09294  
    1515
    1616#include <algorithm>                     // for mismatch
    17 #include <cassert>                       // for assert, strict_dynamic_cast
     17#include <cassert>                       // for assert, safe_dynamic_cast
    1818#include <iostream>                      // for operator<<, stringstream
    1919#include <list>                          // for list, list<>::iterator, _Lis...
     
    13051305
    13061306                DeclarationWithType * Pass2::mutate( FunctionDecl *functionDecl ) {
    1307                         functionDecl = strict_dynamic_cast< FunctionDecl * > ( handleDecl( functionDecl ) );
     1307                        functionDecl = safe_dynamic_cast< FunctionDecl * > ( handleDecl( functionDecl ) );
    13081308                        FunctionType * ftype = functionDecl->get_functionType();
    13091309                        if ( ! ftype->get_returnVals().empty() && functionDecl->get_statements() ) {
     
    13841384                        // move polymorphic return type to parameter list
    13851385                        if ( isDynRet( funcType ) ) {
    1386                                 ObjectDecl *ret = strict_dynamic_cast< ObjectDecl* >( funcType->get_returnVals().front() );
     1386                                ObjectDecl *ret = safe_dynamic_cast< ObjectDecl* >( funcType->get_returnVals().front() );
    13871387                                ret->set_type( new PointerType( Type::Qualifiers(), ret->get_type() ) );
    13881388                                funcType->get_parameters().push_front( ret );
  • src/GenPoly/InstantiateGeneric.cc

    r982832e r7dc09294  
    459459                        Declaration * member = *std::next( aggr->members.begin(), memberIndex );
    460460                        assertf( member->name == memberExpr->member->name, "Instantiation has different member order than the generic type. %s / %s", toString( member ).c_str(), toString( memberExpr->member ).c_str() );
    461                         DeclarationWithType * field = strict_dynamic_cast< DeclarationWithType * >( member );
     461                        DeclarationWithType * field = safe_dynamic_cast< DeclarationWithType * >( member );
    462462                        MemberExpr * ret = new MemberExpr( field, memberExpr->aggregate->clone() );
    463463                        std::swap( ret->env, memberExpr->env );
  • src/GenPoly/Lvalue.cc

    r982832e r7dc09294  
    1414//
    1515
    16 #include <cassert>                       // for strict_dynamic_cast
     16#include <cassert>                       // for safe_dynamic_cast
    1717#include <string>                        // for string
    1818
  • src/InitTweak/FixInit.cc

    r982832e r7dc09294  
    1717#include <stddef.h>                    // for NULL
    1818#include <algorithm>                   // for set_difference, copy_if
    19 #include <cassert>                     // for assert, strict_dynamic_cast
     19#include <cassert>                     // for assert, safe_dynamic_cast
    2020#include <iostream>                    // for operator<<, ostream, basic_ost...
    2121#include <iterator>                    // for insert_iterator, back_inserter
     
    424424                        // arrays are not copy constructed, so this should always be an ExprStmt
    425425                        ImplicitCtorDtorStmt * stmt = genCtorDtor( fname, var, cpArg );
    426                         ExprStmt * exprStmt = strict_dynamic_cast< ExprStmt * >( stmt->get_callStmt() );
     426                        ExprStmt * exprStmt = safe_dynamic_cast< ExprStmt * >( stmt->get_callStmt() );
    427427                        Expression * untyped = exprStmt->get_expr();
    428428
     
    532532                                assert( ! body->get_kids().empty() );
    533533                                // must be an ExprStmt, otherwise it wouldn't have a result
    534                                 ExprStmt * last = strict_dynamic_cast< ExprStmt * >( body->get_kids().back() );
     534                                ExprStmt * last = safe_dynamic_cast< ExprStmt * >( body->get_kids().back() );
    535535                                last->set_expr( makeCtorDtor( "?{}", ret, last->get_expr() ) );
    536536
     
    566566                        CP_CTOR_PRINT( std::cerr << "FixCopyCtors: " << impCpCtorExpr << std::endl; )
    567567
    568                         impCpCtorExpr = strict_dynamic_cast< ImplicitCopyCtorExpr * >( Parent::mutate( impCpCtorExpr ) );
     568                        impCpCtorExpr = safe_dynamic_cast< ImplicitCopyCtorExpr * >( Parent::mutate( impCpCtorExpr ) );
    569569                        std::list< ObjectDecl * > & tempDecls = impCpCtorExpr->get_tempDecls();
    570570                        std::list< ObjectDecl * > & returnDecls = impCpCtorExpr->get_returnDecls();
     
    627627                                stmt = stmt->acceptMutator( *this );
    628628                        } // for
    629                         // stmtExpr = strict_dynamic_cast< StmtExpr * >( Parent::mutate( stmtExpr ) );
     629                        // stmtExpr = safe_dynamic_cast< StmtExpr * >( Parent::mutate( stmtExpr ) );
    630630                        assert( stmtExpr->get_result() );
    631631                        Type * result = stmtExpr->get_result();
     
    791791                                                }
    792792                                        } else {
    793                                                 ImplicitCtorDtorStmt * implicit = strict_dynamic_cast< ImplicitCtorDtorStmt * > ( ctor );
     793                                                ImplicitCtorDtorStmt * implicit = safe_dynamic_cast< ImplicitCtorDtorStmt * > ( ctor );
    794794                                                ExprStmt * ctorStmt = dynamic_cast< ExprStmt * >( implicit->get_callStmt() );
    795795                                                ApplicationExpr * ctorCall = nullptr;
     
    996996                                FunctionType * type = function->get_functionType();
    997997                                assert( ! type->get_parameters().empty() );
    998                                 thisParam = strict_dynamic_cast< ObjectDecl * >( type->get_parameters().front() );
     998                                thisParam = safe_dynamic_cast< ObjectDecl * >( type->get_parameters().front() );
    999999                                Type * thisType = getPointerBase( thisParam->get_type() );
    10001000                                StructInstType * structType = dynamic_cast< StructInstType * >( thisType );
     
    11661166
    11671167                Expression* MutatingResolver::mutate( UntypedExpr *untypedExpr ) {
    1168                         return strict_dynamic_cast< ApplicationExpr * >( ResolvExpr::findVoidExpression( untypedExpr, indexer ) );
     1168                        return safe_dynamic_cast< ApplicationExpr * >( ResolvExpr::findVoidExpression( untypedExpr, indexer ) );
    11691169                }
    11701170
     
    11791179
    11801180                        // xxx - this can be TupleAssignExpr now. Need to properly handle this case.
    1181                         ApplicationExpr * callExpr = strict_dynamic_cast< ApplicationExpr * > ( ctorExpr->get_callExpr() );
     1181                        ApplicationExpr * callExpr = safe_dynamic_cast< ApplicationExpr * > ( ctorExpr->get_callExpr() );
    11821182                        TypeSubstitution * env = ctorExpr->get_env();
    11831183                        ctorExpr->set_callExpr( nullptr );
  • src/InitTweak/GenInit.cc

    r982832e r7dc09294  
    1717#include <stddef.h>                // for NULL
    1818#include <algorithm>               // for any_of
    19 #include <cassert>                 // for assert, strict_dynamic_cast, assertf
     19#include <cassert>                 // for assert, safe_dynamic_cast, assertf
    2020#include <iterator>                // for back_inserter, inserter, back_inse...
    2121#include <list>                    // for _List_iterator, list
     
    255255                SymTab::genImplicitCall( srcParam, new VariableExpr( objDecl ), fname, back_inserter( stmts ), objDecl );
    256256                assert( stmts.size() <= 1 );
    257                 return stmts.size() == 1 ? strict_dynamic_cast< ImplicitCtorDtorStmt * >( stmts.front() ) : nullptr;
     257                return stmts.size() == 1 ? safe_dynamic_cast< ImplicitCtorDtorStmt * >( stmts.front() ) : nullptr;
    258258        }
    259259
  • src/InitTweak/InitTweak.cc

    r982832e r7dc09294  
    11#include <stddef.h>                // for NULL
    22#include <algorithm>               // for find, all_of
    3 #include <cassert>                 // for assertf, assert, strict_dynamic_cast
     3#include <cassert>                 // for assertf, assert, safe_dynamic_cast
    44#include <iostream>                // for ostream, cerr, endl
    55#include <iterator>                // for back_insert_iterator, back_inserter
     
    414414                        std::list< Statement * > & stmts = tupleExpr->get_stmtExpr()->get_statements()->get_kids();
    415415                        assertf( ! stmts.empty(), "TupleAssignExpr somehow has no statements." );
    416                         ExprStmt * stmt = strict_dynamic_cast< ExprStmt * >( stmts.back() );
    417                         TupleExpr * tuple = strict_dynamic_cast< TupleExpr * >( stmt->get_expr() );
     416                        ExprStmt * stmt = safe_dynamic_cast< ExprStmt * >( stmts.back() );
     417                        TupleExpr * tuple = safe_dynamic_cast< TupleExpr * >( stmt->get_expr() );
    418418                        assertf( ! tuple->get_exprs().empty(), "TupleAssignExpr somehow has empty tuple expr." );
    419419                        return getCallArg( tuple->get_exprs().front(), pos );
  • src/Makefile.in

    r982832e r7dc09294  
    159159        CodeTools/driver_cfa_cpp-TrackLoc.$(OBJEXT) \
    160160        Concurrency/driver_cfa_cpp-Keywords.$(OBJEXT) \
    161         Concurrency/driver_cfa_cpp-Waitfor.$(OBJEXT) \
    162161        Common/driver_cfa_cpp-SemanticError.$(OBJEXT) \
    163162        Common/driver_cfa_cpp-UniqueName.$(OBJEXT) \
     
    491490        CodeGen/OperatorTable.cc CodeTools/DeclStats.cc \
    492491        CodeTools/TrackLoc.cc Concurrency/Keywords.cc \
    493         Concurrency/Waitfor.cc Common/SemanticError.cc \
    494         Common/UniqueName.cc Common/DebugMalloc.cc Common/Assert.cc \
     492        Common/SemanticError.cc Common/UniqueName.cc \
     493        Common/DebugMalloc.cc Common/Assert.cc \
    495494        ControlStruct/LabelGenerator.cc ControlStruct/LabelFixer.cc \
    496495        ControlStruct/MLEMutator.cc ControlStruct/Mutate.cc \
     
    664663        @: > Concurrency/$(DEPDIR)/$(am__dirstamp)
    665664Concurrency/driver_cfa_cpp-Keywords.$(OBJEXT):  \
    666         Concurrency/$(am__dirstamp) \
    667         Concurrency/$(DEPDIR)/$(am__dirstamp)
    668 Concurrency/driver_cfa_cpp-Waitfor.$(OBJEXT):  \
    669665        Concurrency/$(am__dirstamp) \
    670666        Concurrency/$(DEPDIR)/$(am__dirstamp)
     
    999995@AMDEP_TRUE@@am__include@ @am__quote@Common/$(DEPDIR)/driver_cfa_cpp-UniqueName.Po@am__quote@
    1000996@AMDEP_TRUE@@am__include@ @am__quote@Concurrency/$(DEPDIR)/driver_cfa_cpp-Keywords.Po@am__quote@
    1001 @AMDEP_TRUE@@am__include@ @am__quote@Concurrency/$(DEPDIR)/driver_cfa_cpp-Waitfor.Po@am__quote@
    1002997@AMDEP_TRUE@@am__include@ @am__quote@ControlStruct/$(DEPDIR)/driver_cfa_cpp-ExceptTranslate.Po@am__quote@
    1003998@AMDEP_TRUE@@am__include@ @am__quote@ControlStruct/$(DEPDIR)/driver_cfa_cpp-ForExprMutator.Po@am__quote@
     
    12681263@am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Concurrency/driver_cfa_cpp-Keywords.obj `if test -f 'Concurrency/Keywords.cc'; then $(CYGPATH_W) 'Concurrency/Keywords.cc'; else $(CYGPATH_W) '$(srcdir)/Concurrency/Keywords.cc'; fi`
    12691264
    1270 Concurrency/driver_cfa_cpp-Waitfor.o: Concurrency/Waitfor.cc
    1271 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT Concurrency/driver_cfa_cpp-Waitfor.o -MD -MP -MF Concurrency/$(DEPDIR)/driver_cfa_cpp-Waitfor.Tpo -c -o Concurrency/driver_cfa_cpp-Waitfor.o `test -f 'Concurrency/Waitfor.cc' || echo '$(srcdir)/'`Concurrency/Waitfor.cc
    1272 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) Concurrency/$(DEPDIR)/driver_cfa_cpp-Waitfor.Tpo Concurrency/$(DEPDIR)/driver_cfa_cpp-Waitfor.Po
    1273 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='Concurrency/Waitfor.cc' object='Concurrency/driver_cfa_cpp-Waitfor.o' libtool=no @AMDEPBACKSLASH@
    1274 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1275 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Concurrency/driver_cfa_cpp-Waitfor.o `test -f 'Concurrency/Waitfor.cc' || echo '$(srcdir)/'`Concurrency/Waitfor.cc
    1276 
    1277 Concurrency/driver_cfa_cpp-Waitfor.obj: Concurrency/Waitfor.cc
    1278 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT Concurrency/driver_cfa_cpp-Waitfor.obj -MD -MP -MF Concurrency/$(DEPDIR)/driver_cfa_cpp-Waitfor.Tpo -c -o Concurrency/driver_cfa_cpp-Waitfor.obj `if test -f 'Concurrency/Waitfor.cc'; then $(CYGPATH_W) 'Concurrency/Waitfor.cc'; else $(CYGPATH_W) '$(srcdir)/Concurrency/Waitfor.cc'; fi`
    1279 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) Concurrency/$(DEPDIR)/driver_cfa_cpp-Waitfor.Tpo Concurrency/$(DEPDIR)/driver_cfa_cpp-Waitfor.Po
    1280 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='Concurrency/Waitfor.cc' object='Concurrency/driver_cfa_cpp-Waitfor.obj' libtool=no @AMDEPBACKSLASH@
    1281 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1282 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Concurrency/driver_cfa_cpp-Waitfor.obj `if test -f 'Concurrency/Waitfor.cc'; then $(CYGPATH_W) 'Concurrency/Waitfor.cc'; else $(CYGPATH_W) '$(srcdir)/Concurrency/Waitfor.cc'; fi`
    1283 
    12841265Common/driver_cfa_cpp-SemanticError.o: Common/SemanticError.cc
    12851266@am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT Common/driver_cfa_cpp-SemanticError.o -MD -MP -MF Common/$(DEPDIR)/driver_cfa_cpp-SemanticError.Tpo -c -o Common/driver_cfa_cpp-SemanticError.o `test -f 'Common/SemanticError.cc' || echo '$(srcdir)/'`Common/SemanticError.cc
  • src/Parser/DeclarationNode.cc

    r982832e r7dc09294  
    1414//
    1515
    16 #include <cassert>                 // for assert, assertf, strict_dynamic_cast
     16#include <cassert>                 // for assert, assertf, safe_dynamic_cast
    1717#include <iterator>                // for back_insert_iterator
    1818#include <list>                    // for list
     
    10271027
    10281028        if ( asmStmt ) {
    1029                 return new AsmDecl( strict_dynamic_cast<AsmStmt *>( asmStmt->build() ) );
     1029                return new AsmDecl( safe_dynamic_cast<AsmStmt *>( asmStmt->build() ) );
    10301030        } // if
    10311031
  • src/Parser/StatementNode.cc

    r982832e r7dc09294  
    1414//
    1515
    16 #include <cassert>                 // for assert, strict_dynamic_cast, assertf
     16#include <cassert>                 // for assert, safe_dynamic_cast, assertf
    1717#include <list>                    // for list
    1818#include <memory>                  // for unique_ptr
     
    5757        // find end of list and maintain previous pointer
    5858        for ( StatementNode * curr = prev; curr != nullptr; curr = (StatementNode *)curr->get_next() ) {
    59                 StatementNode *node = strict_dynamic_cast< StatementNode * >(curr);
     59                StatementNode *node = safe_dynamic_cast< StatementNode * >(curr);
    6060                assert( dynamic_cast< CaseStmt * >(node->stmt.get()) );
    6161                prev = curr;
     
    106106                for ( Statement * stmt : init ) {
    107107                        // build the && of all of the declared variables compared against 0
    108                         DeclStmt * declStmt = strict_dynamic_cast< DeclStmt * >( stmt );
    109                         DeclarationWithType * dwt = strict_dynamic_cast< DeclarationWithType * >( declStmt->decl );
     108                        DeclStmt * declStmt = safe_dynamic_cast< DeclStmt * >( stmt );
     109                        DeclarationWithType * dwt = safe_dynamic_cast< DeclarationWithType * >( declStmt->decl );
    110110                        Expression * nze = notZeroExpr( new VariableExpr( dwt ) );
    111111                        cond = cond ? new LogicalExpr( cond, nze, true ) : nze;
     
    202202        std::list< CatchStmt * > branches;
    203203        buildMoveList< CatchStmt, StatementNode >( catch_stmt, branches );
    204         CompoundStmt *tryBlock = strict_dynamic_cast< CompoundStmt * >(maybeMoveBuild< Statement >(try_stmt));
     204        CompoundStmt *tryBlock = safe_dynamic_cast< CompoundStmt * >(maybeMoveBuild< Statement >(try_stmt));
    205205        FinallyStmt *finallyBlock = dynamic_cast< FinallyStmt * >(maybeMoveBuild< Statement >(finally_stmt) );
    206206        return new TryStmt( noLabels, tryBlock, branches, finallyBlock );
  • src/ResolvExpr/AlternativeFinder.cc

    r982832e r7dc09294  
    1515
    1616#include <algorithm>               // for copy
    17 #include <cassert>                 // for strict_dynamic_cast, assert, assertf
     17#include <cassert>                 // for safe_dynamic_cast, assert, assertf
    1818#include <iostream>                // for operator<<, cerr, ostream, endl
    1919#include <iterator>                // for back_insert_iterator, back_inserter
     
    336336
    337337        Cost computeApplicationConversionCost( Alternative &alt, const SymTab::Indexer &indexer ) {
    338                 ApplicationExpr *appExpr = strict_dynamic_cast< ApplicationExpr* >( alt.expr );
    339                 PointerType *pointer = strict_dynamic_cast< PointerType* >( appExpr->get_function()->get_result() );
    340                 FunctionType *function = strict_dynamic_cast< FunctionType* >( pointer->get_base() );
     338                ApplicationExpr *appExpr = safe_dynamic_cast< ApplicationExpr* >( alt.expr );
     339                PointerType *pointer = safe_dynamic_cast< PointerType* >( appExpr->get_function()->get_result() );
     340                FunctionType *function = safe_dynamic_cast< FunctionType* >( pointer->get_base() );
    341341
    342342                Cost convCost = Cost::zero;
     
    494494                        Cost cost = Cost::zero;
    495495                        std::list< Expression * > newExprs;
    496                         ObjectDecl * obj = strict_dynamic_cast< ObjectDecl * >( formal );
     496                        ObjectDecl * obj = safe_dynamic_cast< ObjectDecl * >( formal );
    497497                        if ( ! instantiateArgument( obj->get_type(), obj->get_init(), actualExpr, actualEnd, openVars, resultEnv, resultNeed, resultHave, indexer, cost, back_inserter( newExprs ) ) ) {
    498498                                deleteAll( newExprs );
     
    787787
    788788                        PRINT(
    789                                 ApplicationExpr *appExpr = strict_dynamic_cast< ApplicationExpr* >( withFunc->expr );
    790                                 PointerType *pointer = strict_dynamic_cast< PointerType* >( appExpr->get_function()->get_result() );
    791                                 FunctionType *function = strict_dynamic_cast< FunctionType* >( pointer->get_base() );
     789                                ApplicationExpr *appExpr = safe_dynamic_cast< ApplicationExpr* >( withFunc->expr );
     790                                PointerType *pointer = safe_dynamic_cast< PointerType* >( appExpr->get_function()->get_result() );
     791                                FunctionType *function = safe_dynamic_cast< FunctionType* >( pointer->get_base() );
    792792                                std::cerr << "Case +++++++++++++ " << appExpr->get_function() << std::endl;
    793793                                std::cerr << "formals are:" << std::endl;
  • src/ResolvExpr/CastCost.cc

    r982832e r7dc09294  
    4646                        } else if ( ( namedType = indexer.lookupType( destAsTypeInst->get_name() ) ) ) {
    4747                                // all typedefs should be gone by this point
    48                                 TypeDecl *type = strict_dynamic_cast< TypeDecl* >( namedType );
     48                                TypeDecl *type = safe_dynamic_cast< TypeDecl* >( namedType );
    4949                                if ( type->get_base() ) {
    5050                                        return castCost( src, type->get_base(), indexer, env ) + Cost::safe;
  • src/ResolvExpr/CommonType.cc

    r982832e r7dc09294  
    1414//
    1515
    16 #include <cassert>                       // for strict_dynamic_cast
     16#include <cassert>                       // for safe_dynamic_cast
    1717#include <map>                           // for _Rb_tree_const_iterator
    1818#include <utility>                       // for pair
     
    100100                        // special case where one type has a reference depth of 1 larger than the other
    101101                        if ( diff > 0 ) {
    102                                 return handleReference( strict_dynamic_cast<ReferenceType *>( type1 ), type2, widenFirst, widenSecond, indexer, env, openVars );
     102                                return handleReference( safe_dynamic_cast<ReferenceType *>( type1 ), type2, widenFirst, widenSecond, indexer, env, openVars );
    103103                        } else if ( diff < 0 ) {
    104                                 return handleReference( strict_dynamic_cast<ReferenceType *>( type2 ), type1, widenSecond, widenFirst, indexer, env, openVars );
     104                                return handleReference( safe_dynamic_cast<ReferenceType *>( type2 ), type1, widenSecond, widenFirst, indexer, env, openVars );
    105105                        }
    106106                        // otherwise, both are reference types of the same depth and this is handled by the CommonType visitor.
     
    114114                                if ( TypeInstType *inst = dynamic_cast< TypeInstType* >( type2 ) ) {
    115115                                        if ( NamedTypeDecl *nt = indexer.lookupType( inst->get_name() ) ) {
    116                                                 TypeDecl *type = strict_dynamic_cast< TypeDecl* >( nt );
     116                                                TypeDecl *type = safe_dynamic_cast< TypeDecl* >( nt );
    117117                                                if ( type->get_base() ) {
    118118                                                        Type::Qualifiers tq1 = type1->get_qualifiers(), tq2 = type2->get_qualifiers();
     
    301301                        NamedTypeDecl *nt = indexer.lookupType( inst->get_name() );
    302302                        if ( nt ) {
    303                                 TypeDecl *type = strict_dynamic_cast< TypeDecl* >( nt );
     303                                TypeDecl *type = safe_dynamic_cast< TypeDecl* >( nt );
    304304                                if ( type->get_base() ) {
    305305                                        Type::Qualifiers tq1 = inst->get_qualifiers(), tq2 = type2->get_qualifiers();
  • src/ResolvExpr/ConversionCost.cc

    r982832e r7dc09294  
    9595                if ( diff > 0 ) {
    9696                        // TODO: document this
    97                         Cost cost = convertToReferenceCost( strict_dynamic_cast< ReferenceType * >( src )->get_base(), dest, diff-1, indexer, env, func );
     97                        Cost cost = convertToReferenceCost( safe_dynamic_cast< ReferenceType * >( src )->get_base(), dest, diff-1, indexer, env, func );
    9898                        cost.incReference();
    9999                        return cost;
    100100                } else if ( diff < -1 ) {
    101101                        // TODO: document this
    102                         Cost cost = convertToReferenceCost( src, strict_dynamic_cast< ReferenceType * >( dest )->get_base(), diff+1, indexer, env, func );
     102                        Cost cost = convertToReferenceCost( src, safe_dynamic_cast< ReferenceType * >( dest )->get_base(), diff+1, indexer, env, func );
    103103                        cost.incReference();
    104104                        return cost;
  • src/ResolvExpr/CurrentObject.cc

    r982832e r7dc09294  
    286286                                for ( InitAlternative & alt : ret ) {
    287287                                        PRINT( std::cerr << "iterating and adding designators" << std::endl; )
    288                                         alt.designation->get_designators().push_front( new VariableExpr( strict_dynamic_cast< ObjectDecl * >( *curMember ) ) );
     288                                        alt.designation->get_designators().push_front( new VariableExpr( safe_dynamic_cast< ObjectDecl * >( *curMember ) ) );
    289289                                        // need to substitute for generic types, so that casts are to concrete types
    290290                                        PRINT( std::cerr << "  type is: " << alt.type; )
     
    346346                                for ( InitAlternative & alt : ret ) {
    347347                                        PRINT( std::cerr << "iterating and adding designators" << std::endl; )
    348                                         alt.designation->get_designators().push_front( new VariableExpr( strict_dynamic_cast< ObjectDecl * >( *curMember ) ) );
     348                                        alt.designation->get_designators().push_front( new VariableExpr( safe_dynamic_cast< ObjectDecl * >( *curMember ) ) );
    349349                                }
    350350                        }
  • src/ResolvExpr/Resolver.cc

    r982832e r7dc09294  
    1515
    1616#include <stddef.h>                      // for NULL
    17 #include <cassert>                       // for strict_dynamic_cast, assert
     17#include <cassert>                       // for safe_dynamic_cast, assert
    1818#include <memory>                        // for allocator, allocator_traits<...
    1919#include <tuple>                         // for get
     
    342342                        CastExpr * castExpr = new CastExpr( caseStmt->get_condition(), initAlts.front().type->clone() );
    343343                        Expression * newExpr = findSingleExpression( castExpr, *this );
    344                         castExpr = strict_dynamic_cast< CastExpr * >( newExpr );
     344                        castExpr = safe_dynamic_cast< CastExpr * >( newExpr );
    345345                        caseStmt->set_condition( castExpr->get_arg() );
    346346                        castExpr->set_arg( nullptr );
     
    398398                Parent::enterScope();
    399399                Visitor::visit( catchStmt );
    400 
     400               
    401401                if ( catchStmt->get_cond() ) {
    402402                        Expression * wrapped = new CastExpr(
     
    423423                UntypedInitExpr * untyped = new UntypedInitExpr( singleInit->get_value(), currentObject.getOptions() );
    424424                Expression * newExpr = findSingleExpression( untyped, *this );
    425                 InitExpr * initExpr = strict_dynamic_cast< InitExpr * >( newExpr );
     425                InitExpr * initExpr = safe_dynamic_cast< InitExpr * >( newExpr );
    426426
    427427                // move cursor to the object that is actually initialized
     
    445445                                        if ( isCharType( pt->get_base() ) ) {
    446446                                                // strip cast if we're initializing a char[] with a char *, e.g.  char x[] = "hello";
    447                                                 CastExpr *ce = strict_dynamic_cast< CastExpr * >( newExpr );
     447                                                CastExpr *ce = safe_dynamic_cast< CastExpr * >( newExpr );
    448448                                                newExpr = ce->get_arg();
    449449                                                ce->set_arg( nullptr );
  • src/SymTab/Autogen.cc

    r982832e r7dc09294  
    1818#include <cstddef>                 // for NULL
    1919#include <algorithm>               // for count_if
    20 #include <cassert>                 // for strict_dynamic_cast, assert, assertf
     20#include <cassert>                 // for safe_dynamic_cast, assert, assertf
    2121#include <iterator>                // for back_insert_iterator, back_inserter
    2222#include <list>                    // for list, _List_iterator, list<>::iter...
     
    248248                // parameters) are using in the variable exprs
    249249                assert( ftype->get_parameters().size() == 2 );
    250                 ObjectDecl * dstParam = strict_dynamic_cast< ObjectDecl * >( ftype->get_parameters().front() );
    251                 ObjectDecl * srcParam = strict_dynamic_cast< ObjectDecl * >( ftype->get_parameters().back() );
     250                ObjectDecl * dstParam = safe_dynamic_cast< ObjectDecl * >( ftype->get_parameters().front() );
     251                ObjectDecl * srcParam = safe_dynamic_cast< ObjectDecl * >( ftype->get_parameters().back() );
    252252
    253253                VariableExpr * assignVarExpr = new VariableExpr( assignDecl );
     
    305305
    306306                // assign to destination
    307                 Expression *dstselect = new MemberExpr( field, new CastExpr( new VariableExpr( dstParam ), strict_dynamic_cast< ReferenceType* >( dstParam->get_type() )->get_base()->clone() ) );
     307                Expression *dstselect = new MemberExpr( field, new CastExpr( new VariableExpr( dstParam ), safe_dynamic_cast< ReferenceType* >( dstParam->get_type() )->get_base()->clone() ) );
    308308                genImplicitCall( srcParam, dstselect, func->get_name(), back_inserter( func->get_statements()->get_kids() ), field, forward );
    309309        }
     
    442442                                FunctionType * assignType = dcl->get_functionType();
    443443                                assert( assignType->get_parameters().size() == 2 );
    444                                 ObjectDecl * srcParam = strict_dynamic_cast< ObjectDecl * >( assignType->get_parameters().back() );
     444                                ObjectDecl * srcParam = safe_dynamic_cast< ObjectDecl * >( assignType->get_parameters().back() );
    445445                                dcl->get_statements()->get_kids().push_back( new ReturnStmt( noLabels, new VariableExpr( srcParam ) ) );
    446446                        }
     
    493493                FunctionType * ftype = funcDecl->get_functionType();
    494494                assert( ftype->get_parameters().size() == 2 );
    495                 ObjectDecl * dstParam = strict_dynamic_cast< ObjectDecl * >( ftype->get_parameters().front() );
    496                 ObjectDecl * srcParam = strict_dynamic_cast< ObjectDecl * >( ftype->get_parameters().back() );
     495                ObjectDecl * dstParam = safe_dynamic_cast< ObjectDecl * >( ftype->get_parameters().front() );
     496                ObjectDecl * srcParam = safe_dynamic_cast< ObjectDecl * >( ftype->get_parameters().back() );
    497497
    498498                makeUnionFieldsAssignment( srcParam, dstParam, back_inserter( funcDecl->get_statements()->get_kids() ) );
     
    657657                                FunctionType * assignType = dcl->type;
    658658                                assert( assignType->parameters.size() == 2 );
    659                                 ObjectDecl * srcParam = strict_dynamic_cast< ObjectDecl * >( assignType->parameters.back() );
     659                                ObjectDecl * srcParam = safe_dynamic_cast< ObjectDecl * >( assignType->parameters.back() );
    660660                                dcl->statements->kids.push_back( new ReturnStmt( noLabels, new VariableExpr( srcParam ) ) );
    661661                        }
     
    735735
    736736        Type * AutogenTupleRoutines::mutate( TupleType * tupleType ) {
    737                 tupleType = strict_dynamic_cast< TupleType * >( Parent::mutate( tupleType ) );
     737                tupleType = safe_dynamic_cast< TupleType * >( Parent::mutate( tupleType ) );
    738738                std::string mangleName = SymTab::Mangler::mangleType( tupleType );
    739739                if ( seenTuples.find( mangleName ) != seenTuples.end() ) return tupleType;
     
    803803        CompoundStmt * AutogenTupleRoutines::mutate( CompoundStmt *compoundStmt ) {
    804804                seenTuples.beginScope();
    805                 compoundStmt = strict_dynamic_cast< CompoundStmt * >( Parent::mutate( compoundStmt ) );
     805                compoundStmt = safe_dynamic_cast< CompoundStmt * >( Parent::mutate( compoundStmt ) );
    806806                seenTuples.endScope();
    807807                return compoundStmt;
  • src/SymTab/Indexer.cc

    r982832e r7dc09294  
    1616#include "Indexer.h"
    1717
    18 #include <cassert>                 // for assert, strict_dynamic_cast
     18#include <cassert>                 // for assert, safe_dynamic_cast
    1919#include <iostream>                // for operator<<, basic_ostream, ostream
    2020#include <string>                  // for string, operator<<, operator!=
  • src/SymTab/Validate.cc

    r982832e r7dc09294  
    493493                std::list< DeclarationWithType * > asserts;
    494494                for ( Declaration * decl : inst->baseTrait->members ) {
    495                         asserts.push_back( strict_dynamic_cast<DeclarationWithType *>( decl->clone() ) );
     495                        asserts.push_back( safe_dynamic_cast<DeclarationWithType *>( decl->clone() ) );
    496496                }
    497497                // substitute trait decl parameters for instance parameters
     
    537537                // need to carry over the 'sized' status of each decl in the instance
    538538                for ( auto p : group_iterate( traitDecl->get_parameters(), traitInst->get_parameters() ) ) {
    539                         TypeExpr * expr = strict_dynamic_cast< TypeExpr * >( std::get<1>(p) );
     539                        TypeExpr * expr = safe_dynamic_cast< TypeExpr * >( std::get<1>(p) );
    540540                        if ( TypeInstType * inst = dynamic_cast< TypeInstType * >( expr->get_type() ) ) {
    541541                                TypeDecl * formalDecl = std::get<0>(p);
     
    897897                        for ( size_t i = 0; paramIter != params->end(); ++paramIter, ++i ) {
    898898                                if ( i < args.size() ) {
    899                                         TypeExpr * expr = strict_dynamic_cast< TypeExpr * >( *std::next( args.begin(), i ) );
     899                                        TypeExpr * expr = safe_dynamic_cast< TypeExpr * >( *std::next( args.begin(), i ) );
    900900                                        sub.add( (*paramIter)->get_name(), expr->get_type()->clone() );
    901901                                } else if ( i == args.size() ) {
     
    967967                if ( retVals.size() > 1 ) {
    968968                        // generate a single return parameter which is the tuple of all of the return values
    969                         TupleType * tupleType = strict_dynamic_cast< TupleType * >( ResolvExpr::extractResultType( ftype ) );
     969                        TupleType * tupleType = safe_dynamic_cast< TupleType * >( ResolvExpr::extractResultType( ftype ) );
    970970                        // ensure return value is not destructed by explicitly creating an empty ListInit node wherein maybeConstruct is false.
    971971                        ObjectDecl * newRet = new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, 0, tupleType, new ListInit( std::list<Initializer*>(), noDesignators, false ) );
  • src/SynTree/AddressExpr.cc

    r982832e r7dc09294  
    4747                } else {
    4848                        // taking address of non-lvalue -- must be a reference, loses one layer of reference
    49                         ReferenceType * refType = strict_dynamic_cast< ReferenceType * >( arg->get_result() );
     49                        ReferenceType * refType = safe_dynamic_cast< ReferenceType * >( arg->get_result() );
    5050                        set_result( addrType( refType->get_base() ) );
    5151                }
  • src/SynTree/ApplicationExpr.cc

    r982832e r7dc09294  
    1414//
    1515
    16 #include <cassert>               // for strict_dynamic_cast, assert
     16#include <cassert>               // for safe_dynamic_cast, assert
    1717#include <list>                  // for list
    1818#include <map>                   // for _Rb_tree_const_iterator, map, map<>:...
     
    5050
    5151ApplicationExpr::ApplicationExpr( Expression *funcExpr, const std::list<Expression *> & args ) : function( funcExpr ), args( args ) {
    52         PointerType *pointer = strict_dynamic_cast< PointerType* >( funcExpr->get_result() );
    53         FunctionType *function = strict_dynamic_cast< FunctionType* >( pointer->get_base() );
     52        PointerType *pointer = safe_dynamic_cast< PointerType* >( funcExpr->get_result() );
     53        FunctionType *function = safe_dynamic_cast< FunctionType* >( pointer->get_base() );
    5454
    5555        set_result( ResolvExpr::extractResultType( function ) );
  • src/SynTree/CompoundStmt.cc

    r982832e r7dc09294  
    1414//
    1515
    16 #include <cassert>                    // for assert, strict_dynamic_cast
     16#include <cassert>                    // for assert, safe_dynamic_cast
    1717#include <list>                       // for list, _List_const_iterator, lis...
    1818#include <ostream>                    // for operator<<, ostream, basic_ostream
     
    5252                Statement * origStmt = *origit++;
    5353                if ( DeclStmt * declStmt = dynamic_cast< DeclStmt * >( s ) ) {
    54                         DeclStmt * origDeclStmt = strict_dynamic_cast< DeclStmt * >( origStmt );
     54                        DeclStmt * origDeclStmt = safe_dynamic_cast< DeclStmt * >( origStmt );
    5555                        if ( DeclarationWithType * dwt = dynamic_cast< DeclarationWithType * > ( declStmt->get_decl() ) ) {
    56                                 DeclarationWithType * origdwt = strict_dynamic_cast< DeclarationWithType * > ( origDeclStmt->get_decl() );
     56                                DeclarationWithType * origdwt = safe_dynamic_cast< DeclarationWithType * > ( origDeclStmt->get_decl() );
    5757                                assert( dwt->get_name() == origdwt->get_name() );
    5858                                declMap[ origdwt ] = dwt;
  • src/SynTree/Constant.cc

    r982832e r7dc09294  
    1414//
    1515
    16 #include <cassert>   // for strict_dynamic_cast, assertf
     16#include <cassert>   // for safe_dynamic_cast, assertf
    1717#include <iostream>  // for operator<<, ostream, basic_ostream
    1818#include <string>    // for to_string, string, char_traits, operator<<
     
    5858
    5959unsigned long long Constant::get_ival() const {
    60         assertf( strict_dynamic_cast<BasicType*>(type)->isInteger(), "Attempt to retrieve ival from non-integer constant." );
     60        assertf( safe_dynamic_cast<BasicType*>(type)->isInteger(), "Attempt to retrieve ival from non-integer constant." );
    6161        return val.ival;
    6262}
    6363
    6464double Constant::get_dval() const {
    65         assertf( ! strict_dynamic_cast<BasicType*>(type)->isInteger(), "Attempt to retrieve dval from integer constant." );
     65        assertf( ! safe_dynamic_cast<BasicType*>(type)->isInteger(), "Attempt to retrieve dval from integer constant." );
    6666        return val.dval;
    6767}
  • src/SynTree/Declaration.h

    r982832e r7dc09294  
    157157        virtual ~FunctionDecl();
    158158
    159         Type * get_type() const { return type; }
    160         virtual void set_type(Type * t) { type = strict_dynamic_cast< FunctionType* >( t ); }
     159        Type * get_type() const;
     160        virtual void set_type(Type *);
    161161
    162162        FunctionType * get_functionType() const { return type; }
  • src/SynTree/Expression.h

    r982832e r7dc09294  
    8686  public:
    8787        Expression * function;
    88         std::list<Expression *> args;
    89         InferredParams inferParams;
    9088
    9189        ApplicationExpr( Expression * function, const std::list<Expression *> & args = std::list< Expression * >() );
     
    102100        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    103101        virtual void print( std::ostream & os, int indent = 0 ) const;
     102
     103  private:
     104        std::list<Expression *> args;
     105        InferredParams inferParams;
    104106};
    105107
  • src/SynTree/FunctionDecl.cc

    r982832e r7dc09294  
    4444        delete type;
    4545        delete statements;
     46}
     47
     48Type * FunctionDecl::get_type() const {
     49        return type;
     50}
     51
     52void FunctionDecl::set_type( Type *t ) {
     53        type = dynamic_cast< FunctionType* >( t );
     54        assert( type );
    4655}
    4756
  • src/SynTree/Statement.h

    r982832e r7dc09294  
    155155  public:
    156156        Expression * condition;
    157         std::list<Statement *> statements;
    158157
    159158        SwitchStmt( std::list<Label> labels, Expression *condition, std::list<Statement *> &statements );
     
    171170        virtual SwitchStmt *clone() const { return new SwitchStmt( *this ); }
    172171        virtual void print( std::ostream &os, int indent = 0 ) const;
    173 
     172  private:
     173        std::list<Statement *> statements;
    174174};
    175175
     
    327327class TryStmt : public Statement {
    328328  public:
    329         CompoundStmt * block;
     329        CompoundStmt *block;
    330330        std::list<CatchStmt *> handlers;
    331         FinallyStmt * finallyBlock;
     331        FinallyStmt *finallyBlock;
    332332
    333333        TryStmt( std::list<Label> labels, CompoundStmt *tryBlock, std::list<CatchStmt *> &handlers, FinallyStmt *finallyBlock = 0 );
  • src/SynTree/TupleExpr.cc

    r982832e r7dc09294  
    1414//
    1515
    16 #include <cassert>              // for assert, strict_dynamic_cast, assertf
     16#include <cassert>              // for assert, safe_dynamic_cast, assertf
    1717#include <iterator>             // for next
    1818#include <list>                 // for list, _List_iterator
     
    6464
    6565TupleIndexExpr::TupleIndexExpr( Expression * tuple, unsigned int index ) : tuple( tuple ), index( index )  {
    66         TupleType * type = strict_dynamic_cast< TupleType * >( tuple->get_result() );
     66        TupleType * type = safe_dynamic_cast< TupleType * >( tuple->get_result() );
    6767        assertf( type->size() > index, "TupleIndexExpr index out of bounds: tuple size %d, requested index %d in expr %s", type->size(), index, toString( tuple ).c_str() );
    6868        set_result( (*std::next( type->get_types().begin(), index ))->clone() );
  • src/SynTree/Visitor.h

    r982832e r7dc09294  
    148148}
    149149
     150template< typename Container, typename VisitorType >
     151void acceptAllFold( Container &container, VisitorType &visitor, VisitorType &around ) {
     152        SemanticError errors;
     153        for ( typename Container::iterator i = container.begin(); i != container.end(); ++i ) {
     154                try {
     155                        if ( *i ) {
     156                                VisitorType *v = new VisitorType;
     157                                (*i)->accept( *v );
     158
     159                                typename Container::iterator nxt = i; nxt++; // forward_iterator
     160                                if ( nxt == container.end() )
     161                                        visitor += *v;
     162                                else
     163                                        visitor += *v + around;
     164
     165                                delete v;
     166                        } // if
     167                } catch( SemanticError &e ) {
     168                        e.set_location( (*i)->location );
     169                        errors.append( e );
     170                } // try
     171        } // for
     172        if ( ! errors.isEmpty() ) {
     173                throw errors;
     174        } // if
     175}
     176
    150177// Local Variables: //
    151178// tab-width: 4 //
  • src/Tuples/TupleExpansion.cc

    r982832e r7dc09294  
    168168                                // steal the already generated assignment to var from the unqExpr - this has been generated by FixInit
    169169                                Expression * expr = unqExpr->get_expr();
    170                                 CommaExpr * commaExpr = strict_dynamic_cast< CommaExpr * >( expr );
     170                                CommaExpr * commaExpr = safe_dynamic_cast< CommaExpr * >( expr );
    171171                                assignUnq = commaExpr->get_arg1();
    172172                                commaExpr->set_arg1( nullptr );
     
    237237                delete tupleExpr;
    238238
    239                 StructInstType * type = strict_dynamic_cast< StructInstType * >( tuple->get_result() );
     239                StructInstType * type = safe_dynamic_cast< StructInstType * >( tuple->get_result() );
    240240                StructDecl * structDecl = type->get_baseStruct();
    241241                assert( structDecl->get_members().size() > idx );
    242242                Declaration * member = *std::next(structDecl->get_members().begin(), idx);
    243                 MemberExpr * memExpr = new MemberExpr( strict_dynamic_cast< DeclarationWithType * >( member ), tuple );
     243                MemberExpr * memExpr = new MemberExpr( safe_dynamic_cast< DeclarationWithType * >( member ), tuple );
    244244                memExpr->set_env( env );
    245245                return memExpr;
  • src/include/cassert

    r982832e r7dc09294  
    3131        __ASSERT_FUNCTION, fmt, ## __VA_ARGS__ ))
    3232
    33 void __assert_fail_f(   const char *assertion, const char *file,
    34                                                 unsigned int line, const char *function,
    35                                                 const char *fmt, ...
     33void __assert_fail_f(   const char *assertion, const char *file, 
     34                                                unsigned int line, const char *function, 
     35                                                const char *fmt, ... 
    3636        ) __attribute__((noreturn, format(printf, 5, 6)));
    3737
     
    3939
    4040template<typename T, typename U>
    41 static inline T strict_dynamic_cast( const U & src ) {
     41static inline T safe_dynamic_cast( const U & src ) {
    4242        T ret = dynamic_cast<T>(src);
    4343        assert(ret);
  • src/libcfa/concurrency/monitor

    r982832e r7dc09294  
    103103        unsigned short count;
    104104        monitor_desc ** monitors;
    105         bool is_dtor;
    106105};
    107106
  • src/main.cc

    r982832e r7dc09294  
    3939#include "Common/UnimplementedError.h"      // for UnimplementedError
    4040#include "Common/utility.h"                 // for deleteAll, filter, printAll
    41 #include "Concurrency/Waitfor.h"            // for generateWaitfor
    4241#include "ControlStruct/ExceptTranslate.h"  // for translateEHM
    4342#include "ControlStruct/Mutate.h"           // for mutate
     
    305304                ControlStruct::translateEHM( translationUnit );
    306305
    307                 OPTPRINT( "generateWaitfor" );
    308                 Concurrency::generateWaitFor( translationUnit );
    309 
    310306                OPTPRINT( "convertSpecializations" ) // needs to happen before tuple types are expanded
    311307                GenPoly::convertSpecializations( translationUnit );
Note: See TracChangeset for help on using the changeset viewer.