source: src/Common/PassVisitor.impl.h @ b11d8e2

ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsdeferred_resndemanglerenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumresolv-newwith_gc
Last change on this file since b11d8e2 was b11d8e2, checked in by Rob Schluntz <rschlunt@…>, 7 years ago

Add PassVisitor? support for Designation

  • Property mode set to 100644
File size: 58.8 KB
RevLine 
[13932f14]1#pragma once
[3268a58]2// IWYU pragma: private, include "PassVisitor.h"
[13932f14]3
[6e09f211]4#define VISIT_START( node )                     \
5        __attribute__((unused))                   \
[62423350]6        guard_value_impl guard( at_cleanup_impl(pass, 0) );       \
[b73bd70]7        bool visit_children = true;               \
8        set_visit_children( visit_children );   \
[6e09f211]9        call_previsit( node );                    \
[b73bd70]10        if( visit_children ) {                    \
[6e09f211]11
12#define VISIT_END( node )                       \
13        }                                         \
14        call_postvisit( node );                   \
[9c1600c]15
[6e09f211]16#define MUTATE_START( node )                    \
17        __attribute__((unused))                   \
[62423350]18        guard_value_impl guard( at_cleanup_impl(pass, 0) );       \
[b73bd70]19        bool visit_children = true;               \
20        set_visit_children( visit_children );   \
[6e09f211]21        call_premutate( node );                   \
[b73bd70]22        if( visit_children ) {                    \
[296b2be]23
24#define MUTATE_END( type, node )                \
[7b13aeb]25        }                                         \
[296b2be]26        return call_postmutate< type * >( node ); \
27
28
[6e09f211]29#define VISIT_BODY( node )        \
30        VISIT_START( node );        \
31        Visitor::visit( node );     \
32        VISIT_END( node );          \
[13932f14]33
[ab904dc]34
[296b2be]35#define MUTATE_BODY( type, node ) \
36        MUTATE_START( node );       \
37        Mutator::mutate( node );    \
38        MUTATE_END( type, node );   \
39
[134322e]40
41
42template<typename T>
43static inline bool empty( T * ptr ) {
44        return !ptr || ptr->empty();
45}
46
[6ca154b]47typedef std::list< Statement   * > StmtList_t;
48typedef std::list< Declaration * > DeclList_t;
49
50template<typename iterator_t>
51static inline void splice( iterator_t it, DeclList_t * decls ) {
52        std::transform(
53                decls->begin(),
54                decls->end(),
55                it,
56                [](Declaration * decl) -> auto {
57                        return new DeclStmt( noLabels, decl );
58                }
59        );
60        decls->clear();
61}
[134322e]62
63template< typename pass_type >
[6ca154b]64static inline void acceptAll( std::list< Declaration* > &decls, PassVisitor< pass_type >& visitor ) {
[134322e]65
[6ca154b]66        DeclList_t* beforeDecls = visitor.get_beforeDecls();
67        DeclList_t* afterDecls  = visitor.get_afterDecls();
[522363e]68        SemanticError errors;
[134322e]69
[6ca154b]70        for ( std::list< Declaration* >::iterator i = decls.begin(); ; ++i ) {
71                // splice in new declarations after previous decl
[d24d4e1]72                if ( !empty( afterDecls ) ) { decls.splice( i, *afterDecls ); }
[6ca154b]73
74                if ( i == decls.end() ) break;
75
[522363e]76                try {
77                        // run visitor on declaration
78                        maybeAccept( *i, visitor );
79                } catch( SemanticError &e ) {
80                        e.set_location( (*i)->location );
81                        errors.append( e );
82                }
[6ca154b]83
84                // splice in new declarations before current decl
85                if ( !empty( beforeDecls ) ) { decls.splice( i, *beforeDecls ); }
[134322e]86        }
[522363e]87        if ( ! errors.isEmpty() ) {
88                throw errors;
89        }
[6ca154b]90}
[134322e]91
[6ca154b]92template< typename pass_type >
93static inline void mutateAll( std::list< Declaration* > &decls, PassVisitor< pass_type >& mutator ) {
94
95        DeclList_t* beforeDecls = mutator.get_beforeDecls();
96        DeclList_t* afterDecls  = mutator.get_afterDecls();
[522363e]97        SemanticError errors;
[6ca154b]98
99        for ( std::list< Declaration* >::iterator i = decls.begin(); ; ++i ) {
100                // splice in new declarations after previous decl
[d24d4e1]101                if ( !empty( afterDecls ) ) { decls.splice( i, *afterDecls ); }
[6ca154b]102
103                if ( i == decls.end() ) break;
[522363e]104                try {
105                        // run mutator on declaration
106                        *i = maybeMutate( *i, mutator );
107                } catch( SemanticError &e ) {
108                        e.set_location( (*i)->location );
109                        errors.append( e );
110                }
[6ca154b]111
112                // splice in new declarations before current decl
113                if ( !empty( beforeDecls ) ) { decls.splice( i, *beforeDecls ); }
114        }
[522363e]115        if ( ! errors.isEmpty() ) {
116                throw errors;
117        }
[134322e]118}
119
[e0886db]120template< typename Container, typename VisitorType >
121inline void maybeAccept( Container &container, VisitorType &visitor ) {
122        SemanticError errors;
123        for ( typename Container::iterator i = container.begin(); i != container.end(); ++i ) {
124                try {
125                        if ( *i ) {
126                                (*i)->accept( visitor );
127                        }
128                } catch( SemanticError &e ) {
129                        e.set_location( (*i)->location );
130                        errors.append( e );
131                }
132        }
133        if ( ! errors.isEmpty() ) {
134                throw errors;
135        }
136}
137
138template< typename Container, typename MutatorType >
139inline void maybeMutateRef( Container &container, MutatorType &mutator ) {
140        SemanticError errors;
141        for ( typename Container::iterator i = container.begin(); i != container.end(); ++i ) {
142                try {
143                        if ( *i ) {
144///                 *i = (*i)->acceptMutator( mutator );
145                                *i = dynamic_cast< typename Container::value_type >( (*i)->acceptMutator( mutator ) );
146                                assert( *i );
147                        } // if
148                } catch( SemanticError &e ) {
149                        e.set_location( (*i)->location );
150                        errors.append( e );
151                } // try
152        } // for
153        if ( ! errors.isEmpty() ) {
154                throw errors;
155        } // if
156}
157
[296b2be]158template< typename pass_type >
[6ca154b]159template< typename func_t >
160void PassVisitor< pass_type >::handleStatementList( std::list< Statement * > & statements, func_t func ) {
[296b2be]161        SemanticError errors;
162
[2a7b3ca]163        // don't want statements from outer CompoundStmts to be added to this CompoundStmt
164        ValueGuardPtr< StmtList_t > oldBeforeStmts( get_beforeStmts() );
165        ValueGuardPtr< StmtList_t > oldAfterStmts ( get_afterStmts () );
166        ValueGuardPtr< DeclList_t > oldBeforeDecls( get_beforeDecls() );
167        ValueGuardPtr< DeclList_t > oldAfterDecls ( get_afterDecls () );
168
[134322e]169        StmtList_t* beforeStmts = get_beforeStmts();
170        StmtList_t* afterStmts  = get_afterStmts();
[6ca154b]171        DeclList_t* beforeDecls = get_beforeDecls();
172        DeclList_t* afterDecls  = get_afterDecls();
[134322e]173
[296b2be]174        for ( std::list< Statement* >::iterator i = statements.begin(); i != statements.end(); ++i ) {
[6ca154b]175
176                if ( !empty( afterDecls ) ) { splice( std::inserter( statements, i ), afterDecls ); }
[134322e]177                if ( !empty( afterStmts ) ) { statements.splice( i, *afterStmts ); }
[6ca154b]178
[296b2be]179                try {
[6ca154b]180                        func( *i );
181                        assert(( empty( beforeStmts ) && empty( afterStmts ))
182                            || ( empty( beforeDecls ) && empty( afterDecls )) );
183
[296b2be]184                } catch ( SemanticError &e ) {
[aa685db]185                        e.set_location( (*i)->location );
[296b2be]186                        errors.append( e );
[134322e]187                }
[6ca154b]188
189                if ( !empty( beforeDecls ) ) { splice( std::inserter( statements, i ), beforeDecls ); }
[134322e]190                if ( !empty( beforeStmts ) ) { statements.splice( i, *beforeStmts ); }
[296b2be]191        }
[134322e]192
[6ca154b]193        if ( !empty( afterDecls ) ) { splice( std::back_inserter( statements ), afterDecls); }
[134322e]194        if ( !empty( afterStmts ) ) { statements.splice( statements.end(), *afterStmts ); }
195        if ( !errors.isEmpty() ) { throw errors; }
[296b2be]196}
197
198template< typename pass_type >
[6ca154b]199void PassVisitor< pass_type >::visitStatementList( std::list< Statement * > & statements ) {
200        handleStatementList( statements, [this]( Statement * stmt) {
201                stmt->accept( *this );
202        });
203}
[134322e]204
[6ca154b]205template< typename pass_type >
206void PassVisitor< pass_type >::mutateStatementList( std::list< Statement * > & statements ) {
207        handleStatementList( statements, [this]( Statement *& stmt) {
208                stmt = stmt->acceptMutator( *this );
209        });
[134322e]210}
211
[6ca154b]212
[134322e]213template< typename pass_type >
[6ca154b]214template< typename func_t >
215Statement * PassVisitor< pass_type >::handleStatement( Statement * stmt, func_t func ) {
[134322e]216        // don't want statements from outer CompoundStmts to be added to this CompoundStmt
[6ca154b]217        ValueGuardPtr< TypeSubstitution * >  oldEnv        ( get_env_ptr    () );
218        ValueGuardPtr< DeclList_t >          oldBeforeDecls( get_beforeDecls() );
219        ValueGuardPtr< DeclList_t >          oldAfterDecls ( get_afterDecls () );
220        ValueGuardPtr< StmtList_t >          oldBeforeStmts( get_beforeStmts() );
221        ValueGuardPtr< StmtList_t >          oldAfterStmts ( get_afterStmts () );
[296b2be]222
[6ca154b]223        Statement *newStmt = func( stmt );
[134322e]224
225        StmtList_t* beforeStmts = get_beforeStmts();
226        StmtList_t* afterStmts  = get_afterStmts();
[6ca154b]227        DeclList_t* beforeDecls = get_beforeDecls();
228        DeclList_t* afterDecls  = get_afterDecls();
[134322e]229
[6ca154b]230        if( empty(beforeStmts) && empty(afterStmts) && empty(beforeDecls) && empty(afterDecls) ) { return newStmt; }
231        assert(( empty( beforeStmts ) && empty( afterStmts ))
232            || ( empty( beforeDecls ) && empty( afterDecls )) );
[134322e]233
234        CompoundStmt *compound = new CompoundStmt( noLabels );
[6ca154b]235        if( !empty(beforeDecls) ) { splice( std::back_inserter( compound->get_kids() ), beforeDecls ); }
[134322e]236        if( !empty(beforeStmts) ) { compound->get_kids().splice( compound->get_kids().end(), *beforeStmts ); }
237        compound->get_kids().push_back( newStmt );
[6ca154b]238        if( !empty(afterDecls) ) { splice( std::back_inserter( compound->get_kids() ), afterDecls ); }
[134322e]239        if( !empty(afterStmts) ) { compound->get_kids().splice( compound->get_kids().end(), *afterStmts ); }
240        return compound;
241}
242
243template< typename pass_type >
[6ca154b]244Statement * PassVisitor< pass_type >::visitStatement( Statement * stmt ) {
245        return handleStatement( stmt, [this]( Statement * stmt ) {
[d24d4e1]246                maybeAccept( stmt, *this );
[6ca154b]247                return stmt;
248        });
249}
[134322e]250
[6ca154b]251template< typename pass_type >
252Statement * PassVisitor< pass_type >::mutateStatement( Statement * stmt ) {
253        return handleStatement( stmt, [this]( Statement * stmt ) {
254                return maybeMutate( stmt, *this );
255        });
[296b2be]256}
257
258template< typename pass_type >
[6ca154b]259template< typename func_t >
260Expression * PassVisitor< pass_type >::handleExpression( Expression * expr, func_t func ) {
[296b2be]261        if( !expr ) return nullptr;
262
[134322e]263        auto env_ptr = get_env_ptr();
264        if ( env_ptr && expr->get_env() ) {
265                *env_ptr = expr->get_env();
[296b2be]266        }
[6ca154b]267
268        // should env be cloned (or moved) onto the result of the mutate?
269        return func( expr );
270}
271
272template< typename pass_type >
273Expression * PassVisitor< pass_type >::visitExpression( Expression * expr ) {
274        return handleExpression(expr, [this]( Expression * expr ) {
275                expr->accept( *this );
276                return expr;
[d24d4e1]277        });
[296b2be]278}
[ab904dc]279
[6ca154b]280template< typename pass_type >
281Expression * PassVisitor< pass_type >::mutateExpression( Expression * expr ) {
282        return handleExpression(expr, [this]( Expression * expr ) {
283                return expr->acceptMutator( *this );
284        });
285}
[ab904dc]286
[296b2be]287//------------------------------------------------------------------------------------------------------------------------------------------------------------------------
[e0886db]288//========================================================================================================================================================================
289//========================================================================================================================================================================
290//========================================================================================================================================================================
291//========================================================================================================================================================================
292//========================================================================================================================================================================
293//------------------------------------------------------------------------------------------------------------------------------------------------------------------------
[13932f14]294
[33a25f9]295// A NOTE ON THE ORDER OF TRAVERSAL
296//
297// Types and typedefs have their base types visited before they are added to the type table.  This is ok, since there is
298// no such thing as a recursive type or typedef.
299//
300//             typedef struct { T *x; } T; // never allowed
301//
302// for structs/unions, it is possible to have recursion, so the decl should be added as if it's incomplete to begin, the
303// members are traversed, and then the complete type should be added (assuming the type is completed by this particular
304// declaration).
305//
306//             struct T { struct T *x; }; // allowed
307//
308// It is important to add the complete type to the symbol table *after* the members/base has been traversed, since that
309// traversal may modify the definition of the type and these modifications should be visible when the symbol table is
310// queried later in this pass.
311//
312// TODO: figure out whether recursive contexts are sensible/possible/reasonable.
[e0886db]313
314//--------------------------------------------------------------------------
315// ObjectDecl
[13932f14]316template< typename pass_type >
[ab904dc]317void PassVisitor< pass_type >::visit( ObjectDecl * node ) {
[e0886db]318        VISIT_START( node );
319
320        indexerScopedAccept( node->type         , *this );
321        maybeAccept        ( node->init         , *this );
322        maybeAccept        ( node->bitfieldWidth, *this );
323
324        if ( node->name != "" ) {
325                indexerAddId( node );
326        }
327
328        VISIT_END( node );
329}
330
331template< typename pass_type >
332DeclarationWithType * PassVisitor< pass_type >::mutate( ObjectDecl * node ) {
333        MUTATE_START( node );
334
335        indexerScopedMutate( node->type         , *this );
336        maybeMutateRef     ( node->init         , *this );
337        maybeMutateRef     ( node->bitfieldWidth, *this );
338
339        if ( node->name != "" ) {
340                indexerAddId( node );
341        }
342
343        MUTATE_END( DeclarationWithType, node );
[13932f14]344}
345
[e0886db]346//--------------------------------------------------------------------------
347// FunctionDecl
[13932f14]348template< typename pass_type >
[ab904dc]349void PassVisitor< pass_type >::visit( FunctionDecl * node ) {
[e0886db]350        VISIT_START( node );
351
352        if ( node->name != "" ) {
353                indexerAddId( node );
354        }
355
356        {
357                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
358                maybeAccept( node->type, *this );
359                maybeAccept( node->statements, *this );
360        }
361
362        VISIT_END( node );
363}
364
365template< typename pass_type >
366DeclarationWithType * PassVisitor< pass_type >::mutate( FunctionDecl * node ) {
367        MUTATE_START( node );
368
369        if ( node->name != "" ) {
370                indexerAddId( node );
371        }
372
373        {
374                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
375                maybeMutateRef( node->type, *this );
376                maybeMutateRef( node->statements, *this );
377        }
378
379        MUTATE_END( DeclarationWithType, node );
[13932f14]380}
381
[e0886db]382//--------------------------------------------------------------------------
383// StructDecl
[13932f14]384template< typename pass_type >
[ab904dc]385void PassVisitor< pass_type >::visit( StructDecl * node ) {
[e0886db]386        VISIT_START( node );
387
388        // make up a forward declaration and add it before processing the members
389        // needs to be on the heap because addStruct saves the pointer
390        indexerAddStructFwd( node );
391
392        {
393                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
394                maybeAccept( node->parameters, *this );
395                maybeAccept( node->members   , *this );
396        }
397
398        // this addition replaces the forward declaration
399        indexerAddStruct( node );
400
401        VISIT_END( node );
402}
403
404template< typename pass_type >
405Declaration * PassVisitor< pass_type >::mutate( StructDecl * node ) {
406        MUTATE_START( node );
407
408        // make up a forward declaration and add it before processing the members
409        // needs to be on the heap because addStruct saves the pointer
410        indexerAddStructFwd( node );
411
412        {
413                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
414                maybeMutateRef( node->parameters, *this );
415                maybeMutateRef( node->members   , *this );
416        }
417
418        // this addition replaces the forward declaration
419        indexerAddStruct( node );
420
421        MUTATE_END( Declaration, node );
[13932f14]422}
423
[e0886db]424//--------------------------------------------------------------------------
425// UnionDecl
[13932f14]426template< typename pass_type >
[ab904dc]427void PassVisitor< pass_type >::visit( UnionDecl * node ) {
[e0886db]428        VISIT_START( node );
429
430        // make up a forward declaration and add it before processing the members
431        indexerAddUnionFwd( node );
432
433        {
434                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
435                maybeAccept( node->parameters, *this );
436                maybeAccept( node->members   , *this );
437        }
438
439        indexerAddUnion( node );
440
441        VISIT_END( node );
442}
443
444template< typename pass_type >
445Declaration * PassVisitor< pass_type >::mutate( UnionDecl * node ) {
446        MUTATE_START( node );
447
448        // make up a forward declaration and add it before processing the members
449        indexerAddUnionFwd( node );
450
451        {
452                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
453                maybeMutateRef( node->parameters, *this );
454                maybeMutateRef( node->members   , *this );
455        }
456
457        indexerAddUnion( node );
458
459        MUTATE_END( Declaration, node );
[13932f14]460}
461
[e0886db]462//--------------------------------------------------------------------------
463// EnumDecl
[13932f14]464template< typename pass_type >
[ab904dc]465void PassVisitor< pass_type >::visit( EnumDecl * node ) {
[e0886db]466        VISIT_START( node );
467
468        indexerAddEnum( node );
469
[33a25f9]470        // unlike structs, traits, and unions, enums inject their members into the global scope
[e0886db]471        maybeAccept( node->parameters, *this );
472        maybeAccept( node->members   , *this );
473
474        VISIT_END( node );
[13932f14]475}
476
[e0886db]477template< typename pass_type >
478Declaration * PassVisitor< pass_type >::mutate( EnumDecl * node ) {
479        MUTATE_START( node );
480
481        indexerAddEnum( node );
482
[522363e]483        // unlike structs, traits, and unions, enums inject their members into the global scope
[e0886db]484        maybeMutateRef( node->parameters, *this );
485        maybeMutateRef( node->members   , *this );
486
487        MUTATE_END( Declaration, node );
488}
489
490//--------------------------------------------------------------------------
491// TraitDecl
[13932f14]492template< typename pass_type >
[ab904dc]493void PassVisitor< pass_type >::visit( TraitDecl * node ) {
[e0886db]494        VISIT_START( node );
495
496        {
497                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
498                maybeAccept( node->parameters, *this );
499                maybeAccept( node->members   , *this );
500        }
501
502        indexerAddTrait( node );
503
504        VISIT_END( node );
[13932f14]505}
506
[e0886db]507template< typename pass_type >
508Declaration * PassVisitor< pass_type >::mutate( TraitDecl * node ) {
509        MUTATE_START( node );
510
511        {
512                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
513                maybeMutateRef( node->parameters, *this );
514                maybeMutateRef( node->members   , *this );
515        }
516
517        indexerAddTrait( node );
518
519        MUTATE_END( Declaration, node );
520}
521
522//--------------------------------------------------------------------------
523// TypeDecl
[13932f14]524template< typename pass_type >
[ab904dc]525void PassVisitor< pass_type >::visit( TypeDecl * node ) {
[e0886db]526        VISIT_START( node );
527
528        {
529                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
530                maybeAccept( node->parameters, *this );
531                maybeAccept( node->base      , *this );
532        }
533
[33a25f9]534        // see A NOTE ON THE ORDER OF TRAVERSAL, above
535        // note that assertions come after the type is added to the symtab, since they are not part of the type proper
536        // and may depend on the type itself
[e0886db]537        indexerAddType( node );
538
539        maybeAccept( node->assertions, *this );
540
541        indexerScopedAccept( node->init, *this );
542
543        VISIT_END( node );
544}
545
546template< typename pass_type >
[982832e]547Declaration * PassVisitor< pass_type >::mutate( TypeDecl * node ) {
[e0886db]548        MUTATE_START( node );
549
550        {
551                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
552                maybeMutateRef( node->parameters, *this );
553                maybeMutateRef( node->base      , *this );
554        }
555
[33a25f9]556        // see A NOTE ON THE ORDER OF TRAVERSAL, above
557        // note that assertions come after the type is added to the symtab, since they are not part of the type proper
558        // and may depend on the type itself
[e0886db]559        indexerAddType( node );
560
561        maybeMutateRef( node->assertions, *this );
562
563        indexerScopedMutate( node->init, *this );
564
[982832e]565        MUTATE_END( Declaration, node );
[13932f14]566}
567
[e0886db]568//--------------------------------------------------------------------------
569// TypedefDecl
[13932f14]570template< typename pass_type >
[ab904dc]571void PassVisitor< pass_type >::visit( TypedefDecl * node ) {
[e0886db]572        VISIT_START( node );
573
574        {
575                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
576                maybeAccept( node->parameters, *this );
577                maybeAccept( node->base      , *this );
578        }
579
580        indexerAddType( node );
581
582        maybeAccept( node->assertions, *this );
583
584        VISIT_END( node );
[13932f14]585}
586
587template< typename pass_type >
[e0886db]588Declaration * PassVisitor< pass_type >::mutate( TypedefDecl * node ) {
589        MUTATE_START( node );
590
591        {
592                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
593                maybeMutateRef     ( node->parameters, *this );
594                maybeMutateRef( node->base      , *this );
595        }
596
597        indexerAddType( node );
598
599        maybeMutateRef( node->assertions, *this );
600
601        MUTATE_END( Declaration, node );
[13932f14]602}
603
[9c1600c]604//--------------------------------------------------------------------------
[e0886db]605// AsmDecl
[13932f14]606template< typename pass_type >
[e0886db]607void PassVisitor< pass_type >::visit( AsmDecl * node ) {
[9c1600c]608        VISIT_START( node );
609
[e0886db]610        maybeAccept( node->stmt, *this );
[9c1600c]611
612        VISIT_END( node );
[13932f14]613}
614
[296b2be]615template< typename pass_type >
[e0886db]616AsmDecl * PassVisitor< pass_type >::mutate( AsmDecl * node ) {
[296b2be]617        MUTATE_START( node );
618
[e0886db]619        maybeMutateRef( node->stmt, *this );
620
621        MUTATE_END( AsmDecl, node );
622}
623
624//--------------------------------------------------------------------------
625// CompoundStmt
626template< typename pass_type >
627void PassVisitor< pass_type >::visit( CompoundStmt * node ) {
628        VISIT_START( node );
629        {
630                auto guard1 = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
631                auto guard2 = makeFuncGuard( [this]() { call_beginScope();   }, [this]() { call_endScope();     } );
632                visitStatementList( node->kids );
633        }
634        VISIT_END( node );
635}
[296b2be]636
[e0886db]637template< typename pass_type >
638CompoundStmt * PassVisitor< pass_type >::mutate( CompoundStmt * node ) {
639        MUTATE_START( node );
640        {
641                auto guard1 = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
642                auto guard2 = makeFuncGuard( [this]() { call_beginScope();   }, [this]() { call_endScope();     } );
643                mutateStatementList( node->kids );
644        }
[296b2be]645        MUTATE_END( CompoundStmt, node );
646}
647
[9c1600c]648//--------------------------------------------------------------------------
649// ExprStmt
[13932f14]650template< typename pass_type >
[ab904dc]651void PassVisitor< pass_type >::visit( ExprStmt * node ) {
[9c1600c]652        VISIT_START( node );
653
[e0886db]654        visitExpression( node->expr );
[9c1600c]655
656        VISIT_END( node );
[13932f14]657}
658
[296b2be]659template< typename pass_type >
660Statement * PassVisitor< pass_type >::mutate( ExprStmt * node ) {
661        MUTATE_START( node );
662
[e0886db]663        node->expr = mutateExpression( node->expr );
[296b2be]664
665        MUTATE_END( Statement, node );
666}
667
[6ca154b]668//--------------------------------------------------------------------------
669// AsmStmt
[13932f14]670template< typename pass_type >
[ab904dc]671void PassVisitor< pass_type >::visit( AsmStmt * node ) {
[4551a6e]672        VISIT_BODY( node );
[13932f14]673}
674
[6ca154b]675template< typename pass_type >
676Statement * PassVisitor< pass_type >::mutate( AsmStmt * node ) {
677        MUTATE_BODY( Statement, node );
678}
679
[9c1600c]680//--------------------------------------------------------------------------
681// IfStmt
[13932f14]682template< typename pass_type >
[ab904dc]683void PassVisitor< pass_type >::visit( IfStmt * node ) {
[4551a6e]684        VISIT_START( node );
[33a25f9]685        {
686                // if statements introduce a level of scope (for the initialization)
687                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
688                acceptAll( node->get_initialization(), *this );
689                visitExpression( node->condition );
690                node->thenPart = visitStatement( node->thenPart );
691                node->elsePart = visitStatement( node->elsePart );
692        }
[9c1600c]693        VISIT_END( node );
[13932f14]694}
695
[296b2be]696template< typename pass_type >
697Statement * PassVisitor< pass_type >::mutate( IfStmt * node ) {
[4551a6e]698        MUTATE_START( node );
[e0886db]699        {
[33a25f9]700                // if statements introduce a level of scope (for the initialization)
[e0886db]701                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
[33a25f9]702                maybeMutateRef( node->get_initialization(), *this );
[e0886db]703                node->condition = mutateExpression( node->condition );
704                node->thenPart  = mutateStatement ( node->thenPart  );
705                node->elsePart  = mutateStatement ( node->elsePart  );
706        }
[296b2be]707        MUTATE_END( Statement, node );
708}
709
[9c1600c]710//--------------------------------------------------------------------------
711// WhileStmt
[13932f14]712template< typename pass_type >
[ab904dc]713void PassVisitor< pass_type >::visit( WhileStmt * node ) {
[4551a6e]714        VISIT_START( node );
[9c1600c]715
[e0886db]716        visitExpression( node->condition );
717        node->body = visitStatement( node->body );
[9c1600c]718
719        VISIT_END( node );
[13932f14]720}
721
[296b2be]722template< typename pass_type >
723Statement * PassVisitor< pass_type >::mutate( WhileStmt * node ) {
[4551a6e]724        MUTATE_START( node );
[296b2be]725
[e0886db]726        node->condition = mutateExpression( node->condition );
727        node->body      = mutateStatement ( node->body      );
[296b2be]728
729        MUTATE_END( Statement, node );
730}
731
[9c1600c]732//--------------------------------------------------------------------------
[6ca154b]733// ForStmt
[13932f14]734template< typename pass_type >
[ab904dc]735void PassVisitor< pass_type >::visit( ForStmt * node ) {
[4551a6e]736        VISIT_START( node );
[e0886db]737        {
[33a25f9]738                // for statements introduce a level of scope (for the initialization)
[e0886db]739                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
740                maybeAccept( node->initialization, *this );
741                visitExpression( node->condition );
742                visitExpression( node->increment );
743                node->body = visitStatement( node->body );
744        }
[9c1600c]745        VISIT_END( node );
[13932f14]746}
747
[296b2be]748template< typename pass_type >
749Statement * PassVisitor< pass_type >::mutate( ForStmt * node ) {
[4551a6e]750        MUTATE_START( node );
[e0886db]751        {
[33a25f9]752                // for statements introduce a level of scope (for the initialization)
[e0886db]753                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
754                maybeMutateRef( node->initialization, *this );
755                node->condition = mutateExpression( node->condition );
756                node->increment = mutateExpression( node->increment );
757                node->body      = mutateStatement ( node->body      );
758        }
[296b2be]759        MUTATE_END( Statement, node );
760}
761
[9c1600c]762//--------------------------------------------------------------------------
763// SwitchStmt
[13932f14]764template< typename pass_type >
[ab904dc]765void PassVisitor< pass_type >::visit( SwitchStmt * node ) {
[4551a6e]766        VISIT_START( node );
[9c1600c]767
[e0886db]768        visitExpression   ( node->condition  );
769        visitStatementList( node->statements );
[9c1600c]770
771        VISIT_END( node );
[13932f14]772}
773
[296b2be]774template< typename pass_type >
775Statement * PassVisitor< pass_type >::mutate( SwitchStmt * node ) {
[4551a6e]776        MUTATE_START( node );
777
[e0886db]778        node->condition = mutateExpression( node->condition );
779        mutateStatementList( node->statements );
[4551a6e]780
[296b2be]781        MUTATE_END( Statement, node );
782}
783
[9c1600c]784//--------------------------------------------------------------------------
[35df560]785// CaseStmt
[13932f14]786template< typename pass_type >
[ab904dc]787void PassVisitor< pass_type >::visit( CaseStmt * node ) {
[4551a6e]788        VISIT_START( node );
789
[e0886db]790        visitExpression   ( node->condition );
791        visitStatementList( node->stmts     );
[4551a6e]792
[9c1600c]793        VISIT_END( node );
[13932f14]794}
795
[296b2be]796template< typename pass_type >
797Statement * PassVisitor< pass_type >::mutate( CaseStmt * node ) {
[4551a6e]798        MUTATE_START( node );
799
[e0886db]800        node->condition = mutateExpression( node->condition );
801        mutateStatementList( node->stmts );
[4551a6e]802
[296b2be]803        MUTATE_END( Statement, node );
804}
805
[6ca154b]806//--------------------------------------------------------------------------
807// BranchStmt
[13932f14]808template< typename pass_type >
[ab904dc]809void PassVisitor< pass_type >::visit( BranchStmt * node ) {
[4551a6e]810        VISIT_BODY( node );
[13932f14]811}
812
[6ca154b]813template< typename pass_type >
814Statement * PassVisitor< pass_type >::mutate( BranchStmt * node ) {
815        MUTATE_BODY( Statement, node );
816}
817
[9c1600c]818//--------------------------------------------------------------------------
819// ReturnStmt
[13932f14]820template< typename pass_type >
[ab904dc]821void PassVisitor< pass_type >::visit( ReturnStmt * node ) {
[9c1600c]822        VISIT_START( node );
823
[e0886db]824        visitExpression( node->expr );
[9c1600c]825
826        VISIT_END( node );
[13932f14]827}
828
[296b2be]829template< typename pass_type >
830Statement * PassVisitor< pass_type >::mutate( ReturnStmt * node ) {
831        MUTATE_START( node );
832
[e0886db]833        node->expr = mutateExpression( node->expr );
[296b2be]834
835        MUTATE_END( Statement, node );
836}
837
[6e09f211]838//--------------------------------------------------------------------------
839// ThrowStmt
840
841template< typename pass_type >
842void PassVisitor< pass_type >::visit( ThrowStmt * node ) {
843        VISIT_BODY( node );
844}
845
846template< typename pass_type >
847Statement * PassVisitor< pass_type >::mutate( ThrowStmt * node ) {
848        MUTATE_BODY( Statement, node );
849}
850
[9c1600c]851//--------------------------------------------------------------------------
852// TryStmt
[13932f14]853template< typename pass_type >
[ab904dc]854void PassVisitor< pass_type >::visit( TryStmt * node ) {
[9c1600c]855        VISIT_START( node );
856
[e0886db]857        maybeAccept( node->block       , *this );
[9dcb653]858        maybeAccept( node->handlers    , *this );
[e0886db]859        maybeAccept( node->finallyBlock, *this );
[9c1600c]860
861        VISIT_END( node );
[13932f14]862}
863
[296b2be]864template< typename pass_type >
865Statement * PassVisitor< pass_type >::mutate( TryStmt * node ) {
866        MUTATE_START( node );
867
[e0886db]868        maybeMutateRef( node->block       , *this );
[9dcb653]869        maybeMutateRef( node->handlers    , *this );
[e0886db]870        maybeMutateRef( node->finallyBlock, *this );
[4551a6e]871
[296b2be]872        MUTATE_END( Statement, node );
873}
874
[9c1600c]875//--------------------------------------------------------------------------
876// CatchStmt
[13932f14]877template< typename pass_type >
[ab904dc]878void PassVisitor< pass_type >::visit( CatchStmt * node ) {
[9c1600c]879        VISIT_START( node );
[e0886db]880        {
[33a25f9]881                // catch statements introduce a level of scope (for the caught exception)
[e0886db]882                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
883                maybeAccept( node->decl, *this );
884                node->cond = visitExpression( node->cond );
885                node->body = visitStatement ( node->body );
886        }
[9c1600c]887        VISIT_END( node );
[13932f14]888}
889
[296b2be]890template< typename pass_type >
891Statement * PassVisitor< pass_type >::mutate( CatchStmt * node ) {
892        MUTATE_START( node );
[e0886db]893        {
[33a25f9]894                // catch statements introduce a level of scope (for the caught exception)
[e0886db]895                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
896                maybeMutateRef( node->decl, *this );
897                node->cond = mutateExpression( node->cond );
898                node->body = mutateStatement ( node->body );
899        }
[296b2be]900        MUTATE_END( Statement, node );
901}
902
[2065609]903//--------------------------------------------------------------------------
904// FinallyStmt
[13932f14]905template< typename pass_type >
[ab904dc]906void PassVisitor< pass_type >::visit( FinallyStmt * node ) {
[4551a6e]907        VISIT_BODY( node );
[13932f14]908}
909
[2065609]910template< typename pass_type >
911Statement * PassVisitor< pass_type >::mutate( FinallyStmt * node ) {
912        MUTATE_BODY( Statement, node );
913}
914
915//--------------------------------------------------------------------------
916// WaitForStmt
917template< typename pass_type >
918void PassVisitor< pass_type >::visit( WaitForStmt * node ) {
919        VISIT_BODY( node );
920}
921
922template< typename pass_type >
923Statement * PassVisitor< pass_type >::mutate( WaitForStmt * node ) {
924        MUTATE_BODY( Statement, node );
925}
926
927//--------------------------------------------------------------------------
928// NullStmt
[13932f14]929template< typename pass_type >
[ab904dc]930void PassVisitor< pass_type >::visit( NullStmt * node ) {
[4551a6e]931        VISIT_BODY( node );
[13932f14]932}
933
[2065609]934template< typename pass_type >
935NullStmt * PassVisitor< pass_type >::mutate( NullStmt * node ) {
936        MUTATE_BODY( NullStmt, node );
937}
938
939//--------------------------------------------------------------------------
940// DeclStmt
[13932f14]941template< typename pass_type >
[ab904dc]942void PassVisitor< pass_type >::visit( DeclStmt * node ) {
[4551a6e]943        VISIT_BODY( node );
[13932f14]944}
945
[2065609]946template< typename pass_type >
947Statement * PassVisitor< pass_type >::mutate( DeclStmt * node ) {
948        MUTATE_BODY( Statement, node );
949}
950
951//--------------------------------------------------------------------------
952// ImplicitCtorDtorStmt
[13932f14]953template< typename pass_type >
[ab904dc]954void PassVisitor< pass_type >::visit( ImplicitCtorDtorStmt * node ) {
[4551a6e]955        VISIT_BODY( node );
[13932f14]956}
957
[2065609]958template< typename pass_type >
959Statement * PassVisitor< pass_type >::mutate( ImplicitCtorDtorStmt * node ) {
960        MUTATE_BODY( Statement, node );
961}
962
963//--------------------------------------------------------------------------
964// ApplicationExpr
[13932f14]965template< typename pass_type >
[ab904dc]966void PassVisitor< pass_type >::visit( ApplicationExpr * node ) {
[e0886db]967        VISIT_START( node );
968
969        indexerScopedAccept( node->result  , *this );
970        maybeAccept        ( node->function, *this );
[9dcb653]971        maybeAccept        ( node->args    , *this );
[e0886db]972
973        VISIT_END( node );
[13932f14]974}
975
[2065609]976template< typename pass_type >
977Expression * PassVisitor< pass_type >::mutate( ApplicationExpr * node ) {
[e0886db]978        MUTATE_START( node );
979
980        indexerScopedMutate( node->env     , *this );
981        indexerScopedMutate( node->result  , *this );
982        maybeMutateRef     ( node->function, *this );
[9dcb653]983        maybeMutateRef     ( node->args    , *this );
[e0886db]984
985        MUTATE_END( Expression, node );
[2065609]986}
987
[9c1600c]988//--------------------------------------------------------------------------
989// UntypedExpr
[13932f14]990template< typename pass_type >
[ab904dc]991void PassVisitor< pass_type >::visit( UntypedExpr * node ) {
[9c1600c]992        VISIT_START( node );
993
[2a7b3ca]994        // maybeAccept( node->get_env(), *this );
[e0886db]995        indexerScopedAccept( node->result, *this );
[2a7b3ca]996
[e0886db]997        for ( auto expr : node->args ) {
[9c1600c]998                visitExpression( expr );
999        }
1000
1001        VISIT_END( node );
[13932f14]1002}
1003
[296b2be]1004template< typename pass_type >
1005Expression * PassVisitor< pass_type >::mutate( UntypedExpr * node ) {
1006        MUTATE_START( node );
1007
[e0886db]1008        indexerScopedMutate( node->env   , *this );
1009        indexerScopedMutate( node->result, *this );
[2a7b3ca]1010
[e0886db]1011        for ( auto& expr : node->args ) {
[296b2be]1012                expr = mutateExpression( expr );
1013        }
1014
1015        MUTATE_END( Expression, node );
1016}
1017
[e0886db]1018//--------------------------------------------------------------------------
1019// NameExpr
[13932f14]1020template< typename pass_type >
[ab904dc]1021void PassVisitor< pass_type >::visit( NameExpr * node ) {
[e0886db]1022        VISIT_START( node );
1023
1024        indexerScopedAccept( node->result, *this );
1025
1026        VISIT_END( node );
[13932f14]1027}
1028
1029template< typename pass_type >
[e0886db]1030Expression * PassVisitor< pass_type >::mutate( NameExpr * node ) {
1031        MUTATE_START( node );
1032
1033        indexerScopedMutate( node->env   , *this );
1034        indexerScopedMutate( node->result, *this );
1035
1036        MUTATE_END( Expression, node );
[13932f14]1037}
1038
[e0886db]1039//--------------------------------------------------------------------------
1040// CastExpr
[a5f0529]1041template< typename pass_type >
[e0886db]1042void PassVisitor< pass_type >::visit( CastExpr * node ) {
1043        VISIT_START( node );
1044
1045        indexerScopedAccept( node->result, *this );
1046        maybeAccept        ( node->arg   , *this );
1047
1048        VISIT_END( node );
[a5f0529]1049}
1050
[13932f14]1051template< typename pass_type >
[e0886db]1052Expression * PassVisitor< pass_type >::mutate( CastExpr * node ) {
1053        MUTATE_START( node );
1054
1055        indexerScopedMutate( node->env   , *this );
1056        indexerScopedMutate( node->result, *this );
1057        maybeMutateRef     ( node->arg   , *this );
1058
1059        MUTATE_END( Expression, node );
[13932f14]1060}
1061
[e0886db]1062//--------------------------------------------------------------------------
1063// VirtualCastExpr
[13932f14]1064template< typename pass_type >
[e0886db]1065void PassVisitor< pass_type >::visit( VirtualCastExpr * node ) {
1066        VISIT_START( node );
1067
1068        indexerScopedAccept( node->result, *this );
1069        maybeAccept( node->arg, *this );
1070
1071        VISIT_END( node );
[13932f14]1072}
1073
1074template< typename pass_type >
[e0886db]1075Expression * PassVisitor< pass_type >::mutate( VirtualCastExpr * node ) {
1076        MUTATE_START( node );
1077
1078        indexerScopedMutate( node->env   , *this );
1079        indexerScopedMutate( node->result, *this );
1080        maybeMutateRef     ( node->arg   , *this );
1081
1082        MUTATE_END( Expression, node );
[13932f14]1083}
1084
[e0886db]1085//--------------------------------------------------------------------------
1086// AddressExpr
[13932f14]1087template< typename pass_type >
[e0886db]1088void PassVisitor< pass_type >::visit( AddressExpr * node ) {
1089        VISIT_START( node );
1090
1091        indexerScopedAccept( node->result, *this );
1092        maybeAccept        ( node->arg   , *this );
1093
1094        VISIT_END( node );
[13932f14]1095}
1096
1097template< typename pass_type >
[e0886db]1098Expression * PassVisitor< pass_type >::mutate( AddressExpr * node ) {
1099        MUTATE_START( node );
1100
1101        indexerScopedMutate( node->env   , *this );
1102        indexerScopedMutate( node->result, *this );
1103        maybeMutateRef     ( node->arg   , *this );
1104
1105        MUTATE_END( Expression, node );
1106}
1107
1108//--------------------------------------------------------------------------
1109// LabelAddressExpr
1110template< typename pass_type >
1111void PassVisitor< pass_type >::visit( LabelAddressExpr * node ) {
1112        VISIT_START( node );
1113
1114        indexerScopedAccept( node->result, *this );
1115
1116        VISIT_END( node );
1117}
1118
1119template< typename pass_type >
1120Expression * PassVisitor< pass_type >::mutate( LabelAddressExpr * node ) {
1121        MUTATE_START( node );
1122
1123        indexerScopedMutate( node->env   , *this );
1124        indexerScopedMutate( node->result, *this );
1125
1126        MUTATE_END( Expression, node );
1127}
1128
1129//--------------------------------------------------------------------------
1130// UntypedMemberExpr
1131template< typename pass_type >
1132void PassVisitor< pass_type >::visit( UntypedMemberExpr * node ) {
1133        VISIT_START( node );
1134
1135        indexerScopedAccept( node->result   , *this );
1136        maybeAccept        ( node->aggregate, *this );
1137        maybeAccept        ( node->member   , *this );
1138
1139        VISIT_END( node );
[13932f14]1140}
1141
[e0886db]1142template< typename pass_type >
1143Expression * PassVisitor< pass_type >::mutate( UntypedMemberExpr * node ) {
1144        MUTATE_START( node );
1145
1146        indexerScopedMutate( node->env      , *this );
1147        indexerScopedMutate( node->result   , *this );
1148        maybeMutateRef     ( node->aggregate, *this );
1149        maybeMutateRef     ( node->member   , *this );
1150
1151        MUTATE_END( Expression, node );
1152}
1153
1154//--------------------------------------------------------------------------
1155// MemberExpr
1156template< typename pass_type >
1157void PassVisitor< pass_type >::visit( MemberExpr * node ) {
1158        VISIT_START( node );
1159
1160        indexerScopedAccept( node->result   , *this );
1161        maybeAccept        ( node->aggregate, *this );
1162
1163        VISIT_END( node );
1164}
1165
1166template< typename pass_type >
1167Expression * PassVisitor< pass_type >::mutate( MemberExpr * node ) {
1168        MUTATE_START( node );
1169
1170        indexerScopedMutate( node->env      , *this );
1171        indexerScopedMutate( node->result   , *this );
1172        maybeMutateRef     ( node->aggregate, *this );
1173
1174        MUTATE_END( Expression, node );
1175}
1176
1177//--------------------------------------------------------------------------
1178// VariableExpr
1179template< typename pass_type >
1180void PassVisitor< pass_type >::visit( VariableExpr * node ) {
1181        VISIT_START( node );
1182
1183        indexerScopedAccept( node->result, *this );
1184
1185        VISIT_END( node );
1186}
1187
1188template< typename pass_type >
1189Expression * PassVisitor< pass_type >::mutate( VariableExpr * node ) {
1190        MUTATE_START( node );
1191
1192        indexerScopedMutate( node->env   , *this );
1193        indexerScopedMutate( node->result, *this );
1194
1195        MUTATE_END( Expression, node );
1196}
1197
1198//--------------------------------------------------------------------------
1199// ConstantExpr
[13932f14]1200template< typename pass_type >
[ab904dc]1201void PassVisitor< pass_type >::visit( ConstantExpr * node ) {
[e0886db]1202        VISIT_START( node );
1203
1204        indexerScopedAccept( node->result   , *this );
1205        maybeAccept        ( &node->constant, *this );
1206
1207        VISIT_END( node );
[13932f14]1208}
1209
[e0886db]1210template< typename pass_type >
1211Expression * PassVisitor< pass_type >::mutate( ConstantExpr * node ) {
1212        MUTATE_START( node );
1213
1214        indexerScopedMutate( node->env   , *this );
1215        indexerScopedMutate( node->result, *this );
1216        node->constant = *maybeMutate( &node->constant, *this );
1217
1218        MUTATE_END( Expression, node );
1219}
1220
1221//--------------------------------------------------------------------------
1222// SizeofExpr
[13932f14]1223template< typename pass_type >
[ab904dc]1224void PassVisitor< pass_type >::visit( SizeofExpr * node ) {
[e0886db]1225        VISIT_START( node );
1226
1227        indexerScopedAccept( node->result, *this );
1228        if ( node->get_isType() ) {
1229                maybeAccept( node->type, *this );
1230        } else {
1231                maybeAccept( node->expr, *this );
1232        }
1233
1234        VISIT_END( node );
[13932f14]1235}
1236
[e0886db]1237template< typename pass_type >
1238Expression * PassVisitor< pass_type >::mutate( SizeofExpr * node ) {
1239        MUTATE_START( node );
1240
1241        indexerScopedMutate( node->env   , *this );
1242        indexerScopedMutate( node->result, *this );
1243        if ( node->get_isType() ) {
1244                maybeMutateRef( node->type, *this );
1245        } else {
1246                maybeMutateRef( node->expr, *this );
1247        }
1248
1249        MUTATE_END( Expression, node );
1250}
1251
1252//--------------------------------------------------------------------------
1253// AlignofExpr
[13932f14]1254template< typename pass_type >
[ab904dc]1255void PassVisitor< pass_type >::visit( AlignofExpr * node ) {
[e0886db]1256        VISIT_START( node );
1257
1258        indexerScopedAccept( node->result, *this );
1259        if ( node->get_isType() ) {
1260                maybeAccept( node->type, *this );
1261        } else {
1262                maybeAccept( node->expr, *this );
1263        }
1264
1265        VISIT_END( node );
[13932f14]1266}
1267
[e0886db]1268template< typename pass_type >
1269Expression * PassVisitor< pass_type >::mutate( AlignofExpr * node ) {
1270        MUTATE_START( node );
1271
1272        indexerScopedMutate( node->env   , *this );
1273        indexerScopedMutate( node->result, *this );
1274        if ( node->get_isType() ) {
1275                maybeMutateRef( node->type, *this );
1276        } else {
1277                maybeMutateRef( node->expr, *this );
1278        }
1279
1280        MUTATE_END( Expression, node );
1281}
1282
1283//--------------------------------------------------------------------------
1284// UntypedOffsetofExpr
[13932f14]1285template< typename pass_type >
[ab904dc]1286void PassVisitor< pass_type >::visit( UntypedOffsetofExpr * node ) {
[e0886db]1287        VISIT_START( node );
1288
1289        indexerScopedAccept( node->result, *this );
1290        maybeAccept        ( node->type  , *this );
1291
1292        VISIT_END( node );
[13932f14]1293}
1294
[e0886db]1295template< typename pass_type >
1296Expression * PassVisitor< pass_type >::mutate( UntypedOffsetofExpr * node ) {
1297        MUTATE_START( node );
1298
1299        indexerScopedMutate( node->env   , *this );
1300        indexerScopedMutate( node->result, *this );
1301        maybeMutateRef     ( node->type  , *this );
1302
1303        MUTATE_END( Expression, node );
1304}
1305
1306//--------------------------------------------------------------------------
1307// OffsetofExpr
[13932f14]1308template< typename pass_type >
[ab904dc]1309void PassVisitor< pass_type >::visit( OffsetofExpr * node ) {
[e0886db]1310        VISIT_START( node );
1311
1312        indexerScopedAccept( node->result, *this );
1313        maybeAccept        ( node->type  , *this );
1314        maybeAccept        ( node->member, *this );
1315
1316        VISIT_END( node );
[13932f14]1317}
1318
[e0886db]1319template< typename pass_type >
1320Expression * PassVisitor< pass_type >::mutate( OffsetofExpr * node ) {
1321        MUTATE_START( node );
1322
1323        indexerScopedMutate( node->env   , *this );
1324        indexerScopedMutate( node->result, *this );
1325        maybeMutateRef     ( node->type  , *this );
1326        maybeMutateRef     ( node->member, *this );
1327
1328        MUTATE_END( Expression, node );
1329}
1330
1331//--------------------------------------------------------------------------
1332// OffsetPackExpr
[13932f14]1333template< typename pass_type >
[ab904dc]1334void PassVisitor< pass_type >::visit( OffsetPackExpr * node ) {
[e0886db]1335        VISIT_START( node );
1336
1337        indexerScopedAccept( node->result, *this );
1338        maybeAccept        ( node->type  , *this );
1339
1340        VISIT_END( node );
[13932f14]1341}
1342
[e0886db]1343template< typename pass_type >
1344Expression * PassVisitor< pass_type >::mutate( OffsetPackExpr * node ) {
1345        MUTATE_START( node );
1346
1347        indexerScopedMutate( node->env   , *this );
1348        indexerScopedMutate( node->result, *this );
1349        maybeMutateRef     ( node->type  , *this );
1350
1351        MUTATE_END( Expression, node );
1352}
1353
1354//--------------------------------------------------------------------------
1355// AttrExpr
[13932f14]1356template< typename pass_type >
[ab904dc]1357void PassVisitor< pass_type >::visit( AttrExpr * node ) {
[e0886db]1358        VISIT_START( node );
1359
1360        indexerScopedAccept( node->result, *this );
1361        if ( node->get_isType() ) {
1362                maybeAccept( node->type, *this );
1363        } else {
1364                maybeAccept( node->expr, *this );
1365        }
1366
1367        VISIT_END( node );
1368}
1369
1370template< typename pass_type >
1371Expression * PassVisitor< pass_type >::mutate( AttrExpr * node ) {
1372        MUTATE_START( node );
1373
1374        indexerScopedMutate( node->env   , *this );
1375        indexerScopedMutate( node->result, *this );
1376        if ( node->get_isType() ) {
1377                maybeMutateRef( node->type, *this );
1378        } else {
1379                maybeMutateRef( node->expr, *this );
1380        }
1381
1382        MUTATE_END( Expression, node );
[13932f14]1383}
1384
[e0886db]1385//--------------------------------------------------------------------------
1386// LogicalExpr
[13932f14]1387template< typename pass_type >
[ab904dc]1388void PassVisitor< pass_type >::visit( LogicalExpr * node ) {
[e0886db]1389        VISIT_START( node );
1390
1391        indexerScopedAccept( node->result, *this );
1392        maybeAccept        ( node->arg1  , *this );
1393        maybeAccept        ( node->arg2  , *this );
1394
1395        VISIT_END( node );
1396}
1397
1398template< typename pass_type >
1399Expression * PassVisitor< pass_type >::mutate( LogicalExpr * node ) {
1400        MUTATE_START( node );
1401
1402        indexerScopedMutate( node->env   , *this );
1403        indexerScopedMutate( node->result, *this );
1404        maybeMutateRef     ( node->arg1  , *this );
1405        maybeMutateRef     ( node->arg2  , *this );
1406
1407        MUTATE_END( Expression, node );
[13932f14]1408}
1409
[e0886db]1410//--------------------------------------------------------------------------
1411// ConditionalExpr
[13932f14]1412template< typename pass_type >
[ab904dc]1413void PassVisitor< pass_type >::visit( ConditionalExpr * node ) {
[e0886db]1414        VISIT_START( node );
1415
1416        indexerScopedAccept( node->result, *this );
1417        maybeAccept        ( node->arg1  , *this );
1418        maybeAccept        ( node->arg2  , *this );
1419        maybeAccept        ( node->arg3  , *this );
1420
1421        VISIT_END( node );
[13932f14]1422}
1423
[e0886db]1424template< typename pass_type >
1425Expression * PassVisitor< pass_type >::mutate( ConditionalExpr * node ) {
1426        MUTATE_START( node );
1427
1428        indexerScopedMutate( node->env   , *this );
1429        indexerScopedMutate( node->result, *this );
1430        maybeMutateRef     ( node->arg1  , *this );
1431        maybeMutateRef     ( node->arg2  , *this );
1432        maybeMutateRef     ( node->arg3  , *this );
1433
1434        MUTATE_END( Expression, node );
1435}
1436
1437//--------------------------------------------------------------------------
1438// CommaExpr
[13932f14]1439template< typename pass_type >
[ab904dc]1440void PassVisitor< pass_type >::visit( CommaExpr * node ) {
[e0886db]1441        VISIT_START( node );
1442
1443        indexerScopedAccept( node->result, *this );
1444        maybeAccept        ( node->arg1  , *this );
1445        maybeAccept        ( node->arg2  , *this );
1446
1447        VISIT_END( node );
1448}
1449
1450template< typename pass_type >
1451Expression * PassVisitor< pass_type >::mutate( CommaExpr * node ) {
1452        MUTATE_START( node );
1453
1454        indexerScopedMutate( node->env   , *this );
1455        indexerScopedMutate( node->result, *this );
1456        maybeMutateRef     ( node->arg1  , *this );
1457        maybeMutateRef     ( node->arg2  , *this );
1458
1459        MUTATE_END( Expression, node );
[13932f14]1460}
1461
[e0886db]1462//--------------------------------------------------------------------------
1463// TypeExpr
[13932f14]1464template< typename pass_type >
[ab904dc]1465void PassVisitor< pass_type >::visit( TypeExpr * node ) {
[e0886db]1466        VISIT_START( node );
1467
1468        indexerScopedAccept( node->result, *this );
1469        maybeAccept        ( node->type, *this );
1470
1471        VISIT_END( node );
[13932f14]1472}
1473
[e0886db]1474template< typename pass_type >
1475Expression * PassVisitor< pass_type >::mutate( TypeExpr * node ) {
1476        MUTATE_START( node );
1477
1478        indexerScopedMutate( node->env   , *this );
1479        indexerScopedMutate( node->result, *this );
1480        maybeMutateRef     ( node->type  , *this );
1481
1482        MUTATE_END( Expression, node );
1483}
1484
1485//--------------------------------------------------------------------------
1486// AsmExpr
[13932f14]1487template< typename pass_type >
[ab904dc]1488void PassVisitor< pass_type >::visit( AsmExpr * node ) {
[e0886db]1489        VISIT_START( node );
1490
1491        indexerScopedAccept( node->result    , *this );
1492        maybeAccept        ( node->inout     , *this );
1493        maybeAccept        ( node->constraint, *this );
1494        maybeAccept        ( node->operand   , *this );
1495
1496        VISIT_END( node );
[13932f14]1497}
1498
[e0886db]1499template< typename pass_type >
1500Expression * PassVisitor< pass_type >::mutate( AsmExpr * node ) {
1501        MUTATE_START( node );
1502
1503        indexerScopedMutate( node->env       , *this );
1504        indexerScopedMutate( node->result    , *this );
1505        maybeMutateRef     ( node->inout     , *this );
1506        maybeMutateRef     ( node->constraint, *this );
1507        maybeMutateRef     ( node->operand   , *this );
1508
1509        MUTATE_END( Expression, node );
1510}
1511
1512//--------------------------------------------------------------------------
1513// ImplicitCopyCtorExpr
[13932f14]1514template< typename pass_type >
[ab904dc]1515void PassVisitor< pass_type >::visit( ImplicitCopyCtorExpr * node ) {
[e0886db]1516        VISIT_START( node );
1517
1518        indexerScopedAccept( node->result     , *this );
1519        maybeAccept        ( node->callExpr   , *this );
[9dcb653]1520        maybeAccept        ( node->tempDecls  , *this );
1521        maybeAccept        ( node->returnDecls, *this );
1522        maybeAccept        ( node->dtors      , *this );
[e0886db]1523
1524        VISIT_END( node );
1525}
1526
1527template< typename pass_type >
1528Expression * PassVisitor< pass_type >::mutate( ImplicitCopyCtorExpr * node ) {
1529        MUTATE_START( node );
1530
1531        indexerScopedMutate( node->env        , *this );
1532        indexerScopedMutate( node->result     , *this );
1533        maybeMutateRef     ( node->callExpr   , *this );
[9dcb653]1534        maybeMutateRef     ( node->tempDecls  , *this );
1535        maybeMutateRef     ( node->returnDecls, *this );
1536        maybeMutateRef     ( node->dtors      , *this );
[e0886db]1537
1538        MUTATE_END( Expression, node );
[13932f14]1539}
1540
[e0886db]1541//--------------------------------------------------------------------------
1542// ConstructorExpr
[13932f14]1543template< typename pass_type >
[ab904dc]1544void PassVisitor< pass_type >::visit( ConstructorExpr * node ) {
[e0886db]1545        VISIT_START( node );
1546
1547        indexerScopedAccept( node->result  , *this );
1548        maybeAccept        ( node->callExpr, *this );
1549
1550        VISIT_END( node );
1551}
1552
1553template< typename pass_type >
1554Expression * PassVisitor< pass_type >::mutate( ConstructorExpr * node ) {
1555        MUTATE_START( node );
1556
1557        indexerScopedMutate( node->env     , *this );
1558        indexerScopedMutate( node->result  , *this );
1559        maybeMutateRef     ( node->callExpr, *this );
1560
1561        MUTATE_END( Expression, node );
[13932f14]1562}
1563
[e0886db]1564//--------------------------------------------------------------------------
1565// CompoundLiteralExpr
[13932f14]1566template< typename pass_type >
[ab904dc]1567void PassVisitor< pass_type >::visit( CompoundLiteralExpr * node ) {
[e0886db]1568        VISIT_START( node );
1569
1570        indexerScopedAccept( node->result     , *this );
1571        maybeAccept        ( node->initializer, *this );
1572
1573        VISIT_END( node );
[13932f14]1574}
1575
[e0886db]1576template< typename pass_type >
1577Expression * PassVisitor< pass_type >::mutate( CompoundLiteralExpr * node ) {
1578        MUTATE_START( node );
1579
1580        indexerScopedMutate( node->env        , *this );
1581        indexerScopedMutate( node->result     , *this );
1582        maybeMutateRef     ( node->initializer, *this );
1583
1584        MUTATE_END( Expression, node );
1585}
1586
1587//--------------------------------------------------------------------------
1588// RangeExpr
[13932f14]1589template< typename pass_type >
[ab904dc]1590void PassVisitor< pass_type >::visit( RangeExpr * node ) {
[e0886db]1591        VISIT_START( node );
1592
1593        indexerScopedAccept( node->result, *this );
1594        maybeAccept        ( node->low   , *this );
1595        maybeAccept        ( node->high  , *this );
1596
1597        VISIT_END( node );
[13932f14]1598}
1599
[e0886db]1600template< typename pass_type >
1601Expression * PassVisitor< pass_type >::mutate( RangeExpr * node ) {
1602        MUTATE_START( node );
1603
1604        indexerScopedMutate( node->env   , *this );
1605        indexerScopedMutate( node->result, *this );
1606        maybeMutateRef     ( node->low   , *this );
1607        maybeMutateRef     ( node->high  , *this );
1608
1609        MUTATE_END( Expression, node );
1610}
1611
1612//--------------------------------------------------------------------------
1613// UntypedTupleExpr
[13932f14]1614template< typename pass_type >
[ab904dc]1615void PassVisitor< pass_type >::visit( UntypedTupleExpr * node ) {
[e0886db]1616        VISIT_START( node );
1617
1618        indexerScopedAccept( node->result, *this );
[9dcb653]1619        maybeAccept        ( node->exprs , *this );
[e0886db]1620
1621        VISIT_END( node );
1622}
1623
1624template< typename pass_type >
1625Expression * PassVisitor< pass_type >::mutate( UntypedTupleExpr * node ) {
1626        MUTATE_START( node );
1627
1628        indexerScopedMutate( node->env   , *this );
1629        indexerScopedMutate( node->result, *this );
[9dcb653]1630        maybeMutateRef     ( node->exprs , *this );
[e0886db]1631
1632        MUTATE_END( Expression, node );
1633}
1634
1635//--------------------------------------------------------------------------
1636// TupleExpr
1637template< typename pass_type >
1638void PassVisitor< pass_type >::visit( TupleExpr * node ) {
1639        VISIT_START( node );
1640
1641        indexerScopedAccept( node->result, *this );
1642        maybeAccept          ( node->exprs , *this );
1643
1644        VISIT_END( node );
1645}
1646
1647template< typename pass_type >
1648Expression * PassVisitor< pass_type >::mutate( TupleExpr * node ) {
1649        MUTATE_START( node );
1650
1651        indexerScopedMutate( node->env   , *this );
1652        indexerScopedMutate( node->result, *this );
[9dcb653]1653        maybeMutateRef     ( node->exprs , *this );
[e0886db]1654
1655        MUTATE_END( Expression, node );
1656}
1657
1658//--------------------------------------------------------------------------
1659// TupleIndexExpr
1660template< typename pass_type >
1661void PassVisitor< pass_type >::visit( TupleIndexExpr * node ) {
1662        VISIT_START( node );
1663
1664        indexerScopedAccept( node->result, *this );
1665        maybeAccept        ( node->tuple , *this );
1666
1667        VISIT_END( node );
1668}
1669
1670template< typename pass_type >
1671Expression * PassVisitor< pass_type >::mutate( TupleIndexExpr * node ) {
1672        MUTATE_START( node );
1673
1674        indexerScopedMutate( node->env   , *this );
1675        indexerScopedMutate( node->result, *this );
1676        maybeMutateRef     ( node->tuple , *this );
1677
1678        MUTATE_END( Expression, node );
1679}
1680
1681//--------------------------------------------------------------------------
1682// TupleAssignExpr
1683template< typename pass_type >
1684void PassVisitor< pass_type >::visit( TupleAssignExpr * node ) {
1685        VISIT_START( node );
1686
1687        indexerScopedAccept( node->result  , *this );
1688        maybeAccept        ( node->stmtExpr, *this );
1689
1690        VISIT_END( node );
[13932f14]1691}
1692
1693template< typename pass_type >
[e0886db]1694Expression * PassVisitor< pass_type >::mutate( TupleAssignExpr * node ) {
1695        MUTATE_START( node );
[13932f14]1696
[e0886db]1697        indexerScopedMutate( node->env     , *this );
1698        indexerScopedMutate( node->result  , *this );
1699        maybeMutateRef     ( node->stmtExpr, *this );
[13932f14]1700
[e0886db]1701        MUTATE_END( Expression, node );
[13932f14]1702}
1703
[9c1600c]1704//--------------------------------------------------------------------------
[e0886db]1705// StmtExpr
[13932f14]1706template< typename pass_type >
[ab904dc]1707void PassVisitor< pass_type >::visit( StmtExpr * node ) {
[9c1600c]1708        VISIT_START( node );
1709
1710        // don't want statements from outer CompoundStmts to be added to this StmtExpr
1711        ValueGuardPtr< TypeSubstitution * >      oldEnv        ( get_env_ptr() );
1712        ValueGuardPtr< std::list< Statement* > > oldBeforeStmts( get_beforeStmts() );
1713        ValueGuardPtr< std::list< Statement* > > oldAfterStmts ( get_afterStmts () );
1714
[e0886db]1715        indexerScopedAccept( node->result     , *this );
1716        maybeAccept        ( node->statements , *this );
[9dcb653]1717        maybeAccept        ( node->returnDecls, *this );
1718        maybeAccept        ( node->dtors      , *this );
[9c1600c]1719
1720        VISIT_END( node );
[13932f14]1721}
1722
[296b2be]1723template< typename pass_type >
1724Expression * PassVisitor< pass_type >::mutate( StmtExpr * node ) {
1725        MUTATE_START( node );
[4551a6e]1726
[296b2be]1727        // don't want statements from outer CompoundStmts to be added to this StmtExpr
[134322e]1728        ValueGuardPtr< TypeSubstitution * >      oldEnv        ( get_env_ptr() );
1729        ValueGuardPtr< std::list< Statement* > > oldBeforeStmts( get_beforeStmts() );
1730        ValueGuardPtr< std::list< Statement* > > oldAfterStmts ( get_afterStmts () );
[296b2be]1731
[e0886db]1732        indexerScopedMutate( node->result     , *this );
1733        maybeMutateRef     ( node->statements , *this );
[9dcb653]1734        maybeMutateRef     ( node->returnDecls, *this );
1735        maybeMutateRef     ( node->dtors      , *this );
[296b2be]1736
1737        MUTATE_END( Expression, node );
1738}
1739
[e0886db]1740//--------------------------------------------------------------------------
1741// UniqueExpr
[13932f14]1742template< typename pass_type >
[ab904dc]1743void PassVisitor< pass_type >::visit( UniqueExpr * node ) {
[e0886db]1744        VISIT_START( node );
1745
1746        indexerScopedAccept( node->result, *this );
1747        maybeAccept        ( node->expr  , *this );
1748
1749        VISIT_END( node );
1750}
1751
1752template< typename pass_type >
1753Expression * PassVisitor< pass_type >::mutate( UniqueExpr * node ) {
1754        MUTATE_START( node );
1755
1756        indexerScopedMutate( node->env   , *this );
1757        indexerScopedMutate( node->result, *this );
1758        maybeMutateRef     ( node->expr  , *this );
1759
1760        MUTATE_END( Expression, node );
[13932f14]1761}
1762
1763template< typename pass_type >
[ab904dc]1764void PassVisitor< pass_type >::visit( VoidType * node ) {
[4551a6e]1765        VISIT_BODY( node );
[13932f14]1766}
1767
1768template< typename pass_type >
[ab904dc]1769void PassVisitor< pass_type >::visit( BasicType * node ) {
[4551a6e]1770        VISIT_BODY( node );
[13932f14]1771}
1772
1773template< typename pass_type >
[ab904dc]1774void PassVisitor< pass_type >::visit( PointerType * node ) {
[4551a6e]1775        VISIT_BODY( node );
[13932f14]1776}
1777
1778template< typename pass_type >
[ab904dc]1779void PassVisitor< pass_type >::visit( ArrayType * node ) {
[4551a6e]1780        VISIT_BODY( node );
[13932f14]1781}
1782
[6b9b047]1783template< typename pass_type >
1784void PassVisitor< pass_type >::visit( ReferenceType * node ) {
1785        VISIT_BODY( node );
1786}
1787
[13932f14]1788template< typename pass_type >
[ab904dc]1789void PassVisitor< pass_type >::visit( FunctionType * node ) {
[4551a6e]1790        VISIT_BODY( node );
[13932f14]1791}
1792
[e0886db]1793//--------------------------------------------------------------------------
1794// StructInstType
[13932f14]1795template< typename pass_type >
[ab904dc]1796void PassVisitor< pass_type >::visit( StructInstType * node ) {
[e0886db]1797        VISIT_START( node );
1798
1799        indexerAddStruct( node->name );
1800
1801        {
1802                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
1803                maybeAccept( node->forall    , *this );
1804                maybeAccept( node->parameters, *this );
1805        }
1806
1807        VISIT_END( node );
1808}
1809
1810template< typename pass_type >
1811Type * PassVisitor< pass_type >::mutate( StructInstType * node ) {
1812        MUTATE_START( node );
1813
1814        indexerAddStruct( node->name );
1815
1816        {
1817                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
1818                maybeMutateRef( node->forall    , *this );
1819                maybeMutateRef( node->parameters, *this );
1820        }
1821
1822        MUTATE_END( Type, node );
[13932f14]1823}
1824
[e0886db]1825//--------------------------------------------------------------------------
1826// UnionInstType
[13932f14]1827template< typename pass_type >
[ab904dc]1828void PassVisitor< pass_type >::visit( UnionInstType * node ) {
[e0886db]1829        VISIT_START( node );
1830
1831        indexerAddStruct( node->name );
1832
1833        {
1834                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
1835                maybeAccept( node->forall    , *this );
1836                maybeAccept( node->parameters, *this );
1837        }
1838
1839        VISIT_END( node );
1840}
1841
1842template< typename pass_type >
1843Type * PassVisitor< pass_type >::mutate( UnionInstType * node ) {
1844        MUTATE_START( node );
1845
1846        indexerAddStruct( node->name );
1847
1848        {
1849                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
1850                maybeMutateRef( node->forall    , *this );
1851                maybeMutateRef( node->parameters, *this );
1852        }
1853
1854        MUTATE_END( Type, node );
[13932f14]1855}
1856
[e0886db]1857//--------------------------------------------------------------------------
1858// EnumInstType
[13932f14]1859template< typename pass_type >
[ab904dc]1860void PassVisitor< pass_type >::visit( EnumInstType * node ) {
[4551a6e]1861        VISIT_BODY( node );
[13932f14]1862}
1863
[e0886db]1864template< typename pass_type >
1865Type * PassVisitor< pass_type >::mutate( EnumInstType * node ) {
1866        MUTATE_BODY( Type, node );
1867}
1868
1869//--------------------------------------------------------------------------
1870// TraitInstType
[13932f14]1871template< typename pass_type >
[ab904dc]1872void PassVisitor< pass_type >::visit( TraitInstType * node ) {
[e0886db]1873        VISIT_START( node );
1874
1875        maybeAccept( node->forall    , *this );
1876        maybeAccept( node->parameters, *this );
1877
1878        VISIT_END( node );
1879}
1880
1881template< typename pass_type >
1882Type * PassVisitor< pass_type >::mutate( TraitInstType * node ) {
1883        MUTATE_START( node );
1884
1885        maybeMutateRef( node->forall    , *this );
1886        maybeMutateRef( node->parameters, *this );
1887
1888        MUTATE_END( Type, node );
[13932f14]1889}
1890
[e0886db]1891//--------------------------------------------------------------------------
1892// TypeInstType
[13932f14]1893template< typename pass_type >
[ab904dc]1894void PassVisitor< pass_type >::visit( TypeInstType * node ) {
[4551a6e]1895        VISIT_BODY( node );
[13932f14]1896}
1897
1898template< typename pass_type >
[ab904dc]1899void PassVisitor< pass_type >::visit( TupleType * node ) {
[4551a6e]1900        VISIT_BODY( node );
[13932f14]1901}
1902
1903template< typename pass_type >
[ab904dc]1904void PassVisitor< pass_type >::visit( TypeofType * node ) {
[4551a6e]1905        VISIT_BODY( node );
[13932f14]1906}
1907
1908template< typename pass_type >
[ab904dc]1909void PassVisitor< pass_type >::visit( AttrType * node ) {
[4551a6e]1910        VISIT_BODY( node );
[13932f14]1911}
1912
1913template< typename pass_type >
[ab904dc]1914void PassVisitor< pass_type >::visit( VarArgsType * node ) {
[4551a6e]1915        VISIT_BODY( node );
[13932f14]1916}
1917
1918template< typename pass_type >
[ab904dc]1919void PassVisitor< pass_type >::visit( ZeroType * node ) {
[4551a6e]1920        VISIT_BODY( node );
[13932f14]1921}
1922
1923template< typename pass_type >
[ab904dc]1924void PassVisitor< pass_type >::visit( OneType * node ) {
[4551a6e]1925        VISIT_BODY( node );
[13932f14]1926}
1927
[b11d8e2]1928template< typename pass_type >
1929void PassVisitor< pass_type >::visit( Designation * node ) {
1930        VISIT_START( node );
1931
1932        maybeAccept( node->get_designators(), *this );
1933
1934        VISIT_END( node );
1935}
1936
1937template< typename pass_type >
1938Designation * PassVisitor< pass_type >::mutate( Designation * node ) {
1939        MUTATE_START( node );
1940
1941        maybeMutateRef( node->get_designators(), *this );
1942
1943        MUTATE_END( Designation, node );
1944}
1945
[9c1600c]1946//--------------------------------------------------------------------------
[e0886db]1947// SingleInit
[13932f14]1948template< typename pass_type >
[ab904dc]1949void PassVisitor< pass_type >::visit( SingleInit * node ) {
[9c1600c]1950        VISIT_START( node );
1951
1952        visitExpression( node->get_value() );
1953
1954        VISIT_END( node );
[13932f14]1955}
1956
[296b2be]1957template< typename pass_type >
1958Initializer * PassVisitor< pass_type >::mutate( SingleInit * node ) {
1959        MUTATE_START( node );
1960
1961        node->set_value( mutateExpression( node->get_value() ) );
1962
1963        MUTATE_END( Initializer, node );
1964}
1965
[13932f14]1966template< typename pass_type >
[ab904dc]1967void PassVisitor< pass_type >::visit( ListInit * node ) {
[4551a6e]1968        VISIT_BODY( node );
[13932f14]1969}
1970
1971template< typename pass_type >
[ab904dc]1972void PassVisitor< pass_type >::visit( ConstructorInit * node ) {
[4551a6e]1973        VISIT_BODY( node );
[13932f14]1974}
1975
1976template< typename pass_type >
[ab904dc]1977void PassVisitor< pass_type >::visit( Subrange * node ) {
[4551a6e]1978        VISIT_BODY( node );
[13932f14]1979}
1980
1981template< typename pass_type >
[ab904dc]1982void PassVisitor< pass_type >::visit( Constant * node ) {
[4551a6e]1983        VISIT_BODY( node );
[13932f14]1984}
[ab904dc]1985
1986//---------------------------------------------------------------------------------------------------------------
1987template< typename pass_type >
1988Type * PassVisitor< pass_type >::mutate( VoidType * node ) {
1989        MUTATE_BODY( Type, node );
1990}
1991
1992template< typename pass_type >
1993Type * PassVisitor< pass_type >::mutate( BasicType * node ) {
1994        MUTATE_BODY( Type, node );
1995}
1996
1997template< typename pass_type >
1998Type * PassVisitor< pass_type >::mutate( PointerType * node ) {
1999        MUTATE_BODY( Type, node );
2000}
2001
2002template< typename pass_type >
2003Type * PassVisitor< pass_type >::mutate( ArrayType * node ) {
2004        MUTATE_BODY( Type, node );
2005}
2006
2007template< typename pass_type >
[6b9b047]2008Type * PassVisitor< pass_type >::mutate( ReferenceType * node ) {
2009        MUTATE_BODY( Type, node );
2010}
2011
2012template< typename pass_type >
[ab904dc]2013Type * PassVisitor< pass_type >::mutate( FunctionType * node ) {
2014        MUTATE_BODY( Type, node );
2015}
2016
2017template< typename pass_type >
2018Type * PassVisitor< pass_type >::mutate( TypeInstType * node ) {
2019        MUTATE_BODY( Type, node );
2020}
2021
2022template< typename pass_type >
2023Type * PassVisitor< pass_type >::mutate( TupleType * node ) {
2024        MUTATE_BODY( Type, node );
2025}
2026
2027template< typename pass_type >
2028Type * PassVisitor< pass_type >::mutate( TypeofType * node ) {
2029        MUTATE_BODY( Type, node );
2030}
2031
2032template< typename pass_type >
2033Type * PassVisitor< pass_type >::mutate( AttrType * node ) {
2034        MUTATE_BODY( Type, node );
2035}
2036
2037template< typename pass_type >
2038Type * PassVisitor< pass_type >::mutate( VarArgsType * node ) {
2039        MUTATE_BODY( Type, node );
2040}
2041
2042template< typename pass_type >
2043Type * PassVisitor< pass_type >::mutate( ZeroType * node ) {
2044        MUTATE_BODY( Type, node );
2045}
2046
2047template< typename pass_type >
2048Type * PassVisitor< pass_type >::mutate( OneType * node ) {
2049        MUTATE_BODY( Type, node );
2050}
2051
2052template< typename pass_type >
2053Initializer * PassVisitor< pass_type >::mutate( ListInit * node ) {
2054        MUTATE_BODY( Initializer, node );
2055}
2056
2057template< typename pass_type >
2058Initializer * PassVisitor< pass_type >::mutate( ConstructorInit * node ) {
2059        MUTATE_BODY( Initializer, node );
2060}
2061
2062template< typename pass_type >
2063Subrange * PassVisitor< pass_type >::mutate( Subrange * node  )  {
2064        MUTATE_BODY( Subrange, node );
2065}
2066
2067template< typename pass_type >
2068Constant * PassVisitor< pass_type >::mutate( Constant * node  )  {
2069        MUTATE_BODY( Constant, node );
[4551a6e]2070}
Note: See TracBrowser for help on using the repository browser.