Changeset 7870799 for src/Common


Ignore:
Timestamp:
Jul 12, 2019, 10:49:02 AM (6 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
ef5b828
Parents:
ee6dbae
Message:

Cast cost and conversion cost now take constant parameters.
This required supporting visiting const node.
The PassVisitor can now visit const nodes but not when using the Indexer

Location:
src/Common
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/Common/PassVisitor.h

    ree6dbae r7870799  
    6060
    6161        virtual void visit( ObjectDecl * objectDecl ) override final;
     62        virtual void visit( const ObjectDecl * objectDecl ) override final;
    6263        virtual void visit( FunctionDecl * functionDecl ) override final;
     64        virtual void visit( const FunctionDecl * functionDecl ) override final;
    6365        virtual void visit( StructDecl * aggregateDecl ) override final;
     66        virtual void visit( const StructDecl * aggregateDecl ) override final;
    6467        virtual void visit( UnionDecl * aggregateDecl ) override final;
     68        virtual void visit( const UnionDecl * aggregateDecl ) override final;
    6569        virtual void visit( EnumDecl * aggregateDecl ) override final;
     70        virtual void visit( const EnumDecl * aggregateDecl ) override final;
    6671        virtual void visit( TraitDecl * aggregateDecl ) override final;
     72        virtual void visit( const TraitDecl * aggregateDecl ) override final;
    6773        virtual void visit( TypeDecl * typeDecl ) override final;
     74        virtual void visit( const TypeDecl * typeDecl ) override final;
    6875        virtual void visit( TypedefDecl * typeDecl ) override final;
     76        virtual void visit( const TypedefDecl * typeDecl ) override final;
    6977        virtual void visit( AsmDecl * asmDecl ) override final;
     78        virtual void visit( const AsmDecl * asmDecl ) override final;
    7079        virtual void visit( StaticAssertDecl * assertDecl ) override final;
     80        virtual void visit( const StaticAssertDecl * assertDecl ) override final;
    7181
    7282        virtual void visit( CompoundStmt * compoundStmt ) override final;
     83        virtual void visit( const CompoundStmt * compoundStmt ) override final;
    7384        virtual void visit( ExprStmt * exprStmt ) override final;
     85        virtual void visit( const ExprStmt * exprStmt ) override final;
    7486        virtual void visit( AsmStmt * asmStmt ) override final;
     87        virtual void visit( const AsmStmt * asmStmt ) override final;
    7588        virtual void visit( DirectiveStmt * dirStmt ) override final;
     89        virtual void visit( const DirectiveStmt * dirStmt ) override final;
    7690        virtual void visit( IfStmt * ifStmt ) override final;
     91        virtual void visit( const IfStmt * ifStmt ) override final;
    7792        virtual void visit( WhileStmt * whileStmt ) override final;
     93        virtual void visit( const WhileStmt * whileStmt ) override final;
    7894        virtual void visit( ForStmt * forStmt ) override final;
     95        virtual void visit( const ForStmt * forStmt ) override final;
    7996        virtual void visit( SwitchStmt * switchStmt ) override final;
     97        virtual void visit( const SwitchStmt * switchStmt ) override final;
    8098        virtual void visit( CaseStmt * caseStmt ) override final;
     99        virtual void visit( const CaseStmt * caseStmt ) override final;
    81100        virtual void visit( BranchStmt * branchStmt ) override final;
     101        virtual void visit( const BranchStmt * branchStmt ) override final;
    82102        virtual void visit( ReturnStmt * returnStmt ) override final;
     103        virtual void visit( const ReturnStmt * returnStmt ) override final;
    83104        virtual void visit( ThrowStmt * throwStmt ) override final;
     105        virtual void visit( const ThrowStmt * throwStmt ) override final;
    84106        virtual void visit( TryStmt * tryStmt ) override final;
     107        virtual void visit( const TryStmt * tryStmt ) override final;
    85108        virtual void visit( CatchStmt * catchStmt ) override final;
     109        virtual void visit( const CatchStmt * catchStmt ) override final;
    86110        virtual void visit( FinallyStmt * finallyStmt ) override final;
     111        virtual void visit( const FinallyStmt * finallyStmt ) override final;
    87112        virtual void visit( WaitForStmt * waitforStmt ) override final;
     113        virtual void visit( const WaitForStmt * waitforStmt ) override final;
    88114        virtual void visit( WithStmt * withStmt ) override final;
     115        virtual void visit( const WithStmt * withStmt ) override final;
    89116        virtual void visit( NullStmt * nullStmt ) override final;
     117        virtual void visit( const NullStmt * nullStmt ) override final;
    90118        virtual void visit( DeclStmt * declStmt ) override final;
     119        virtual void visit( const DeclStmt * declStmt ) override final;
    91120        virtual void visit( ImplicitCtorDtorStmt * impCtorDtorStmt ) override final;
     121        virtual void visit( const ImplicitCtorDtorStmt * impCtorDtorStmt ) override final;
    92122
    93123        virtual void visit( ApplicationExpr * applicationExpr ) override final;
     124        virtual void visit( const ApplicationExpr * applicationExpr ) override final;
    94125        virtual void visit( UntypedExpr * untypedExpr ) override final;
     126        virtual void visit( const UntypedExpr * untypedExpr ) override final;
    95127        virtual void visit( NameExpr * nameExpr ) override final;
     128        virtual void visit( const NameExpr * nameExpr ) override final;
    96129        virtual void visit( CastExpr * castExpr ) override final;
     130        virtual void visit( const CastExpr * castExpr ) override final;
    97131        virtual void visit( KeywordCastExpr * castExpr ) override final;
     132        virtual void visit( const KeywordCastExpr * castExpr ) override final;
    98133        virtual void visit( VirtualCastExpr * castExpr ) override final;
     134        virtual void visit( const VirtualCastExpr * castExpr ) override final;
    99135        virtual void visit( AddressExpr * addressExpr ) override final;
     136        virtual void visit( const AddressExpr * addressExpr ) override final;
    100137        virtual void visit( LabelAddressExpr * labAddressExpr ) override final;
     138        virtual void visit( const LabelAddressExpr * labAddressExpr ) override final;
    101139        virtual void visit( UntypedMemberExpr * memberExpr ) override final;
     140        virtual void visit( const UntypedMemberExpr * memberExpr ) override final;
    102141        virtual void visit( MemberExpr * memberExpr ) override final;
     142        virtual void visit( const MemberExpr * memberExpr ) override final;
    103143        virtual void visit( VariableExpr * variableExpr ) override final;
     144        virtual void visit( const VariableExpr * variableExpr ) override final;
    104145        virtual void visit( ConstantExpr * constantExpr ) override final;
     146        virtual void visit( const ConstantExpr * constantExpr ) override final;
    105147        virtual void visit( SizeofExpr * sizeofExpr ) override final;
     148        virtual void visit( const SizeofExpr * sizeofExpr ) override final;
    106149        virtual void visit( AlignofExpr * alignofExpr ) override final;
     150        virtual void visit( const AlignofExpr * alignofExpr ) override final;
    107151        virtual void visit( UntypedOffsetofExpr * offsetofExpr ) override final;
     152        virtual void visit( const UntypedOffsetofExpr * offsetofExpr ) override final;
    108153        virtual void visit( OffsetofExpr * offsetofExpr ) override final;
     154        virtual void visit( const OffsetofExpr * offsetofExpr ) override final;
    109155        virtual void visit( OffsetPackExpr * offsetPackExpr ) override final;
     156        virtual void visit( const OffsetPackExpr * offsetPackExpr ) override final;
    110157        virtual void visit( AttrExpr * attrExpr ) override final;
     158        virtual void visit( const AttrExpr * attrExpr ) override final;
    111159        virtual void visit( LogicalExpr * logicalExpr ) override final;
     160        virtual void visit( const LogicalExpr * logicalExpr ) override final;
    112161        virtual void visit( ConditionalExpr * conditionalExpr ) override final;
     162        virtual void visit( const ConditionalExpr * conditionalExpr ) override final;
    113163        virtual void visit( CommaExpr * commaExpr ) override final;
     164        virtual void visit( const CommaExpr * commaExpr ) override final;
    114165        virtual void visit( TypeExpr * typeExpr ) override final;
     166        virtual void visit( const TypeExpr * typeExpr ) override final;
    115167        virtual void visit( AsmExpr * asmExpr ) override final;
     168        virtual void visit( const AsmExpr * asmExpr ) override final;
    116169        virtual void visit( ImplicitCopyCtorExpr * impCpCtorExpr ) override final;
     170        virtual void visit( const ImplicitCopyCtorExpr * impCpCtorExpr ) override final;
    117171        virtual void visit( ConstructorExpr *  ctorExpr ) override final;
     172        virtual void visit( const ConstructorExpr *  ctorExpr ) override final;
    118173        virtual void visit( CompoundLiteralExpr * compLitExpr ) override final;
     174        virtual void visit( const CompoundLiteralExpr * compLitExpr ) override final;
    119175        virtual void visit( RangeExpr * rangeExpr ) override final;
     176        virtual void visit( const RangeExpr * rangeExpr ) override final;
    120177        virtual void visit( UntypedTupleExpr * tupleExpr ) override final;
     178        virtual void visit( const UntypedTupleExpr * tupleExpr ) override final;
    121179        virtual void visit( TupleExpr * tupleExpr ) override final;
     180        virtual void visit( const TupleExpr * tupleExpr ) override final;
    122181        virtual void visit( TupleIndexExpr * tupleExpr ) override final;
     182        virtual void visit( const TupleIndexExpr * tupleExpr ) override final;
    123183        virtual void visit( TupleAssignExpr * assignExpr ) override final;
     184        virtual void visit( const TupleAssignExpr * assignExpr ) override final;
    124185        virtual void visit( StmtExpr *  stmtExpr ) override final;
     186        virtual void visit( const StmtExpr *  stmtExpr ) override final;
    125187        virtual void visit( UniqueExpr *  uniqueExpr ) override final;
     188        virtual void visit( const UniqueExpr *  uniqueExpr ) override final;
    126189        virtual void visit( UntypedInitExpr *  initExpr ) override final;
     190        virtual void visit( const UntypedInitExpr *  initExpr ) override final;
    127191        virtual void visit( InitExpr *  initExpr ) override final;
     192        virtual void visit( const InitExpr *  initExpr ) override final;
    128193        virtual void visit( DeletedExpr *  delExpr ) override final;
     194        virtual void visit( const DeletedExpr *  delExpr ) override final;
    129195        virtual void visit( DefaultArgExpr * argExpr ) override final;
     196        virtual void visit( const DefaultArgExpr * argExpr ) override final;
    130197        virtual void visit( GenericExpr * genExpr ) override final;
     198        virtual void visit( const GenericExpr * genExpr ) override final;
    131199
    132200        virtual void visit( VoidType * basicType ) override final;
     201        virtual void visit( const VoidType * basicType ) override final;
    133202        virtual void visit( BasicType * basicType ) override final;
     203        virtual void visit( const BasicType * basicType ) override final;
    134204        virtual void visit( PointerType * pointerType ) override final;
     205        virtual void visit( const PointerType * pointerType ) override final;
    135206        virtual void visit( ArrayType * arrayType ) override final;
     207        virtual void visit( const ArrayType * arrayType ) override final;
    136208        virtual void visit( ReferenceType * referenceType ) override final;
     209        virtual void visit( const ReferenceType * referenceType ) override final;
    137210        virtual void visit( QualifiedType * qualType ) override final;
     211        virtual void visit( const QualifiedType * qualType ) override final;
    138212        virtual void visit( FunctionType * functionType ) override final;
     213        virtual void visit( const FunctionType * functionType ) override final;
    139214        virtual void visit( StructInstType * aggregateUseType ) override final;
     215        virtual void visit( const StructInstType * aggregateUseType ) override final;
    140216        virtual void visit( UnionInstType * aggregateUseType ) override final;
     217        virtual void visit( const UnionInstType * aggregateUseType ) override final;
    141218        virtual void visit( EnumInstType * aggregateUseType ) override final;
     219        virtual void visit( const EnumInstType * aggregateUseType ) override final;
    142220        virtual void visit( TraitInstType * aggregateUseType ) override final;
     221        virtual void visit( const TraitInstType * aggregateUseType ) override final;
    143222        virtual void visit( TypeInstType * aggregateUseType ) override final;
     223        virtual void visit( const TypeInstType * aggregateUseType ) override final;
    144224        virtual void visit( TupleType * tupleType ) override final;
     225        virtual void visit( const TupleType * tupleType ) override final;
    145226        virtual void visit( TypeofType * typeofType ) override final;
     227        virtual void visit( const TypeofType * typeofType ) override final;
    146228        virtual void visit( AttrType * attrType ) override final;
     229        virtual void visit( const AttrType * attrType ) override final;
    147230        virtual void visit( VarArgsType * varArgsType ) override final;
     231        virtual void visit( const VarArgsType * varArgsType ) override final;
    148232        virtual void visit( ZeroType * zeroType ) override final;
     233        virtual void visit( const ZeroType * zeroType ) override final;
    149234        virtual void visit( OneType * oneType ) override final;
     235        virtual void visit( const OneType * oneType ) override final;
    150236        virtual void visit( GlobalScopeType * globalType ) override final;
     237        virtual void visit( const GlobalScopeType * globalType ) override final;
    151238
    152239        virtual void visit( Designation * designation ) override final;
     240        virtual void visit( const Designation * designation ) override final;
    153241        virtual void visit( SingleInit * singleInit ) override final;
     242        virtual void visit( const SingleInit * singleInit ) override final;
    154243        virtual void visit( ListInit * listInit ) override final;
     244        virtual void visit( const ListInit * listInit ) override final;
    155245        virtual void visit( ConstructorInit * ctorInit ) override final;
     246        virtual void visit( const ConstructorInit * ctorInit ) override final;
    156247
    157248        virtual void visit( Constant * constant ) override final;
     249        virtual void visit( const Constant * constant ) override final;
    158250
    159251        virtual void visit( Attribute * attribute ) override final;
     252        virtual void visit( const Attribute * attribute ) override final;
    160253
    161254        virtual DeclarationWithType * mutate( ObjectDecl * objectDecl ) override final;
     
    265358
    266359        template<typename pass_t> friend void acceptAll( std::list< Declaration* > &decls, PassVisitor< pass_t >& visitor );
     360        template<typename pass_t> friend void acceptAll( const std::list< const Declaration * > &decls, PassVisitor< pass_t >& visitor );
    267361        template<typename pass_t> friend void mutateAll( std::list< Declaration* > &decls, PassVisitor< pass_t >& visitor );
    268362        template< typename TreeType, typename pass_t > friend void maybeAccept_impl( TreeType * tree, PassVisitor< pass_t > & visitor );
     363        template< typename TreeType, typename pass_t > friend void maybeAccept_impl( const TreeType * tree, PassVisitor< pass_t > & visitor );
    269364        template< typename TreeType, typename pass_t > friend void maybeMutate_impl( TreeType *& tree, PassVisitor< pass_t > & mutator );
    270365        template< typename Container, typename pass_t > friend void maybeAccept_impl( Container & container, PassVisitor< pass_t > & visitor );
     366        template< typename Container, typename pass_t > friend void maybeAccept_impl( const Container & container, PassVisitor< pass_t > & visitor );
    271367        template< typename Container, typename pass_t > friend void maybeMutate_impl( Container & container, PassVisitor< pass_t > & mutator );
    272368
    273369        template<typename node_type> void call_previsit ( node_type * node ) { previsit_impl ( pass, node, 0 ); }
     370        template<typename node_type> void call_previsit ( const node_type * node ) { previsit_impl ( pass, node, 0 ); }
    274371        template<typename node_type> void call_postvisit( node_type * node ) { postvisit_impl( pass, node, 0 ); }
     372        template<typename node_type> void call_postvisit( const node_type * node ) { postvisit_impl( pass, node, 0 ); }
    275373
    276374        template<typename node_type> void call_premutate ( node_type * node ) { premutate_impl( pass, node, 0 ); }
     
    286384        void visitStatementList ( std::list< Statement* > &statements );
    287385        void mutateStatementList( std::list< Statement* > &statements );
     386        void visitStatementList ( const std::list< Statement * > & statements );
    288387
    289388        template< typename func_t >
     
    291390        Statement * visitStatement ( Statement * stmt );
    292391        Statement * mutateStatement( Statement * stmt );
     392        void visitStatement ( const Statement * stmt );
    293393
    294394        template< typename func_t >
     
    296396        Expression * visitExpression ( Expression * expr );
    297397        Expression * mutateExpression( Expression * expr );
     398        void visitExpression ( const Expression * expr );
    298399
    299400
  • src/Common/PassVisitor.impl.h

    ree6dbae r7870799  
    8080
    8181template< typename pass_type >
     82inline void acceptAll( const std::list< const Declaration * > & decls, PassVisitor< pass_type >& visitor ) {
     83        SemanticErrorException errors;
     84
     85        pass_visitor_stats.depth++;
     86        pass_visitor_stats.max->push(pass_visitor_stats.depth);
     87        pass_visitor_stats.avg->push(pass_visitor_stats.depth);
     88        for ( const Declaration * decl : decls ) {
     89                try {
     90                        // run visitor on declaration
     91                        maybeAccept_impl( decl, visitor );
     92                }
     93                catch( SemanticErrorException &e ) {
     94                        errors.append( e );
     95                }
     96        }
     97        pass_visitor_stats.depth--;
     98        if ( ! errors.isEmpty() ) {
     99                throw errors;
     100        }
     101}
     102
     103template< typename pass_type >
    82104inline void mutateAll( std::list< Declaration* > &decls, PassVisitor< pass_type >& mutator ) {
    83105        DeclList_t* beforeDecls = mutator.get_beforeDecls();
     
    117139}
    118140
     141template< typename TreeType, typename pass_type >
     142inline void maybeAccept_impl( const TreeType * tree, PassVisitor< pass_type > & visitor ) {
     143        if ( ! visitor.get_visit_children() ) return;
     144        if ( tree ) {
     145                tree->accept( visitor );
     146        }
     147}
     148
    119149template< typename Container, typename pass_type >
    120150inline void maybeAccept_impl( Container & container, PassVisitor< pass_type > & visitor ) {
     
    129159                        if ( *i ) {
    130160                                (*i)->accept( visitor );
     161                        }
     162                } catch( SemanticErrorException &e ) {
     163                        errors.append( e );
     164                }
     165        }
     166        pass_visitor_stats.depth--;
     167        if ( ! errors.isEmpty() ) {
     168                throw errors;
     169        }
     170}
     171
     172template< typename Container, typename pass_type >
     173inline void maybeAccept_impl( const Container & container, PassVisitor< pass_type > & visitor ) {
     174        if ( ! visitor.get_visit_children() ) return;
     175        SemanticErrorException errors;
     176
     177        pass_visitor_stats.depth++;
     178        pass_visitor_stats.max->push(pass_visitor_stats.depth);
     179        pass_visitor_stats.avg->push(pass_visitor_stats.depth);
     180        for ( const auto & i : container ) {
     181                try {
     182                        if ( i ) {
     183                                i->accept( visitor );
    131184                        }
    132185                } catch( SemanticErrorException &e ) {
     
    227280
    228281template< typename pass_type >
     282void PassVisitor< pass_type >::visitStatementList( const std::list< Statement * > & statements ) {
     283        if ( ! get_visit_children() ) return;
     284        SemanticErrorException errors;
     285
     286        pass_visitor_stats.depth++;
     287        pass_visitor_stats.max->push(pass_visitor_stats.depth);
     288        pass_visitor_stats.avg->push(pass_visitor_stats.depth);
     289        for ( const Statement * i : statements ) {
     290                try {
     291                        maybeAccept_impl( i, *this );
     292                } catch ( SemanticErrorException &e ) {
     293                        errors.append( e );
     294                }
     295        }
     296        pass_visitor_stats.depth--;
     297        if ( !errors.isEmpty() ) { throw errors; }
     298}
     299
     300template< typename pass_type >
    229301void PassVisitor< pass_type >::mutateStatementList( std::list< Statement * > & statements ) {
    230302        handleStatementList( statements, [this]( Statement *& stmt) {
     
    275347
    276348template< typename pass_type >
     349void PassVisitor< pass_type >::visitStatement( const Statement * stmt ) {
     350        if ( ! get_visit_children() ) return;
     351
     352        // don't want statements from outer CompoundStmts to be added to this CompoundStmt
     353        ValueGuardPtr< typename std::remove_pointer<decltype(get_env_ptr())>::type >  oldEnv( get_env_ptr() );
     354
     355        maybeAccept_impl( stmt, *this );
     356}
     357
     358template< typename pass_type >
    277359Statement * PassVisitor< pass_type >::mutateStatement( Statement * stmt ) {
    278360        return handleStatement( stmt, [this]( Statement * stmt ) {
     
    306388
    307389template< typename pass_type >
     390void PassVisitor< pass_type >::visitExpression( const Expression * expr ) {
     391        if ( ! get_visit_children() ) return;
     392        if( !expr ) return;
     393
     394        auto env_ptr = get_env_ptr();
     395        if ( env_ptr && expr->get_env() ) {
     396                *env_ptr = expr->get_env();
     397        }
     398
     399        maybeAccept_impl( expr, *this );
     400}
     401
     402template< typename pass_type >
    308403Expression * PassVisitor< pass_type >::mutateExpression( Expression * expr ) {
    309404        return handleExpression(expr, [this]( Expression * expr ) {
     
    315410template< typename TreeType, typename VisitorType >
    316411inline void indexerScopedAccept( TreeType * tree, VisitorType & visitor ) {
     412        if ( ! visitor.get_visit_children() ) return;
     413        auto guard = makeFuncGuard(
     414                [&visitor]() { visitor.indexerScopeEnter(); },
     415                [&visitor]() { visitor.indexerScopeLeave(); }
     416        );
     417        maybeAccept_impl( tree, visitor );
     418}
     419
     420template< typename TreeType, typename VisitorType >
     421inline void indexerScopedAccept( const TreeType * tree, VisitorType & visitor ) {
    317422        if ( ! visitor.get_visit_children() ) return;
    318423        auto guard = makeFuncGuard(
     
    372477
    373478        indexerAddId( node );
     479
     480        VISIT_END( node );
     481}
     482
     483template< typename pass_type >
     484void PassVisitor< pass_type >::visit( const ObjectDecl * node ) {
     485        VISIT_START( node );
     486
     487        maybeAccept_impl( node->type         , *this );
     488        maybeAccept_impl( node->init         , *this );
     489        maybeAccept_impl( node->bitfieldWidth, *this );
     490        maybeAccept_impl( node->attributes   , *this );
    374491
    375492        VISIT_END( node );
     
    428545
    429546template< typename pass_type >
     547void PassVisitor< pass_type >::visit( const FunctionDecl * node ) {
     548        VISIT_START( node );
     549
     550        maybeAccept_impl( node->withExprs, *this );
     551        {
     552                // implicit add __func__ identifier as specified in the C manual 6.4.2.2
     553                static ObjectDecl func(
     554                        "__func__", noStorageClasses, LinkageSpec::C, nullptr,
     555                        new ArrayType( Type::Qualifiers(), new BasicType( Type::Qualifiers( Type::Const ), BasicType::Char ), nullptr, true, false ),
     556                        nullptr
     557                );
     558                maybeAccept_impl( node->type, *this );
     559                // function body needs to have the same scope as parameters - CompoundStmt will not enter
     560                // a new scope if inFunction is true
     561                ValueGuard< bool > oldInFunction( inFunction );
     562                inFunction = true;
     563                maybeAccept_impl( node->statements, *this );
     564                maybeAccept_impl( node->attributes, *this );
     565        }
     566
     567        VISIT_END( node );
     568}
     569
     570template< typename pass_type >
    430571DeclarationWithType * PassVisitor< pass_type >::mutate( FunctionDecl * node ) {
    431572        MUTATE_START( node );
     
    484625
    485626template< typename pass_type >
     627void PassVisitor< pass_type >::visit( const StructDecl * node ) {
     628        VISIT_START( node );
     629
     630        maybeAccept_impl( node->parameters, *this );
     631        maybeAccept_impl( node->members   , *this );
     632
     633        VISIT_END( node );
     634}
     635
     636template< typename pass_type >
    486637Declaration * PassVisitor< pass_type >::mutate( StructDecl * node ) {
    487638        MUTATE_START( node );
     
    522673        VISIT_END( node );
    523674}
     675template< typename pass_type >
     676void PassVisitor< pass_type >::visit( const UnionDecl * node ) {
     677        VISIT_START( node );
     678
     679        maybeAccept_impl( node->parameters, *this );
     680        maybeAccept_impl( node->members   , *this );
     681
     682        VISIT_END( node );
     683}
    524684
    525685template< typename pass_type >
     
    557717
    558718template< typename pass_type >
     719void PassVisitor< pass_type >::visit( const EnumDecl * node ) {
     720        VISIT_START( node );
     721
     722        // unlike structs, traits, and unions, enums inject their members into the global scope
     723        maybeAccept_impl( node->parameters, *this );
     724        maybeAccept_impl( node->members   , *this );
     725
     726        VISIT_END( node );
     727}
     728
     729template< typename pass_type >
    559730Declaration * PassVisitor< pass_type >::mutate( EnumDecl * node ) {
    560731        MUTATE_START( node );
     
    587758
    588759template< typename pass_type >
     760void PassVisitor< pass_type >::visit( const TraitDecl * node ) {
     761        VISIT_START( node );
     762
     763        maybeAccept_impl( node->parameters, *this );
     764        maybeAccept_impl( node->members   , *this );
     765
     766        VISIT_END( node );
     767}
     768
     769template< typename pass_type >
    589770Declaration * PassVisitor< pass_type >::mutate( TraitDecl * node ) {
    590771        MUTATE_START( node );
     
    625806}
    626807
     808
     809template< typename pass_type >
     810void PassVisitor< pass_type >::visit( const TypeDecl * node ) {
     811        VISIT_START( node );
     812
     813        maybeAccept_impl( node->parameters, *this );
     814        maybeAccept_impl( node->base      , *this );
     815        maybeAccept_impl( node->assertions, *this );
     816
     817        VISIT_END( node );
     818}
     819
    627820template< typename pass_type >
    628821Declaration * PassVisitor< pass_type >::mutate( TypeDecl * node ) {
     
    667860
    668861template< typename pass_type >
     862void PassVisitor< pass_type >::visit( const TypedefDecl * node ) {
     863        VISIT_START( node );
     864
     865        maybeAccept_impl( node->parameters, *this );
     866        maybeAccept_impl( node->base      , *this );
     867        maybeAccept_impl( node->assertions, *this );
     868
     869        VISIT_END( node );
     870}
     871
     872template< typename pass_type >
    669873Declaration * PassVisitor< pass_type >::mutate( TypedefDecl * node ) {
    670874        MUTATE_START( node );
     
    695899
    696900template< typename pass_type >
     901void PassVisitor< pass_type >::visit( const AsmDecl * node ) {
     902        VISIT_START( node );
     903
     904        maybeAccept_impl( node->stmt, *this );
     905
     906        VISIT_END( node );
     907}
     908
     909template< typename pass_type >
    697910AsmDecl * PassVisitor< pass_type >::mutate( AsmDecl * node ) {
    698911        MUTATE_START( node );
     
    710923
    711924        node->condition = visitExpression( node->condition );
     925        maybeAccept_impl( node->message, *this );
     926
     927        VISIT_END( node );
     928}
     929
     930template< typename pass_type >
     931void PassVisitor< pass_type >::visit( const StaticAssertDecl * node ) {
     932        VISIT_START( node );
     933
     934        visitExpression( node->condition );
    712935        maybeAccept_impl( node->message, *this );
    713936
     
    742965
    743966template< typename pass_type >
     967void PassVisitor< pass_type >::visit( const CompoundStmt * node ) {
     968        VISIT_START( node );
     969        {
     970                // do not enter a new scope if inFunction is true - needs to check old state before the assignment
     971                ValueGuard< bool > oldInFunction( inFunction );
     972                auto guard1 = makeFuncGuard( [this, &oldInFunction]() { if ( ! oldInFunction.old ) indexerScopeEnter(); }, [this, &oldInFunction]() { if ( ! oldInFunction.old ) indexerScopeLeave(); } );
     973                auto guard2 = makeFuncGuard( [this]() { call_beginScope();   }, [this]() { call_endScope();     } );
     974                inFunction = false;
     975                visitStatementList( node->kids );
     976        }
     977        VISIT_END( node );
     978}
     979
     980template< typename pass_type >
    744981CompoundStmt * PassVisitor< pass_type >::mutate( CompoundStmt * node ) {
    745982        MUTATE_START( node );
     
    7671004
    7681005template< typename pass_type >
     1006void PassVisitor< pass_type >::visit( const ExprStmt * node ) {
     1007        VISIT_START( node );
     1008
     1009        visitExpression( node->expr );
     1010
     1011        VISIT_END( node );
     1012}
     1013
     1014template< typename pass_type >
    7691015Statement * PassVisitor< pass_type >::mutate( ExprStmt * node ) {
    7701016        MUTATE_START( node );
     
    7901036
    7911037template< typename pass_type >
     1038void PassVisitor< pass_type >::visit( const AsmStmt * node ) {
     1039        VISIT_START( node )
     1040
     1041        maybeAccept_impl( node->instruction, *this );
     1042        maybeAccept_impl( node->output, *this );
     1043        maybeAccept_impl( node->input, *this );
     1044        maybeAccept_impl( node->clobber, *this );
     1045
     1046        VISIT_END( node );
     1047}
     1048
     1049template< typename pass_type >
    7921050Statement * PassVisitor< pass_type >::mutate( AsmStmt * node ) {
    7931051        MUTATE_START( node );
     
    8111069
    8121070template< typename pass_type >
     1071void PassVisitor< pass_type >::visit( const DirectiveStmt * node ) {
     1072        VISIT_START( node )
     1073
     1074        VISIT_END( node );
     1075}
     1076
     1077template< typename pass_type >
    8131078Statement * PassVisitor< pass_type >::mutate( DirectiveStmt * node ) {
    8141079        MUTATE_START( node );
     
    8251090                // if statements introduce a level of scope (for the initialization)
    8261091                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
    827                 maybeAccept_impl( node->get_initialization(), *this );
     1092                maybeAccept_impl( node->initialization, *this );
    8281093                visitExpression ( node->condition );
    8291094                node->thenPart = visitStatement( node->thenPart );
     
    8341099
    8351100template< typename pass_type >
     1101void PassVisitor< pass_type >::visit( const IfStmt * node ) {
     1102        VISIT_START( node );
     1103
     1104        maybeAccept_impl( node->initialization, *this );
     1105        visitExpression ( node->condition );
     1106        visitStatement( node->thenPart );
     1107        visitStatement( node->elsePart );
     1108
     1109        VISIT_END( node );
     1110}
     1111
     1112template< typename pass_type >
    8361113Statement * PassVisitor< pass_type >::mutate( IfStmt * node ) {
    8371114        MUTATE_START( node );
     
    8391116                // if statements introduce a level of scope (for the initialization)
    8401117                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
    841                 maybeMutate_impl( node->get_initialization(), *this );
     1118                maybeMutate_impl( node->initialization, *this );
    8421119                node->condition = mutateExpression( node->condition );
    8431120                node->thenPart  = mutateStatement ( node->thenPart  );
     
    8601137                node->body = visitStatement( node->body );
    8611138        }
     1139
     1140        VISIT_END( node );
     1141}
     1142
     1143template< typename pass_type >
     1144void PassVisitor< pass_type >::visit( const WhileStmt * node ) {
     1145        VISIT_START( node );
     1146
     1147        maybeAccept_impl( node->initialization, *this );
     1148        visitExpression ( node->condition );
     1149        visitStatement( node->body );
    8621150
    8631151        VISIT_END( node );
     
    8971185
    8981186template< typename pass_type >
     1187void PassVisitor< pass_type >::visit( const ForStmt * node ) {
     1188        VISIT_START( node );
     1189
     1190        maybeAccept_impl( node->initialization, *this );
     1191        visitExpression( node->condition );
     1192        visitExpression( node->increment );
     1193        visitStatement( node->body );
     1194
     1195        VISIT_END( node );
     1196}
     1197
     1198template< typename pass_type >
    8991199Statement * PassVisitor< pass_type >::mutate( ForStmt * node ) {
    9001200        MUTATE_START( node );
     
    9231223
    9241224template< typename pass_type >
     1225void PassVisitor< pass_type >::visit( const SwitchStmt * node ) {
     1226        VISIT_START( node );
     1227
     1228        visitExpression   ( node->condition  );
     1229        visitStatementList( node->statements );
     1230
     1231        VISIT_END( node );
     1232}
     1233
     1234template< typename pass_type >
    9251235Statement * PassVisitor< pass_type >::mutate( SwitchStmt * node ) {
    9261236        MUTATE_START( node );
     
    9451255
    9461256template< typename pass_type >
     1257void PassVisitor< pass_type >::visit( const CaseStmt * node ) {
     1258        VISIT_START( node );
     1259
     1260        visitExpression   ( node->condition );
     1261        visitStatementList( node->stmts     );
     1262
     1263        VISIT_END( node );
     1264}
     1265
     1266template< typename pass_type >
    9471267Statement * PassVisitor< pass_type >::mutate( CaseStmt * node ) {
    9481268        MUTATE_START( node );
     
    9631283
    9641284template< typename pass_type >
     1285void PassVisitor< pass_type >::visit( const BranchStmt * node ) {
     1286        VISIT_START( node );
     1287        VISIT_END( node );
     1288}
     1289
     1290template< typename pass_type >
    9651291Statement * PassVisitor< pass_type >::mutate( BranchStmt * node ) {
    9661292        MUTATE_START( node );
     
    9801306
    9811307template< typename pass_type >
     1308void PassVisitor< pass_type >::visit( const ReturnStmt * node ) {
     1309        VISIT_START( node );
     1310
     1311        visitExpression( node->expr );
     1312
     1313        VISIT_END( node );
     1314}
     1315
     1316template< typename pass_type >
    9821317Statement * PassVisitor< pass_type >::mutate( ReturnStmt * node ) {
    9831318        MUTATE_START( node );
     
    9901325//--------------------------------------------------------------------------
    9911326// ThrowStmt
    992 
    9931327template< typename pass_type >
    9941328void PassVisitor< pass_type >::visit( ThrowStmt * node ) {
     
    10021336
    10031337template< typename pass_type >
     1338void PassVisitor< pass_type >::visit( const ThrowStmt * node ) {
     1339        VISIT_START( node );
     1340
     1341        maybeAccept_impl( node->expr, *this );
     1342        maybeAccept_impl( node->target, *this );
     1343
     1344        VISIT_END( node );
     1345}
     1346
     1347template< typename pass_type >
    10041348Statement * PassVisitor< pass_type >::mutate( ThrowStmt * node ) {
    10051349        MUTATE_START( node );
     
    10151359template< typename pass_type >
    10161360void PassVisitor< pass_type >::visit( TryStmt * node ) {
     1361        VISIT_START( node );
     1362
     1363        maybeAccept_impl( node->block       , *this );
     1364        maybeAccept_impl( node->handlers    , *this );
     1365        maybeAccept_impl( node->finallyBlock, *this );
     1366
     1367        VISIT_END( node );
     1368}
     1369
     1370template< typename pass_type >
     1371void PassVisitor< pass_type >::visit( const TryStmt * node ) {
    10171372        VISIT_START( node );
    10181373
     
    10511406
    10521407template< typename pass_type >
     1408void PassVisitor< pass_type >::visit( const CatchStmt * node ) {
     1409        VISIT_START( node );
     1410
     1411        maybeAccept_impl( node->decl, *this );
     1412        visitExpression( node->cond );
     1413        visitStatement ( node->body );
     1414
     1415        VISIT_END( node );
     1416}
     1417
     1418template< typename pass_type >
    10531419Statement * PassVisitor< pass_type >::mutate( CatchStmt * node ) {
    10541420        MUTATE_START( node );
     
    10751441
    10761442template< typename pass_type >
     1443void PassVisitor< pass_type >::visit( const FinallyStmt * node ) {
     1444        VISIT_START( node );
     1445
     1446        maybeAccept_impl( node->block, *this );
     1447
     1448        VISIT_END( node );
     1449}
     1450
     1451template< typename pass_type >
    10771452Statement * PassVisitor< pass_type >::mutate( FinallyStmt * node ) {
    10781453        MUTATE_START( node );
     
    11071482
    11081483template< typename pass_type >
     1484void PassVisitor< pass_type >::visit( const WaitForStmt * node ) {
     1485        VISIT_START( node );
     1486
     1487        for( auto & clause : node->clauses ) {
     1488                maybeAccept_impl( clause.target.function, *this );
     1489                maybeAccept_impl( clause.target.arguments, *this );
     1490
     1491                maybeAccept_impl( clause.statement, *this );
     1492                maybeAccept_impl( clause.condition, *this );
     1493        }
     1494
     1495        maybeAccept_impl( node->timeout.time, *this );
     1496        maybeAccept_impl( node->timeout.statement, *this );
     1497        maybeAccept_impl( node->timeout.condition, *this );
     1498        maybeAccept_impl( node->orelse.statement, *this );
     1499        maybeAccept_impl( node->orelse.condition, *this );
     1500
     1501        VISIT_END( node );
     1502}
     1503
     1504template< typename pass_type >
    11091505Statement * PassVisitor< pass_type >::mutate( WaitForStmt * node ) {
    11101506        MUTATE_START( node );
     
    11301526
    11311527//--------------------------------------------------------------------------
    1132 // NullStmt
     1528// WithStmt
    11331529template< typename pass_type >
    11341530void PassVisitor< pass_type >::visit( WithStmt * node ) {
     
    11451541
    11461542template< typename pass_type >
     1543void PassVisitor< pass_type >::visit( const WithStmt * node ) {
     1544        VISIT_START( node );
     1545
     1546        maybeAccept_impl( node->exprs, *this );
     1547        maybeAccept_impl( node->stmt, *this );
     1548
     1549        VISIT_END( node );
     1550}
     1551
     1552template< typename pass_type >
    11471553Statement * PassVisitor< pass_type >::mutate( WithStmt * node ) {
    11481554        MUTATE_START( node );
     
    11661572
    11671573template< typename pass_type >
     1574void PassVisitor< pass_type >::visit( const NullStmt * node ) {
     1575        VISIT_START( node );
     1576        VISIT_END( node );
     1577}
     1578
     1579template< typename pass_type >
    11681580NullStmt * PassVisitor< pass_type >::mutate( NullStmt * node ) {
    11691581        MUTATE_START( node );
     
    11831595
    11841596template< typename pass_type >
     1597void PassVisitor< pass_type >::visit( const DeclStmt * node ) {
     1598        VISIT_START( node );
     1599
     1600        maybeAccept_impl( node->decl, *this );
     1601
     1602        VISIT_END( node );
     1603}
     1604
     1605template< typename pass_type >
    11851606Statement * PassVisitor< pass_type >::mutate( DeclStmt * node ) {
    11861607        MUTATE_START( node );
     
    11951616template< typename pass_type >
    11961617void PassVisitor< pass_type >::visit( ImplicitCtorDtorStmt * node ) {
     1618        VISIT_START( node );
     1619
     1620        maybeAccept_impl( node->callStmt, *this );
     1621
     1622        VISIT_END( node );
     1623}
     1624
     1625template< typename pass_type >
     1626void PassVisitor< pass_type >::visit( const ImplicitCtorDtorStmt * node ) {
    11971627        VISIT_START( node );
    11981628
     
    12201650        maybeAccept_impl        ( node->function, *this );
    12211651        maybeAccept_impl        ( node->args    , *this );
     1652
     1653        VISIT_END( node );
     1654}
     1655
     1656template< typename pass_type >
     1657void PassVisitor< pass_type >::visit( const ApplicationExpr * node ) {
     1658        VISIT_START( node );
     1659
     1660        maybeAccept_impl( node->result  , *this );
     1661        maybeAccept_impl( node->function, *this );
     1662        maybeAccept_impl( node->args    , *this );
    12221663
    12231664        VISIT_END( node );
     
    12531694
    12541695template< typename pass_type >
     1696void PassVisitor< pass_type >::visit( const UntypedExpr * node ) {
     1697        VISIT_START( node );
     1698
     1699        maybeAccept_impl( node->result, *this );
     1700
     1701        for ( auto expr : node->args ) {
     1702                visitExpression( expr );
     1703        }
     1704
     1705        VISIT_END( node );
     1706}
     1707
     1708template< typename pass_type >
    12551709Expression * PassVisitor< pass_type >::mutate( UntypedExpr * node ) {
    12561710        MUTATE_START( node );
     
    12781732
    12791733template< typename pass_type >
     1734void PassVisitor< pass_type >::visit( const NameExpr * node ) {
     1735        VISIT_START( node );
     1736
     1737        maybeAccept_impl( node->result, *this );
     1738
     1739        VISIT_END( node );
     1740}
     1741
     1742template< typename pass_type >
    12801743Expression * PassVisitor< pass_type >::mutate( NameExpr * node ) {
    12811744        MUTATE_START( node );
     
    12951758        indexerScopedAccept( node->result, *this );
    12961759        maybeAccept_impl        ( node->arg   , *this );
     1760
     1761        VISIT_END( node );
     1762}
     1763
     1764template< typename pass_type >
     1765void PassVisitor< pass_type >::visit( const CastExpr * node ) {
     1766        VISIT_START( node );
     1767
     1768        maybeAccept_impl( node->result, *this );
     1769        maybeAccept_impl( node->arg   , *this );
    12971770
    12981771        VISIT_END( node );
     
    13231796
    13241797template< typename pass_type >
     1798void PassVisitor< pass_type >::visit( const KeywordCastExpr * node ) {
     1799        VISIT_START( node );
     1800
     1801        maybeAccept_impl( node->result, *this );
     1802        maybeAccept_impl( node->arg   , *this );
     1803
     1804        VISIT_END( node );
     1805}
     1806
     1807template< typename pass_type >
    13251808Expression * PassVisitor< pass_type >::mutate( KeywordCastExpr * node ) {
    13261809        MUTATE_START( node );
     
    13461829
    13471830template< typename pass_type >
     1831void PassVisitor< pass_type >::visit( const VirtualCastExpr * node ) {
     1832        VISIT_START( node );
     1833
     1834        maybeAccept_impl( node->result, *this );
     1835        maybeAccept_impl( node->arg, *this );
     1836
     1837        VISIT_END( node );
     1838}
     1839
     1840template< typename pass_type >
    13481841Expression * PassVisitor< pass_type >::mutate( VirtualCastExpr * node ) {
    13491842        MUTATE_START( node );
     
    13691862
    13701863template< typename pass_type >
     1864void PassVisitor< pass_type >::visit( const AddressExpr * node ) {
     1865        VISIT_START( node );
     1866
     1867        maybeAccept_impl( node->result, *this );
     1868        maybeAccept_impl( node->arg   , *this );
     1869
     1870        VISIT_END( node );
     1871}
     1872
     1873template< typename pass_type >
    13711874Expression * PassVisitor< pass_type >::mutate( AddressExpr * node ) {
    13721875        MUTATE_START( node );
     
    13911894
    13921895template< typename pass_type >
     1896void PassVisitor< pass_type >::visit( const LabelAddressExpr * node ) {
     1897        VISIT_START( node );
     1898
     1899        maybeAccept_impl( node->result, *this );
     1900
     1901        VISIT_END( node );
     1902}
     1903
     1904template< typename pass_type >
    13931905Expression * PassVisitor< pass_type >::mutate( LabelAddressExpr * node ) {
    13941906        MUTATE_START( node );
     
    14091921        maybeAccept_impl   ( node->aggregate, *this );
    14101922        maybeAccept_impl   ( node->member   , *this );
     1923
     1924        VISIT_END( node );
     1925}
     1926
     1927template< typename pass_type >
     1928void PassVisitor< pass_type >::visit( const UntypedMemberExpr * node ) {
     1929        VISIT_START( node );
     1930
     1931        maybeAccept_impl( node->result   , *this );
     1932        maybeAccept_impl( node->aggregate, *this );
     1933        maybeAccept_impl( node->member   , *this );
    14111934
    14121935        VISIT_END( node );
     
    14381961
    14391962template< typename pass_type >
     1963void PassVisitor< pass_type >::visit( const MemberExpr * node ) {
     1964        VISIT_START( node );
     1965
     1966        maybeAccept_impl( node->result   , *this );
     1967        maybeAccept_impl( node->aggregate, *this );
     1968
     1969        VISIT_END( node );
     1970}
     1971
     1972template< typename pass_type >
    14401973Expression * PassVisitor< pass_type >::mutate( MemberExpr * node ) {
    14411974        MUTATE_START( node );
     
    14601993
    14611994template< typename pass_type >
     1995void PassVisitor< pass_type >::visit( const VariableExpr * node ) {
     1996        VISIT_START( node );
     1997
     1998        maybeAccept_impl( node->result, *this );
     1999
     2000        VISIT_END( node );
     2001}
     2002
     2003template< typename pass_type >
    14622004Expression * PassVisitor< pass_type >::mutate( VariableExpr * node ) {
    14632005        MUTATE_START( node );
     
    14772019        indexerScopedAccept( node->result   , *this );
    14782020        maybeAccept_impl   ( &node->constant, *this );
     2021
     2022        VISIT_END( node );
     2023}
     2024
     2025template< typename pass_type >
     2026void PassVisitor< pass_type >::visit( const ConstantExpr * node ) {
     2027        VISIT_START( node );
     2028
     2029        maybeAccept_impl( node->result   , *this );
     2030        maybeAccept_impl( &node->constant, *this );
    14792031
    14802032        VISIT_END( node );
     
    15012053
    15022054        indexerScopedAccept( node->result, *this );
     2055        if ( node->get_isType() ) {
     2056                maybeAccept_impl( node->type, *this );
     2057        } else {
     2058                maybeAccept_impl( node->expr, *this );
     2059        }
     2060
     2061        VISIT_END( node );
     2062}
     2063
     2064template< typename pass_type >
     2065void PassVisitor< pass_type >::visit( const SizeofExpr * node ) {
     2066        VISIT_START( node );
     2067
     2068        maybeAccept_impl( node->result, *this );
    15032069        if ( node->get_isType() ) {
    15042070                maybeAccept_impl( node->type, *this );
     
    15422108
    15432109template< typename pass_type >
     2110void PassVisitor< pass_type >::visit( const AlignofExpr * node ) {
     2111        VISIT_START( node );
     2112
     2113        maybeAccept_impl( node->result, *this );
     2114        if ( node->get_isType() ) {
     2115                maybeAccept_impl( node->type, *this );
     2116        } else {
     2117                maybeAccept_impl( node->expr, *this );
     2118        }
     2119
     2120        VISIT_END( node );
     2121}
     2122
     2123template< typename pass_type >
    15442124Expression * PassVisitor< pass_type >::mutate( AlignofExpr * node ) {
    15452125        MUTATE_START( node );
     
    15692149
    15702150template< typename pass_type >
     2151void PassVisitor< pass_type >::visit( const UntypedOffsetofExpr * node ) {
     2152        VISIT_START( node );
     2153
     2154        maybeAccept_impl( node->result, *this );
     2155        maybeAccept_impl( node->type  , *this );
     2156
     2157        VISIT_END( node );
     2158}
     2159
     2160template< typename pass_type >
    15712161Expression * PassVisitor< pass_type >::mutate( UntypedOffsetofExpr * node ) {
    15722162        MUTATE_START( node );
     
    15922182
    15932183template< typename pass_type >
     2184void PassVisitor< pass_type >::visit( const OffsetofExpr * node ) {
     2185        VISIT_START( node );
     2186
     2187        maybeAccept_impl( node->result, *this );
     2188        maybeAccept_impl( node->type  , *this );
     2189
     2190        VISIT_END( node );
     2191}
     2192
     2193template< typename pass_type >
    15942194Expression * PassVisitor< pass_type >::mutate( OffsetofExpr * node ) {
    15952195        MUTATE_START( node );
     
    16152215
    16162216template< typename pass_type >
     2217void PassVisitor< pass_type >::visit( const OffsetPackExpr * node ) {
     2218        VISIT_START( node );
     2219
     2220        maybeAccept_impl( node->result, *this );
     2221        maybeAccept_impl( node->type  , *this );
     2222
     2223        VISIT_END( node );
     2224}
     2225
     2226template< typename pass_type >
    16172227Expression * PassVisitor< pass_type >::mutate( OffsetPackExpr * node ) {
    16182228        MUTATE_START( node );
     
    16322242
    16332243        indexerScopedAccept( node->result, *this );
     2244        if ( node->get_isType() ) {
     2245                maybeAccept_impl( node->type, *this );
     2246        } else {
     2247                maybeAccept_impl( node->expr, *this );
     2248        }
     2249
     2250        VISIT_END( node );
     2251}
     2252
     2253template< typename pass_type >
     2254void PassVisitor< pass_type >::visit( const AttrExpr * node ) {
     2255        VISIT_START( node );
     2256
     2257        maybeAccept_impl( node->result, *this );
    16342258        if ( node->get_isType() ) {
    16352259                maybeAccept_impl( node->type, *this );
     
    16702294
    16712295template< typename pass_type >
     2296void PassVisitor< pass_type >::visit( const LogicalExpr * node ) {
     2297        VISIT_START( node );
     2298
     2299        maybeAccept_impl( node->result, *this );
     2300        maybeAccept_impl( node->arg1  , *this );
     2301        maybeAccept_impl( node->arg2  , *this );
     2302
     2303        VISIT_END( node );
     2304}
     2305
     2306template< typename pass_type >
    16722307Expression * PassVisitor< pass_type >::mutate( LogicalExpr * node ) {
    16732308        MUTATE_START( node );
     
    16912326        maybeAccept_impl        ( node->arg2  , *this );
    16922327        maybeAccept_impl        ( node->arg3  , *this );
     2328
     2329        VISIT_END( node );
     2330}
     2331
     2332template< typename pass_type >
     2333void PassVisitor< pass_type >::visit( const ConditionalExpr * node ) {
     2334        VISIT_START( node );
     2335
     2336        maybeAccept_impl( node->result, *this );
     2337        maybeAccept_impl( node->arg1  , *this );
     2338        maybeAccept_impl( node->arg2  , *this );
     2339        maybeAccept_impl( node->arg3  , *this );
    16932340
    16942341        VISIT_END( node );
     
    17222369
    17232370template< typename pass_type >
     2371void PassVisitor< pass_type >::visit( const CommaExpr * node ) {
     2372        VISIT_START( node );
     2373
     2374        maybeAccept_impl( node->result, *this );
     2375        maybeAccept_impl( node->arg1  , *this );
     2376        maybeAccept_impl( node->arg2  , *this );
     2377
     2378        VISIT_END( node );
     2379}
     2380
     2381template< typename pass_type >
    17242382Expression * PassVisitor< pass_type >::mutate( CommaExpr * node ) {
    17252383        MUTATE_START( node );
     
    17462404
    17472405template< typename pass_type >
     2406void PassVisitor< pass_type >::visit( const TypeExpr * node ) {
     2407        VISIT_START( node );
     2408
     2409        maybeAccept_impl( node->result, *this );
     2410        maybeAccept_impl( node->type, *this );
     2411
     2412        VISIT_END( node );
     2413}
     2414
     2415template< typename pass_type >
    17482416Expression * PassVisitor< pass_type >::mutate( TypeExpr * node ) {
    17492417        MUTATE_START( node );
     
    17662434        maybeAccept_impl   ( node->constraint, *this );
    17672435        maybeAccept_impl   ( node->operand   , *this );
     2436
     2437        VISIT_END( node );
     2438}
     2439
     2440template< typename pass_type >
     2441void PassVisitor< pass_type >::visit( const AsmExpr * node ) {
     2442        VISIT_START( node );
     2443
     2444        maybeAccept_impl( node->result    , *this );
     2445        maybeAccept_impl( node->inout     , *this );
     2446        maybeAccept_impl( node->constraint, *this );
     2447        maybeAccept_impl( node->operand   , *this );
    17682448
    17692449        VISIT_END( node );
     
    17962476
    17972477template< typename pass_type >
     2478void PassVisitor< pass_type >::visit( const ImplicitCopyCtorExpr * node ) {
     2479        VISIT_START( node );
     2480
     2481        maybeAccept_impl( node->result    , *this );
     2482        maybeAccept_impl( node->callExpr  , *this );
     2483
     2484        VISIT_END( node );
     2485}
     2486
     2487template< typename pass_type >
    17982488Expression * PassVisitor< pass_type >::mutate( ImplicitCopyCtorExpr * node ) {
    17992489        MUTATE_START( node );
     
    18192509
    18202510template< typename pass_type >
     2511void PassVisitor< pass_type >::visit( const ConstructorExpr * node ) {
     2512        VISIT_START( node );
     2513
     2514        maybeAccept_impl( node->result  , *this );
     2515        maybeAccept_impl( node->callExpr, *this );
     2516
     2517        VISIT_END( node );
     2518}
     2519
     2520template< typename pass_type >
    18212521Expression * PassVisitor< pass_type >::mutate( ConstructorExpr * node ) {
    18222522        MUTATE_START( node );
     
    18422542
    18432543template< typename pass_type >
     2544void PassVisitor< pass_type >::visit( const CompoundLiteralExpr * node ) {
     2545        VISIT_START( node );
     2546
     2547        maybeAccept_impl( node->result     , *this );
     2548        maybeAccept_impl( node->initializer, *this );
     2549
     2550        VISIT_END( node );
     2551}
     2552
     2553template< typename pass_type >
    18442554Expression * PassVisitor< pass_type >::mutate( CompoundLiteralExpr * node ) {
    18452555        MUTATE_START( node );
     
    18612571        maybeAccept_impl   ( node->low   , *this );
    18622572        maybeAccept_impl   ( node->high  , *this );
     2573
     2574        VISIT_END( node );
     2575}
     2576
     2577template< typename pass_type >
     2578void PassVisitor< pass_type >::visit( const RangeExpr * node ) {
     2579        VISIT_START( node );
     2580
     2581        maybeAccept_impl( node->result, *this );
     2582        maybeAccept_impl( node->low   , *this );
     2583        maybeAccept_impl( node->high  , *this );
    18632584
    18642585        VISIT_END( node );
     
    18902611
    18912612template< typename pass_type >
     2613void PassVisitor< pass_type >::visit( const UntypedTupleExpr * node ) {
     2614        VISIT_START( node );
     2615
     2616        maybeAccept_impl( node->result, *this );
     2617        maybeAccept_impl( node->exprs , *this );
     2618
     2619        VISIT_END( node );
     2620}
     2621
     2622template< typename pass_type >
    18922623Expression * PassVisitor< pass_type >::mutate( UntypedTupleExpr * node ) {
    18932624        MUTATE_START( node );
     
    19132644
    19142645template< typename pass_type >
     2646void PassVisitor< pass_type >::visit( const TupleExpr * node ) {
     2647        VISIT_START( node );
     2648
     2649        maybeAccept_impl( node->result, *this );
     2650        maybeAccept_impl( node->exprs , *this );
     2651
     2652        VISIT_END( node );
     2653}
     2654
     2655template< typename pass_type >
    19152656Expression * PassVisitor< pass_type >::mutate( TupleExpr * node ) {
    19162657        MUTATE_START( node );
     
    19362677
    19372678template< typename pass_type >
     2679void PassVisitor< pass_type >::visit( const TupleIndexExpr * node ) {
     2680        VISIT_START( node );
     2681
     2682        maybeAccept_impl( node->result, *this );
     2683        maybeAccept_impl( node->tuple , *this );
     2684
     2685        VISIT_END( node );
     2686}
     2687
     2688template< typename pass_type >
    19382689Expression * PassVisitor< pass_type >::mutate( TupleIndexExpr * node ) {
    19392690        MUTATE_START( node );
     
    19542705        indexerScopedAccept( node->result  , *this );
    19552706        maybeAccept_impl   ( node->stmtExpr, *this );
     2707
     2708        VISIT_END( node );
     2709}
     2710
     2711template< typename pass_type >
     2712void PassVisitor< pass_type >::visit( const TupleAssignExpr * node ) {
     2713        VISIT_START( node );
     2714
     2715        maybeAccept_impl( node->result  , *this );
     2716        maybeAccept_impl( node->stmtExpr, *this );
    19562717
    19572718        VISIT_END( node );
     
    19892750
    19902751template< typename pass_type >
     2752void PassVisitor< pass_type >::visit( const StmtExpr * node ) {
     2753        VISIT_START( node );
     2754
     2755        maybeAccept_impl( node->result     , *this );
     2756        maybeAccept_impl( node->statements , *this );
     2757        maybeAccept_impl( node->returnDecls, *this );
     2758        maybeAccept_impl( node->dtors      , *this );
     2759
     2760        VISIT_END( node );
     2761}
     2762
     2763template< typename pass_type >
    19912764Expression * PassVisitor< pass_type >::mutate( StmtExpr * node ) {
    19922765        MUTATE_START( node );
     
    20182791
    20192792template< typename pass_type >
     2793void PassVisitor< pass_type >::visit( const UniqueExpr * node ) {
     2794        VISIT_START( node );
     2795
     2796        maybeAccept_impl( node->result, *this );
     2797        maybeAccept_impl( node->expr  , *this );
     2798
     2799        VISIT_END( node );
     2800}
     2801
     2802template< typename pass_type >
    20202803Expression * PassVisitor< pass_type >::mutate( UniqueExpr * node ) {
    20212804        MUTATE_START( node );
     
    20362819        indexerScopedAccept( node->result, *this );
    20372820        maybeAccept_impl   ( node->expr  , *this );
     2821        // not currently visiting initAlts, but this doesn't matter since this node is only used in the resolver.
     2822
     2823        VISIT_END( node );
     2824}
     2825
     2826template< typename pass_type >
     2827void PassVisitor< pass_type >::visit( const UntypedInitExpr * node ) {
     2828        VISIT_START( node );
     2829
     2830        maybeAccept_impl( node->result, *this );
     2831        maybeAccept_impl( node->expr  , *this );
    20382832        // not currently visiting initAlts, but this doesn't matter since this node is only used in the resolver.
    20392833
     
    20672861
    20682862template< typename pass_type >
     2863void PassVisitor< pass_type >::visit( const InitExpr * node ) {
     2864        VISIT_START( node );
     2865
     2866        maybeAccept_impl( node->result, *this );
     2867        maybeAccept_impl( node->expr  , *this );
     2868        maybeAccept_impl( node->designation, *this );
     2869
     2870        VISIT_END( node );
     2871}
     2872
     2873template< typename pass_type >
    20692874Expression * PassVisitor< pass_type >::mutate( InitExpr * node ) {
    20702875        MUTATE_START( node );
     
    20922897
    20932898template< typename pass_type >
     2899void PassVisitor< pass_type >::visit( const DeletedExpr * node ) {
     2900        VISIT_START( node );
     2901
     2902        maybeAccept_impl( node->result, *this );
     2903        maybeAccept_impl( node->expr, *this );
     2904        // don't visit deleteStmt, because it is a pointer to somewhere else in the tree.
     2905
     2906        VISIT_END( node );
     2907}
     2908
     2909template< typename pass_type >
    20942910Expression * PassVisitor< pass_type >::mutate( DeletedExpr * node ) {
    20952911        MUTATE_START( node );
     
    21092925
    21102926        indexerScopedAccept( node->result, *this );
     2927        maybeAccept_impl( node->expr, *this );
     2928
     2929        VISIT_END( node );
     2930}
     2931
     2932template< typename pass_type >
     2933void PassVisitor< pass_type >::visit( const DefaultArgExpr * node ) {
     2934        VISIT_START( node );
     2935
     2936        maybeAccept_impl( node->result, *this );
    21112937        maybeAccept_impl( node->expr, *this );
    21122938
     
    21352961        for ( GenericExpr::Association & assoc : node->associations ) {
    21362962                indexerScopedAccept( assoc.type, *this );
     2963                maybeAccept_impl( assoc.expr, *this );
     2964        }
     2965
     2966        VISIT_END( node );
     2967}
     2968
     2969template< typename pass_type >
     2970void PassVisitor< pass_type >::visit( const GenericExpr * node ) {
     2971        VISIT_START( node );
     2972
     2973        maybeAccept_impl( node->result, *this );
     2974        maybeAccept_impl( node->control, *this );
     2975        for ( const GenericExpr::Association & assoc : node->associations ) {
     2976                maybeAccept_impl( assoc.type, *this );
    21372977                maybeAccept_impl( assoc.expr, *this );
    21382978        }
     
    21683008
    21693009template< typename pass_type >
     3010void PassVisitor< pass_type >::visit( const VoidType * node ) {
     3011        VISIT_START( node );
     3012
     3013        maybeAccept_impl( node->forall, *this );
     3014
     3015        VISIT_END( node );
     3016}
     3017
     3018template< typename pass_type >
    21703019Type * PassVisitor< pass_type >::mutate( VoidType * node ) {
    21713020        MUTATE_START( node );
     
    21803029template< typename pass_type >
    21813030void PassVisitor< pass_type >::visit( BasicType * node ) {
     3031        VISIT_START( node );
     3032
     3033        maybeAccept_impl( node->forall, *this );
     3034
     3035        VISIT_END( node );
     3036}
     3037
     3038template< typename pass_type >
     3039void PassVisitor< pass_type >::visit( const BasicType * node ) {
    21823040        VISIT_START( node );
    21833041
     
    22103068
    22113069template< typename pass_type >
     3070void PassVisitor< pass_type >::visit( const PointerType * node ) {
     3071        VISIT_START( node );
     3072
     3073        maybeAccept_impl( node->forall, *this );
     3074        // xxx - should PointerType visit/mutate dimension?
     3075        maybeAccept_impl( node->base, *this );
     3076
     3077        VISIT_END( node );
     3078}
     3079
     3080template< typename pass_type >
    22123081Type * PassVisitor< pass_type >::mutate( PointerType * node ) {
    22133082        MUTATE_START( node );
     
    22343103
    22353104template< typename pass_type >
     3105void PassVisitor< pass_type >::visit( const ArrayType * node ) {
     3106        VISIT_START( node );
     3107
     3108        maybeAccept_impl( node->forall, *this );
     3109        maybeAccept_impl( node->dimension, *this );
     3110        maybeAccept_impl( node->base, *this );
     3111
     3112        VISIT_END( node );
     3113}
     3114
     3115template< typename pass_type >
    22363116Type * PassVisitor< pass_type >::mutate( ArrayType * node ) {
    22373117        MUTATE_START( node );
     
    22573137
    22583138template< typename pass_type >
     3139void PassVisitor< pass_type >::visit( const ReferenceType * node ) {
     3140        VISIT_START( node );
     3141
     3142        maybeAccept_impl( node->forall, *this );
     3143        maybeAccept_impl( node->base, *this );
     3144
     3145        VISIT_END( node );
     3146}
     3147
     3148template< typename pass_type >
    22593149Type * PassVisitor< pass_type >::mutate( ReferenceType * node ) {
    22603150        MUTATE_START( node );
     
    22803170
    22813171template< typename pass_type >
     3172void PassVisitor< pass_type >::visit( const QualifiedType * node ) {
     3173        VISIT_START( node );
     3174
     3175        maybeAccept_impl( node->forall, *this );
     3176        maybeAccept_impl( node->parent, *this );
     3177        maybeAccept_impl( node->child, *this );
     3178
     3179        VISIT_END( node );
     3180}
     3181
     3182template< typename pass_type >
    22823183Type * PassVisitor< pass_type >::mutate( QualifiedType * node ) {
    22833184        MUTATE_START( node );
     
    22943195template< typename pass_type >
    22953196void PassVisitor< pass_type >::visit( FunctionType * node ) {
     3197        VISIT_START( node );
     3198
     3199        maybeAccept_impl( node->forall, *this );
     3200        maybeAccept_impl( node->returnVals, *this );
     3201        maybeAccept_impl( node->parameters, *this );
     3202
     3203        VISIT_END( node );
     3204}
     3205
     3206template< typename pass_type >
     3207void PassVisitor< pass_type >::visit( const FunctionType * node ) {
    22963208        VISIT_START( node );
    22973209
     
    23323244
    23333245template< typename pass_type >
     3246void PassVisitor< pass_type >::visit( const StructInstType * node ) {
     3247        VISIT_START( node );
     3248
     3249        maybeAccept_impl( node->forall    , *this );
     3250        maybeAccept_impl( node->parameters, *this );
     3251
     3252        VISIT_END( node );
     3253}
     3254
     3255template< typename pass_type >
    23343256Type * PassVisitor< pass_type >::mutate( StructInstType * node ) {
    23353257        MUTATE_START( node );
     
    23643286
    23653287template< typename pass_type >
     3288void PassVisitor< pass_type >::visit( const UnionInstType * node ) {
     3289        VISIT_START( node );
     3290
     3291        maybeAccept_impl( node->forall    , *this );
     3292        maybeAccept_impl( node->parameters, *this );
     3293
     3294        VISIT_END( node );
     3295}
     3296
     3297template< typename pass_type >
    23663298Type * PassVisitor< pass_type >::mutate( UnionInstType * node ) {
    23673299        MUTATE_START( node );
     
    23913323
    23923324template< typename pass_type >
     3325void PassVisitor< pass_type >::visit( const EnumInstType * node ) {
     3326        VISIT_START( node );
     3327
     3328        maybeAccept_impl( node->forall, *this );
     3329        maybeAccept_impl( node->parameters, *this );
     3330
     3331        VISIT_END( node );
     3332}
     3333
     3334template< typename pass_type >
    23933335Type * PassVisitor< pass_type >::mutate( EnumInstType * node ) {
    23943336        MUTATE_START( node );
     
    24133355
    24143356template< typename pass_type >
     3357void PassVisitor< pass_type >::visit( const TraitInstType * node ) {
     3358        VISIT_START( node );
     3359
     3360        maybeAccept_impl( node->forall    , *this );
     3361        maybeAccept_impl( node->parameters, *this );
     3362
     3363        VISIT_END( node );
     3364}
     3365
     3366template< typename pass_type >
    24153367Type * PassVisitor< pass_type >::mutate( TraitInstType * node ) {
    24163368        MUTATE_START( node );
     
    24263378template< typename pass_type >
    24273379void PassVisitor< pass_type >::visit( TypeInstType * node ) {
     3380        VISIT_START( node );
     3381
     3382        maybeAccept_impl( node->forall    , *this );
     3383        maybeAccept_impl( node->parameters, *this );
     3384
     3385        VISIT_END( node );
     3386}
     3387
     3388template< typename pass_type >
     3389void PassVisitor< pass_type >::visit( const TypeInstType * node ) {
    24283390        VISIT_START( node );
    24293391
     
    24583420
    24593421template< typename pass_type >
     3422void PassVisitor< pass_type >::visit( const TupleType * node ) {
     3423        VISIT_START( node );
     3424
     3425        maybeAccept_impl( node->forall, *this );
     3426        maybeAccept_impl( node->types, *this );
     3427        maybeAccept_impl( node->members, *this );
     3428
     3429        VISIT_END( node );
     3430}
     3431
     3432template< typename pass_type >
    24603433Type * PassVisitor< pass_type >::mutate( TupleType * node ) {
    24613434        MUTATE_START( node );
     
    24723445template< typename pass_type >
    24733446void PassVisitor< pass_type >::visit( TypeofType * node ) {
     3447        VISIT_START( node );
     3448
     3449        assert( node->expr );
     3450        maybeAccept_impl( node->expr, *this );
     3451
     3452        VISIT_END( node );
     3453}
     3454
     3455template< typename pass_type >
     3456void PassVisitor< pass_type >::visit( const TypeofType * node ) {
    24743457        VISIT_START( node );
    24753458
     
    25083491
    25093492template< typename pass_type >
     3493void PassVisitor< pass_type >::visit( const AttrType * node ) {
     3494        VISIT_START( node );
     3495
     3496        if ( node->isType ) {
     3497                assert( node->type );
     3498                maybeAccept_impl( node->type, *this );
     3499        } else {
     3500                assert( node->expr );
     3501                maybeAccept_impl( node->expr, *this );
     3502        } // if
     3503
     3504        VISIT_END( node );
     3505}
     3506
     3507template< typename pass_type >
    25103508Type * PassVisitor< pass_type >::mutate( AttrType * node ) {
    25113509        MUTATE_START( node );
     
    25343532
    25353533template< typename pass_type >
     3534void PassVisitor< pass_type >::visit( const VarArgsType * node ) {
     3535        VISIT_START( node );
     3536
     3537        maybeAccept_impl( node->forall, *this );
     3538
     3539        VISIT_END( node );
     3540}
     3541
     3542template< typename pass_type >
    25363543Type * PassVisitor< pass_type >::mutate( VarArgsType * node ) {
    25373544        MUTATE_START( node );
     
    25543561
    25553562template< typename pass_type >
     3563void PassVisitor< pass_type >::visit( const ZeroType * node ) {
     3564        VISIT_START( node );
     3565
     3566        maybeAccept_impl( node->forall, *this );
     3567
     3568        VISIT_END( node );
     3569}
     3570
     3571template< typename pass_type >
    25563572Type * PassVisitor< pass_type >::mutate( ZeroType * node ) {
    25573573        MUTATE_START( node );
     
    25743590
    25753591template< typename pass_type >
     3592void PassVisitor< pass_type >::visit( const OneType * node ) {
     3593        VISIT_START( node );
     3594
     3595        maybeAccept_impl( node->forall, *this );
     3596
     3597        VISIT_END( node );
     3598}
     3599
     3600template< typename pass_type >
    25763601Type * PassVisitor< pass_type >::mutate( OneType * node ) {
    25773602        MUTATE_START( node );
     
    25943619
    25953620template< typename pass_type >
     3621void PassVisitor< pass_type >::visit( const GlobalScopeType * node ) {
     3622        VISIT_START( node );
     3623
     3624        maybeAccept_impl( node->forall, *this );
     3625
     3626        VISIT_END( node );
     3627}
     3628
     3629template< typename pass_type >
    25963630Type * PassVisitor< pass_type >::mutate( GlobalScopeType * node ) {
    25973631        MUTATE_START( node );
     
    26143648
    26153649template< typename pass_type >
     3650void PassVisitor< pass_type >::visit( const Designation * node ) {
     3651        VISIT_START( node );
     3652
     3653        maybeAccept_impl( node->designators, *this );
     3654
     3655        VISIT_END( node );
     3656}
     3657
     3658template< typename pass_type >
    26163659Designation * PassVisitor< pass_type >::mutate( Designation * node ) {
    26173660        MUTATE_START( node );
     
    26343677
    26353678template< typename pass_type >
     3679void PassVisitor< pass_type >::visit( const SingleInit * node ) {
     3680        VISIT_START( node );
     3681
     3682        visitExpression( node->value );
     3683
     3684        VISIT_END( node );
     3685}
     3686
     3687template< typename pass_type >
    26363688Initializer * PassVisitor< pass_type >::mutate( SingleInit * node ) {
    26373689        MUTATE_START( node );
     
    26463698template< typename pass_type >
    26473699void PassVisitor< pass_type >::visit( ListInit * node ) {
     3700        VISIT_START( node );
     3701
     3702        maybeAccept_impl( node->designations, *this );
     3703        maybeAccept_impl( node->initializers, *this );
     3704
     3705        VISIT_END( node );
     3706}
     3707
     3708template< typename pass_type >
     3709void PassVisitor< pass_type >::visit( const ListInit * node ) {
    26483710        VISIT_START( node );
    26493711
     
    26783740
    26793741template< typename pass_type >
     3742void PassVisitor< pass_type >::visit( const ConstructorInit * node ) {
     3743        VISIT_START( node );
     3744
     3745        maybeAccept_impl( node->ctor, *this );
     3746        maybeAccept_impl( node->dtor, *this );
     3747        maybeAccept_impl( node->init, *this );
     3748
     3749        VISIT_END( node );
     3750}
     3751
     3752template< typename pass_type >
    26803753Initializer * PassVisitor< pass_type >::mutate( ConstructorInit * node ) {
    26813754        MUTATE_START( node );
     
    26983771
    26993772template< typename pass_type >
     3773void PassVisitor< pass_type >::visit( const Constant * node ) {
     3774        VISIT_START( node );
     3775
     3776        VISIT_END( node );
     3777}
     3778
     3779template< typename pass_type >
    27003780Constant * PassVisitor< pass_type >::mutate( Constant * node  )  {
    27013781        MUTATE_START( node );
     
    27083788template< typename pass_type >
    27093789void PassVisitor< pass_type >::visit( Attribute * node ) {
     3790        VISIT_START( node );
     3791
     3792        maybeAccept_impl( node->parameters, *this );
     3793
     3794        VISIT_END( node );
     3795}
     3796
     3797template< typename pass_type >
     3798void PassVisitor< pass_type >::visit( const Attribute * node ) {
    27103799        VISIT_START( node );
    27113800
  • src/Common/PassVisitor.proto.h

    ree6dbae r7870799  
    118118static inline void postvisit_impl( __attribute__((unused)) pass_type& pass, __attribute__((unused)) node_type * node, __attribute__((unused)) long unused ) {}
    119119
     120template<typename pass_type, typename node_type>
     121static inline auto previsit_impl( pass_type& pass, const node_type * node, __attribute__((unused)) int unused ) -> decltype( pass.previsit( node ), void() ) {
     122        pass.previsit( node );
     123}
     124
     125template<typename pass_type, typename node_type>
     126static inline void previsit_impl( __attribute__((unused)) pass_type& pass, __attribute__((unused)) const node_type * node, __attribute__((unused)) long unused ) {}
     127
     128
     129template<typename pass_type, typename node_type>
     130static inline auto postvisit_impl( pass_type& pass, const node_type * node, __attribute__((unused)) int unused ) -> decltype( pass.postvisit( node ), void() ) {
     131        pass.postvisit( node );
     132}
     133
     134template<typename pass_type, typename node_type>
     135static inline void postvisit_impl( __attribute__((unused)) pass_type& pass, __attribute__((unused)) const node_type * node, __attribute__((unused)) long unused ) {}
     136
    120137//---------------------------------------------------------
    121138// Mutate
     
    200217        pass.indexer.func( arg );                                                                                                \
    201218}                                                                                                                              \
    202                                                                                                                                \
    203 template<typename pass_type>                                                                                                   \
    204 static inline void indexer_impl_##func ( pass_type &, long, type ) { }                                                          \
     219template<typename pass_type>                                                                                                   \
     220static inline void indexer_impl_##func ( pass_type &, long, type ) { }
    205221
    206222#define INDEXER_FUNC2( func, type1, type2 )                                                                                             \
     
    209225        pass.indexer.func( arg1, arg2 );                                                                                                \
    210226}                                                                                                                              \
    211                                                                                                                                \
    212227template<typename pass_type>                                                                                                   \
    213228static inline void indexer_impl_##func ( pass_type &, long, type1, type2 ) { }
     
    233248
    234249template<typename pass_type>
    235 static inline auto indexer_impl_addStructFwd( pass_type &, long, StructDecl * ) {}
     250static inline auto indexer_impl_addStructFwd( pass_type &, long, const StructDecl * ) {}
    236251
    237252template<typename pass_type>
     
    243258
    244259template<typename pass_type>
    245 static inline auto indexer_impl_addUnionFwd( pass_type &, long, UnionDecl * ) {}
     260static inline auto indexer_impl_addUnionFwd( pass_type &, long, const UnionDecl * ) {}
    246261
    247262template<typename pass_type>
Note: See TracChangeset for help on using the changeset viewer.