1 | #pragma once |
---|
2 | // IWYU pragma: private, include "PassVisitor.h" |
---|
3 | |
---|
4 | #define VISIT_START( node ) \ |
---|
5 | __attribute__((unused)) \ |
---|
6 | ChildrenGuard children_guard( get_visit_children_ptr() ); \ |
---|
7 | __attribute__((unused)) \ |
---|
8 | guard_value_impl guard( at_cleanup_impl(pass, 0) ); \ |
---|
9 | call_previsit( node ); \ |
---|
10 | |
---|
11 | #define VISIT_END( node ) \ |
---|
12 | call_postvisit( node ); \ |
---|
13 | |
---|
14 | #define MUTATE_START( node ) \ |
---|
15 | __attribute__((unused)) \ |
---|
16 | ChildrenGuard children_guard( get_visit_children_ptr() ); \ |
---|
17 | __attribute__((unused)) \ |
---|
18 | guard_value_impl guard( at_cleanup_impl(pass, 0) ); \ |
---|
19 | call_premutate( node ); \ |
---|
20 | |
---|
21 | #define MUTATE_END( type, node ) \ |
---|
22 | auto __return = call_postmutate< type * >( node ); \ |
---|
23 | assert( __return ); \ |
---|
24 | return __return; |
---|
25 | |
---|
26 | |
---|
27 | template<typename T> |
---|
28 | static inline bool empty( T * ptr ) { |
---|
29 | return !ptr || ptr->empty(); |
---|
30 | } |
---|
31 | |
---|
32 | typedef std::list< Statement * > StmtList_t; |
---|
33 | typedef std::list< Declaration * > DeclList_t; |
---|
34 | |
---|
35 | template<typename iterator_t> |
---|
36 | static inline void splice( iterator_t it, DeclList_t * decls ) { |
---|
37 | std::transform( |
---|
38 | decls->begin(), |
---|
39 | decls->end(), |
---|
40 | it, |
---|
41 | [](Declaration * decl) -> auto { |
---|
42 | return new DeclStmt( decl ); |
---|
43 | } |
---|
44 | ); |
---|
45 | decls->clear(); |
---|
46 | } |
---|
47 | |
---|
48 | template< typename pass_type > |
---|
49 | inline void acceptAll( std::list< Declaration* > &decls, PassVisitor< pass_type >& visitor ) { |
---|
50 | DeclList_t* beforeDecls = visitor.get_beforeDecls(); |
---|
51 | DeclList_t* afterDecls = visitor.get_afterDecls(); |
---|
52 | SemanticErrorException errors; |
---|
53 | |
---|
54 | pass_visitor_stats.depth++; |
---|
55 | pass_visitor_stats.max->push(pass_visitor_stats.depth); |
---|
56 | pass_visitor_stats.avg->push(pass_visitor_stats.depth); |
---|
57 | for ( std::list< Declaration* >::iterator i = decls.begin(); ; ++i ) { |
---|
58 | |
---|
59 | |
---|
60 | // splice in new declarations after previous decl |
---|
61 | if ( !empty( afterDecls ) ) { decls.splice( i, *afterDecls ); } |
---|
62 | |
---|
63 | if ( i == decls.end() ) break; |
---|
64 | |
---|
65 | try { |
---|
66 | // run visitor on declaration |
---|
67 | maybeAccept_impl( *i, visitor ); |
---|
68 | } catch( SemanticErrorException &e ) { |
---|
69 | errors.append( e ); |
---|
70 | } |
---|
71 | |
---|
72 | // splice in new declarations before current decl |
---|
73 | if ( !empty( beforeDecls ) ) { decls.splice( i, *beforeDecls ); } |
---|
74 | } |
---|
75 | pass_visitor_stats.depth--; |
---|
76 | if ( ! errors.isEmpty() ) { |
---|
77 | throw errors; |
---|
78 | } |
---|
79 | } |
---|
80 | |
---|
81 | template< typename pass_type > |
---|
82 | inline 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 | |
---|
103 | template< typename pass_type > |
---|
104 | inline void mutateAll( std::list< Declaration* > &decls, PassVisitor< pass_type >& mutator ) { |
---|
105 | DeclList_t* beforeDecls = mutator.get_beforeDecls(); |
---|
106 | DeclList_t* afterDecls = mutator.get_afterDecls(); |
---|
107 | SemanticErrorException errors; |
---|
108 | |
---|
109 | pass_visitor_stats.depth++; |
---|
110 | pass_visitor_stats.max->push(pass_visitor_stats.depth); |
---|
111 | pass_visitor_stats.avg->push(pass_visitor_stats.depth); |
---|
112 | for ( std::list< Declaration* >::iterator i = decls.begin(); ; ++i ) { |
---|
113 | // splice in new declarations after previous decl |
---|
114 | if ( !empty( afterDecls ) ) { decls.splice( i, *afterDecls ); } |
---|
115 | |
---|
116 | if ( i == decls.end() ) break; |
---|
117 | try { |
---|
118 | // run mutator on declaration |
---|
119 | maybeMutate_impl( *i, mutator ); |
---|
120 | } catch( SemanticErrorException &e ) { |
---|
121 | errors.append( e ); |
---|
122 | } |
---|
123 | |
---|
124 | // splice in new declarations before current decl |
---|
125 | if ( !empty( beforeDecls ) ) { decls.splice( i, *beforeDecls ); } |
---|
126 | } |
---|
127 | pass_visitor_stats.depth--; |
---|
128 | if ( ! errors.isEmpty() ) { |
---|
129 | throw errors; |
---|
130 | } |
---|
131 | } |
---|
132 | |
---|
133 | template< typename TreeType, typename pass_type > |
---|
134 | inline void maybeAccept_impl( TreeType * tree, PassVisitor< pass_type > & visitor ) { |
---|
135 | if ( ! visitor.get_visit_children() ) return; |
---|
136 | if ( tree ) { |
---|
137 | tree->accept( visitor ); |
---|
138 | } |
---|
139 | } |
---|
140 | |
---|
141 | template< typename TreeType, typename pass_type > |
---|
142 | inline 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 | |
---|
149 | template< typename Container, typename pass_type > |
---|
150 | inline void maybeAccept_impl( Container & container, PassVisitor< pass_type > & visitor ) { |
---|
151 | if ( ! visitor.get_visit_children() ) return; |
---|
152 | SemanticErrorException errors; |
---|
153 | |
---|
154 | pass_visitor_stats.depth++; |
---|
155 | pass_visitor_stats.max->push(pass_visitor_stats.depth); |
---|
156 | pass_visitor_stats.avg->push(pass_visitor_stats.depth); |
---|
157 | for ( typename Container::iterator i = container.begin(); i != container.end(); ++i ) { |
---|
158 | try { |
---|
159 | if ( *i ) { |
---|
160 | (*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 | |
---|
172 | template< typename Container, typename pass_type > |
---|
173 | inline 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 ); |
---|
184 | } |
---|
185 | } catch( SemanticErrorException &e ) { |
---|
186 | errors.append( e ); |
---|
187 | } |
---|
188 | } |
---|
189 | pass_visitor_stats.depth--; |
---|
190 | if ( ! errors.isEmpty() ) { |
---|
191 | throw errors; |
---|
192 | } |
---|
193 | } |
---|
194 | |
---|
195 | template< typename TreeType, typename pass_type > |
---|
196 | inline void maybeMutate_impl( TreeType *& tree, PassVisitor< pass_type > & mutator ) { |
---|
197 | if ( ! mutator.get_visit_children() ) return; |
---|
198 | |
---|
199 | if ( tree ) { |
---|
200 | tree = strict_dynamic_cast< TreeType * >( tree->acceptMutator( mutator ) ); |
---|
201 | } |
---|
202 | } |
---|
203 | |
---|
204 | template< typename Container, typename pass_type > |
---|
205 | inline void maybeMutate_impl( Container & container, PassVisitor< pass_type > & mutator ) { |
---|
206 | |
---|
207 | if ( ! mutator.get_visit_children() ) return; |
---|
208 | SemanticErrorException errors; |
---|
209 | |
---|
210 | pass_visitor_stats.depth++; |
---|
211 | pass_visitor_stats.max->push(pass_visitor_stats.depth); |
---|
212 | pass_visitor_stats.avg->push(pass_visitor_stats.depth); |
---|
213 | for ( typename Container::iterator i = container.begin(); i != container.end(); ++i ) { |
---|
214 | try { |
---|
215 | if ( *i ) { |
---|
216 | *i = dynamic_cast< typename Container::value_type >( (*i)->acceptMutator( mutator ) ); |
---|
217 | assert( *i ); |
---|
218 | } // if |
---|
219 | } catch( SemanticErrorException &e ) { |
---|
220 | errors.append( e ); |
---|
221 | } // try |
---|
222 | } // for |
---|
223 | pass_visitor_stats.depth--; |
---|
224 | if ( ! errors.isEmpty() ) { |
---|
225 | throw errors; |
---|
226 | } // if |
---|
227 | } |
---|
228 | |
---|
229 | template< typename pass_type > |
---|
230 | template< typename func_t > |
---|
231 | void PassVisitor< pass_type >::handleStatementList( std::list< Statement * > & statements, func_t func ) { |
---|
232 | if ( ! get_visit_children() ) return; |
---|
233 | SemanticErrorException errors; |
---|
234 | |
---|
235 | // don't want statements from outer CompoundStmts to be added to this CompoundStmt |
---|
236 | ValueGuardPtr< StmtList_t > oldBeforeStmts( get_beforeStmts() ); |
---|
237 | ValueGuardPtr< StmtList_t > oldAfterStmts ( get_afterStmts () ); |
---|
238 | ValueGuardPtr< DeclList_t > oldBeforeDecls( get_beforeDecls() ); |
---|
239 | ValueGuardPtr< DeclList_t > oldAfterDecls ( get_afterDecls () ); |
---|
240 | |
---|
241 | StmtList_t* beforeStmts = get_beforeStmts(); |
---|
242 | StmtList_t* afterStmts = get_afterStmts(); |
---|
243 | DeclList_t* beforeDecls = get_beforeDecls(); |
---|
244 | DeclList_t* afterDecls = get_afterDecls(); |
---|
245 | |
---|
246 | pass_visitor_stats.depth++; |
---|
247 | pass_visitor_stats.max->push(pass_visitor_stats.depth); |
---|
248 | pass_visitor_stats.avg->push(pass_visitor_stats.depth); |
---|
249 | for ( std::list< Statement* >::iterator i = statements.begin(); i != statements.end(); ++i ) { |
---|
250 | |
---|
251 | if ( !empty( afterDecls ) ) { splice( std::inserter( statements, i ), afterDecls ); } |
---|
252 | if ( !empty( afterStmts ) ) { statements.splice( i, *afterStmts ); } |
---|
253 | |
---|
254 | try { |
---|
255 | func( *i ); |
---|
256 | assert( *i ); |
---|
257 | assert(( empty( beforeStmts ) && empty( afterStmts )) |
---|
258 | || ( empty( beforeDecls ) && empty( afterDecls )) ); |
---|
259 | |
---|
260 | } catch ( SemanticErrorException &e ) { |
---|
261 | errors.append( e ); |
---|
262 | } |
---|
263 | |
---|
264 | if ( !empty( beforeDecls ) ) { splice( std::inserter( statements, i ), beforeDecls ); } |
---|
265 | if ( !empty( beforeStmts ) ) { statements.splice( i, *beforeStmts ); } |
---|
266 | } |
---|
267 | pass_visitor_stats.depth--; |
---|
268 | |
---|
269 | if ( !empty( afterDecls ) ) { splice( std::back_inserter( statements ), afterDecls); } |
---|
270 | if ( !empty( afterStmts ) ) { statements.splice( statements.end(), *afterStmts ); } |
---|
271 | if ( !errors.isEmpty() ) { throw errors; } |
---|
272 | } |
---|
273 | |
---|
274 | template< typename pass_type > |
---|
275 | void PassVisitor< pass_type >::visitStatementList( std::list< Statement * > & statements ) { |
---|
276 | handleStatementList( statements, [this]( Statement * stmt) { |
---|
277 | maybeAccept_impl( stmt, *this ); |
---|
278 | }); |
---|
279 | } |
---|
280 | |
---|
281 | template< typename pass_type > |
---|
282 | void 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 | |
---|
300 | template< typename pass_type > |
---|
301 | void PassVisitor< pass_type >::mutateStatementList( std::list< Statement * > & statements ) { |
---|
302 | handleStatementList( statements, [this]( Statement *& stmt) { |
---|
303 | maybeMutate_impl( stmt, *this ); |
---|
304 | }); |
---|
305 | } |
---|
306 | |
---|
307 | |
---|
308 | template< typename pass_type > |
---|
309 | template< typename func_t > |
---|
310 | Statement * PassVisitor< pass_type >::handleStatement( Statement * stmt, func_t func ) { |
---|
311 | if ( ! get_visit_children() ) return stmt; |
---|
312 | |
---|
313 | // don't want statements from outer CompoundStmts to be added to this CompoundStmt |
---|
314 | ValueGuardPtr< typename std::remove_pointer<decltype(get_env_ptr())>::type > oldEnv( get_env_ptr() ); |
---|
315 | ValueGuardPtr< DeclList_t > oldBeforeDecls( get_beforeDecls() ); |
---|
316 | ValueGuardPtr< DeclList_t > oldAfterDecls ( get_afterDecls () ); |
---|
317 | ValueGuardPtr< StmtList_t > oldBeforeStmts( get_beforeStmts() ); |
---|
318 | ValueGuardPtr< StmtList_t > oldAfterStmts ( get_afterStmts () ); |
---|
319 | |
---|
320 | Statement *newStmt = func( stmt ); |
---|
321 | |
---|
322 | StmtList_t* beforeStmts = get_beforeStmts(); |
---|
323 | StmtList_t* afterStmts = get_afterStmts(); |
---|
324 | DeclList_t* beforeDecls = get_beforeDecls(); |
---|
325 | DeclList_t* afterDecls = get_afterDecls(); |
---|
326 | |
---|
327 | if( empty(beforeStmts) && empty(afterStmts) && empty(beforeDecls) && empty(afterDecls) ) { return newStmt; } |
---|
328 | assert(( empty( beforeStmts ) && empty( afterStmts )) |
---|
329 | || ( empty( beforeDecls ) && empty( afterDecls )) ); |
---|
330 | |
---|
331 | CompoundStmt *compound = new CompoundStmt(); |
---|
332 | if( !empty(beforeDecls) ) { splice( std::back_inserter( compound->get_kids() ), beforeDecls ); } |
---|
333 | if( !empty(beforeStmts) ) { compound->get_kids().splice( compound->get_kids().end(), *beforeStmts ); } |
---|
334 | compound->get_kids().push_back( newStmt ); |
---|
335 | if( !empty(afterDecls) ) { splice( std::back_inserter( compound->get_kids() ), afterDecls ); } |
---|
336 | if( !empty(afterStmts) ) { compound->get_kids().splice( compound->get_kids().end(), *afterStmts ); } |
---|
337 | return compound; |
---|
338 | } |
---|
339 | |
---|
340 | template< typename pass_type > |
---|
341 | Statement * PassVisitor< pass_type >::visitStatement( Statement * stmt ) { |
---|
342 | return handleStatement( stmt, [this]( Statement * stmt ) { |
---|
343 | maybeAccept_impl( stmt, *this ); |
---|
344 | return stmt; |
---|
345 | }); |
---|
346 | } |
---|
347 | |
---|
348 | template< typename pass_type > |
---|
349 | void 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 | |
---|
358 | template< typename pass_type > |
---|
359 | Statement * PassVisitor< pass_type >::mutateStatement( Statement * stmt ) { |
---|
360 | return handleStatement( stmt, [this]( Statement * stmt ) { |
---|
361 | maybeMutate_impl( stmt, *this ); |
---|
362 | return stmt; |
---|
363 | }); |
---|
364 | } |
---|
365 | |
---|
366 | template< typename pass_type > |
---|
367 | template< typename func_t > |
---|
368 | Expression * PassVisitor< pass_type >::handleExpression( Expression * expr, func_t func ) { |
---|
369 | if ( ! get_visit_children() ) return expr; |
---|
370 | if( !expr ) return nullptr; |
---|
371 | |
---|
372 | auto env_ptr = get_env_ptr(); |
---|
373 | if ( env_ptr && expr->get_env() ) { |
---|
374 | *env_ptr = expr->get_env(); |
---|
375 | } |
---|
376 | |
---|
377 | // should env be moved onto the result of the mutate? |
---|
378 | return func( expr ); |
---|
379 | } |
---|
380 | |
---|
381 | template< typename pass_type > |
---|
382 | Expression * PassVisitor< pass_type >::visitExpression( Expression * expr ) { |
---|
383 | return handleExpression(expr, [this]( Expression * expr ) { |
---|
384 | maybeAccept_impl( expr, *this ); |
---|
385 | return expr; |
---|
386 | }); |
---|
387 | } |
---|
388 | |
---|
389 | template< typename pass_type > |
---|
390 | void 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 | |
---|
402 | template< typename pass_type > |
---|
403 | Expression * PassVisitor< pass_type >::mutateExpression( Expression * expr ) { |
---|
404 | return handleExpression(expr, [this]( Expression * expr ) { |
---|
405 | maybeMutate_impl( expr, *this ); |
---|
406 | return expr; |
---|
407 | }); |
---|
408 | } |
---|
409 | |
---|
410 | template< typename TreeType, typename VisitorType > |
---|
411 | inline 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 | |
---|
420 | template< typename TreeType, typename VisitorType > |
---|
421 | inline void indexerScopedAccept( const TreeType * tree, VisitorType & visitor ) { |
---|
422 | if ( ! visitor.get_visit_children() ) return; |
---|
423 | auto guard = makeFuncGuard( |
---|
424 | [&visitor]() { visitor.indexerScopeEnter(); }, |
---|
425 | [&visitor]() { visitor.indexerScopeLeave(); } |
---|
426 | ); |
---|
427 | maybeAccept_impl( tree, visitor ); |
---|
428 | } |
---|
429 | |
---|
430 | template< typename TreeType, typename MutatorType > |
---|
431 | inline void indexerScopedMutate( TreeType *& tree, MutatorType & mutator ) { |
---|
432 | if ( ! mutator.get_visit_children() ) return; |
---|
433 | auto guard = makeFuncGuard( |
---|
434 | [&mutator]() { mutator.indexerScopeEnter(); }, |
---|
435 | [&mutator]() { mutator.indexerScopeLeave(); } |
---|
436 | ); |
---|
437 | maybeMutate_impl( tree, mutator ); |
---|
438 | } |
---|
439 | |
---|
440 | //------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
---|
441 | //======================================================================================================================================================================== |
---|
442 | //======================================================================================================================================================================== |
---|
443 | //======================================================================================================================================================================== |
---|
444 | //======================================================================================================================================================================== |
---|
445 | //======================================================================================================================================================================== |
---|
446 | //------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
---|
447 | |
---|
448 | // A NOTE ON THE ORDER OF TRAVERSAL |
---|
449 | // |
---|
450 | // Types and typedefs have their base types visited before they are added to the type table. This is ok, since there is |
---|
451 | // no such thing as a recursive type or typedef. |
---|
452 | // |
---|
453 | // typedef struct { T *x; } T; // never allowed |
---|
454 | // |
---|
455 | // for structs/unions, it is possible to have recursion, so the decl should be added as if it's incomplete to begin, the |
---|
456 | // members are traversed, and then the complete type should be added (assuming the type is completed by this particular |
---|
457 | // declaration). |
---|
458 | // |
---|
459 | // struct T { struct T *x; }; // allowed |
---|
460 | // |
---|
461 | // It is important to add the complete type to the symbol table *after* the members/base has been traversed, since that |
---|
462 | // traversal may modify the definition of the type and these modifications should be visible when the symbol table is |
---|
463 | // queried later in this pass. |
---|
464 | // |
---|
465 | // TODO: figure out whether recursive contexts are sensible/possible/reasonable. |
---|
466 | |
---|
467 | //-------------------------------------------------------------------------- |
---|
468 | // ObjectDecl |
---|
469 | template< typename pass_type > |
---|
470 | void PassVisitor< pass_type >::visit( ObjectDecl * node ) { |
---|
471 | VISIT_START( node ); |
---|
472 | |
---|
473 | indexerScopedAccept( node->type , *this ); |
---|
474 | maybeAccept_impl ( node->init , *this ); |
---|
475 | maybeAccept_impl ( node->bitfieldWidth, *this ); |
---|
476 | maybeAccept_impl ( node->attributes , *this ); |
---|
477 | |
---|
478 | indexerAddId( node ); |
---|
479 | |
---|
480 | VISIT_END( node ); |
---|
481 | } |
---|
482 | |
---|
483 | template< typename pass_type > |
---|
484 | void 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 ); |
---|
491 | |
---|
492 | VISIT_END( node ); |
---|
493 | } |
---|
494 | |
---|
495 | template< typename pass_type > |
---|
496 | DeclarationWithType * PassVisitor< pass_type >::mutate( ObjectDecl * node ) { |
---|
497 | MUTATE_START( node ); |
---|
498 | |
---|
499 | indexerScopedMutate( node->type , *this ); |
---|
500 | maybeMutate_impl ( node->init , *this ); |
---|
501 | maybeMutate_impl ( node->bitfieldWidth, *this ); |
---|
502 | maybeMutate_impl ( node->attributes , *this ); |
---|
503 | |
---|
504 | indexerAddId( node ); |
---|
505 | |
---|
506 | MUTATE_END( DeclarationWithType, node ); |
---|
507 | } |
---|
508 | |
---|
509 | //-------------------------------------------------------------------------- |
---|
510 | // FunctionDecl |
---|
511 | template< typename pass_type > |
---|
512 | void PassVisitor< pass_type >::visit( FunctionDecl * node ) { |
---|
513 | VISIT_START( node ); |
---|
514 | |
---|
515 | indexerAddId( node ); |
---|
516 | |
---|
517 | maybeAccept_impl( node->withExprs, *this ); |
---|
518 | { |
---|
519 | // with clause introduces a level of scope (for the with expression members). |
---|
520 | // with clause exprs are added to the indexer before parameters so that parameters |
---|
521 | // shadow with exprs and not the other way around. |
---|
522 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
523 | indexerAddWith( node->withExprs, node ); |
---|
524 | { |
---|
525 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
526 | // implicit add __func__ identifier as specified in the C manual 6.4.2.2 |
---|
527 | static ObjectDecl func( |
---|
528 | "__func__", noStorageClasses, LinkageSpec::C, nullptr, |
---|
529 | new ArrayType( Type::Qualifiers(), new BasicType( Type::Qualifiers( Type::Const ), BasicType::Char ), nullptr, true, false ), |
---|
530 | nullptr |
---|
531 | ); |
---|
532 | indexerAddId( &func ); |
---|
533 | maybeAccept_impl( node->type, *this ); |
---|
534 | // First remember that we are now within a function. |
---|
535 | ValueGuard< bool > oldInFunction( inFunction ); |
---|
536 | inFunction = true; |
---|
537 | // The function body needs to have the same scope as parameters. |
---|
538 | // A CompoundStmt will not enter a new scope if atFunctionTop is true. |
---|
539 | ValueGuard< bool > oldAtFunctionTop( atFunctionTop ); |
---|
540 | atFunctionTop = true; |
---|
541 | maybeAccept_impl( node->statements, *this ); |
---|
542 | maybeAccept_impl( node->attributes, *this ); |
---|
543 | } |
---|
544 | } |
---|
545 | |
---|
546 | VISIT_END( node ); |
---|
547 | } |
---|
548 | |
---|
549 | template< typename pass_type > |
---|
550 | void PassVisitor< pass_type >::visit( const FunctionDecl * node ) { |
---|
551 | VISIT_START( node ); |
---|
552 | |
---|
553 | indexerAddId( node ); |
---|
554 | |
---|
555 | maybeAccept_impl( node->withExprs, *this ); |
---|
556 | { |
---|
557 | // with clause introduces a level of scope (for the with expression members). |
---|
558 | // with clause exprs are added to the indexer before parameters so that parameters |
---|
559 | // shadow with exprs and not the other way around. |
---|
560 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
561 | indexerAddWith( node->withExprs, node ); |
---|
562 | { |
---|
563 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
564 | // implicit add __func__ identifier as specified in the C manual 6.4.2.2 |
---|
565 | static ObjectDecl func( |
---|
566 | "__func__", noStorageClasses, LinkageSpec::C, nullptr, |
---|
567 | new ArrayType( Type::Qualifiers(), new BasicType( Type::Qualifiers( Type::Const ), BasicType::Char ), nullptr, true, false ), |
---|
568 | nullptr |
---|
569 | ); |
---|
570 | indexerAddId( &func ); |
---|
571 | maybeAccept_impl( node->type, *this ); |
---|
572 | // First remember that we are now within a function. |
---|
573 | ValueGuard< bool > oldInFunction( inFunction ); |
---|
574 | inFunction = true; |
---|
575 | // The function body needs to have the same scope as parameters. |
---|
576 | // A CompoundStmt will not enter a new scope if atFunctionTop is true. |
---|
577 | ValueGuard< bool > oldAtFunctionTop( atFunctionTop ); |
---|
578 | atFunctionTop = true; |
---|
579 | maybeAccept_impl( node->statements, *this ); |
---|
580 | maybeAccept_impl( node->attributes, *this ); |
---|
581 | } |
---|
582 | } |
---|
583 | |
---|
584 | VISIT_END( node ); |
---|
585 | } |
---|
586 | |
---|
587 | template< typename pass_type > |
---|
588 | DeclarationWithType * PassVisitor< pass_type >::mutate( FunctionDecl * node ) { |
---|
589 | MUTATE_START( node ); |
---|
590 | |
---|
591 | indexerAddId( node ); |
---|
592 | |
---|
593 | { |
---|
594 | // with clause introduces a level of scope (for the with expression members). |
---|
595 | // with clause exprs are added to the indexer before parameters so that parameters |
---|
596 | // shadow with exprs and not the other way around. |
---|
597 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
598 | indexerAddWith( node->withExprs, node ); |
---|
599 | { |
---|
600 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
601 | // implicit add __func__ identifier as specified in the C manual 6.4.2.2 |
---|
602 | static ObjectDecl func( |
---|
603 | "__func__", noStorageClasses, LinkageSpec::C, nullptr, |
---|
604 | new ArrayType( Type::Qualifiers(), new BasicType( Type::Qualifiers( Type::Const ), BasicType::Char ), nullptr, true, false ), |
---|
605 | nullptr |
---|
606 | ); |
---|
607 | indexerAddId( &func ); |
---|
608 | maybeMutate_impl( node->type, *this ); |
---|
609 | maybeMutate_impl( node->attributes, *this ); |
---|
610 | // First remember that we are now within a function. |
---|
611 | ValueGuard< bool > oldInFunction( inFunction ); |
---|
612 | inFunction = true; |
---|
613 | // The function body needs to have the same scope as parameters. |
---|
614 | // A CompoundStmt will not enter a new scope if atFunctionTop is true. |
---|
615 | ValueGuard< bool > oldAtFunctionTop( atFunctionTop ); |
---|
616 | atFunctionTop = true; |
---|
617 | maybeMutate_impl( node->statements, *this ); |
---|
618 | } |
---|
619 | } |
---|
620 | |
---|
621 | MUTATE_END( DeclarationWithType, node ); |
---|
622 | } |
---|
623 | |
---|
624 | //-------------------------------------------------------------------------- |
---|
625 | // StructDecl |
---|
626 | template< typename pass_type > |
---|
627 | void PassVisitor< pass_type >::visit( StructDecl * node ) { |
---|
628 | VISIT_START( node ); |
---|
629 | |
---|
630 | // make up a forward declaration and add it before processing the members |
---|
631 | // needs to be on the heap because addStruct saves the pointer |
---|
632 | indexerAddStructFwd( node ); |
---|
633 | |
---|
634 | { |
---|
635 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
636 | maybeAccept_impl( node->parameters, *this ); |
---|
637 | maybeAccept_impl( node->members , *this ); |
---|
638 | maybeAccept_impl( node->attributes, *this ); |
---|
639 | } |
---|
640 | |
---|
641 | // this addition replaces the forward declaration |
---|
642 | indexerAddStruct( node ); |
---|
643 | |
---|
644 | VISIT_END( node ); |
---|
645 | } |
---|
646 | |
---|
647 | template< typename pass_type > |
---|
648 | void PassVisitor< pass_type >::visit( const StructDecl * node ) { |
---|
649 | VISIT_START( node ); |
---|
650 | |
---|
651 | // make up a forward declaration and add it before processing the members |
---|
652 | // needs to be on the heap because addStruct saves the pointer |
---|
653 | indexerAddStructFwd( node ); |
---|
654 | |
---|
655 | { |
---|
656 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
657 | maybeAccept_impl( node->parameters, *this ); |
---|
658 | maybeAccept_impl( node->members , *this ); |
---|
659 | maybeAccept_impl( node->attributes, *this ); |
---|
660 | } |
---|
661 | |
---|
662 | // this addition replaces the forward declaration |
---|
663 | indexerAddStruct( node ); |
---|
664 | |
---|
665 | VISIT_END( node ); |
---|
666 | } |
---|
667 | |
---|
668 | template< typename pass_type > |
---|
669 | Declaration * PassVisitor< pass_type >::mutate( StructDecl * node ) { |
---|
670 | MUTATE_START( node ); |
---|
671 | |
---|
672 | // make up a forward declaration and add it before processing the members |
---|
673 | // needs to be on the heap because addStruct saves the pointer |
---|
674 | indexerAddStructFwd( node ); |
---|
675 | |
---|
676 | { |
---|
677 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
678 | maybeMutate_impl( node->parameters, *this ); |
---|
679 | maybeMutate_impl( node->members , *this ); |
---|
680 | maybeMutate_impl( node->attributes, *this ); |
---|
681 | } |
---|
682 | |
---|
683 | // this addition replaces the forward declaration |
---|
684 | indexerAddStruct( node ); |
---|
685 | |
---|
686 | MUTATE_END( Declaration, node ); |
---|
687 | } |
---|
688 | |
---|
689 | //-------------------------------------------------------------------------- |
---|
690 | // UnionDecl |
---|
691 | template< typename pass_type > |
---|
692 | void PassVisitor< pass_type >::visit( UnionDecl * node ) { |
---|
693 | VISIT_START( node ); |
---|
694 | |
---|
695 | // make up a forward declaration and add it before processing the members |
---|
696 | indexerAddUnionFwd( node ); |
---|
697 | |
---|
698 | { |
---|
699 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
700 | maybeAccept_impl( node->parameters, *this ); |
---|
701 | maybeAccept_impl( node->members , *this ); |
---|
702 | maybeAccept_impl( node->attributes, *this ); |
---|
703 | } |
---|
704 | |
---|
705 | indexerAddUnion( node ); |
---|
706 | |
---|
707 | VISIT_END( node ); |
---|
708 | } |
---|
709 | template< typename pass_type > |
---|
710 | void PassVisitor< pass_type >::visit( const UnionDecl * node ) { |
---|
711 | VISIT_START( node ); |
---|
712 | |
---|
713 | // make up a forward declaration and add it before processing the members |
---|
714 | indexerAddUnionFwd( node ); |
---|
715 | |
---|
716 | { |
---|
717 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
718 | maybeAccept_impl( node->parameters, *this ); |
---|
719 | maybeAccept_impl( node->members , *this ); |
---|
720 | maybeAccept_impl( node->attributes, *this ); |
---|
721 | } |
---|
722 | |
---|
723 | indexerAddUnion( node ); |
---|
724 | |
---|
725 | VISIT_END( node ); |
---|
726 | } |
---|
727 | |
---|
728 | template< typename pass_type > |
---|
729 | Declaration * PassVisitor< pass_type >::mutate( UnionDecl * node ) { |
---|
730 | MUTATE_START( node ); |
---|
731 | |
---|
732 | // make up a forward declaration and add it before processing the members |
---|
733 | indexerAddUnionFwd( node ); |
---|
734 | |
---|
735 | { |
---|
736 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
737 | maybeMutate_impl( node->parameters, *this ); |
---|
738 | maybeMutate_impl( node->members , *this ); |
---|
739 | maybeMutate_impl( node->attributes, *this ); |
---|
740 | } |
---|
741 | |
---|
742 | indexerAddUnion( node ); |
---|
743 | |
---|
744 | MUTATE_END( Declaration, node ); |
---|
745 | } |
---|
746 | |
---|
747 | //-------------------------------------------------------------------------- |
---|
748 | // EnumDecl |
---|
749 | template< typename pass_type > |
---|
750 | void PassVisitor< pass_type >::visit( EnumDecl * node ) { |
---|
751 | VISIT_START( node ); |
---|
752 | |
---|
753 | indexerAddEnum( node ); |
---|
754 | |
---|
755 | // unlike structs, traits, and unions, enums inject their members into the global scope |
---|
756 | // if ( node->base ) maybeAccept_impl( node->base, *this ); // Need this? Maybe not? |
---|
757 | maybeAccept_impl( node->parameters, *this ); |
---|
758 | maybeAccept_impl( node->members , *this ); |
---|
759 | maybeAccept_impl( node->attributes, *this ); |
---|
760 | |
---|
761 | VISIT_END( node ); |
---|
762 | } |
---|
763 | |
---|
764 | template< typename pass_type > |
---|
765 | void PassVisitor< pass_type >::visit( const EnumDecl * node ) { |
---|
766 | VISIT_START( node ); |
---|
767 | |
---|
768 | indexerAddEnum( node ); |
---|
769 | |
---|
770 | // unlike structs, traits, and unions, enums inject their members into the global scope |
---|
771 | maybeAccept_impl( node->parameters, *this ); |
---|
772 | maybeAccept_impl( node->members , *this ); |
---|
773 | maybeAccept_impl( node->attributes, *this ); |
---|
774 | |
---|
775 | VISIT_END( node ); |
---|
776 | } |
---|
777 | |
---|
778 | template< typename pass_type > |
---|
779 | Declaration * PassVisitor< pass_type >::mutate( EnumDecl * node ) { |
---|
780 | MUTATE_START( node ); |
---|
781 | |
---|
782 | indexerAddEnum( node ); |
---|
783 | |
---|
784 | // unlike structs, traits, and unions, enums inject their members into the global scope |
---|
785 | maybeMutate_impl( node->parameters, *this ); |
---|
786 | maybeMutate_impl( node->members , *this ); |
---|
787 | maybeMutate_impl( node->attributes, *this ); |
---|
788 | |
---|
789 | MUTATE_END( Declaration, node ); |
---|
790 | } |
---|
791 | |
---|
792 | //-------------------------------------------------------------------------- |
---|
793 | // TraitDecl |
---|
794 | template< typename pass_type > |
---|
795 | void PassVisitor< pass_type >::visit( TraitDecl * node ) { |
---|
796 | VISIT_START( node ); |
---|
797 | |
---|
798 | { |
---|
799 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
800 | maybeAccept_impl( node->parameters, *this ); |
---|
801 | maybeAccept_impl( node->members , *this ); |
---|
802 | maybeAccept_impl( node->attributes, *this ); |
---|
803 | } |
---|
804 | |
---|
805 | indexerAddTrait( node ); |
---|
806 | |
---|
807 | VISIT_END( node ); |
---|
808 | } |
---|
809 | |
---|
810 | template< typename pass_type > |
---|
811 | void PassVisitor< pass_type >::visit( const TraitDecl * node ) { |
---|
812 | VISIT_START( node ); |
---|
813 | |
---|
814 | { |
---|
815 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
816 | maybeAccept_impl( node->parameters, *this ); |
---|
817 | maybeAccept_impl( node->members , *this ); |
---|
818 | maybeAccept_impl( node->attributes, *this ); |
---|
819 | } |
---|
820 | |
---|
821 | indexerAddTrait( node ); |
---|
822 | |
---|
823 | VISIT_END( node ); |
---|
824 | } |
---|
825 | |
---|
826 | template< typename pass_type > |
---|
827 | Declaration * PassVisitor< pass_type >::mutate( TraitDecl * node ) { |
---|
828 | MUTATE_START( node ); |
---|
829 | |
---|
830 | { |
---|
831 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
832 | maybeMutate_impl( node->parameters, *this ); |
---|
833 | maybeMutate_impl( node->members , *this ); |
---|
834 | maybeMutate_impl( node->attributes, *this ); |
---|
835 | } |
---|
836 | |
---|
837 | indexerAddTrait( node ); |
---|
838 | |
---|
839 | MUTATE_END( Declaration, node ); |
---|
840 | } |
---|
841 | |
---|
842 | //-------------------------------------------------------------------------- |
---|
843 | // TypeDecl |
---|
844 | template< typename pass_type > |
---|
845 | void PassVisitor< pass_type >::visit( TypeDecl * node ) { |
---|
846 | VISIT_START( node ); |
---|
847 | |
---|
848 | { |
---|
849 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
850 | maybeAccept_impl( node->base , *this ); |
---|
851 | } |
---|
852 | |
---|
853 | // see A NOTE ON THE ORDER OF TRAVERSAL, above |
---|
854 | // note that assertions come after the type is added to the symtab, since they are not part of the type proper |
---|
855 | // and may depend on the type itself |
---|
856 | indexerAddType( node ); |
---|
857 | |
---|
858 | maybeAccept_impl( node->assertions, *this ); |
---|
859 | |
---|
860 | indexerScopedAccept( node->init, *this ); |
---|
861 | |
---|
862 | VISIT_END( node ); |
---|
863 | } |
---|
864 | |
---|
865 | |
---|
866 | template< typename pass_type > |
---|
867 | void PassVisitor< pass_type >::visit( const TypeDecl * node ) { |
---|
868 | VISIT_START( node ); |
---|
869 | |
---|
870 | { |
---|
871 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
872 | maybeAccept_impl( node->base , *this ); |
---|
873 | } |
---|
874 | |
---|
875 | // see A NOTE ON THE ORDER OF TRAVERSAL, above |
---|
876 | // note that assertions come after the type is added to the symtab, since they are not part of the type proper |
---|
877 | // and may depend on the type itself |
---|
878 | indexerAddType( node ); |
---|
879 | |
---|
880 | maybeAccept_impl( node->assertions, *this ); |
---|
881 | |
---|
882 | indexerScopedAccept( node->init, *this ); |
---|
883 | |
---|
884 | VISIT_END( node ); |
---|
885 | } |
---|
886 | |
---|
887 | template< typename pass_type > |
---|
888 | Declaration * PassVisitor< pass_type >::mutate( TypeDecl * node ) { |
---|
889 | MUTATE_START( node ); |
---|
890 | |
---|
891 | { |
---|
892 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
893 | maybeMutate_impl( node->base , *this ); |
---|
894 | } |
---|
895 | |
---|
896 | // see A NOTE ON THE ORDER OF TRAVERSAL, above |
---|
897 | // note that assertions come after the type is added to the symtab, since they are not part of the type proper |
---|
898 | // and may depend on the type itself |
---|
899 | indexerAddType( node ); |
---|
900 | |
---|
901 | maybeMutate_impl( node->assertions, *this ); |
---|
902 | |
---|
903 | indexerScopedMutate( node->init, *this ); |
---|
904 | |
---|
905 | MUTATE_END( Declaration, node ); |
---|
906 | } |
---|
907 | |
---|
908 | //-------------------------------------------------------------------------- |
---|
909 | // TypedefDecl |
---|
910 | template< typename pass_type > |
---|
911 | void PassVisitor< pass_type >::visit( TypedefDecl * node ) { |
---|
912 | VISIT_START( node ); |
---|
913 | |
---|
914 | { |
---|
915 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
916 | maybeAccept_impl( node->base , *this ); |
---|
917 | } |
---|
918 | |
---|
919 | indexerAddType( node ); |
---|
920 | |
---|
921 | maybeAccept_impl( node->assertions, *this ); |
---|
922 | |
---|
923 | VISIT_END( node ); |
---|
924 | } |
---|
925 | |
---|
926 | template< typename pass_type > |
---|
927 | void PassVisitor< pass_type >::visit( const TypedefDecl * node ) { |
---|
928 | VISIT_START( node ); |
---|
929 | |
---|
930 | { |
---|
931 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
932 | maybeAccept_impl( node->base , *this ); |
---|
933 | } |
---|
934 | |
---|
935 | indexerAddType( node ); |
---|
936 | |
---|
937 | maybeAccept_impl( node->assertions, *this ); |
---|
938 | |
---|
939 | VISIT_END( node ); |
---|
940 | } |
---|
941 | |
---|
942 | template< typename pass_type > |
---|
943 | Declaration * PassVisitor< pass_type >::mutate( TypedefDecl * node ) { |
---|
944 | MUTATE_START( node ); |
---|
945 | |
---|
946 | { |
---|
947 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
948 | maybeMutate_impl( node->base , *this ); |
---|
949 | } |
---|
950 | |
---|
951 | indexerAddType( node ); |
---|
952 | |
---|
953 | maybeMutate_impl( node->assertions, *this ); |
---|
954 | |
---|
955 | MUTATE_END( Declaration, node ); |
---|
956 | } |
---|
957 | |
---|
958 | //-------------------------------------------------------------------------- |
---|
959 | // AsmDecl |
---|
960 | template< typename pass_type > |
---|
961 | void PassVisitor< pass_type >::visit( AsmDecl * node ) { |
---|
962 | VISIT_START( node ); |
---|
963 | |
---|
964 | maybeAccept_impl( node->stmt, *this ); |
---|
965 | |
---|
966 | VISIT_END( node ); |
---|
967 | } |
---|
968 | |
---|
969 | template< typename pass_type > |
---|
970 | void PassVisitor< pass_type >::visit( const AsmDecl * node ) { |
---|
971 | VISIT_START( node ); |
---|
972 | |
---|
973 | maybeAccept_impl( node->stmt, *this ); |
---|
974 | |
---|
975 | VISIT_END( node ); |
---|
976 | } |
---|
977 | |
---|
978 | template< typename pass_type > |
---|
979 | AsmDecl * PassVisitor< pass_type >::mutate( AsmDecl * node ) { |
---|
980 | MUTATE_START( node ); |
---|
981 | |
---|
982 | maybeMutate_impl( node->stmt, *this ); |
---|
983 | |
---|
984 | MUTATE_END( AsmDecl, node ); |
---|
985 | } |
---|
986 | |
---|
987 | //-------------------------------------------------------------------------- |
---|
988 | // DirectiveDecl |
---|
989 | template< typename pass_type > |
---|
990 | void PassVisitor< pass_type >::visit( DirectiveDecl * node ) { |
---|
991 | VISIT_START( node ); |
---|
992 | |
---|
993 | maybeAccept_impl( node->stmt, *this ); |
---|
994 | |
---|
995 | VISIT_END( node ); |
---|
996 | } |
---|
997 | |
---|
998 | template< typename pass_type > |
---|
999 | void PassVisitor< pass_type >::visit( const DirectiveDecl * node ) { |
---|
1000 | VISIT_START( node ); |
---|
1001 | |
---|
1002 | maybeAccept_impl( node->stmt, *this ); |
---|
1003 | |
---|
1004 | VISIT_END( node ); |
---|
1005 | } |
---|
1006 | |
---|
1007 | template< typename pass_type > |
---|
1008 | DirectiveDecl * PassVisitor< pass_type >::mutate( DirectiveDecl * node ) { |
---|
1009 | MUTATE_START( node ); |
---|
1010 | |
---|
1011 | maybeMutate_impl( node->stmt, *this ); |
---|
1012 | |
---|
1013 | MUTATE_END( DirectiveDecl, node ); |
---|
1014 | } |
---|
1015 | |
---|
1016 | //-------------------------------------------------------------------------- |
---|
1017 | // StaticAssertDecl |
---|
1018 | template< typename pass_type > |
---|
1019 | void PassVisitor< pass_type >::visit( StaticAssertDecl * node ) { |
---|
1020 | VISIT_START( node ); |
---|
1021 | |
---|
1022 | node->condition = visitExpression( node->condition ); |
---|
1023 | maybeAccept_impl( node->message, *this ); |
---|
1024 | |
---|
1025 | VISIT_END( node ); |
---|
1026 | } |
---|
1027 | |
---|
1028 | template< typename pass_type > |
---|
1029 | void PassVisitor< pass_type >::visit( const StaticAssertDecl * node ) { |
---|
1030 | VISIT_START( node ); |
---|
1031 | |
---|
1032 | visitExpression( node->condition ); |
---|
1033 | maybeAccept_impl( node->message, *this ); |
---|
1034 | |
---|
1035 | VISIT_END( node ); |
---|
1036 | } |
---|
1037 | |
---|
1038 | template< typename pass_type > |
---|
1039 | StaticAssertDecl * PassVisitor< pass_type >::mutate( StaticAssertDecl * node ) { |
---|
1040 | MUTATE_START( node ); |
---|
1041 | |
---|
1042 | node->condition = mutateExpression( node->condition ); |
---|
1043 | maybeMutate_impl( node->message, *this ); |
---|
1044 | |
---|
1045 | MUTATE_END( StaticAssertDecl, node ); |
---|
1046 | } |
---|
1047 | |
---|
1048 | //-------------------------------------------------------------------------- |
---|
1049 | // InlineMemberDecl |
---|
1050 | template< typename pass_type > |
---|
1051 | void PassVisitor< pass_type >::visit( InlineMemberDecl * node ) { |
---|
1052 | VISIT_START( node ); |
---|
1053 | |
---|
1054 | maybeAccept_impl( node->type, *this ); |
---|
1055 | |
---|
1056 | VISIT_END( node ); |
---|
1057 | } |
---|
1058 | |
---|
1059 | template< typename pass_type > |
---|
1060 | void PassVisitor< pass_type >::visit( const InlineMemberDecl * node ) { |
---|
1061 | VISIT_START( node ); |
---|
1062 | |
---|
1063 | maybeAccept_impl( node->type, *this ); |
---|
1064 | |
---|
1065 | VISIT_END( node ); |
---|
1066 | } |
---|
1067 | |
---|
1068 | template< typename pass_type > |
---|
1069 | DeclarationWithType * PassVisitor< pass_type >::mutate( InlineMemberDecl * node ) { |
---|
1070 | MUTATE_START( node ); |
---|
1071 | |
---|
1072 | maybeMutate_impl( node->type, *this ); |
---|
1073 | |
---|
1074 | MUTATE_END( DeclarationWithType, node ); |
---|
1075 | } |
---|
1076 | |
---|
1077 | //-------------------------------------------------------------------------- |
---|
1078 | // CompoundStmt |
---|
1079 | template< typename pass_type > |
---|
1080 | void PassVisitor< pass_type >::visit( CompoundStmt * node ) { |
---|
1081 | VISIT_START( node ); |
---|
1082 | { |
---|
1083 | // Do not enter a new scope if atFunctionTop is true, don't leave one either. |
---|
1084 | ValueGuard< bool > oldAtFunctionTop( atFunctionTop ); |
---|
1085 | auto guard1 = makeFuncGuard( [this, go = !atFunctionTop]() { if ( go ) indexerScopeEnter(); }, [this, go = !atFunctionTop]() { if ( go ) indexerScopeLeave(); } ); |
---|
1086 | auto guard2 = makeFuncGuard( [this]() { call_beginScope(); }, [this]() { call_endScope(); } ); |
---|
1087 | atFunctionTop = false; |
---|
1088 | visitStatementList( node->kids ); |
---|
1089 | } |
---|
1090 | VISIT_END( node ); |
---|
1091 | } |
---|
1092 | |
---|
1093 | template< typename pass_type > |
---|
1094 | void PassVisitor< pass_type >::visit( const CompoundStmt * node ) { |
---|
1095 | VISIT_START( node ); |
---|
1096 | { |
---|
1097 | // Do not enter a new scope if atFunctionTop is true, don't leave one either. |
---|
1098 | ValueGuard< bool > oldAtFunctionTop( atFunctionTop ); |
---|
1099 | auto guard1 = makeFuncGuard( [this, go = !atFunctionTop]() { if ( go ) indexerScopeEnter(); }, [this, go = !atFunctionTop]() { if ( go ) indexerScopeLeave(); } ); |
---|
1100 | auto guard2 = makeFuncGuard( [this]() { call_beginScope(); }, [this]() { call_endScope(); } ); |
---|
1101 | atFunctionTop = false; |
---|
1102 | visitStatementList( node->kids ); |
---|
1103 | } |
---|
1104 | VISIT_END( node ); |
---|
1105 | } |
---|
1106 | |
---|
1107 | template< typename pass_type > |
---|
1108 | CompoundStmt * PassVisitor< pass_type >::mutate( CompoundStmt * node ) { |
---|
1109 | MUTATE_START( node ); |
---|
1110 | { |
---|
1111 | // Do not enter a new scope if atFunctionTop is true, don't leave one either. |
---|
1112 | ValueGuard< bool > oldAtFunctionTop( atFunctionTop ); |
---|
1113 | auto guard1 = makeFuncGuard( [this, go = !atFunctionTop]() { if ( go ) indexerScopeEnter(); }, [this, go = !atFunctionTop]() { if ( go ) indexerScopeLeave(); } ); |
---|
1114 | auto guard2 = makeFuncGuard( [this]() { call_beginScope(); }, [this]() { call_endScope(); } ); |
---|
1115 | atFunctionTop = false; |
---|
1116 | mutateStatementList( node->kids ); |
---|
1117 | } |
---|
1118 | MUTATE_END( CompoundStmt, node ); |
---|
1119 | } |
---|
1120 | |
---|
1121 | //-------------------------------------------------------------------------- |
---|
1122 | // ExprStmt |
---|
1123 | template< typename pass_type > |
---|
1124 | void PassVisitor< pass_type >::visit( ExprStmt * node ) { |
---|
1125 | VISIT_START( node ); |
---|
1126 | |
---|
1127 | visitExpression( node->expr ); |
---|
1128 | |
---|
1129 | VISIT_END( node ); |
---|
1130 | } |
---|
1131 | |
---|
1132 | template< typename pass_type > |
---|
1133 | void PassVisitor< pass_type >::visit( const ExprStmt * node ) { |
---|
1134 | VISIT_START( node ); |
---|
1135 | |
---|
1136 | visitExpression( node->expr ); |
---|
1137 | |
---|
1138 | VISIT_END( node ); |
---|
1139 | } |
---|
1140 | |
---|
1141 | template< typename pass_type > |
---|
1142 | Statement * PassVisitor< pass_type >::mutate( ExprStmt * node ) { |
---|
1143 | MUTATE_START( node ); |
---|
1144 | |
---|
1145 | node->expr = mutateExpression( node->expr ); |
---|
1146 | |
---|
1147 | MUTATE_END( Statement, node ); |
---|
1148 | } |
---|
1149 | |
---|
1150 | //-------------------------------------------------------------------------- |
---|
1151 | // AsmStmt |
---|
1152 | template< typename pass_type > |
---|
1153 | void PassVisitor< pass_type >::visit( AsmStmt * node ) { |
---|
1154 | VISIT_START( node ) |
---|
1155 | |
---|
1156 | maybeAccept_impl( node->instruction, *this ); |
---|
1157 | maybeAccept_impl( node->output, *this ); |
---|
1158 | maybeAccept_impl( node->input, *this ); |
---|
1159 | maybeAccept_impl( node->clobber, *this ); |
---|
1160 | |
---|
1161 | VISIT_END( node ); |
---|
1162 | } |
---|
1163 | |
---|
1164 | template< typename pass_type > |
---|
1165 | void PassVisitor< pass_type >::visit( const AsmStmt * node ) { |
---|
1166 | VISIT_START( node ) |
---|
1167 | |
---|
1168 | maybeAccept_impl( node->instruction, *this ); |
---|
1169 | maybeAccept_impl( node->output, *this ); |
---|
1170 | maybeAccept_impl( node->input, *this ); |
---|
1171 | maybeAccept_impl( node->clobber, *this ); |
---|
1172 | |
---|
1173 | VISIT_END( node ); |
---|
1174 | } |
---|
1175 | |
---|
1176 | template< typename pass_type > |
---|
1177 | Statement * PassVisitor< pass_type >::mutate( AsmStmt * node ) { |
---|
1178 | MUTATE_START( node ); |
---|
1179 | |
---|
1180 | maybeMutate_impl( node->instruction, *this ); |
---|
1181 | maybeMutate_impl( node->output, *this ); |
---|
1182 | maybeMutate_impl( node->input, *this ); |
---|
1183 | maybeMutate_impl( node->clobber, *this ); |
---|
1184 | |
---|
1185 | MUTATE_END( Statement, node ); |
---|
1186 | } |
---|
1187 | |
---|
1188 | //-------------------------------------------------------------------------- |
---|
1189 | // AsmStmt |
---|
1190 | template< typename pass_type > |
---|
1191 | void PassVisitor< pass_type >::visit( DirectiveStmt * node ) { |
---|
1192 | VISIT_START( node ) |
---|
1193 | |
---|
1194 | VISIT_END( node ); |
---|
1195 | } |
---|
1196 | |
---|
1197 | template< typename pass_type > |
---|
1198 | void PassVisitor< pass_type >::visit( const DirectiveStmt * node ) { |
---|
1199 | VISIT_START( node ) |
---|
1200 | |
---|
1201 | VISIT_END( node ); |
---|
1202 | } |
---|
1203 | |
---|
1204 | template< typename pass_type > |
---|
1205 | Statement * PassVisitor< pass_type >::mutate( DirectiveStmt * node ) { |
---|
1206 | MUTATE_START( node ); |
---|
1207 | |
---|
1208 | MUTATE_END( Statement, node ); |
---|
1209 | } |
---|
1210 | |
---|
1211 | //-------------------------------------------------------------------------- |
---|
1212 | // IfStmt |
---|
1213 | template< typename pass_type > |
---|
1214 | void PassVisitor< pass_type >::visit( IfStmt * node ) { |
---|
1215 | VISIT_START( node ); |
---|
1216 | { |
---|
1217 | // if statements introduce a level of scope (for the initialization) |
---|
1218 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
1219 | maybeAccept_impl( node->initialization, *this ); |
---|
1220 | visitExpression ( node->condition ); |
---|
1221 | node->then = visitStatement( node->then ); |
---|
1222 | node->else_ = visitStatement( node->else_ ); |
---|
1223 | } |
---|
1224 | VISIT_END( node ); |
---|
1225 | } |
---|
1226 | |
---|
1227 | template< typename pass_type > |
---|
1228 | void PassVisitor< pass_type >::visit( const IfStmt * node ) { |
---|
1229 | VISIT_START( node ); |
---|
1230 | { |
---|
1231 | // if statements introduce a level of scope (for the initialization) |
---|
1232 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
1233 | maybeAccept_impl( node->initialization, *this ); |
---|
1234 | visitExpression ( node->condition ); |
---|
1235 | visitStatement ( node->then ); |
---|
1236 | visitStatement ( node->else_ ); |
---|
1237 | } |
---|
1238 | VISIT_END( node ); |
---|
1239 | } |
---|
1240 | |
---|
1241 | template< typename pass_type > |
---|
1242 | Statement * PassVisitor< pass_type >::mutate( IfStmt * node ) { |
---|
1243 | MUTATE_START( node ); |
---|
1244 | { |
---|
1245 | // if statements introduce a level of scope (for the initialization) |
---|
1246 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
1247 | maybeMutate_impl( node->initialization, *this ); |
---|
1248 | node->condition = mutateExpression( node->condition ); |
---|
1249 | node->then = mutateStatement ( node->then ); |
---|
1250 | node->else_ = mutateStatement ( node->else_ ); |
---|
1251 | } |
---|
1252 | MUTATE_END( Statement, node ); |
---|
1253 | } |
---|
1254 | |
---|
1255 | //-------------------------------------------------------------------------- |
---|
1256 | // WhileDoStmt |
---|
1257 | template< typename pass_type > |
---|
1258 | void PassVisitor< pass_type >::visit( WhileDoStmt * node ) { |
---|
1259 | VISIT_START( node ); |
---|
1260 | |
---|
1261 | { |
---|
1262 | // while statements introduce a level of scope (for the initialization) |
---|
1263 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
1264 | maybeAccept_impl( node->initialization, *this ); |
---|
1265 | visitExpression ( node->condition ); |
---|
1266 | node->body = visitStatement( node->body ); |
---|
1267 | } |
---|
1268 | |
---|
1269 | VISIT_END( node ); |
---|
1270 | } |
---|
1271 | |
---|
1272 | template< typename pass_type > |
---|
1273 | void PassVisitor< pass_type >::visit( const WhileDoStmt * node ) { |
---|
1274 | VISIT_START( node ); |
---|
1275 | |
---|
1276 | { |
---|
1277 | // while statements introduce a level of scope (for the initialization) |
---|
1278 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
1279 | maybeAccept_impl( node->initialization, *this ); |
---|
1280 | visitExpression ( node->condition ); |
---|
1281 | visitStatement ( node->body ); |
---|
1282 | } |
---|
1283 | |
---|
1284 | VISIT_END( node ); |
---|
1285 | } |
---|
1286 | |
---|
1287 | template< typename pass_type > |
---|
1288 | Statement * PassVisitor< pass_type >::mutate( WhileDoStmt * node ) { |
---|
1289 | MUTATE_START( node ); |
---|
1290 | |
---|
1291 | { |
---|
1292 | // while statements introduce a level of scope (for the initialization) |
---|
1293 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
1294 | maybeMutate_impl( node->initialization, *this ); |
---|
1295 | node->condition = mutateExpression( node->condition ); |
---|
1296 | node->body = mutateStatement ( node->body ); |
---|
1297 | } |
---|
1298 | |
---|
1299 | |
---|
1300 | MUTATE_END( Statement, node ); |
---|
1301 | } |
---|
1302 | |
---|
1303 | //-------------------------------------------------------------------------- |
---|
1304 | // ForStmt |
---|
1305 | template< typename pass_type > |
---|
1306 | void PassVisitor< pass_type >::visit( ForStmt * node ) { |
---|
1307 | VISIT_START( node ); |
---|
1308 | { |
---|
1309 | // for statements introduce a level of scope (for the initialization) |
---|
1310 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
1311 | maybeAccept_impl( node->initialization, *this ); |
---|
1312 | visitExpression( node->condition ); |
---|
1313 | visitExpression( node->increment ); |
---|
1314 | node->body = visitStatement( node->body ); |
---|
1315 | } |
---|
1316 | VISIT_END( node ); |
---|
1317 | } |
---|
1318 | |
---|
1319 | template< typename pass_type > |
---|
1320 | void PassVisitor< pass_type >::visit( const ForStmt * node ) { |
---|
1321 | VISIT_START( node ); |
---|
1322 | { |
---|
1323 | // for statements introduce a level of scope (for the initialization) |
---|
1324 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
1325 | maybeAccept_impl( node->initialization, *this ); |
---|
1326 | visitExpression( node->condition ); |
---|
1327 | visitExpression( node->increment ); |
---|
1328 | visitStatement ( node->body ); |
---|
1329 | } |
---|
1330 | VISIT_END( node ); |
---|
1331 | } |
---|
1332 | |
---|
1333 | template< typename pass_type > |
---|
1334 | Statement * PassVisitor< pass_type >::mutate( ForStmt * node ) { |
---|
1335 | MUTATE_START( node ); |
---|
1336 | { |
---|
1337 | // for statements introduce a level of scope (for the initialization) |
---|
1338 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
1339 | maybeMutate_impl( node->initialization, *this ); |
---|
1340 | node->condition = mutateExpression( node->condition ); |
---|
1341 | node->increment = mutateExpression( node->increment ); |
---|
1342 | node->body = mutateStatement ( node->body ); |
---|
1343 | } |
---|
1344 | MUTATE_END( Statement, node ); |
---|
1345 | } |
---|
1346 | |
---|
1347 | //-------------------------------------------------------------------------- |
---|
1348 | // SwitchStmt |
---|
1349 | template< typename pass_type > |
---|
1350 | void PassVisitor< pass_type >::visit( SwitchStmt * node ) { |
---|
1351 | VISIT_START( node ); |
---|
1352 | |
---|
1353 | visitExpression ( node->condition ); |
---|
1354 | visitStatementList( node->statements ); |
---|
1355 | |
---|
1356 | VISIT_END( node ); |
---|
1357 | } |
---|
1358 | |
---|
1359 | template< typename pass_type > |
---|
1360 | void PassVisitor< pass_type >::visit( const SwitchStmt * node ) { |
---|
1361 | VISIT_START( node ); |
---|
1362 | |
---|
1363 | visitExpression ( node->condition ); |
---|
1364 | visitStatementList( node->statements ); |
---|
1365 | |
---|
1366 | VISIT_END( node ); |
---|
1367 | } |
---|
1368 | |
---|
1369 | template< typename pass_type > |
---|
1370 | Statement * PassVisitor< pass_type >::mutate( SwitchStmt * node ) { |
---|
1371 | MUTATE_START( node ); |
---|
1372 | |
---|
1373 | node->condition = mutateExpression( node->condition ); |
---|
1374 | mutateStatementList( node->statements ); |
---|
1375 | |
---|
1376 | MUTATE_END( Statement, node ); |
---|
1377 | } |
---|
1378 | |
---|
1379 | //-------------------------------------------------------------------------- |
---|
1380 | // CaseStmt |
---|
1381 | template< typename pass_type > |
---|
1382 | void PassVisitor< pass_type >::visit( CaseStmt * node ) { |
---|
1383 | VISIT_START( node ); |
---|
1384 | |
---|
1385 | visitExpression ( node->condition ); |
---|
1386 | visitStatementList( node->stmts ); |
---|
1387 | |
---|
1388 | VISIT_END( node ); |
---|
1389 | } |
---|
1390 | |
---|
1391 | template< typename pass_type > |
---|
1392 | void PassVisitor< pass_type >::visit( const CaseStmt * node ) { |
---|
1393 | VISIT_START( node ); |
---|
1394 | |
---|
1395 | visitExpression ( node->condition ); |
---|
1396 | visitStatementList( node->stmts ); |
---|
1397 | |
---|
1398 | VISIT_END( node ); |
---|
1399 | } |
---|
1400 | |
---|
1401 | template< typename pass_type > |
---|
1402 | Statement * PassVisitor< pass_type >::mutate( CaseStmt * node ) { |
---|
1403 | MUTATE_START( node ); |
---|
1404 | |
---|
1405 | node->condition = mutateExpression( node->condition ); |
---|
1406 | mutateStatementList( node->stmts ); |
---|
1407 | |
---|
1408 | MUTATE_END( Statement, node ); |
---|
1409 | } |
---|
1410 | |
---|
1411 | //-------------------------------------------------------------------------- |
---|
1412 | // BranchStmt |
---|
1413 | template< typename pass_type > |
---|
1414 | void PassVisitor< pass_type >::visit( BranchStmt * node ) { |
---|
1415 | VISIT_START( node ); |
---|
1416 | VISIT_END( node ); |
---|
1417 | } |
---|
1418 | |
---|
1419 | template< typename pass_type > |
---|
1420 | void PassVisitor< pass_type >::visit( const BranchStmt * node ) { |
---|
1421 | VISIT_START( node ); |
---|
1422 | VISIT_END( node ); |
---|
1423 | } |
---|
1424 | |
---|
1425 | template< typename pass_type > |
---|
1426 | Statement * PassVisitor< pass_type >::mutate( BranchStmt * node ) { |
---|
1427 | MUTATE_START( node ); |
---|
1428 | MUTATE_END( Statement, node ); |
---|
1429 | } |
---|
1430 | |
---|
1431 | //-------------------------------------------------------------------------- |
---|
1432 | // ReturnStmt |
---|
1433 | template< typename pass_type > |
---|
1434 | void PassVisitor< pass_type >::visit( ReturnStmt * node ) { |
---|
1435 | VISIT_START( node ); |
---|
1436 | |
---|
1437 | visitExpression( node->expr ); |
---|
1438 | |
---|
1439 | VISIT_END( node ); |
---|
1440 | } |
---|
1441 | |
---|
1442 | template< typename pass_type > |
---|
1443 | void PassVisitor< pass_type >::visit( const ReturnStmt * node ) { |
---|
1444 | VISIT_START( node ); |
---|
1445 | |
---|
1446 | visitExpression( node->expr ); |
---|
1447 | |
---|
1448 | VISIT_END( node ); |
---|
1449 | } |
---|
1450 | |
---|
1451 | template< typename pass_type > |
---|
1452 | Statement * PassVisitor< pass_type >::mutate( ReturnStmt * node ) { |
---|
1453 | MUTATE_START( node ); |
---|
1454 | |
---|
1455 | node->expr = mutateExpression( node->expr ); |
---|
1456 | |
---|
1457 | MUTATE_END( Statement, node ); |
---|
1458 | } |
---|
1459 | |
---|
1460 | //-------------------------------------------------------------------------- |
---|
1461 | // ThrowStmt |
---|
1462 | template< typename pass_type > |
---|
1463 | void PassVisitor< pass_type >::visit( ThrowStmt * node ) { |
---|
1464 | VISIT_START( node ); |
---|
1465 | |
---|
1466 | maybeAccept_impl( node->expr, *this ); |
---|
1467 | maybeAccept_impl( node->target, *this ); |
---|
1468 | |
---|
1469 | VISIT_END( node ); |
---|
1470 | } |
---|
1471 | |
---|
1472 | template< typename pass_type > |
---|
1473 | void PassVisitor< pass_type >::visit( const ThrowStmt * node ) { |
---|
1474 | VISIT_START( node ); |
---|
1475 | |
---|
1476 | maybeAccept_impl( node->expr, *this ); |
---|
1477 | maybeAccept_impl( node->target, *this ); |
---|
1478 | |
---|
1479 | VISIT_END( node ); |
---|
1480 | } |
---|
1481 | |
---|
1482 | template< typename pass_type > |
---|
1483 | Statement * PassVisitor< pass_type >::mutate( ThrowStmt * node ) { |
---|
1484 | MUTATE_START( node ); |
---|
1485 | |
---|
1486 | maybeMutate_impl( node->expr, *this ); |
---|
1487 | maybeMutate_impl( node->target, *this ); |
---|
1488 | |
---|
1489 | MUTATE_END( Statement, node ); |
---|
1490 | } |
---|
1491 | |
---|
1492 | //-------------------------------------------------------------------------- |
---|
1493 | // TryStmt |
---|
1494 | template< typename pass_type > |
---|
1495 | void PassVisitor< pass_type >::visit( TryStmt * node ) { |
---|
1496 | VISIT_START( node ); |
---|
1497 | |
---|
1498 | maybeAccept_impl( node->block , *this ); |
---|
1499 | maybeAccept_impl( node->handlers , *this ); |
---|
1500 | maybeAccept_impl( node->finallyBlock, *this ); |
---|
1501 | |
---|
1502 | VISIT_END( node ); |
---|
1503 | } |
---|
1504 | |
---|
1505 | template< typename pass_type > |
---|
1506 | void PassVisitor< pass_type >::visit( const TryStmt * node ) { |
---|
1507 | VISIT_START( node ); |
---|
1508 | |
---|
1509 | maybeAccept_impl( node->block , *this ); |
---|
1510 | maybeAccept_impl( node->handlers , *this ); |
---|
1511 | maybeAccept_impl( node->finallyBlock, *this ); |
---|
1512 | |
---|
1513 | VISIT_END( node ); |
---|
1514 | } |
---|
1515 | |
---|
1516 | template< typename pass_type > |
---|
1517 | Statement * PassVisitor< pass_type >::mutate( TryStmt * node ) { |
---|
1518 | MUTATE_START( node ); |
---|
1519 | |
---|
1520 | maybeMutate_impl( node->block , *this ); |
---|
1521 | maybeMutate_impl( node->handlers , *this ); |
---|
1522 | maybeMutate_impl( node->finallyBlock, *this ); |
---|
1523 | |
---|
1524 | MUTATE_END( Statement, node ); |
---|
1525 | } |
---|
1526 | |
---|
1527 | //-------------------------------------------------------------------------- |
---|
1528 | // CatchStmt |
---|
1529 | template< typename pass_type > |
---|
1530 | void PassVisitor< pass_type >::visit( CatchStmt * node ) { |
---|
1531 | VISIT_START( node ); |
---|
1532 | { |
---|
1533 | // catch statements introduce a level of scope (for the caught exception) |
---|
1534 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
1535 | maybeAccept_impl( node->decl, *this ); |
---|
1536 | node->cond = visitExpression( node->cond ); |
---|
1537 | node->body = visitStatement ( node->body ); |
---|
1538 | } |
---|
1539 | VISIT_END( node ); |
---|
1540 | } |
---|
1541 | |
---|
1542 | template< typename pass_type > |
---|
1543 | void PassVisitor< pass_type >::visit( const CatchStmt * node ) { |
---|
1544 | VISIT_START( node ); |
---|
1545 | { |
---|
1546 | // catch statements introduce a level of scope (for the caught exception) |
---|
1547 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
1548 | maybeAccept_impl( node->decl, *this ); |
---|
1549 | visitExpression ( node->cond ); |
---|
1550 | visitStatement ( node->body ); |
---|
1551 | } |
---|
1552 | VISIT_END( node ); |
---|
1553 | } |
---|
1554 | |
---|
1555 | template< typename pass_type > |
---|
1556 | Statement * PassVisitor< pass_type >::mutate( CatchStmt * node ) { |
---|
1557 | MUTATE_START( node ); |
---|
1558 | { |
---|
1559 | // catch statements introduce a level of scope (for the caught exception) |
---|
1560 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
1561 | maybeMutate_impl( node->decl, *this ); |
---|
1562 | node->cond = mutateExpression( node->cond ); |
---|
1563 | node->body = mutateStatement ( node->body ); |
---|
1564 | } |
---|
1565 | MUTATE_END( Statement, node ); |
---|
1566 | } |
---|
1567 | |
---|
1568 | //-------------------------------------------------------------------------- |
---|
1569 | // FinallyStmt |
---|
1570 | template< typename pass_type > |
---|
1571 | void PassVisitor< pass_type >::visit( FinallyStmt * node ) { |
---|
1572 | VISIT_START( node ); |
---|
1573 | |
---|
1574 | maybeAccept_impl( node->block, *this ); |
---|
1575 | |
---|
1576 | VISIT_END( node ); |
---|
1577 | } |
---|
1578 | |
---|
1579 | template< typename pass_type > |
---|
1580 | void PassVisitor< pass_type >::visit( const FinallyStmt * node ) { |
---|
1581 | VISIT_START( node ); |
---|
1582 | |
---|
1583 | maybeAccept_impl( node->block, *this ); |
---|
1584 | |
---|
1585 | VISIT_END( node ); |
---|
1586 | } |
---|
1587 | |
---|
1588 | template< typename pass_type > |
---|
1589 | Statement * PassVisitor< pass_type >::mutate( FinallyStmt * node ) { |
---|
1590 | MUTATE_START( node ); |
---|
1591 | |
---|
1592 | maybeMutate_impl( node->block, *this ); |
---|
1593 | |
---|
1594 | MUTATE_END( Statement, node ); |
---|
1595 | } |
---|
1596 | |
---|
1597 | //-------------------------------------------------------------------------- |
---|
1598 | // SuspendStmt |
---|
1599 | template< typename pass_type > |
---|
1600 | void PassVisitor< pass_type >::visit( SuspendStmt * node ) { |
---|
1601 | VISIT_START( node ); |
---|
1602 | |
---|
1603 | maybeAccept_impl( node->then , *this ); |
---|
1604 | |
---|
1605 | VISIT_END( node ); |
---|
1606 | } |
---|
1607 | |
---|
1608 | template< typename pass_type > |
---|
1609 | void PassVisitor< pass_type >::visit( const SuspendStmt * node ) { |
---|
1610 | VISIT_START( node ); |
---|
1611 | |
---|
1612 | maybeAccept_impl( node->then , *this ); |
---|
1613 | |
---|
1614 | VISIT_END( node ); |
---|
1615 | } |
---|
1616 | |
---|
1617 | template< typename pass_type > |
---|
1618 | Statement * PassVisitor< pass_type >::mutate( SuspendStmt * node ) { |
---|
1619 | MUTATE_START( node ); |
---|
1620 | |
---|
1621 | maybeMutate_impl( node->then , *this ); |
---|
1622 | |
---|
1623 | MUTATE_END( Statement, node ); |
---|
1624 | } |
---|
1625 | |
---|
1626 | //-------------------------------------------------------------------------- |
---|
1627 | // WaitForStmt |
---|
1628 | template< typename pass_type > |
---|
1629 | void PassVisitor< pass_type >::visit( WaitForStmt * node ) { |
---|
1630 | VISIT_START( node ); |
---|
1631 | |
---|
1632 | for( auto & clause : node->clauses ) { |
---|
1633 | maybeAccept_impl( clause.target.function, *this ); |
---|
1634 | maybeAccept_impl( clause.target.arguments, *this ); |
---|
1635 | |
---|
1636 | maybeAccept_impl( clause.statement, *this ); |
---|
1637 | maybeAccept_impl( clause.condition, *this ); |
---|
1638 | } |
---|
1639 | |
---|
1640 | maybeAccept_impl( node->timeout.time, *this ); |
---|
1641 | maybeAccept_impl( node->timeout.statement, *this ); |
---|
1642 | maybeAccept_impl( node->timeout.condition, *this ); |
---|
1643 | maybeAccept_impl( node->orelse.statement, *this ); |
---|
1644 | maybeAccept_impl( node->orelse.condition, *this ); |
---|
1645 | |
---|
1646 | VISIT_END( node ); |
---|
1647 | } |
---|
1648 | |
---|
1649 | template< typename pass_type > |
---|
1650 | void PassVisitor< pass_type >::visit( const WaitForStmt * node ) { |
---|
1651 | VISIT_START( node ); |
---|
1652 | |
---|
1653 | for( auto & clause : node->clauses ) { |
---|
1654 | maybeAccept_impl( clause.target.function, *this ); |
---|
1655 | maybeAccept_impl( clause.target.arguments, *this ); |
---|
1656 | |
---|
1657 | maybeAccept_impl( clause.statement, *this ); |
---|
1658 | maybeAccept_impl( clause.condition, *this ); |
---|
1659 | } |
---|
1660 | |
---|
1661 | maybeAccept_impl( node->timeout.time, *this ); |
---|
1662 | maybeAccept_impl( node->timeout.statement, *this ); |
---|
1663 | maybeAccept_impl( node->timeout.condition, *this ); |
---|
1664 | maybeAccept_impl( node->orelse.statement, *this ); |
---|
1665 | maybeAccept_impl( node->orelse.condition, *this ); |
---|
1666 | |
---|
1667 | VISIT_END( node ); |
---|
1668 | } |
---|
1669 | |
---|
1670 | template< typename pass_type > |
---|
1671 | Statement * PassVisitor< pass_type >::mutate( WaitForStmt * node ) { |
---|
1672 | MUTATE_START( node ); |
---|
1673 | |
---|
1674 | for( auto & clause : node->clauses ) { |
---|
1675 | maybeMutate_impl( clause.target.function, *this ); |
---|
1676 | maybeMutate_impl( clause.target.arguments, *this ); |
---|
1677 | |
---|
1678 | maybeMutate_impl( clause.statement, *this ); |
---|
1679 | maybeMutate_impl( clause.condition, *this ); |
---|
1680 | } |
---|
1681 | |
---|
1682 | maybeMutate_impl( node->timeout.time, *this ); |
---|
1683 | maybeMutate_impl( node->timeout.statement, *this ); |
---|
1684 | maybeMutate_impl( node->timeout.condition, *this ); |
---|
1685 | maybeMutate_impl( node->orelse.statement, *this ); |
---|
1686 | maybeMutate_impl( node->orelse.condition, *this ); |
---|
1687 | |
---|
1688 | MUTATE_END( Statement, node ); |
---|
1689 | } |
---|
1690 | |
---|
1691 | |
---|
1692 | |
---|
1693 | //-------------------------------------------------------------------------- |
---|
1694 | // WithStmt |
---|
1695 | template< typename pass_type > |
---|
1696 | void PassVisitor< pass_type >::visit( WithStmt * node ) { |
---|
1697 | VISIT_START( node ); |
---|
1698 | maybeAccept_impl( node->exprs, *this ); |
---|
1699 | { |
---|
1700 | // catch statements introduce a level of scope (for the caught exception) |
---|
1701 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
1702 | indexerAddWith( node->exprs, node ); |
---|
1703 | maybeAccept_impl( node->stmt, *this ); |
---|
1704 | } |
---|
1705 | VISIT_END( node ); |
---|
1706 | } |
---|
1707 | |
---|
1708 | template< typename pass_type > |
---|
1709 | void PassVisitor< pass_type >::visit( const WithStmt * node ) { |
---|
1710 | VISIT_START( node ); |
---|
1711 | maybeAccept_impl( node->exprs, *this ); |
---|
1712 | { |
---|
1713 | // catch statements introduce a level of scope (for the caught exception) |
---|
1714 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
1715 | indexerAddWith( node->exprs, node ); |
---|
1716 | maybeAccept_impl( node->stmt, *this ); |
---|
1717 | } |
---|
1718 | VISIT_END( node ); |
---|
1719 | } |
---|
1720 | |
---|
1721 | template< typename pass_type > |
---|
1722 | Declaration * PassVisitor< pass_type >::mutate( WithStmt * node ) { |
---|
1723 | MUTATE_START( node ); |
---|
1724 | maybeMutate_impl( node->exprs, *this ); |
---|
1725 | { |
---|
1726 | // catch statements introduce a level of scope (for the caught exception) |
---|
1727 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
1728 | indexerAddWith( node->exprs, node ); |
---|
1729 | maybeMutate_impl( node->stmt, *this ); |
---|
1730 | } |
---|
1731 | MUTATE_END( Declaration, node ); |
---|
1732 | } |
---|
1733 | |
---|
1734 | //-------------------------------------------------------------------------- |
---|
1735 | // NullStmt |
---|
1736 | template< typename pass_type > |
---|
1737 | void PassVisitor< pass_type >::visit( NullStmt * node ) { |
---|
1738 | VISIT_START( node ); |
---|
1739 | VISIT_END( node ); |
---|
1740 | } |
---|
1741 | |
---|
1742 | template< typename pass_type > |
---|
1743 | void PassVisitor< pass_type >::visit( const NullStmt * node ) { |
---|
1744 | VISIT_START( node ); |
---|
1745 | VISIT_END( node ); |
---|
1746 | } |
---|
1747 | |
---|
1748 | template< typename pass_type > |
---|
1749 | NullStmt * PassVisitor< pass_type >::mutate( NullStmt * node ) { |
---|
1750 | MUTATE_START( node ); |
---|
1751 | MUTATE_END( NullStmt, node ); |
---|
1752 | } |
---|
1753 | |
---|
1754 | //-------------------------------------------------------------------------- |
---|
1755 | // DeclStmt |
---|
1756 | template< typename pass_type > |
---|
1757 | void PassVisitor< pass_type >::visit( DeclStmt * node ) { |
---|
1758 | VISIT_START( node ); |
---|
1759 | |
---|
1760 | maybeAccept_impl( node->decl, *this ); |
---|
1761 | |
---|
1762 | VISIT_END( node ); |
---|
1763 | } |
---|
1764 | |
---|
1765 | template< typename pass_type > |
---|
1766 | void PassVisitor< pass_type >::visit( const DeclStmt * node ) { |
---|
1767 | VISIT_START( node ); |
---|
1768 | |
---|
1769 | maybeAccept_impl( node->decl, *this ); |
---|
1770 | |
---|
1771 | VISIT_END( node ); |
---|
1772 | } |
---|
1773 | |
---|
1774 | template< typename pass_type > |
---|
1775 | Statement * PassVisitor< pass_type >::mutate( DeclStmt * node ) { |
---|
1776 | MUTATE_START( node ); |
---|
1777 | |
---|
1778 | maybeMutate_impl( node->decl, *this ); |
---|
1779 | |
---|
1780 | MUTATE_END( Statement, node ); |
---|
1781 | } |
---|
1782 | |
---|
1783 | //-------------------------------------------------------------------------- |
---|
1784 | // ImplicitCtorDtorStmt |
---|
1785 | template< typename pass_type > |
---|
1786 | void PassVisitor< pass_type >::visit( ImplicitCtorDtorStmt * node ) { |
---|
1787 | VISIT_START( node ); |
---|
1788 | |
---|
1789 | maybeAccept_impl( node->callStmt, *this ); |
---|
1790 | |
---|
1791 | VISIT_END( node ); |
---|
1792 | } |
---|
1793 | |
---|
1794 | template< typename pass_type > |
---|
1795 | void PassVisitor< pass_type >::visit( const ImplicitCtorDtorStmt * node ) { |
---|
1796 | VISIT_START( node ); |
---|
1797 | |
---|
1798 | maybeAccept_impl( node->callStmt, *this ); |
---|
1799 | |
---|
1800 | VISIT_END( node ); |
---|
1801 | } |
---|
1802 | |
---|
1803 | template< typename pass_type > |
---|
1804 | Statement * PassVisitor< pass_type >::mutate( ImplicitCtorDtorStmt * node ) { |
---|
1805 | MUTATE_START( node ); |
---|
1806 | |
---|
1807 | maybeMutate_impl( node->callStmt, *this ); |
---|
1808 | |
---|
1809 | MUTATE_END( Statement, node ); |
---|
1810 | } |
---|
1811 | |
---|
1812 | //-------------------------------------------------------------------------- |
---|
1813 | // MutexStmt |
---|
1814 | template< typename pass_type > |
---|
1815 | void PassVisitor< pass_type >::visit( MutexStmt * node ) { |
---|
1816 | VISIT_START( node ); |
---|
1817 | // mutex statements introduce a level of scope (for the initialization) |
---|
1818 | maybeAccept_impl( node->mutexObjs, *this ); |
---|
1819 | { |
---|
1820 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
1821 | node->stmt = visitStatement( node->stmt ); |
---|
1822 | } |
---|
1823 | VISIT_END( node ); |
---|
1824 | } |
---|
1825 | |
---|
1826 | template< typename pass_type > |
---|
1827 | void PassVisitor< pass_type >::visit( const MutexStmt * node ) { |
---|
1828 | VISIT_START( node ); |
---|
1829 | maybeAccept_impl( node->mutexObjs, *this ); |
---|
1830 | { |
---|
1831 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
1832 | visitStatement( node->stmt ); |
---|
1833 | } |
---|
1834 | VISIT_END( node ); |
---|
1835 | } |
---|
1836 | |
---|
1837 | template< typename pass_type > |
---|
1838 | Statement * PassVisitor< pass_type >::mutate( MutexStmt * node ) { |
---|
1839 | MUTATE_START( node ); |
---|
1840 | maybeMutate_impl( node->mutexObjs, *this ); |
---|
1841 | { |
---|
1842 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
1843 | node->stmt = mutateStatement( node->stmt ); |
---|
1844 | } |
---|
1845 | MUTATE_END( Statement, node ); |
---|
1846 | } |
---|
1847 | |
---|
1848 | //-------------------------------------------------------------------------- |
---|
1849 | // ApplicationExpr |
---|
1850 | template< typename pass_type > |
---|
1851 | void PassVisitor< pass_type >::visit( ApplicationExpr * node ) { |
---|
1852 | VISIT_START( node ); |
---|
1853 | |
---|
1854 | indexerScopedAccept( node->result , *this ); |
---|
1855 | maybeAccept_impl ( node->function, *this ); |
---|
1856 | maybeAccept_impl ( node->args , *this ); |
---|
1857 | |
---|
1858 | VISIT_END( node ); |
---|
1859 | } |
---|
1860 | |
---|
1861 | template< typename pass_type > |
---|
1862 | void PassVisitor< pass_type >::visit( const ApplicationExpr * node ) { |
---|
1863 | VISIT_START( node ); |
---|
1864 | |
---|
1865 | indexerScopedAccept( node->result , *this ); |
---|
1866 | maybeAccept_impl ( node->function, *this ); |
---|
1867 | maybeAccept_impl ( node->args , *this ); |
---|
1868 | |
---|
1869 | VISIT_END( node ); |
---|
1870 | } |
---|
1871 | |
---|
1872 | template< typename pass_type > |
---|
1873 | Expression * PassVisitor< pass_type >::mutate( ApplicationExpr * node ) { |
---|
1874 | MUTATE_START( node ); |
---|
1875 | |
---|
1876 | indexerScopedMutate( node->env , *this ); |
---|
1877 | indexerScopedMutate( node->result , *this ); |
---|
1878 | maybeMutate_impl ( node->function, *this ); |
---|
1879 | maybeMutate_impl ( node->args , *this ); |
---|
1880 | |
---|
1881 | MUTATE_END( Expression, node ); |
---|
1882 | } |
---|
1883 | |
---|
1884 | //-------------------------------------------------------------------------- |
---|
1885 | // UntypedExpr |
---|
1886 | template< typename pass_type > |
---|
1887 | void PassVisitor< pass_type >::visit( UntypedExpr * node ) { |
---|
1888 | VISIT_START( node ); |
---|
1889 | |
---|
1890 | // maybeAccept_impl( node->get_env(), *this ); |
---|
1891 | indexerScopedAccept( node->result, *this ); |
---|
1892 | |
---|
1893 | for ( auto expr : node->args ) { |
---|
1894 | visitExpression( expr ); |
---|
1895 | } |
---|
1896 | |
---|
1897 | VISIT_END( node ); |
---|
1898 | } |
---|
1899 | |
---|
1900 | template< typename pass_type > |
---|
1901 | void PassVisitor< pass_type >::visit( const UntypedExpr * node ) { |
---|
1902 | VISIT_START( node ); |
---|
1903 | |
---|
1904 | indexerScopedAccept( node->result, *this ); |
---|
1905 | |
---|
1906 | for ( auto expr : node->args ) { |
---|
1907 | visitExpression( expr ); |
---|
1908 | } |
---|
1909 | |
---|
1910 | VISIT_END( node ); |
---|
1911 | } |
---|
1912 | |
---|
1913 | template< typename pass_type > |
---|
1914 | Expression * PassVisitor< pass_type >::mutate( UntypedExpr * node ) { |
---|
1915 | MUTATE_START( node ); |
---|
1916 | |
---|
1917 | indexerScopedMutate( node->env , *this ); |
---|
1918 | indexerScopedMutate( node->result, *this ); |
---|
1919 | |
---|
1920 | for ( auto& expr : node->args ) { |
---|
1921 | expr = mutateExpression( expr ); |
---|
1922 | } |
---|
1923 | |
---|
1924 | MUTATE_END( Expression, node ); |
---|
1925 | } |
---|
1926 | |
---|
1927 | //-------------------------------------------------------------------------- |
---|
1928 | // NameExpr |
---|
1929 | template< typename pass_type > |
---|
1930 | void PassVisitor< pass_type >::visit( NameExpr * node ) { |
---|
1931 | VISIT_START( node ); |
---|
1932 | |
---|
1933 | indexerScopedAccept( node->result, *this ); |
---|
1934 | |
---|
1935 | VISIT_END( node ); |
---|
1936 | } |
---|
1937 | |
---|
1938 | template< typename pass_type > |
---|
1939 | void PassVisitor< pass_type >::visit( const NameExpr * node ) { |
---|
1940 | VISIT_START( node ); |
---|
1941 | |
---|
1942 | indexerScopedAccept( node->result, *this ); |
---|
1943 | |
---|
1944 | VISIT_END( node ); |
---|
1945 | } |
---|
1946 | |
---|
1947 | template< typename pass_type > |
---|
1948 | Expression * PassVisitor< pass_type >::mutate( NameExpr * node ) { |
---|
1949 | MUTATE_START( node ); |
---|
1950 | |
---|
1951 | indexerScopedMutate( node->env , *this ); |
---|
1952 | indexerScopedMutate( node->result, *this ); |
---|
1953 | |
---|
1954 | MUTATE_END( Expression, node ); |
---|
1955 | } |
---|
1956 | |
---|
1957 | //-------------------------------------------------------------------------- |
---|
1958 | // QualifiedNameExpr |
---|
1959 | template< typename pass_type > |
---|
1960 | void PassVisitor< pass_type >::visit( QualifiedNameExpr * node ) { |
---|
1961 | VISIT_START( node ); |
---|
1962 | |
---|
1963 | indexerScopedAccept( node->result, *this ); |
---|
1964 | maybeAccept_impl( node->type_decl, *this ); |
---|
1965 | |
---|
1966 | VISIT_END( node ); |
---|
1967 | } |
---|
1968 | |
---|
1969 | template< typename pass_type > |
---|
1970 | void PassVisitor< pass_type >::visit( const QualifiedNameExpr * node ) { |
---|
1971 | VISIT_START( node ); |
---|
1972 | |
---|
1973 | indexerScopedAccept( node->result, *this ); |
---|
1974 | maybeAccept_impl( node->type_decl, *this ); |
---|
1975 | |
---|
1976 | VISIT_END( node ); |
---|
1977 | } |
---|
1978 | |
---|
1979 | template< typename pass_type > |
---|
1980 | Expression * PassVisitor< pass_type >::mutate( QualifiedNameExpr * node ) { |
---|
1981 | MUTATE_START( node ); |
---|
1982 | |
---|
1983 | indexerScopedMutate( node->env , *this ); |
---|
1984 | indexerScopedMutate( node->result, *this ); |
---|
1985 | maybeMutate_impl( node->type_decl, *this ); |
---|
1986 | |
---|
1987 | MUTATE_END( Expression, node ); |
---|
1988 | } |
---|
1989 | |
---|
1990 | //-------------------------------------------------------------------------- |
---|
1991 | // CastExpr |
---|
1992 | template< typename pass_type > |
---|
1993 | void PassVisitor< pass_type >::visit( CastExpr * node ) { |
---|
1994 | VISIT_START( node ); |
---|
1995 | |
---|
1996 | indexerScopedAccept( node->result, *this ); |
---|
1997 | maybeAccept_impl ( node->arg , *this ); |
---|
1998 | |
---|
1999 | VISIT_END( node ); |
---|
2000 | } |
---|
2001 | |
---|
2002 | template< typename pass_type > |
---|
2003 | void PassVisitor< pass_type >::visit( const CastExpr * node ) { |
---|
2004 | VISIT_START( node ); |
---|
2005 | |
---|
2006 | indexerScopedAccept( node->result, *this ); |
---|
2007 | maybeAccept_impl ( node->arg , *this ); |
---|
2008 | |
---|
2009 | VISIT_END( node ); |
---|
2010 | } |
---|
2011 | |
---|
2012 | template< typename pass_type > |
---|
2013 | Expression * PassVisitor< pass_type >::mutate( CastExpr * node ) { |
---|
2014 | MUTATE_START( node ); |
---|
2015 | |
---|
2016 | indexerScopedMutate( node->env , *this ); |
---|
2017 | indexerScopedMutate( node->result, *this ); |
---|
2018 | maybeMutate_impl ( node->arg , *this ); |
---|
2019 | |
---|
2020 | MUTATE_END( Expression, node ); |
---|
2021 | } |
---|
2022 | |
---|
2023 | //-------------------------------------------------------------------------- |
---|
2024 | // KeywordCastExpr |
---|
2025 | template< typename pass_type > |
---|
2026 | void PassVisitor< pass_type >::visit( KeywordCastExpr * node ) { |
---|
2027 | VISIT_START( node ); |
---|
2028 | |
---|
2029 | indexerScopedAccept( node->result, *this ); |
---|
2030 | maybeAccept_impl ( node->arg , *this ); |
---|
2031 | |
---|
2032 | VISIT_END( node ); |
---|
2033 | } |
---|
2034 | |
---|
2035 | template< typename pass_type > |
---|
2036 | void PassVisitor< pass_type >::visit( const KeywordCastExpr * node ) { |
---|
2037 | VISIT_START( node ); |
---|
2038 | |
---|
2039 | indexerScopedAccept( node->result, *this ); |
---|
2040 | maybeAccept_impl ( node->arg , *this ); |
---|
2041 | |
---|
2042 | VISIT_END( node ); |
---|
2043 | } |
---|
2044 | |
---|
2045 | template< typename pass_type > |
---|
2046 | Expression * PassVisitor< pass_type >::mutate( KeywordCastExpr * node ) { |
---|
2047 | MUTATE_START( node ); |
---|
2048 | |
---|
2049 | indexerScopedMutate( node->env , *this ); |
---|
2050 | indexerScopedMutate( node->result, *this ); |
---|
2051 | maybeMutate_impl ( node->arg , *this ); |
---|
2052 | |
---|
2053 | MUTATE_END( Expression, node ); |
---|
2054 | } |
---|
2055 | |
---|
2056 | //-------------------------------------------------------------------------- |
---|
2057 | // VirtualCastExpr |
---|
2058 | template< typename pass_type > |
---|
2059 | void PassVisitor< pass_type >::visit( VirtualCastExpr * node ) { |
---|
2060 | VISIT_START( node ); |
---|
2061 | |
---|
2062 | indexerScopedAccept( node->result, *this ); |
---|
2063 | maybeAccept_impl ( node->arg, *this ); |
---|
2064 | |
---|
2065 | VISIT_END( node ); |
---|
2066 | } |
---|
2067 | |
---|
2068 | template< typename pass_type > |
---|
2069 | void PassVisitor< pass_type >::visit( const VirtualCastExpr * node ) { |
---|
2070 | VISIT_START( node ); |
---|
2071 | |
---|
2072 | indexerScopedAccept( node->result, *this ); |
---|
2073 | maybeAccept_impl ( node->arg, *this ); |
---|
2074 | |
---|
2075 | VISIT_END( node ); |
---|
2076 | } |
---|
2077 | |
---|
2078 | template< typename pass_type > |
---|
2079 | Expression * PassVisitor< pass_type >::mutate( VirtualCastExpr * node ) { |
---|
2080 | MUTATE_START( node ); |
---|
2081 | |
---|
2082 | indexerScopedMutate( node->env , *this ); |
---|
2083 | indexerScopedMutate( node->result, *this ); |
---|
2084 | maybeMutate_impl ( node->arg , *this ); |
---|
2085 | |
---|
2086 | MUTATE_END( Expression, node ); |
---|
2087 | } |
---|
2088 | |
---|
2089 | //-------------------------------------------------------------------------- |
---|
2090 | // AddressExpr |
---|
2091 | template< typename pass_type > |
---|
2092 | void PassVisitor< pass_type >::visit( AddressExpr * node ) { |
---|
2093 | VISIT_START( node ); |
---|
2094 | |
---|
2095 | indexerScopedAccept( node->result, *this ); |
---|
2096 | maybeAccept_impl ( node->arg , *this ); |
---|
2097 | |
---|
2098 | VISIT_END( node ); |
---|
2099 | } |
---|
2100 | |
---|
2101 | template< typename pass_type > |
---|
2102 | void PassVisitor< pass_type >::visit( const AddressExpr * node ) { |
---|
2103 | VISIT_START( node ); |
---|
2104 | |
---|
2105 | indexerScopedAccept( node->result, *this ); |
---|
2106 | maybeAccept_impl ( node->arg , *this ); |
---|
2107 | |
---|
2108 | VISIT_END( node ); |
---|
2109 | } |
---|
2110 | |
---|
2111 | template< typename pass_type > |
---|
2112 | Expression * PassVisitor< pass_type >::mutate( AddressExpr * node ) { |
---|
2113 | MUTATE_START( node ); |
---|
2114 | |
---|
2115 | indexerScopedMutate( node->env , *this ); |
---|
2116 | indexerScopedMutate( node->result, *this ); |
---|
2117 | maybeMutate_impl ( node->arg , *this ); |
---|
2118 | |
---|
2119 | MUTATE_END( Expression, node ); |
---|
2120 | } |
---|
2121 | |
---|
2122 | //-------------------------------------------------------------------------- |
---|
2123 | // LabelAddressExpr |
---|
2124 | template< typename pass_type > |
---|
2125 | void PassVisitor< pass_type >::visit( LabelAddressExpr * node ) { |
---|
2126 | VISIT_START( node ); |
---|
2127 | |
---|
2128 | indexerScopedAccept( node->result, *this ); |
---|
2129 | |
---|
2130 | VISIT_END( node ); |
---|
2131 | } |
---|
2132 | |
---|
2133 | template< typename pass_type > |
---|
2134 | void PassVisitor< pass_type >::visit( const LabelAddressExpr * node ) { |
---|
2135 | VISIT_START( node ); |
---|
2136 | |
---|
2137 | indexerScopedAccept( node->result, *this ); |
---|
2138 | |
---|
2139 | VISIT_END( node ); |
---|
2140 | } |
---|
2141 | |
---|
2142 | template< typename pass_type > |
---|
2143 | Expression * PassVisitor< pass_type >::mutate( LabelAddressExpr * node ) { |
---|
2144 | MUTATE_START( node ); |
---|
2145 | |
---|
2146 | indexerScopedMutate( node->env , *this ); |
---|
2147 | indexerScopedMutate( node->result, *this ); |
---|
2148 | |
---|
2149 | MUTATE_END( Expression, node ); |
---|
2150 | } |
---|
2151 | |
---|
2152 | //-------------------------------------------------------------------------- |
---|
2153 | // UntypedMemberExpr |
---|
2154 | template< typename pass_type > |
---|
2155 | void PassVisitor< pass_type >::visit( UntypedMemberExpr * node ) { |
---|
2156 | VISIT_START( node ); |
---|
2157 | |
---|
2158 | indexerScopedAccept( node->result , *this ); |
---|
2159 | maybeAccept_impl ( node->aggregate, *this ); |
---|
2160 | maybeAccept_impl ( node->member , *this ); |
---|
2161 | |
---|
2162 | VISIT_END( node ); |
---|
2163 | } |
---|
2164 | |
---|
2165 | template< typename pass_type > |
---|
2166 | void PassVisitor< pass_type >::visit( const UntypedMemberExpr * node ) { |
---|
2167 | VISIT_START( node ); |
---|
2168 | |
---|
2169 | indexerScopedAccept( node->result , *this ); |
---|
2170 | maybeAccept_impl ( node->aggregate, *this ); |
---|
2171 | maybeAccept_impl ( node->member , *this ); |
---|
2172 | |
---|
2173 | VISIT_END( node ); |
---|
2174 | } |
---|
2175 | |
---|
2176 | template< typename pass_type > |
---|
2177 | Expression * PassVisitor< pass_type >::mutate( UntypedMemberExpr * node ) { |
---|
2178 | MUTATE_START( node ); |
---|
2179 | |
---|
2180 | indexerScopedMutate( node->env , *this ); |
---|
2181 | indexerScopedMutate( node->result , *this ); |
---|
2182 | maybeMutate_impl ( node->aggregate, *this ); |
---|
2183 | maybeMutate_impl ( node->member , *this ); |
---|
2184 | |
---|
2185 | MUTATE_END( Expression, node ); |
---|
2186 | } |
---|
2187 | |
---|
2188 | //-------------------------------------------------------------------------- |
---|
2189 | // MemberExpr |
---|
2190 | template< typename pass_type > |
---|
2191 | void PassVisitor< pass_type >::visit( MemberExpr * node ) { |
---|
2192 | VISIT_START( node ); |
---|
2193 | |
---|
2194 | indexerScopedAccept( node->result , *this ); |
---|
2195 | maybeAccept_impl ( node->aggregate, *this ); |
---|
2196 | |
---|
2197 | VISIT_END( node ); |
---|
2198 | } |
---|
2199 | |
---|
2200 | template< typename pass_type > |
---|
2201 | void PassVisitor< pass_type >::visit( const MemberExpr * node ) { |
---|
2202 | VISIT_START( node ); |
---|
2203 | |
---|
2204 | indexerScopedAccept( node->result , *this ); |
---|
2205 | maybeAccept_impl ( node->aggregate, *this ); |
---|
2206 | |
---|
2207 | VISIT_END( node ); |
---|
2208 | } |
---|
2209 | |
---|
2210 | template< typename pass_type > |
---|
2211 | Expression * PassVisitor< pass_type >::mutate( MemberExpr * node ) { |
---|
2212 | MUTATE_START( node ); |
---|
2213 | |
---|
2214 | indexerScopedMutate( node->env , *this ); |
---|
2215 | indexerScopedMutate( node->result , *this ); |
---|
2216 | maybeMutate_impl ( node->aggregate, *this ); |
---|
2217 | |
---|
2218 | MUTATE_END( Expression, node ); |
---|
2219 | } |
---|
2220 | |
---|
2221 | //-------------------------------------------------------------------------- |
---|
2222 | // VariableExpr |
---|
2223 | template< typename pass_type > |
---|
2224 | void PassVisitor< pass_type >::visit( VariableExpr * node ) { |
---|
2225 | VISIT_START( node ); |
---|
2226 | |
---|
2227 | indexerScopedAccept( node->result, *this ); |
---|
2228 | |
---|
2229 | VISIT_END( node ); |
---|
2230 | } |
---|
2231 | |
---|
2232 | template< typename pass_type > |
---|
2233 | void PassVisitor< pass_type >::visit( const VariableExpr * node ) { |
---|
2234 | VISIT_START( node ); |
---|
2235 | |
---|
2236 | indexerScopedAccept( node->result, *this ); |
---|
2237 | |
---|
2238 | VISIT_END( node ); |
---|
2239 | } |
---|
2240 | |
---|
2241 | template< typename pass_type > |
---|
2242 | Expression * PassVisitor< pass_type >::mutate( VariableExpr * node ) { |
---|
2243 | MUTATE_START( node ); |
---|
2244 | |
---|
2245 | indexerScopedMutate( node->env , *this ); |
---|
2246 | indexerScopedMutate( node->result, *this ); |
---|
2247 | |
---|
2248 | MUTATE_END( Expression, node ); |
---|
2249 | } |
---|
2250 | |
---|
2251 | //-------------------------------------------------------------------------- |
---|
2252 | // ConstantExpr |
---|
2253 | template< typename pass_type > |
---|
2254 | void PassVisitor< pass_type >::visit( ConstantExpr * node ) { |
---|
2255 | VISIT_START( node ); |
---|
2256 | |
---|
2257 | indexerScopedAccept( node->result , *this ); |
---|
2258 | maybeAccept_impl ( &node->constant, *this ); |
---|
2259 | |
---|
2260 | VISIT_END( node ); |
---|
2261 | } |
---|
2262 | |
---|
2263 | template< typename pass_type > |
---|
2264 | void PassVisitor< pass_type >::visit( const ConstantExpr * node ) { |
---|
2265 | VISIT_START( node ); |
---|
2266 | |
---|
2267 | indexerScopedAccept( node->result , *this ); |
---|
2268 | maybeAccept_impl ( &node->constant, *this ); |
---|
2269 | |
---|
2270 | VISIT_END( node ); |
---|
2271 | } |
---|
2272 | |
---|
2273 | template< typename pass_type > |
---|
2274 | Expression * PassVisitor< pass_type >::mutate( ConstantExpr * node ) { |
---|
2275 | MUTATE_START( node ); |
---|
2276 | |
---|
2277 | indexerScopedMutate( node->env , *this ); |
---|
2278 | indexerScopedMutate( node->result, *this ); |
---|
2279 | Constant * ptr = &node->constant; |
---|
2280 | maybeMutate_impl( ptr, *this ); |
---|
2281 | node->constant = *ptr; |
---|
2282 | |
---|
2283 | MUTATE_END( Expression, node ); |
---|
2284 | } |
---|
2285 | |
---|
2286 | //-------------------------------------------------------------------------- |
---|
2287 | // SizeofExpr |
---|
2288 | template< typename pass_type > |
---|
2289 | void PassVisitor< pass_type >::visit( SizeofExpr * node ) { |
---|
2290 | VISIT_START( node ); |
---|
2291 | |
---|
2292 | indexerScopedAccept( node->result, *this ); |
---|
2293 | if ( node->get_isType() ) { |
---|
2294 | maybeAccept_impl( node->type, *this ); |
---|
2295 | } else { |
---|
2296 | maybeAccept_impl( node->expr, *this ); |
---|
2297 | } |
---|
2298 | |
---|
2299 | VISIT_END( node ); |
---|
2300 | } |
---|
2301 | |
---|
2302 | template< typename pass_type > |
---|
2303 | void PassVisitor< pass_type >::visit( const SizeofExpr * node ) { |
---|
2304 | VISIT_START( node ); |
---|
2305 | |
---|
2306 | indexerScopedAccept( node->result, *this ); |
---|
2307 | if ( node->get_isType() ) { |
---|
2308 | maybeAccept_impl( node->type, *this ); |
---|
2309 | } else { |
---|
2310 | maybeAccept_impl( node->expr, *this ); |
---|
2311 | } |
---|
2312 | |
---|
2313 | VISIT_END( node ); |
---|
2314 | } |
---|
2315 | |
---|
2316 | template< typename pass_type > |
---|
2317 | Expression * PassVisitor< pass_type >::mutate( SizeofExpr * node ) { |
---|
2318 | MUTATE_START( node ); |
---|
2319 | |
---|
2320 | indexerScopedMutate( node->env , *this ); |
---|
2321 | indexerScopedMutate( node->result, *this ); |
---|
2322 | if ( node->get_isType() ) { |
---|
2323 | maybeMutate_impl( node->type, *this ); |
---|
2324 | } else { |
---|
2325 | maybeMutate_impl( node->expr, *this ); |
---|
2326 | } |
---|
2327 | |
---|
2328 | MUTATE_END( Expression, node ); |
---|
2329 | } |
---|
2330 | |
---|
2331 | //-------------------------------------------------------------------------- |
---|
2332 | // AlignofExpr |
---|
2333 | template< typename pass_type > |
---|
2334 | void PassVisitor< pass_type >::visit( AlignofExpr * node ) { |
---|
2335 | VISIT_START( node ); |
---|
2336 | |
---|
2337 | indexerScopedAccept( node->result, *this ); |
---|
2338 | if ( node->get_isType() ) { |
---|
2339 | maybeAccept_impl( node->type, *this ); |
---|
2340 | } else { |
---|
2341 | maybeAccept_impl( node->expr, *this ); |
---|
2342 | } |
---|
2343 | |
---|
2344 | VISIT_END( node ); |
---|
2345 | } |
---|
2346 | |
---|
2347 | template< typename pass_type > |
---|
2348 | void PassVisitor< pass_type >::visit( const AlignofExpr * node ) { |
---|
2349 | VISIT_START( node ); |
---|
2350 | |
---|
2351 | indexerScopedAccept( node->result, *this ); |
---|
2352 | if ( node->get_isType() ) { |
---|
2353 | maybeAccept_impl( node->type, *this ); |
---|
2354 | } else { |
---|
2355 | maybeAccept_impl( node->expr, *this ); |
---|
2356 | } |
---|
2357 | |
---|
2358 | VISIT_END( node ); |
---|
2359 | } |
---|
2360 | |
---|
2361 | template< typename pass_type > |
---|
2362 | Expression * PassVisitor< pass_type >::mutate( AlignofExpr * node ) { |
---|
2363 | MUTATE_START( node ); |
---|
2364 | |
---|
2365 | indexerScopedMutate( node->env , *this ); |
---|
2366 | indexerScopedMutate( node->result, *this ); |
---|
2367 | if ( node->get_isType() ) { |
---|
2368 | maybeMutate_impl( node->type, *this ); |
---|
2369 | } else { |
---|
2370 | maybeMutate_impl( node->expr, *this ); |
---|
2371 | } |
---|
2372 | |
---|
2373 | MUTATE_END( Expression, node ); |
---|
2374 | } |
---|
2375 | |
---|
2376 | //-------------------------------------------------------------------------- |
---|
2377 | // UntypedOffsetofExpr |
---|
2378 | template< typename pass_type > |
---|
2379 | void PassVisitor< pass_type >::visit( UntypedOffsetofExpr * node ) { |
---|
2380 | VISIT_START( node ); |
---|
2381 | |
---|
2382 | indexerScopedAccept( node->result, *this ); |
---|
2383 | maybeAccept_impl ( node->type , *this ); |
---|
2384 | |
---|
2385 | VISIT_END( node ); |
---|
2386 | } |
---|
2387 | |
---|
2388 | template< typename pass_type > |
---|
2389 | void PassVisitor< pass_type >::visit( const UntypedOffsetofExpr * node ) { |
---|
2390 | VISIT_START( node ); |
---|
2391 | |
---|
2392 | indexerScopedAccept( node->result, *this ); |
---|
2393 | maybeAccept_impl ( node->type , *this ); |
---|
2394 | |
---|
2395 | VISIT_END( node ); |
---|
2396 | } |
---|
2397 | |
---|
2398 | template< typename pass_type > |
---|
2399 | Expression * PassVisitor< pass_type >::mutate( UntypedOffsetofExpr * node ) { |
---|
2400 | MUTATE_START( node ); |
---|
2401 | |
---|
2402 | indexerScopedMutate( node->env , *this ); |
---|
2403 | indexerScopedMutate( node->result, *this ); |
---|
2404 | maybeMutate_impl ( node->type , *this ); |
---|
2405 | |
---|
2406 | MUTATE_END( Expression, node ); |
---|
2407 | } |
---|
2408 | |
---|
2409 | //-------------------------------------------------------------------------- |
---|
2410 | // OffsetofExpr |
---|
2411 | template< typename pass_type > |
---|
2412 | void PassVisitor< pass_type >::visit( OffsetofExpr * node ) { |
---|
2413 | VISIT_START( node ); |
---|
2414 | |
---|
2415 | indexerScopedAccept( node->result, *this ); |
---|
2416 | maybeAccept_impl ( node->type , *this ); |
---|
2417 | |
---|
2418 | VISIT_END( node ); |
---|
2419 | } |
---|
2420 | |
---|
2421 | template< typename pass_type > |
---|
2422 | void PassVisitor< pass_type >::visit( const OffsetofExpr * node ) { |
---|
2423 | VISIT_START( node ); |
---|
2424 | |
---|
2425 | indexerScopedAccept( node->result, *this ); |
---|
2426 | maybeAccept_impl ( node->type , *this ); |
---|
2427 | |
---|
2428 | VISIT_END( node ); |
---|
2429 | } |
---|
2430 | |
---|
2431 | template< typename pass_type > |
---|
2432 | Expression * PassVisitor< pass_type >::mutate( OffsetofExpr * node ) { |
---|
2433 | MUTATE_START( node ); |
---|
2434 | |
---|
2435 | indexerScopedMutate( node->env , *this ); |
---|
2436 | indexerScopedMutate( node->result, *this ); |
---|
2437 | maybeMutate_impl ( node->type , *this ); |
---|
2438 | |
---|
2439 | MUTATE_END( Expression, node ); |
---|
2440 | } |
---|
2441 | |
---|
2442 | //-------------------------------------------------------------------------- |
---|
2443 | // OffsetPackExpr |
---|
2444 | template< typename pass_type > |
---|
2445 | void PassVisitor< pass_type >::visit( OffsetPackExpr * node ) { |
---|
2446 | VISIT_START( node ); |
---|
2447 | |
---|
2448 | indexerScopedAccept( node->result, *this ); |
---|
2449 | maybeAccept_impl ( node->type , *this ); |
---|
2450 | |
---|
2451 | VISIT_END( node ); |
---|
2452 | } |
---|
2453 | |
---|
2454 | template< typename pass_type > |
---|
2455 | void PassVisitor< pass_type >::visit( const OffsetPackExpr * node ) { |
---|
2456 | VISIT_START( node ); |
---|
2457 | |
---|
2458 | indexerScopedAccept( node->result, *this ); |
---|
2459 | maybeAccept_impl ( node->type , *this ); |
---|
2460 | |
---|
2461 | VISIT_END( node ); |
---|
2462 | } |
---|
2463 | |
---|
2464 | template< typename pass_type > |
---|
2465 | Expression * PassVisitor< pass_type >::mutate( OffsetPackExpr * node ) { |
---|
2466 | MUTATE_START( node ); |
---|
2467 | |
---|
2468 | indexerScopedMutate( node->env , *this ); |
---|
2469 | indexerScopedMutate( node->result, *this ); |
---|
2470 | maybeMutate_impl ( node->type , *this ); |
---|
2471 | |
---|
2472 | MUTATE_END( Expression, node ); |
---|
2473 | } |
---|
2474 | |
---|
2475 | //-------------------------------------------------------------------------- |
---|
2476 | // LogicalExpr |
---|
2477 | template< typename pass_type > |
---|
2478 | void PassVisitor< pass_type >::visit( LogicalExpr * node ) { |
---|
2479 | VISIT_START( node ); |
---|
2480 | |
---|
2481 | indexerScopedAccept( node->result, *this ); |
---|
2482 | maybeAccept_impl ( node->arg1 , *this ); |
---|
2483 | maybeAccept_impl ( node->arg2 , *this ); |
---|
2484 | |
---|
2485 | VISIT_END( node ); |
---|
2486 | } |
---|
2487 | |
---|
2488 | template< typename pass_type > |
---|
2489 | void PassVisitor< pass_type >::visit( const LogicalExpr * node ) { |
---|
2490 | VISIT_START( node ); |
---|
2491 | |
---|
2492 | indexerScopedAccept( node->result, *this ); |
---|
2493 | maybeAccept_impl ( node->arg1 , *this ); |
---|
2494 | maybeAccept_impl ( node->arg2 , *this ); |
---|
2495 | |
---|
2496 | VISIT_END( node ); |
---|
2497 | } |
---|
2498 | |
---|
2499 | template< typename pass_type > |
---|
2500 | Expression * PassVisitor< pass_type >::mutate( LogicalExpr * node ) { |
---|
2501 | MUTATE_START( node ); |
---|
2502 | |
---|
2503 | indexerScopedMutate( node->env , *this ); |
---|
2504 | indexerScopedMutate( node->result, *this ); |
---|
2505 | maybeMutate_impl ( node->arg1 , *this ); |
---|
2506 | maybeMutate_impl ( node->arg2 , *this ); |
---|
2507 | |
---|
2508 | MUTATE_END( Expression, node ); |
---|
2509 | } |
---|
2510 | |
---|
2511 | //-------------------------------------------------------------------------- |
---|
2512 | // ConditionalExpr |
---|
2513 | template< typename pass_type > |
---|
2514 | void PassVisitor< pass_type >::visit( ConditionalExpr * node ) { |
---|
2515 | VISIT_START( node ); |
---|
2516 | |
---|
2517 | indexerScopedAccept( node->result, *this ); |
---|
2518 | maybeAccept_impl ( node->arg1 , *this ); |
---|
2519 | maybeAccept_impl ( node->arg2 , *this ); |
---|
2520 | maybeAccept_impl ( node->arg3 , *this ); |
---|
2521 | |
---|
2522 | VISIT_END( node ); |
---|
2523 | } |
---|
2524 | |
---|
2525 | template< typename pass_type > |
---|
2526 | void PassVisitor< pass_type >::visit( const ConditionalExpr * node ) { |
---|
2527 | VISIT_START( node ); |
---|
2528 | |
---|
2529 | indexerScopedAccept( node->result, *this ); |
---|
2530 | maybeAccept_impl ( node->arg1 , *this ); |
---|
2531 | maybeAccept_impl ( node->arg2 , *this ); |
---|
2532 | maybeAccept_impl ( node->arg3 , *this ); |
---|
2533 | |
---|
2534 | VISIT_END( node ); |
---|
2535 | } |
---|
2536 | |
---|
2537 | template< typename pass_type > |
---|
2538 | Expression * PassVisitor< pass_type >::mutate( ConditionalExpr * node ) { |
---|
2539 | MUTATE_START( node ); |
---|
2540 | |
---|
2541 | indexerScopedMutate( node->env , *this ); |
---|
2542 | indexerScopedMutate( node->result, *this ); |
---|
2543 | maybeMutate_impl ( node->arg1 , *this ); |
---|
2544 | maybeMutate_impl ( node->arg2 , *this ); |
---|
2545 | maybeMutate_impl ( node->arg3 , *this ); |
---|
2546 | |
---|
2547 | MUTATE_END( Expression, node ); |
---|
2548 | } |
---|
2549 | |
---|
2550 | //-------------------------------------------------------------------------- |
---|
2551 | // CommaExpr |
---|
2552 | template< typename pass_type > |
---|
2553 | void PassVisitor< pass_type >::visit( CommaExpr * node ) { |
---|
2554 | VISIT_START( node ); |
---|
2555 | |
---|
2556 | indexerScopedAccept( node->result, *this ); |
---|
2557 | maybeAccept_impl ( node->arg1 , *this ); |
---|
2558 | maybeAccept_impl ( node->arg2 , *this ); |
---|
2559 | |
---|
2560 | VISIT_END( node ); |
---|
2561 | } |
---|
2562 | |
---|
2563 | template< typename pass_type > |
---|
2564 | void PassVisitor< pass_type >::visit( const CommaExpr * node ) { |
---|
2565 | VISIT_START( node ); |
---|
2566 | |
---|
2567 | indexerScopedAccept( node->result, *this ); |
---|
2568 | maybeAccept_impl ( node->arg1 , *this ); |
---|
2569 | maybeAccept_impl ( node->arg2 , *this ); |
---|
2570 | |
---|
2571 | VISIT_END( node ); |
---|
2572 | } |
---|
2573 | |
---|
2574 | template< typename pass_type > |
---|
2575 | Expression * PassVisitor< pass_type >::mutate( CommaExpr * node ) { |
---|
2576 | MUTATE_START( node ); |
---|
2577 | |
---|
2578 | indexerScopedMutate( node->env , *this ); |
---|
2579 | indexerScopedMutate( node->result, *this ); |
---|
2580 | maybeMutate_impl ( node->arg1 , *this ); |
---|
2581 | maybeMutate_impl ( node->arg2 , *this ); |
---|
2582 | |
---|
2583 | MUTATE_END( Expression, node ); |
---|
2584 | } |
---|
2585 | |
---|
2586 | //-------------------------------------------------------------------------- |
---|
2587 | // TypeExpr |
---|
2588 | template< typename pass_type > |
---|
2589 | void PassVisitor< pass_type >::visit( TypeExpr * node ) { |
---|
2590 | VISIT_START( node ); |
---|
2591 | |
---|
2592 | indexerScopedAccept( node->result, *this ); |
---|
2593 | maybeAccept_impl ( node->type, *this ); |
---|
2594 | |
---|
2595 | VISIT_END( node ); |
---|
2596 | } |
---|
2597 | |
---|
2598 | template< typename pass_type > |
---|
2599 | void PassVisitor< pass_type >::visit( const TypeExpr * node ) { |
---|
2600 | VISIT_START( node ); |
---|
2601 | |
---|
2602 | indexerScopedAccept( node->result, *this ); |
---|
2603 | maybeAccept_impl ( node->type, *this ); |
---|
2604 | |
---|
2605 | VISIT_END( node ); |
---|
2606 | } |
---|
2607 | |
---|
2608 | template< typename pass_type > |
---|
2609 | Expression * PassVisitor< pass_type >::mutate( TypeExpr * node ) { |
---|
2610 | MUTATE_START( node ); |
---|
2611 | |
---|
2612 | indexerScopedMutate( node->env , *this ); |
---|
2613 | indexerScopedMutate( node->result, *this ); |
---|
2614 | maybeMutate_impl ( node->type , *this ); |
---|
2615 | |
---|
2616 | MUTATE_END( Expression, node ); |
---|
2617 | } |
---|
2618 | |
---|
2619 | //-------------------------------------------------------------------------- |
---|
2620 | // DimensionExpr |
---|
2621 | template< typename pass_type > |
---|
2622 | void PassVisitor< pass_type >::visit( DimensionExpr * node ) { |
---|
2623 | VISIT_START( node ); |
---|
2624 | |
---|
2625 | indexerScopedAccept( node->result, *this ); |
---|
2626 | |
---|
2627 | VISIT_END( node ); |
---|
2628 | } |
---|
2629 | |
---|
2630 | template< typename pass_type > |
---|
2631 | void PassVisitor< pass_type >::visit( const DimensionExpr * node ) { |
---|
2632 | VISIT_START( node ); |
---|
2633 | |
---|
2634 | indexerScopedAccept( node->result, *this ); |
---|
2635 | |
---|
2636 | VISIT_END( node ); |
---|
2637 | } |
---|
2638 | |
---|
2639 | template< typename pass_type > |
---|
2640 | Expression * PassVisitor< pass_type >::mutate( DimensionExpr * node ) { |
---|
2641 | MUTATE_START( node ); |
---|
2642 | |
---|
2643 | indexerScopedMutate( node->env , *this ); |
---|
2644 | indexerScopedMutate( node->result, *this ); |
---|
2645 | |
---|
2646 | MUTATE_END( Expression, node ); |
---|
2647 | } |
---|
2648 | |
---|
2649 | //-------------------------------------------------------------------------- |
---|
2650 | // AsmExpr |
---|
2651 | template< typename pass_type > |
---|
2652 | void PassVisitor< pass_type >::visit( AsmExpr * node ) { |
---|
2653 | VISIT_START( node ); |
---|
2654 | |
---|
2655 | indexerScopedAccept( node->result , *this ); |
---|
2656 | maybeAccept_impl ( node->constraint, *this ); |
---|
2657 | maybeAccept_impl ( node->operand , *this ); |
---|
2658 | |
---|
2659 | VISIT_END( node ); |
---|
2660 | } |
---|
2661 | |
---|
2662 | template< typename pass_type > |
---|
2663 | void PassVisitor< pass_type >::visit( const AsmExpr * node ) { |
---|
2664 | VISIT_START( node ); |
---|
2665 | |
---|
2666 | indexerScopedAccept( node->result , *this ); |
---|
2667 | maybeAccept_impl ( node->constraint, *this ); |
---|
2668 | maybeAccept_impl ( node->operand , *this ); |
---|
2669 | |
---|
2670 | VISIT_END( node ); |
---|
2671 | } |
---|
2672 | |
---|
2673 | template< typename pass_type > |
---|
2674 | Expression * PassVisitor< pass_type >::mutate( AsmExpr * node ) { |
---|
2675 | MUTATE_START( node ); |
---|
2676 | |
---|
2677 | indexerScopedMutate( node->env , *this ); |
---|
2678 | indexerScopedMutate( node->result , *this ); |
---|
2679 | maybeMutate_impl ( node->constraint, *this ); |
---|
2680 | maybeMutate_impl ( node->operand , *this ); |
---|
2681 | |
---|
2682 | MUTATE_END( Expression, node ); |
---|
2683 | } |
---|
2684 | |
---|
2685 | //-------------------------------------------------------------------------- |
---|
2686 | // ImplicitCopyCtorExpr |
---|
2687 | template< typename pass_type > |
---|
2688 | void PassVisitor< pass_type >::visit( ImplicitCopyCtorExpr * node ) { |
---|
2689 | VISIT_START( node ); |
---|
2690 | |
---|
2691 | indexerScopedAccept( node->result , *this ); |
---|
2692 | maybeAccept_impl ( node->callExpr , *this ); |
---|
2693 | |
---|
2694 | VISIT_END( node ); |
---|
2695 | } |
---|
2696 | |
---|
2697 | template< typename pass_type > |
---|
2698 | void PassVisitor< pass_type >::visit( const ImplicitCopyCtorExpr * node ) { |
---|
2699 | VISIT_START( node ); |
---|
2700 | |
---|
2701 | indexerScopedAccept( node->result , *this ); |
---|
2702 | maybeAccept_impl ( node->callExpr , *this ); |
---|
2703 | |
---|
2704 | VISIT_END( node ); |
---|
2705 | } |
---|
2706 | |
---|
2707 | template< typename pass_type > |
---|
2708 | Expression * PassVisitor< pass_type >::mutate( ImplicitCopyCtorExpr * node ) { |
---|
2709 | MUTATE_START( node ); |
---|
2710 | |
---|
2711 | indexerScopedMutate( node->env , *this ); |
---|
2712 | indexerScopedMutate( node->result , *this ); |
---|
2713 | maybeMutate_impl ( node->callExpr , *this ); |
---|
2714 | |
---|
2715 | MUTATE_END( Expression, node ); |
---|
2716 | } |
---|
2717 | |
---|
2718 | //-------------------------------------------------------------------------- |
---|
2719 | // ConstructorExpr |
---|
2720 | template< typename pass_type > |
---|
2721 | void PassVisitor< pass_type >::visit( ConstructorExpr * node ) { |
---|
2722 | VISIT_START( node ); |
---|
2723 | |
---|
2724 | indexerScopedAccept( node->result , *this ); |
---|
2725 | maybeAccept_impl ( node->callExpr, *this ); |
---|
2726 | |
---|
2727 | VISIT_END( node ); |
---|
2728 | } |
---|
2729 | |
---|
2730 | template< typename pass_type > |
---|
2731 | void PassVisitor< pass_type >::visit( const ConstructorExpr * node ) { |
---|
2732 | VISIT_START( node ); |
---|
2733 | |
---|
2734 | indexerScopedAccept( node->result , *this ); |
---|
2735 | maybeAccept_impl ( node->callExpr, *this ); |
---|
2736 | |
---|
2737 | VISIT_END( node ); |
---|
2738 | } |
---|
2739 | |
---|
2740 | template< typename pass_type > |
---|
2741 | Expression * PassVisitor< pass_type >::mutate( ConstructorExpr * node ) { |
---|
2742 | MUTATE_START( node ); |
---|
2743 | |
---|
2744 | indexerScopedMutate( node->env , *this ); |
---|
2745 | indexerScopedMutate( node->result , *this ); |
---|
2746 | maybeMutate_impl ( node->callExpr, *this ); |
---|
2747 | |
---|
2748 | MUTATE_END( Expression, node ); |
---|
2749 | } |
---|
2750 | |
---|
2751 | //-------------------------------------------------------------------------- |
---|
2752 | // CompoundLiteralExpr |
---|
2753 | template< typename pass_type > |
---|
2754 | void PassVisitor< pass_type >::visit( CompoundLiteralExpr * node ) { |
---|
2755 | VISIT_START( node ); |
---|
2756 | |
---|
2757 | indexerScopedAccept( node->result , *this ); |
---|
2758 | maybeAccept_impl ( node->initializer, *this ); |
---|
2759 | |
---|
2760 | VISIT_END( node ); |
---|
2761 | } |
---|
2762 | |
---|
2763 | template< typename pass_type > |
---|
2764 | void PassVisitor< pass_type >::visit( const CompoundLiteralExpr * node ) { |
---|
2765 | VISIT_START( node ); |
---|
2766 | |
---|
2767 | indexerScopedAccept( node->result , *this ); |
---|
2768 | maybeAccept_impl ( node->initializer, *this ); |
---|
2769 | |
---|
2770 | VISIT_END( node ); |
---|
2771 | } |
---|
2772 | |
---|
2773 | template< typename pass_type > |
---|
2774 | Expression * PassVisitor< pass_type >::mutate( CompoundLiteralExpr * node ) { |
---|
2775 | MUTATE_START( node ); |
---|
2776 | |
---|
2777 | indexerScopedMutate( node->env , *this ); |
---|
2778 | indexerScopedMutate( node->result , *this ); |
---|
2779 | maybeMutate_impl ( node->initializer, *this ); |
---|
2780 | |
---|
2781 | MUTATE_END( Expression, node ); |
---|
2782 | } |
---|
2783 | |
---|
2784 | //-------------------------------------------------------------------------- |
---|
2785 | // RangeExpr |
---|
2786 | template< typename pass_type > |
---|
2787 | void PassVisitor< pass_type >::visit( RangeExpr * node ) { |
---|
2788 | VISIT_START( node ); |
---|
2789 | |
---|
2790 | indexerScopedAccept( node->result, *this ); |
---|
2791 | maybeAccept_impl ( node->low , *this ); |
---|
2792 | maybeAccept_impl ( node->high , *this ); |
---|
2793 | |
---|
2794 | VISIT_END( node ); |
---|
2795 | } |
---|
2796 | |
---|
2797 | template< typename pass_type > |
---|
2798 | void PassVisitor< pass_type >::visit( const RangeExpr * node ) { |
---|
2799 | VISIT_START( node ); |
---|
2800 | |
---|
2801 | indexerScopedAccept( node->result, *this ); |
---|
2802 | maybeAccept_impl ( node->low , *this ); |
---|
2803 | maybeAccept_impl ( node->high , *this ); |
---|
2804 | |
---|
2805 | VISIT_END( node ); |
---|
2806 | } |
---|
2807 | |
---|
2808 | template< typename pass_type > |
---|
2809 | Expression * PassVisitor< pass_type >::mutate( RangeExpr * node ) { |
---|
2810 | MUTATE_START( node ); |
---|
2811 | |
---|
2812 | indexerScopedMutate( node->env , *this ); |
---|
2813 | indexerScopedMutate( node->result, *this ); |
---|
2814 | maybeMutate_impl ( node->low , *this ); |
---|
2815 | maybeMutate_impl ( node->high , *this ); |
---|
2816 | |
---|
2817 | MUTATE_END( Expression, node ); |
---|
2818 | } |
---|
2819 | |
---|
2820 | //-------------------------------------------------------------------------- |
---|
2821 | // UntypedTupleExpr |
---|
2822 | template< typename pass_type > |
---|
2823 | void PassVisitor< pass_type >::visit( UntypedTupleExpr * node ) { |
---|
2824 | VISIT_START( node ); |
---|
2825 | |
---|
2826 | indexerScopedAccept( node->result, *this ); |
---|
2827 | maybeAccept_impl ( node->exprs , *this ); |
---|
2828 | |
---|
2829 | VISIT_END( node ); |
---|
2830 | } |
---|
2831 | |
---|
2832 | template< typename pass_type > |
---|
2833 | void PassVisitor< pass_type >::visit( const UntypedTupleExpr * node ) { |
---|
2834 | VISIT_START( node ); |
---|
2835 | |
---|
2836 | indexerScopedAccept( node->result, *this ); |
---|
2837 | maybeAccept_impl ( node->exprs , *this ); |
---|
2838 | |
---|
2839 | VISIT_END( node ); |
---|
2840 | } |
---|
2841 | |
---|
2842 | template< typename pass_type > |
---|
2843 | Expression * PassVisitor< pass_type >::mutate( UntypedTupleExpr * node ) { |
---|
2844 | MUTATE_START( node ); |
---|
2845 | |
---|
2846 | indexerScopedMutate( node->env , *this ); |
---|
2847 | indexerScopedMutate( node->result, *this ); |
---|
2848 | maybeMutate_impl ( node->exprs , *this ); |
---|
2849 | |
---|
2850 | MUTATE_END( Expression, node ); |
---|
2851 | } |
---|
2852 | |
---|
2853 | //-------------------------------------------------------------------------- |
---|
2854 | // TupleExpr |
---|
2855 | template< typename pass_type > |
---|
2856 | void PassVisitor< pass_type >::visit( TupleExpr * node ) { |
---|
2857 | VISIT_START( node ); |
---|
2858 | |
---|
2859 | indexerScopedAccept( node->result, *this ); |
---|
2860 | maybeAccept_impl ( node->exprs , *this ); |
---|
2861 | |
---|
2862 | VISIT_END( node ); |
---|
2863 | } |
---|
2864 | |
---|
2865 | template< typename pass_type > |
---|
2866 | void PassVisitor< pass_type >::visit( const TupleExpr * node ) { |
---|
2867 | VISIT_START( node ); |
---|
2868 | |
---|
2869 | indexerScopedAccept( node->result, *this ); |
---|
2870 | maybeAccept_impl ( node->exprs , *this ); |
---|
2871 | |
---|
2872 | VISIT_END( node ); |
---|
2873 | } |
---|
2874 | |
---|
2875 | template< typename pass_type > |
---|
2876 | Expression * PassVisitor< pass_type >::mutate( TupleExpr * node ) { |
---|
2877 | MUTATE_START( node ); |
---|
2878 | |
---|
2879 | indexerScopedMutate( node->env , *this ); |
---|
2880 | indexerScopedMutate( node->result, *this ); |
---|
2881 | maybeMutate_impl ( node->exprs , *this ); |
---|
2882 | |
---|
2883 | MUTATE_END( Expression, node ); |
---|
2884 | } |
---|
2885 | |
---|
2886 | //-------------------------------------------------------------------------- |
---|
2887 | // TupleIndexExpr |
---|
2888 | template< typename pass_type > |
---|
2889 | void PassVisitor< pass_type >::visit( TupleIndexExpr * node ) { |
---|
2890 | VISIT_START( node ); |
---|
2891 | |
---|
2892 | indexerScopedAccept( node->result, *this ); |
---|
2893 | maybeAccept_impl ( node->tuple , *this ); |
---|
2894 | |
---|
2895 | VISIT_END( node ); |
---|
2896 | } |
---|
2897 | |
---|
2898 | template< typename pass_type > |
---|
2899 | void PassVisitor< pass_type >::visit( const TupleIndexExpr * node ) { |
---|
2900 | VISIT_START( node ); |
---|
2901 | |
---|
2902 | indexerScopedAccept( node->result, *this ); |
---|
2903 | maybeAccept_impl ( node->tuple , *this ); |
---|
2904 | |
---|
2905 | VISIT_END( node ); |
---|
2906 | } |
---|
2907 | |
---|
2908 | template< typename pass_type > |
---|
2909 | Expression * PassVisitor< pass_type >::mutate( TupleIndexExpr * node ) { |
---|
2910 | MUTATE_START( node ); |
---|
2911 | |
---|
2912 | indexerScopedMutate( node->env , *this ); |
---|
2913 | indexerScopedMutate( node->result, *this ); |
---|
2914 | maybeMutate_impl ( node->tuple , *this ); |
---|
2915 | |
---|
2916 | MUTATE_END( Expression, node ); |
---|
2917 | } |
---|
2918 | |
---|
2919 | //-------------------------------------------------------------------------- |
---|
2920 | // TupleAssignExpr |
---|
2921 | template< typename pass_type > |
---|
2922 | void PassVisitor< pass_type >::visit( TupleAssignExpr * node ) { |
---|
2923 | VISIT_START( node ); |
---|
2924 | |
---|
2925 | indexerScopedAccept( node->result , *this ); |
---|
2926 | maybeAccept_impl ( node->stmtExpr, *this ); |
---|
2927 | |
---|
2928 | VISIT_END( node ); |
---|
2929 | } |
---|
2930 | |
---|
2931 | template< typename pass_type > |
---|
2932 | void PassVisitor< pass_type >::visit( const TupleAssignExpr * node ) { |
---|
2933 | VISIT_START( node ); |
---|
2934 | |
---|
2935 | indexerScopedAccept( node->result , *this ); |
---|
2936 | maybeAccept_impl( node->stmtExpr, *this ); |
---|
2937 | |
---|
2938 | VISIT_END( node ); |
---|
2939 | } |
---|
2940 | |
---|
2941 | template< typename pass_type > |
---|
2942 | Expression * PassVisitor< pass_type >::mutate( TupleAssignExpr * node ) { |
---|
2943 | MUTATE_START( node ); |
---|
2944 | |
---|
2945 | indexerScopedMutate( node->env , *this ); |
---|
2946 | indexerScopedMutate( node->result , *this ); |
---|
2947 | maybeMutate_impl ( node->stmtExpr, *this ); |
---|
2948 | |
---|
2949 | MUTATE_END( Expression, node ); |
---|
2950 | } |
---|
2951 | |
---|
2952 | //-------------------------------------------------------------------------- |
---|
2953 | // StmtExpr |
---|
2954 | template< typename pass_type > |
---|
2955 | void PassVisitor< pass_type >::visit( StmtExpr * node ) { |
---|
2956 | VISIT_START( node ); |
---|
2957 | |
---|
2958 | // don't want statements from outer CompoundStmts to be added to this StmtExpr |
---|
2959 | ValueGuardPtr< typename std::remove_pointer<decltype(get_env_ptr())>::type > oldEnv( get_env_ptr() ); |
---|
2960 | ValueGuardPtr< std::list< Statement* > > oldBeforeStmts( get_beforeStmts() ); |
---|
2961 | ValueGuardPtr< std::list< Statement* > > oldAfterStmts ( get_afterStmts () ); |
---|
2962 | |
---|
2963 | indexerScopedAccept( node->result , *this ); |
---|
2964 | maybeAccept_impl ( node->statements , *this ); |
---|
2965 | maybeAccept_impl ( node->returnDecls, *this ); |
---|
2966 | maybeAccept_impl ( node->dtors , *this ); |
---|
2967 | |
---|
2968 | VISIT_END( node ); |
---|
2969 | } |
---|
2970 | |
---|
2971 | template< typename pass_type > |
---|
2972 | void PassVisitor< pass_type >::visit( const StmtExpr * node ) { |
---|
2973 | VISIT_START( node ); |
---|
2974 | |
---|
2975 | // don't want statements from outer CompoundStmts to be added to this StmtExpr |
---|
2976 | ValueGuardPtr< typename std::remove_pointer<decltype(get_env_ptr())>::type > oldEnv( get_env_ptr() ); |
---|
2977 | ValueGuardPtr< std::list< Statement* > > oldBeforeStmts( get_beforeStmts() ); |
---|
2978 | ValueGuardPtr< std::list< Statement* > > oldAfterStmts ( get_afterStmts () ); |
---|
2979 | |
---|
2980 | indexerScopedAccept( node->result , *this ); |
---|
2981 | maybeAccept_impl ( node->statements , *this ); |
---|
2982 | maybeAccept_impl ( node->returnDecls, *this ); |
---|
2983 | maybeAccept_impl ( node->dtors , *this ); |
---|
2984 | |
---|
2985 | VISIT_END( node ); |
---|
2986 | } |
---|
2987 | |
---|
2988 | template< typename pass_type > |
---|
2989 | Expression * PassVisitor< pass_type >::mutate( StmtExpr * node ) { |
---|
2990 | MUTATE_START( node ); |
---|
2991 | |
---|
2992 | // don't want statements from outer CompoundStmts to be added to this StmtExpr |
---|
2993 | ValueGuardPtr< typename std::remove_pointer<decltype(get_env_ptr())>::type > oldEnv( get_env_ptr() ); |
---|
2994 | ValueGuardPtr< std::list< Statement* > > oldBeforeStmts( get_beforeStmts() ); |
---|
2995 | ValueGuardPtr< std::list< Statement* > > oldAfterStmts ( get_afterStmts () ); |
---|
2996 | |
---|
2997 | indexerScopedMutate( node->result , *this ); |
---|
2998 | maybeMutate_impl ( node->statements , *this ); |
---|
2999 | maybeMutate_impl ( node->returnDecls, *this ); |
---|
3000 | maybeMutate_impl ( node->dtors , *this ); |
---|
3001 | |
---|
3002 | MUTATE_END( Expression, node ); |
---|
3003 | } |
---|
3004 | |
---|
3005 | //-------------------------------------------------------------------------- |
---|
3006 | // UniqueExpr |
---|
3007 | template< typename pass_type > |
---|
3008 | void PassVisitor< pass_type >::visit( UniqueExpr * node ) { |
---|
3009 | VISIT_START( node ); |
---|
3010 | |
---|
3011 | indexerScopedAccept( node->result, *this ); |
---|
3012 | maybeAccept_impl ( node->expr , *this ); |
---|
3013 | |
---|
3014 | VISIT_END( node ); |
---|
3015 | } |
---|
3016 | |
---|
3017 | template< typename pass_type > |
---|
3018 | void PassVisitor< pass_type >::visit( const UniqueExpr * node ) { |
---|
3019 | VISIT_START( node ); |
---|
3020 | |
---|
3021 | indexerScopedAccept( node->result, *this ); |
---|
3022 | maybeAccept_impl ( node->expr , *this ); |
---|
3023 | |
---|
3024 | VISIT_END( node ); |
---|
3025 | } |
---|
3026 | |
---|
3027 | template< typename pass_type > |
---|
3028 | Expression * PassVisitor< pass_type >::mutate( UniqueExpr * node ) { |
---|
3029 | MUTATE_START( node ); |
---|
3030 | |
---|
3031 | indexerScopedMutate( node->env , *this ); |
---|
3032 | indexerScopedMutate( node->result, *this ); |
---|
3033 | maybeMutate_impl ( node->expr , *this ); |
---|
3034 | |
---|
3035 | MUTATE_END( Expression, node ); |
---|
3036 | } |
---|
3037 | |
---|
3038 | //-------------------------------------------------------------------------- |
---|
3039 | // UntypedInitExpr |
---|
3040 | template< typename pass_type > |
---|
3041 | void PassVisitor< pass_type >::visit( UntypedInitExpr * node ) { |
---|
3042 | VISIT_START( node ); |
---|
3043 | |
---|
3044 | indexerScopedAccept( node->result, *this ); |
---|
3045 | maybeAccept_impl ( node->expr , *this ); |
---|
3046 | // not currently visiting initAlts, but this doesn't matter since this node is only used in the resolver. |
---|
3047 | |
---|
3048 | VISIT_END( node ); |
---|
3049 | } |
---|
3050 | |
---|
3051 | template< typename pass_type > |
---|
3052 | void PassVisitor< pass_type >::visit( const UntypedInitExpr * node ) { |
---|
3053 | VISIT_START( node ); |
---|
3054 | |
---|
3055 | indexerScopedAccept( node->result, *this ); |
---|
3056 | maybeAccept_impl ( node->expr , *this ); |
---|
3057 | // not currently visiting initAlts, but this doesn't matter since this node is only used in the resolver. |
---|
3058 | |
---|
3059 | VISIT_END( node ); |
---|
3060 | } |
---|
3061 | |
---|
3062 | template< typename pass_type > |
---|
3063 | Expression * PassVisitor< pass_type >::mutate( UntypedInitExpr * node ) { |
---|
3064 | MUTATE_START( node ); |
---|
3065 | |
---|
3066 | indexerScopedMutate( node->env , *this ); |
---|
3067 | indexerScopedMutate( node->result, *this ); |
---|
3068 | maybeMutate_impl ( node->expr , *this ); |
---|
3069 | // not currently visiting initAlts, but this doesn't matter since this node is only used in the resolver. |
---|
3070 | |
---|
3071 | MUTATE_END( Expression, node ); |
---|
3072 | } |
---|
3073 | |
---|
3074 | //-------------------------------------------------------------------------- |
---|
3075 | // InitExpr |
---|
3076 | template< typename pass_type > |
---|
3077 | void PassVisitor< pass_type >::visit( InitExpr * node ) { |
---|
3078 | VISIT_START( node ); |
---|
3079 | |
---|
3080 | indexerScopedAccept( node->result, *this ); |
---|
3081 | maybeAccept_impl ( node->expr , *this ); |
---|
3082 | maybeAccept_impl ( node->designation, *this ); |
---|
3083 | |
---|
3084 | VISIT_END( node ); |
---|
3085 | } |
---|
3086 | |
---|
3087 | template< typename pass_type > |
---|
3088 | void PassVisitor< pass_type >::visit( const InitExpr * node ) { |
---|
3089 | VISIT_START( node ); |
---|
3090 | |
---|
3091 | indexerScopedAccept( node->result, *this ); |
---|
3092 | maybeAccept_impl ( node->expr , *this ); |
---|
3093 | maybeAccept_impl ( node->designation, *this ); |
---|
3094 | |
---|
3095 | VISIT_END( node ); |
---|
3096 | } |
---|
3097 | |
---|
3098 | template< typename pass_type > |
---|
3099 | Expression * PassVisitor< pass_type >::mutate( InitExpr * node ) { |
---|
3100 | MUTATE_START( node ); |
---|
3101 | |
---|
3102 | indexerScopedMutate( node->env , *this ); |
---|
3103 | indexerScopedMutate( node->result, *this ); |
---|
3104 | maybeMutate_impl ( node->expr , *this ); |
---|
3105 | maybeMutate_impl ( node->designation, *this ); |
---|
3106 | |
---|
3107 | MUTATE_END( Expression, node ); |
---|
3108 | } |
---|
3109 | |
---|
3110 | //-------------------------------------------------------------------------- |
---|
3111 | // DeletedExpr |
---|
3112 | template< typename pass_type > |
---|
3113 | void PassVisitor< pass_type >::visit( DeletedExpr * node ) { |
---|
3114 | VISIT_START( node ); |
---|
3115 | |
---|
3116 | indexerScopedAccept( node->result, *this ); |
---|
3117 | maybeAccept_impl ( node->expr, *this ); |
---|
3118 | // don't visit deleteStmt, because it is a pointer to somewhere else in the tree. |
---|
3119 | |
---|
3120 | VISIT_END( node ); |
---|
3121 | } |
---|
3122 | |
---|
3123 | template< typename pass_type > |
---|
3124 | void PassVisitor< pass_type >::visit( const DeletedExpr * node ) { |
---|
3125 | VISIT_START( node ); |
---|
3126 | |
---|
3127 | indexerScopedAccept( node->result, *this ); |
---|
3128 | maybeAccept_impl ( node->expr, *this ); |
---|
3129 | // don't visit deleteStmt, because it is a pointer to somewhere else in the tree. |
---|
3130 | |
---|
3131 | VISIT_END( node ); |
---|
3132 | } |
---|
3133 | |
---|
3134 | template< typename pass_type > |
---|
3135 | Expression * PassVisitor< pass_type >::mutate( DeletedExpr * node ) { |
---|
3136 | MUTATE_START( node ); |
---|
3137 | |
---|
3138 | indexerScopedMutate( node->env, *this ); |
---|
3139 | indexerScopedMutate( node->result, *this ); |
---|
3140 | maybeMutate_impl( node->expr, *this ); |
---|
3141 | |
---|
3142 | MUTATE_END( Expression, node ); |
---|
3143 | } |
---|
3144 | |
---|
3145 | //-------------------------------------------------------------------------- |
---|
3146 | // DefaultArgExpr |
---|
3147 | template< typename pass_type > |
---|
3148 | void PassVisitor< pass_type >::visit( DefaultArgExpr * node ) { |
---|
3149 | VISIT_START( node ); |
---|
3150 | |
---|
3151 | indexerScopedAccept( node->result, *this ); |
---|
3152 | maybeAccept_impl ( node->expr, *this ); |
---|
3153 | |
---|
3154 | VISIT_END( node ); |
---|
3155 | } |
---|
3156 | |
---|
3157 | template< typename pass_type > |
---|
3158 | void PassVisitor< pass_type >::visit( const DefaultArgExpr * node ) { |
---|
3159 | VISIT_START( node ); |
---|
3160 | |
---|
3161 | indexerScopedAccept( node->result, *this ); |
---|
3162 | maybeAccept_impl ( node->expr, *this ); |
---|
3163 | |
---|
3164 | VISIT_END( node ); |
---|
3165 | } |
---|
3166 | |
---|
3167 | template< typename pass_type > |
---|
3168 | Expression * PassVisitor< pass_type >::mutate( DefaultArgExpr * node ) { |
---|
3169 | MUTATE_START( node ); |
---|
3170 | |
---|
3171 | indexerScopedMutate( node->env, *this ); |
---|
3172 | indexerScopedMutate( node->result, *this ); |
---|
3173 | maybeMutate_impl( node->expr, *this ); |
---|
3174 | |
---|
3175 | MUTATE_END( Expression, node ); |
---|
3176 | } |
---|
3177 | |
---|
3178 | //-------------------------------------------------------------------------- |
---|
3179 | // GenericExpr |
---|
3180 | template< typename pass_type > |
---|
3181 | void PassVisitor< pass_type >::visit( GenericExpr * node ) { |
---|
3182 | VISIT_START( node ); |
---|
3183 | |
---|
3184 | indexerScopedAccept( node->result, *this ); |
---|
3185 | maybeAccept_impl( node->control, *this ); |
---|
3186 | for ( GenericExpr::Association & assoc : node->associations ) { |
---|
3187 | indexerScopedAccept( assoc.type, *this ); |
---|
3188 | maybeAccept_impl( assoc.expr, *this ); |
---|
3189 | } |
---|
3190 | |
---|
3191 | VISIT_END( node ); |
---|
3192 | } |
---|
3193 | |
---|
3194 | template< typename pass_type > |
---|
3195 | void PassVisitor< pass_type >::visit( const GenericExpr * node ) { |
---|
3196 | VISIT_START( node ); |
---|
3197 | |
---|
3198 | indexerScopedAccept( node->result, *this ); |
---|
3199 | maybeAccept_impl( node->control, *this ); |
---|
3200 | for ( const GenericExpr::Association & assoc : node->associations ) { |
---|
3201 | indexerScopedAccept( assoc.type, *this ); |
---|
3202 | maybeAccept_impl( assoc.expr, *this ); |
---|
3203 | } |
---|
3204 | |
---|
3205 | VISIT_END( node ); |
---|
3206 | } |
---|
3207 | |
---|
3208 | template< typename pass_type > |
---|
3209 | Expression * PassVisitor< pass_type >::mutate( GenericExpr * node ) { |
---|
3210 | MUTATE_START( node ); |
---|
3211 | |
---|
3212 | indexerScopedMutate( node->env, *this ); |
---|
3213 | indexerScopedMutate( node->result, *this ); |
---|
3214 | maybeMutate_impl( node->control, *this ); |
---|
3215 | for ( GenericExpr::Association & assoc : node->associations ) { |
---|
3216 | indexerScopedMutate( assoc.type, *this ); |
---|
3217 | maybeMutate_impl( assoc.expr, *this ); |
---|
3218 | } |
---|
3219 | |
---|
3220 | MUTATE_END( Expression, node ); |
---|
3221 | } |
---|
3222 | |
---|
3223 | //-------------------------------------------------------------------------- |
---|
3224 | // VoidType |
---|
3225 | template< typename pass_type > |
---|
3226 | void PassVisitor< pass_type >::visit( VoidType * node ) { |
---|
3227 | VISIT_START( node ); |
---|
3228 | |
---|
3229 | maybeAccept_impl( node->forall, *this ); |
---|
3230 | |
---|
3231 | VISIT_END( node ); |
---|
3232 | } |
---|
3233 | |
---|
3234 | template< typename pass_type > |
---|
3235 | void PassVisitor< pass_type >::visit( const VoidType * node ) { |
---|
3236 | VISIT_START( node ); |
---|
3237 | |
---|
3238 | maybeAccept_impl( node->forall, *this ); |
---|
3239 | |
---|
3240 | VISIT_END( node ); |
---|
3241 | } |
---|
3242 | |
---|
3243 | template< typename pass_type > |
---|
3244 | Type * PassVisitor< pass_type >::mutate( VoidType * node ) { |
---|
3245 | MUTATE_START( node ); |
---|
3246 | |
---|
3247 | maybeMutate_impl( node->forall, *this ); |
---|
3248 | |
---|
3249 | MUTATE_END( Type, node ); |
---|
3250 | } |
---|
3251 | |
---|
3252 | //-------------------------------------------------------------------------- |
---|
3253 | // BasicType |
---|
3254 | template< typename pass_type > |
---|
3255 | void PassVisitor< pass_type >::visit( BasicType * node ) { |
---|
3256 | VISIT_START( node ); |
---|
3257 | |
---|
3258 | maybeAccept_impl( node->forall, *this ); |
---|
3259 | |
---|
3260 | VISIT_END( node ); |
---|
3261 | } |
---|
3262 | |
---|
3263 | template< typename pass_type > |
---|
3264 | void PassVisitor< pass_type >::visit( const BasicType * node ) { |
---|
3265 | VISIT_START( node ); |
---|
3266 | |
---|
3267 | maybeAccept_impl( node->forall, *this ); |
---|
3268 | |
---|
3269 | VISIT_END( node ); |
---|
3270 | } |
---|
3271 | |
---|
3272 | template< typename pass_type > |
---|
3273 | Type * PassVisitor< pass_type >::mutate( BasicType * node ) { |
---|
3274 | MUTATE_START( node ); |
---|
3275 | |
---|
3276 | maybeMutate_impl( node->forall, *this ); |
---|
3277 | |
---|
3278 | MUTATE_END( Type, node ); |
---|
3279 | } |
---|
3280 | |
---|
3281 | //-------------------------------------------------------------------------- |
---|
3282 | // PointerType |
---|
3283 | template< typename pass_type > |
---|
3284 | void PassVisitor< pass_type >::visit( PointerType * node ) { |
---|
3285 | VISIT_START( node ); |
---|
3286 | |
---|
3287 | maybeAccept_impl( node->forall, *this ); |
---|
3288 | maybeAccept_impl( node->dimension, *this ); |
---|
3289 | maybeAccept_impl( node->base, *this ); |
---|
3290 | |
---|
3291 | VISIT_END( node ); |
---|
3292 | } |
---|
3293 | |
---|
3294 | template< typename pass_type > |
---|
3295 | void PassVisitor< pass_type >::visit( const PointerType * node ) { |
---|
3296 | VISIT_START( node ); |
---|
3297 | |
---|
3298 | maybeAccept_impl( node->forall, *this ); |
---|
3299 | maybeAccept_impl( node->dimension, *this ); |
---|
3300 | maybeAccept_impl( node->base, *this ); |
---|
3301 | |
---|
3302 | VISIT_END( node ); |
---|
3303 | } |
---|
3304 | |
---|
3305 | template< typename pass_type > |
---|
3306 | Type * PassVisitor< pass_type >::mutate( PointerType * node ) { |
---|
3307 | MUTATE_START( node ); |
---|
3308 | |
---|
3309 | maybeMutate_impl( node->forall, *this ); |
---|
3310 | maybeMutate_impl( node->dimension, *this ); |
---|
3311 | maybeMutate_impl( node->base, *this ); |
---|
3312 | |
---|
3313 | MUTATE_END( Type, node ); |
---|
3314 | } |
---|
3315 | |
---|
3316 | //-------------------------------------------------------------------------- |
---|
3317 | // ArrayType |
---|
3318 | template< typename pass_type > |
---|
3319 | void PassVisitor< pass_type >::visit( ArrayType * node ) { |
---|
3320 | VISIT_START( node ); |
---|
3321 | |
---|
3322 | maybeAccept_impl( node->forall, *this ); |
---|
3323 | maybeAccept_impl( node->dimension, *this ); |
---|
3324 | maybeAccept_impl( node->base, *this ); |
---|
3325 | |
---|
3326 | VISIT_END( node ); |
---|
3327 | } |
---|
3328 | |
---|
3329 | template< typename pass_type > |
---|
3330 | void PassVisitor< pass_type >::visit( const ArrayType * node ) { |
---|
3331 | VISIT_START( node ); |
---|
3332 | |
---|
3333 | maybeAccept_impl( node->forall, *this ); |
---|
3334 | maybeAccept_impl( node->dimension, *this ); |
---|
3335 | maybeAccept_impl( node->base, *this ); |
---|
3336 | |
---|
3337 | VISIT_END( node ); |
---|
3338 | } |
---|
3339 | |
---|
3340 | template< typename pass_type > |
---|
3341 | Type * PassVisitor< pass_type >::mutate( ArrayType * node ) { |
---|
3342 | MUTATE_START( node ); |
---|
3343 | |
---|
3344 | maybeMutate_impl( node->forall, *this ); |
---|
3345 | maybeMutate_impl( node->dimension, *this ); |
---|
3346 | maybeMutate_impl( node->base, *this ); |
---|
3347 | |
---|
3348 | MUTATE_END( Type, node ); |
---|
3349 | } |
---|
3350 | |
---|
3351 | //-------------------------------------------------------------------------- |
---|
3352 | // ReferenceType |
---|
3353 | template< typename pass_type > |
---|
3354 | void PassVisitor< pass_type >::visit( ReferenceType * node ) { |
---|
3355 | VISIT_START( node ); |
---|
3356 | |
---|
3357 | maybeAccept_impl( node->forall, *this ); |
---|
3358 | maybeAccept_impl( node->base, *this ); |
---|
3359 | |
---|
3360 | VISIT_END( node ); |
---|
3361 | } |
---|
3362 | |
---|
3363 | template< typename pass_type > |
---|
3364 | void PassVisitor< pass_type >::visit( const ReferenceType * node ) { |
---|
3365 | VISIT_START( node ); |
---|
3366 | |
---|
3367 | maybeAccept_impl( node->forall, *this ); |
---|
3368 | maybeAccept_impl( node->base, *this ); |
---|
3369 | |
---|
3370 | VISIT_END( node ); |
---|
3371 | } |
---|
3372 | |
---|
3373 | template< typename pass_type > |
---|
3374 | Type * PassVisitor< pass_type >::mutate( ReferenceType * node ) { |
---|
3375 | MUTATE_START( node ); |
---|
3376 | |
---|
3377 | maybeMutate_impl( node->forall, *this ); |
---|
3378 | maybeMutate_impl( node->base, *this ); |
---|
3379 | |
---|
3380 | MUTATE_END( Type, node ); |
---|
3381 | } |
---|
3382 | |
---|
3383 | //-------------------------------------------------------------------------- |
---|
3384 | // QualifiedType |
---|
3385 | template< typename pass_type > |
---|
3386 | void PassVisitor< pass_type >::visit( QualifiedType * node ) { |
---|
3387 | VISIT_START( node ); |
---|
3388 | |
---|
3389 | maybeAccept_impl( node->forall, *this ); |
---|
3390 | maybeAccept_impl( node->parent, *this ); |
---|
3391 | maybeAccept_impl( node->child, *this ); |
---|
3392 | |
---|
3393 | VISIT_END( node ); |
---|
3394 | } |
---|
3395 | |
---|
3396 | template< typename pass_type > |
---|
3397 | void PassVisitor< pass_type >::visit( const QualifiedType * node ) { |
---|
3398 | VISIT_START( node ); |
---|
3399 | |
---|
3400 | maybeAccept_impl( node->forall, *this ); |
---|
3401 | maybeAccept_impl( node->parent, *this ); |
---|
3402 | maybeAccept_impl( node->child, *this ); |
---|
3403 | |
---|
3404 | VISIT_END( node ); |
---|
3405 | } |
---|
3406 | |
---|
3407 | template< typename pass_type > |
---|
3408 | Type * PassVisitor< pass_type >::mutate( QualifiedType * node ) { |
---|
3409 | MUTATE_START( node ); |
---|
3410 | |
---|
3411 | maybeMutate_impl( node->forall, *this ); |
---|
3412 | maybeMutate_impl( node->parent, *this ); |
---|
3413 | maybeMutate_impl( node->child, *this ); |
---|
3414 | |
---|
3415 | MUTATE_END( Type, node ); |
---|
3416 | } |
---|
3417 | |
---|
3418 | //-------------------------------------------------------------------------- |
---|
3419 | // FunctionType |
---|
3420 | template< typename pass_type > |
---|
3421 | void PassVisitor< pass_type >::visit( FunctionType * node ) { |
---|
3422 | VISIT_START( node ); |
---|
3423 | |
---|
3424 | maybeAccept_impl( node->forall, *this ); |
---|
3425 | maybeAccept_impl( node->returnVals, *this ); |
---|
3426 | maybeAccept_impl( node->parameters, *this ); |
---|
3427 | |
---|
3428 | VISIT_END( node ); |
---|
3429 | } |
---|
3430 | |
---|
3431 | template< typename pass_type > |
---|
3432 | void PassVisitor< pass_type >::visit( const FunctionType * node ) { |
---|
3433 | VISIT_START( node ); |
---|
3434 | |
---|
3435 | maybeAccept_impl( node->forall, *this ); |
---|
3436 | maybeAccept_impl( node->returnVals, *this ); |
---|
3437 | maybeAccept_impl( node->parameters, *this ); |
---|
3438 | |
---|
3439 | VISIT_END( node ); |
---|
3440 | } |
---|
3441 | |
---|
3442 | template< typename pass_type > |
---|
3443 | Type * PassVisitor< pass_type >::mutate( FunctionType * node ) { |
---|
3444 | MUTATE_START( node ); |
---|
3445 | |
---|
3446 | maybeMutate_impl( node->forall, *this ); |
---|
3447 | maybeMutate_impl( node->returnVals, *this ); |
---|
3448 | maybeMutate_impl( node->parameters, *this ); |
---|
3449 | |
---|
3450 | MUTATE_END( Type, node ); |
---|
3451 | } |
---|
3452 | |
---|
3453 | //-------------------------------------------------------------------------- |
---|
3454 | // StructInstType |
---|
3455 | template< typename pass_type > |
---|
3456 | void PassVisitor< pass_type >::visit( StructInstType * node ) { |
---|
3457 | VISIT_START( node ); |
---|
3458 | |
---|
3459 | indexerAddStruct( node->name ); |
---|
3460 | |
---|
3461 | { |
---|
3462 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
3463 | maybeAccept_impl( node->forall , *this ); |
---|
3464 | maybeAccept_impl( node->parameters, *this ); |
---|
3465 | } |
---|
3466 | |
---|
3467 | VISIT_END( node ); |
---|
3468 | } |
---|
3469 | |
---|
3470 | template< typename pass_type > |
---|
3471 | void PassVisitor< pass_type >::visit( const StructInstType * node ) { |
---|
3472 | VISIT_START( node ); |
---|
3473 | |
---|
3474 | indexerAddStruct( node->name ); |
---|
3475 | |
---|
3476 | { |
---|
3477 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
3478 | maybeAccept_impl( node->forall , *this ); |
---|
3479 | maybeAccept_impl( node->parameters, *this ); |
---|
3480 | } |
---|
3481 | |
---|
3482 | VISIT_END( node ); |
---|
3483 | } |
---|
3484 | |
---|
3485 | template< typename pass_type > |
---|
3486 | Type * PassVisitor< pass_type >::mutate( StructInstType * node ) { |
---|
3487 | MUTATE_START( node ); |
---|
3488 | |
---|
3489 | indexerAddStruct( node->name ); |
---|
3490 | |
---|
3491 | { |
---|
3492 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
3493 | maybeMutate_impl( node->forall , *this ); |
---|
3494 | maybeMutate_impl( node->parameters, *this ); |
---|
3495 | } |
---|
3496 | |
---|
3497 | MUTATE_END( Type, node ); |
---|
3498 | } |
---|
3499 | |
---|
3500 | //-------------------------------------------------------------------------- |
---|
3501 | // UnionInstType |
---|
3502 | template< typename pass_type > |
---|
3503 | void PassVisitor< pass_type >::visit( UnionInstType * node ) { |
---|
3504 | VISIT_START( node ); |
---|
3505 | |
---|
3506 | indexerAddUnion( node->name ); |
---|
3507 | |
---|
3508 | { |
---|
3509 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
3510 | maybeAccept_impl( node->forall , *this ); |
---|
3511 | maybeAccept_impl( node->parameters, *this ); |
---|
3512 | } |
---|
3513 | |
---|
3514 | VISIT_END( node ); |
---|
3515 | } |
---|
3516 | |
---|
3517 | template< typename pass_type > |
---|
3518 | void PassVisitor< pass_type >::visit( const UnionInstType * node ) { |
---|
3519 | VISIT_START( node ); |
---|
3520 | |
---|
3521 | indexerAddUnion( node->name ); |
---|
3522 | |
---|
3523 | { |
---|
3524 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
3525 | maybeAccept_impl( node->forall , *this ); |
---|
3526 | maybeAccept_impl( node->parameters, *this ); |
---|
3527 | } |
---|
3528 | |
---|
3529 | VISIT_END( node ); |
---|
3530 | } |
---|
3531 | |
---|
3532 | template< typename pass_type > |
---|
3533 | Type * PassVisitor< pass_type >::mutate( UnionInstType * node ) { |
---|
3534 | MUTATE_START( node ); |
---|
3535 | |
---|
3536 | indexerAddUnion( node->name ); |
---|
3537 | |
---|
3538 | { |
---|
3539 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
3540 | maybeMutate_impl( node->forall , *this ); |
---|
3541 | maybeMutate_impl( node->parameters, *this ); |
---|
3542 | } |
---|
3543 | |
---|
3544 | MUTATE_END( Type, node ); |
---|
3545 | } |
---|
3546 | |
---|
3547 | //-------------------------------------------------------------------------- |
---|
3548 | // EnumInstType |
---|
3549 | template< typename pass_type > |
---|
3550 | void PassVisitor< pass_type >::visit( EnumInstType * node ) { |
---|
3551 | VISIT_START( node ); |
---|
3552 | |
---|
3553 | maybeAccept_impl( node->forall, *this ); |
---|
3554 | maybeAccept_impl( node->parameters, *this ); |
---|
3555 | |
---|
3556 | VISIT_END( node ); |
---|
3557 | } |
---|
3558 | |
---|
3559 | template< typename pass_type > |
---|
3560 | void PassVisitor< pass_type >::visit( const EnumInstType * node ) { |
---|
3561 | VISIT_START( node ); |
---|
3562 | |
---|
3563 | maybeAccept_impl( node->forall, *this ); |
---|
3564 | maybeAccept_impl( node->parameters, *this ); |
---|
3565 | |
---|
3566 | VISIT_END( node ); |
---|
3567 | } |
---|
3568 | |
---|
3569 | template< typename pass_type > |
---|
3570 | Type * PassVisitor< pass_type >::mutate( EnumInstType * node ) { |
---|
3571 | MUTATE_START( node ); |
---|
3572 | |
---|
3573 | maybeMutate_impl( node->forall, *this ); |
---|
3574 | maybeMutate_impl( node->parameters, *this ); |
---|
3575 | |
---|
3576 | MUTATE_END( Type, node ); |
---|
3577 | } |
---|
3578 | |
---|
3579 | //-------------------------------------------------------------------------- |
---|
3580 | // TraitInstType |
---|
3581 | template< typename pass_type > |
---|
3582 | void PassVisitor< pass_type >::visit( TraitInstType * node ) { |
---|
3583 | VISIT_START( node ); |
---|
3584 | |
---|
3585 | maybeAccept_impl( node->forall , *this ); |
---|
3586 | maybeAccept_impl( node->parameters, *this ); |
---|
3587 | |
---|
3588 | VISIT_END( node ); |
---|
3589 | } |
---|
3590 | |
---|
3591 | template< typename pass_type > |
---|
3592 | void PassVisitor< pass_type >::visit( const TraitInstType * node ) { |
---|
3593 | VISIT_START( node ); |
---|
3594 | |
---|
3595 | maybeAccept_impl( node->forall , *this ); |
---|
3596 | maybeAccept_impl( node->parameters, *this ); |
---|
3597 | |
---|
3598 | VISIT_END( node ); |
---|
3599 | } |
---|
3600 | |
---|
3601 | template< typename pass_type > |
---|
3602 | Type * PassVisitor< pass_type >::mutate( TraitInstType * node ) { |
---|
3603 | MUTATE_START( node ); |
---|
3604 | |
---|
3605 | maybeMutate_impl( node->forall , *this ); |
---|
3606 | maybeMutate_impl( node->parameters, *this ); |
---|
3607 | |
---|
3608 | MUTATE_END( Type, node ); |
---|
3609 | } |
---|
3610 | |
---|
3611 | //-------------------------------------------------------------------------- |
---|
3612 | // TypeInstType |
---|
3613 | template< typename pass_type > |
---|
3614 | void PassVisitor< pass_type >::visit( TypeInstType * node ) { |
---|
3615 | VISIT_START( node ); |
---|
3616 | |
---|
3617 | maybeAccept_impl( node->forall , *this ); |
---|
3618 | maybeAccept_impl( node->parameters, *this ); |
---|
3619 | |
---|
3620 | VISIT_END( node ); |
---|
3621 | } |
---|
3622 | |
---|
3623 | template< typename pass_type > |
---|
3624 | void PassVisitor< pass_type >::visit( const TypeInstType * node ) { |
---|
3625 | VISIT_START( node ); |
---|
3626 | |
---|
3627 | maybeAccept_impl( node->forall , *this ); |
---|
3628 | maybeAccept_impl( node->parameters, *this ); |
---|
3629 | |
---|
3630 | VISIT_END( node ); |
---|
3631 | } |
---|
3632 | |
---|
3633 | template< typename pass_type > |
---|
3634 | Type * PassVisitor< pass_type >::mutate( TypeInstType * node ) { |
---|
3635 | MUTATE_START( node ); |
---|
3636 | |
---|
3637 | maybeMutate_impl( node->forall , *this ); |
---|
3638 | maybeMutate_impl( node->parameters, *this ); |
---|
3639 | |
---|
3640 | MUTATE_END( Type, node ); |
---|
3641 | } |
---|
3642 | |
---|
3643 | //-------------------------------------------------------------------------- |
---|
3644 | // TupleType |
---|
3645 | template< typename pass_type > |
---|
3646 | void PassVisitor< pass_type >::visit( TupleType * node ) { |
---|
3647 | VISIT_START( node ); |
---|
3648 | |
---|
3649 | maybeAccept_impl( node->forall, *this ); |
---|
3650 | maybeAccept_impl( node->types, *this ); |
---|
3651 | maybeAccept_impl( node->members, *this ); |
---|
3652 | |
---|
3653 | VISIT_END( node ); |
---|
3654 | } |
---|
3655 | |
---|
3656 | template< typename pass_type > |
---|
3657 | void PassVisitor< pass_type >::visit( const TupleType * node ) { |
---|
3658 | VISIT_START( node ); |
---|
3659 | |
---|
3660 | maybeAccept_impl( node->forall, *this ); |
---|
3661 | maybeAccept_impl( node->types, *this ); |
---|
3662 | maybeAccept_impl( node->members, *this ); |
---|
3663 | |
---|
3664 | VISIT_END( node ); |
---|
3665 | } |
---|
3666 | |
---|
3667 | template< typename pass_type > |
---|
3668 | Type * PassVisitor< pass_type >::mutate( TupleType * node ) { |
---|
3669 | MUTATE_START( node ); |
---|
3670 | |
---|
3671 | maybeMutate_impl( node->forall, *this ); |
---|
3672 | maybeMutate_impl( node->types, *this ); |
---|
3673 | maybeMutate_impl( node->members, *this ); |
---|
3674 | |
---|
3675 | MUTATE_END( Type, node ); |
---|
3676 | } |
---|
3677 | |
---|
3678 | //-------------------------------------------------------------------------- |
---|
3679 | // TypeofType |
---|
3680 | template< typename pass_type > |
---|
3681 | void PassVisitor< pass_type >::visit( TypeofType * node ) { |
---|
3682 | VISIT_START( node ); |
---|
3683 | |
---|
3684 | assert( node->expr ); |
---|
3685 | maybeAccept_impl( node->expr, *this ); |
---|
3686 | |
---|
3687 | VISIT_END( node ); |
---|
3688 | } |
---|
3689 | |
---|
3690 | template< typename pass_type > |
---|
3691 | void PassVisitor< pass_type >::visit( const TypeofType * node ) { |
---|
3692 | VISIT_START( node ); |
---|
3693 | |
---|
3694 | assert( node->expr ); |
---|
3695 | maybeAccept_impl( node->expr, *this ); |
---|
3696 | |
---|
3697 | VISIT_END( node ); |
---|
3698 | } |
---|
3699 | |
---|
3700 | template< typename pass_type > |
---|
3701 | Type * PassVisitor< pass_type >::mutate( TypeofType * node ) { |
---|
3702 | MUTATE_START( node ); |
---|
3703 | |
---|
3704 | assert( node->expr ); |
---|
3705 | maybeMutate_impl( node->expr, *this ); |
---|
3706 | |
---|
3707 | MUTATE_END( Type, node ); |
---|
3708 | } |
---|
3709 | |
---|
3710 | //-------------------------------------------------------------------------- |
---|
3711 | // VTableType |
---|
3712 | template< typename pass_type > |
---|
3713 | void PassVisitor< pass_type >::visit( VTableType * node ) { |
---|
3714 | VISIT_START( node ); |
---|
3715 | |
---|
3716 | // Forall qualifiers should be on base type, not here |
---|
3717 | // maybeAccept_impl( node->forall, *this ); |
---|
3718 | maybeAccept_impl( node->base, *this ); |
---|
3719 | |
---|
3720 | VISIT_END( node ); |
---|
3721 | } |
---|
3722 | |
---|
3723 | template< typename pass_type > |
---|
3724 | void PassVisitor< pass_type >::visit( const VTableType * node ) { |
---|
3725 | VISIT_START( node ); |
---|
3726 | |
---|
3727 | // Forall qualifiers should be on base type, not here |
---|
3728 | // maybeAccept_impl( node->forall, *this ); |
---|
3729 | maybeAccept_impl( node->base, *this ); |
---|
3730 | |
---|
3731 | VISIT_END( node ); |
---|
3732 | } |
---|
3733 | |
---|
3734 | template< typename pass_type > |
---|
3735 | Type * PassVisitor< pass_type >::mutate( VTableType * node ) { |
---|
3736 | MUTATE_START( node ); |
---|
3737 | |
---|
3738 | // Forall qualifiers should be on base type, not here |
---|
3739 | // maybeMutate_impl( node->forall, *this ); |
---|
3740 | maybeMutate_impl( node->base, *this ); |
---|
3741 | |
---|
3742 | MUTATE_END( Type, node ); |
---|
3743 | } |
---|
3744 | |
---|
3745 | //-------------------------------------------------------------------------- |
---|
3746 | // AttrType |
---|
3747 | template< typename pass_type > |
---|
3748 | void PassVisitor< pass_type >::visit( AttrType * node ) { |
---|
3749 | VISIT_START( node ); |
---|
3750 | |
---|
3751 | if ( node->isType ) { |
---|
3752 | assert( node->type ); |
---|
3753 | maybeAccept_impl( node->type, *this ); |
---|
3754 | } else { |
---|
3755 | assert( node->expr ); |
---|
3756 | maybeAccept_impl( node->expr, *this ); |
---|
3757 | } // if |
---|
3758 | |
---|
3759 | VISIT_END( node ); |
---|
3760 | } |
---|
3761 | |
---|
3762 | template< typename pass_type > |
---|
3763 | void PassVisitor< pass_type >::visit( const AttrType * node ) { |
---|
3764 | VISIT_START( node ); |
---|
3765 | |
---|
3766 | if ( node->isType ) { |
---|
3767 | assert( node->type ); |
---|
3768 | maybeAccept_impl( node->type, *this ); |
---|
3769 | } else { |
---|
3770 | assert( node->expr ); |
---|
3771 | maybeAccept_impl( node->expr, *this ); |
---|
3772 | } // if |
---|
3773 | |
---|
3774 | VISIT_END( node ); |
---|
3775 | } |
---|
3776 | |
---|
3777 | template< typename pass_type > |
---|
3778 | Type * PassVisitor< pass_type >::mutate( AttrType * node ) { |
---|
3779 | MUTATE_START( node ); |
---|
3780 | |
---|
3781 | if ( node->isType ) { |
---|
3782 | assert( node->type ); |
---|
3783 | maybeMutate_impl( node->type, *this ); |
---|
3784 | } else { |
---|
3785 | assert( node->expr ); |
---|
3786 | maybeMutate_impl( node->expr, *this ); |
---|
3787 | } // if |
---|
3788 | |
---|
3789 | MUTATE_END( Type, node ); |
---|
3790 | } |
---|
3791 | |
---|
3792 | //-------------------------------------------------------------------------- |
---|
3793 | // VarArgsType |
---|
3794 | template< typename pass_type > |
---|
3795 | void PassVisitor< pass_type >::visit( VarArgsType * node ) { |
---|
3796 | VISIT_START( node ); |
---|
3797 | |
---|
3798 | maybeAccept_impl( node->forall, *this ); |
---|
3799 | |
---|
3800 | VISIT_END( node ); |
---|
3801 | } |
---|
3802 | |
---|
3803 | template< typename pass_type > |
---|
3804 | void PassVisitor< pass_type >::visit( const VarArgsType * node ) { |
---|
3805 | VISIT_START( node ); |
---|
3806 | |
---|
3807 | maybeAccept_impl( node->forall, *this ); |
---|
3808 | |
---|
3809 | VISIT_END( node ); |
---|
3810 | } |
---|
3811 | |
---|
3812 | template< typename pass_type > |
---|
3813 | Type * PassVisitor< pass_type >::mutate( VarArgsType * node ) { |
---|
3814 | MUTATE_START( node ); |
---|
3815 | |
---|
3816 | maybeMutate_impl( node->forall, *this ); |
---|
3817 | |
---|
3818 | MUTATE_END( Type, node ); |
---|
3819 | } |
---|
3820 | |
---|
3821 | //-------------------------------------------------------------------------- |
---|
3822 | // ZeroType |
---|
3823 | template< typename pass_type > |
---|
3824 | void PassVisitor< pass_type >::visit( ZeroType * node ) { |
---|
3825 | VISIT_START( node ); |
---|
3826 | |
---|
3827 | maybeAccept_impl( node->forall, *this ); |
---|
3828 | |
---|
3829 | VISIT_END( node ); |
---|
3830 | } |
---|
3831 | |
---|
3832 | template< typename pass_type > |
---|
3833 | void PassVisitor< pass_type >::visit( const ZeroType * node ) { |
---|
3834 | VISIT_START( node ); |
---|
3835 | |
---|
3836 | maybeAccept_impl( node->forall, *this ); |
---|
3837 | |
---|
3838 | VISIT_END( node ); |
---|
3839 | } |
---|
3840 | |
---|
3841 | template< typename pass_type > |
---|
3842 | Type * PassVisitor< pass_type >::mutate( ZeroType * node ) { |
---|
3843 | MUTATE_START( node ); |
---|
3844 | |
---|
3845 | maybeMutate_impl( node->forall, *this ); |
---|
3846 | |
---|
3847 | MUTATE_END( Type, node ); |
---|
3848 | } |
---|
3849 | |
---|
3850 | //-------------------------------------------------------------------------- |
---|
3851 | // OneType |
---|
3852 | template< typename pass_type > |
---|
3853 | void PassVisitor< pass_type >::visit( OneType * node ) { |
---|
3854 | VISIT_START( node ); |
---|
3855 | |
---|
3856 | maybeAccept_impl( node->forall, *this ); |
---|
3857 | |
---|
3858 | VISIT_END( node ); |
---|
3859 | } |
---|
3860 | |
---|
3861 | template< typename pass_type > |
---|
3862 | void PassVisitor< pass_type >::visit( const OneType * node ) { |
---|
3863 | VISIT_START( node ); |
---|
3864 | |
---|
3865 | maybeAccept_impl( node->forall, *this ); |
---|
3866 | |
---|
3867 | VISIT_END( node ); |
---|
3868 | } |
---|
3869 | |
---|
3870 | template< typename pass_type > |
---|
3871 | Type * PassVisitor< pass_type >::mutate( OneType * node ) { |
---|
3872 | MUTATE_START( node ); |
---|
3873 | |
---|
3874 | maybeMutate_impl( node->forall, *this ); |
---|
3875 | |
---|
3876 | MUTATE_END( Type, node ); |
---|
3877 | } |
---|
3878 | |
---|
3879 | //-------------------------------------------------------------------------- |
---|
3880 | // GlobalScopeType |
---|
3881 | template< typename pass_type > |
---|
3882 | void PassVisitor< pass_type >::visit( GlobalScopeType * node ) { |
---|
3883 | VISIT_START( node ); |
---|
3884 | |
---|
3885 | maybeAccept_impl( node->forall, *this ); |
---|
3886 | |
---|
3887 | VISIT_END( node ); |
---|
3888 | } |
---|
3889 | |
---|
3890 | template< typename pass_type > |
---|
3891 | void PassVisitor< pass_type >::visit( const GlobalScopeType * node ) { |
---|
3892 | VISIT_START( node ); |
---|
3893 | |
---|
3894 | maybeAccept_impl( node->forall, *this ); |
---|
3895 | |
---|
3896 | VISIT_END( node ); |
---|
3897 | } |
---|
3898 | |
---|
3899 | template< typename pass_type > |
---|
3900 | Type * PassVisitor< pass_type >::mutate( GlobalScopeType * node ) { |
---|
3901 | MUTATE_START( node ); |
---|
3902 | |
---|
3903 | maybeMutate_impl( node->forall, *this ); |
---|
3904 | |
---|
3905 | MUTATE_END( Type, node ); |
---|
3906 | } |
---|
3907 | |
---|
3908 | //-------------------------------------------------------------------------- |
---|
3909 | // Designation |
---|
3910 | template< typename pass_type > |
---|
3911 | void PassVisitor< pass_type >::visit( Designation * node ) { |
---|
3912 | VISIT_START( node ); |
---|
3913 | |
---|
3914 | maybeAccept_impl( node->designators, *this ); |
---|
3915 | |
---|
3916 | VISIT_END( node ); |
---|
3917 | } |
---|
3918 | |
---|
3919 | template< typename pass_type > |
---|
3920 | void PassVisitor< pass_type >::visit( const Designation * node ) { |
---|
3921 | VISIT_START( node ); |
---|
3922 | |
---|
3923 | maybeAccept_impl( node->designators, *this ); |
---|
3924 | |
---|
3925 | VISIT_END( node ); |
---|
3926 | } |
---|
3927 | |
---|
3928 | template< typename pass_type > |
---|
3929 | Designation * PassVisitor< pass_type >::mutate( Designation * node ) { |
---|
3930 | MUTATE_START( node ); |
---|
3931 | |
---|
3932 | maybeMutate_impl( node->designators, *this ); |
---|
3933 | |
---|
3934 | MUTATE_END( Designation, node ); |
---|
3935 | } |
---|
3936 | |
---|
3937 | //-------------------------------------------------------------------------- |
---|
3938 | // SingleInit |
---|
3939 | template< typename pass_type > |
---|
3940 | void PassVisitor< pass_type >::visit( SingleInit * node ) { |
---|
3941 | VISIT_START( node ); |
---|
3942 | |
---|
3943 | visitExpression( node->value ); |
---|
3944 | |
---|
3945 | VISIT_END( node ); |
---|
3946 | } |
---|
3947 | |
---|
3948 | template< typename pass_type > |
---|
3949 | void PassVisitor< pass_type >::visit( const SingleInit * node ) { |
---|
3950 | VISIT_START( node ); |
---|
3951 | |
---|
3952 | visitExpression( node->value ); |
---|
3953 | |
---|
3954 | VISIT_END( node ); |
---|
3955 | } |
---|
3956 | |
---|
3957 | template< typename pass_type > |
---|
3958 | Initializer * PassVisitor< pass_type >::mutate( SingleInit * node ) { |
---|
3959 | MUTATE_START( node ); |
---|
3960 | |
---|
3961 | node->value = mutateExpression( node->value ); |
---|
3962 | |
---|
3963 | MUTATE_END( Initializer, node ); |
---|
3964 | } |
---|
3965 | |
---|
3966 | //-------------------------------------------------------------------------- |
---|
3967 | // ListInit |
---|
3968 | template< typename pass_type > |
---|
3969 | void PassVisitor< pass_type >::visit( ListInit * node ) { |
---|
3970 | VISIT_START( node ); |
---|
3971 | |
---|
3972 | maybeAccept_impl( node->designations, *this ); |
---|
3973 | maybeAccept_impl( node->initializers, *this ); |
---|
3974 | |
---|
3975 | VISIT_END( node ); |
---|
3976 | } |
---|
3977 | |
---|
3978 | template< typename pass_type > |
---|
3979 | void PassVisitor< pass_type >::visit( const ListInit * node ) { |
---|
3980 | VISIT_START( node ); |
---|
3981 | |
---|
3982 | maybeAccept_impl( node->designations, *this ); |
---|
3983 | maybeAccept_impl( node->initializers, *this ); |
---|
3984 | |
---|
3985 | VISIT_END( node ); |
---|
3986 | } |
---|
3987 | |
---|
3988 | template< typename pass_type > |
---|
3989 | Initializer * PassVisitor< pass_type >::mutate( ListInit * node ) { |
---|
3990 | MUTATE_START( node ); |
---|
3991 | |
---|
3992 | maybeMutate_impl( node->designations, *this ); |
---|
3993 | maybeMutate_impl( node->initializers, *this ); |
---|
3994 | |
---|
3995 | MUTATE_END( Initializer, node ); |
---|
3996 | } |
---|
3997 | |
---|
3998 | //-------------------------------------------------------------------------- |
---|
3999 | // ConstructorInit |
---|
4000 | template< typename pass_type > |
---|
4001 | void PassVisitor< pass_type >::visit( ConstructorInit * node ) { |
---|
4002 | VISIT_START( node ); |
---|
4003 | |
---|
4004 | maybeAccept_impl( node->ctor, *this ); |
---|
4005 | maybeAccept_impl( node->dtor, *this ); |
---|
4006 | maybeAccept_impl( node->init, *this ); |
---|
4007 | |
---|
4008 | VISIT_END( node ); |
---|
4009 | } |
---|
4010 | |
---|
4011 | template< typename pass_type > |
---|
4012 | void PassVisitor< pass_type >::visit( const ConstructorInit * node ) { |
---|
4013 | VISIT_START( node ); |
---|
4014 | |
---|
4015 | maybeAccept_impl( node->ctor, *this ); |
---|
4016 | maybeAccept_impl( node->dtor, *this ); |
---|
4017 | maybeAccept_impl( node->init, *this ); |
---|
4018 | |
---|
4019 | VISIT_END( node ); |
---|
4020 | } |
---|
4021 | |
---|
4022 | template< typename pass_type > |
---|
4023 | Initializer * PassVisitor< pass_type >::mutate( ConstructorInit * node ) { |
---|
4024 | MUTATE_START( node ); |
---|
4025 | |
---|
4026 | maybeMutate_impl( node->ctor, *this ); |
---|
4027 | maybeMutate_impl( node->dtor, *this ); |
---|
4028 | maybeMutate_impl( node->init, *this ); |
---|
4029 | |
---|
4030 | MUTATE_END( Initializer, node ); |
---|
4031 | } |
---|
4032 | |
---|
4033 | //-------------------------------------------------------------------------- |
---|
4034 | // Constant |
---|
4035 | template< typename pass_type > |
---|
4036 | void PassVisitor< pass_type >::visit( Constant * node ) { |
---|
4037 | VISIT_START( node ); |
---|
4038 | |
---|
4039 | VISIT_END( node ); |
---|
4040 | } |
---|
4041 | |
---|
4042 | template< typename pass_type > |
---|
4043 | void PassVisitor< pass_type >::visit( const Constant * node ) { |
---|
4044 | VISIT_START( node ); |
---|
4045 | |
---|
4046 | VISIT_END( node ); |
---|
4047 | } |
---|
4048 | |
---|
4049 | template< typename pass_type > |
---|
4050 | Constant * PassVisitor< pass_type >::mutate( Constant * node ) { |
---|
4051 | MUTATE_START( node ); |
---|
4052 | |
---|
4053 | MUTATE_END( Constant, node ); |
---|
4054 | } |
---|
4055 | |
---|
4056 | //-------------------------------------------------------------------------- |
---|
4057 | // Attribute |
---|
4058 | template< typename pass_type > |
---|
4059 | void PassVisitor< pass_type >::visit( Attribute * node ) { |
---|
4060 | VISIT_START( node ); |
---|
4061 | |
---|
4062 | maybeAccept_impl( node->parameters, *this ); |
---|
4063 | |
---|
4064 | VISIT_END( node ); |
---|
4065 | } |
---|
4066 | |
---|
4067 | template< typename pass_type > |
---|
4068 | void PassVisitor< pass_type >::visit( const Attribute * node ) { |
---|
4069 | VISIT_START( node ); |
---|
4070 | |
---|
4071 | maybeAccept_impl( node->parameters, *this ); |
---|
4072 | |
---|
4073 | VISIT_END( node ); |
---|
4074 | } |
---|
4075 | |
---|
4076 | template< typename pass_type > |
---|
4077 | Attribute * PassVisitor< pass_type >::mutate( Attribute * node ) { |
---|
4078 | MUTATE_START( node ); |
---|
4079 | |
---|
4080 | maybeMutate_impl( node->parameters, *this ); |
---|
4081 | |
---|
4082 | MUTATE_END( Attribute, node ); |
---|
4083 | } |
---|
4084 | |
---|
4085 | //-------------------------------------------------------------------------- |
---|
4086 | // TypeSubstitution |
---|
4087 | template< typename pass_type > |
---|
4088 | TypeSubstitution * PassVisitor< pass_type >::mutate( TypeSubstitution * node ) { |
---|
4089 | MUTATE_START( node ); |
---|
4090 | |
---|
4091 | for ( auto & p : node->typeEnv ) { |
---|
4092 | indexerScopedMutate( p.second, *this ); |
---|
4093 | } |
---|
4094 | for ( auto & p : node->varEnv ) { |
---|
4095 | indexerScopedMutate( p.second, *this ); |
---|
4096 | } |
---|
4097 | |
---|
4098 | MUTATE_END( TypeSubstitution, node ); |
---|
4099 | } |
---|
4100 | |
---|
4101 | #undef VISIT_START |
---|
4102 | #undef VISIT_END |
---|
4103 | |
---|
4104 | #undef MUTATE_START |
---|
4105 | #undef MUTATE_END |
---|