1 | #pragma once
|
---|
2 |
|
---|
3 | #define VISIT_START( node ) \
|
---|
4 | __attribute__((unused)) \
|
---|
5 | guard_value_impl guard( at_cleanup_impl(pass, 0) ); \
|
---|
6 | bool visit_children = true; \
|
---|
7 | set_visit_children( visit_children ); \
|
---|
8 | call_previsit( node ); \
|
---|
9 | if( visit_children ) { \
|
---|
10 |
|
---|
11 | #define VISIT_END( node ) \
|
---|
12 | } \
|
---|
13 | call_postvisit( node ); \
|
---|
14 |
|
---|
15 | #define MUTATE_START( node ) \
|
---|
16 | __attribute__((unused)) \
|
---|
17 | guard_value_impl guard( at_cleanup_impl(pass, 0) ); \
|
---|
18 | bool visit_children = true; \
|
---|
19 | set_visit_children( visit_children ); \
|
---|
20 | call_premutate( node ); \
|
---|
21 | if( visit_children ) { \
|
---|
22 |
|
---|
23 | #define MUTATE_END( type, node ) \
|
---|
24 | } \
|
---|
25 | return call_postmutate< type * >( node ); \
|
---|
26 |
|
---|
27 |
|
---|
28 | #define VISIT_BODY( node ) \
|
---|
29 | VISIT_START( node ); \
|
---|
30 | Visitor::visit( node ); \
|
---|
31 | VISIT_END( node ); \
|
---|
32 |
|
---|
33 |
|
---|
34 | #define MUTATE_BODY( type, node ) \
|
---|
35 | MUTATE_START( node ); \
|
---|
36 | Mutator::mutate( node ); \
|
---|
37 | MUTATE_END( type, node ); \
|
---|
38 |
|
---|
39 |
|
---|
40 |
|
---|
41 | template<typename T>
|
---|
42 | static inline bool empty( T * ptr ) {
|
---|
43 | return !ptr || ptr->empty();
|
---|
44 | }
|
---|
45 |
|
---|
46 | typedef std::list< Statement * > StmtList_t;
|
---|
47 | typedef std::list< Declaration * > DeclList_t;
|
---|
48 |
|
---|
49 | template<typename iterator_t>
|
---|
50 | static inline void splice( iterator_t it, DeclList_t * decls ) {
|
---|
51 | std::transform(
|
---|
52 | decls->begin(),
|
---|
53 | decls->end(),
|
---|
54 | it,
|
---|
55 | [](Declaration * decl) -> auto {
|
---|
56 | return new DeclStmt( noLabels, decl );
|
---|
57 | }
|
---|
58 | );
|
---|
59 | decls->clear();
|
---|
60 | }
|
---|
61 |
|
---|
62 | template< typename pass_type >
|
---|
63 | static inline void acceptAll( std::list< Declaration* > &decls, PassVisitor< pass_type >& visitor ) {
|
---|
64 |
|
---|
65 | DeclList_t* beforeDecls = visitor.get_beforeDecls();
|
---|
66 | DeclList_t* afterDecls = visitor.get_afterDecls();
|
---|
67 |
|
---|
68 | for ( std::list< Declaration* >::iterator i = decls.begin(); ; ++i ) {
|
---|
69 | // splice in new declarations after previous decl
|
---|
70 | if ( !empty( afterDecls ) ) { decls.splice( i, *afterDecls ); }
|
---|
71 |
|
---|
72 | if ( i == decls.end() ) break;
|
---|
73 |
|
---|
74 | // run mutator on declaration
|
---|
75 | maybeAccept( *i, visitor );
|
---|
76 |
|
---|
77 | // splice in new declarations before current decl
|
---|
78 | if ( !empty( beforeDecls ) ) { decls.splice( i, *beforeDecls ); }
|
---|
79 | }
|
---|
80 | }
|
---|
81 |
|
---|
82 | template< typename pass_type >
|
---|
83 | static inline void mutateAll( std::list< Declaration* > &decls, PassVisitor< pass_type >& mutator ) {
|
---|
84 |
|
---|
85 | DeclList_t* beforeDecls = mutator.get_beforeDecls();
|
---|
86 | DeclList_t* afterDecls = mutator.get_afterDecls();
|
---|
87 |
|
---|
88 | for ( std::list< Declaration* >::iterator i = decls.begin(); ; ++i ) {
|
---|
89 | // splice in new declarations after previous decl
|
---|
90 | if ( !empty( afterDecls ) ) { decls.splice( i, *afterDecls ); }
|
---|
91 |
|
---|
92 | if ( i == decls.end() ) break;
|
---|
93 |
|
---|
94 | // run mutator on declaration
|
---|
95 | *i = maybeMutate( *i, mutator );
|
---|
96 |
|
---|
97 | // splice in new declarations before current decl
|
---|
98 | if ( !empty( beforeDecls ) ) { decls.splice( i, *beforeDecls ); }
|
---|
99 | }
|
---|
100 | }
|
---|
101 |
|
---|
102 | template< typename pass_type >
|
---|
103 | template< typename func_t >
|
---|
104 | void PassVisitor< pass_type >::handleStatementList( std::list< Statement * > & statements, func_t func ) {
|
---|
105 | SemanticError errors;
|
---|
106 |
|
---|
107 | // don't want statements from outer CompoundStmts to be added to this CompoundStmt
|
---|
108 | ValueGuardPtr< StmtList_t > oldBeforeStmts( get_beforeStmts() );
|
---|
109 | ValueGuardPtr< StmtList_t > oldAfterStmts ( get_afterStmts () );
|
---|
110 | ValueGuardPtr< DeclList_t > oldBeforeDecls( get_beforeDecls() );
|
---|
111 | ValueGuardPtr< DeclList_t > oldAfterDecls ( get_afterDecls () );
|
---|
112 |
|
---|
113 | StmtList_t* beforeStmts = get_beforeStmts();
|
---|
114 | StmtList_t* afterStmts = get_afterStmts();
|
---|
115 | DeclList_t* beforeDecls = get_beforeDecls();
|
---|
116 | DeclList_t* afterDecls = get_afterDecls();
|
---|
117 |
|
---|
118 | for ( std::list< Statement* >::iterator i = statements.begin(); i != statements.end(); ++i ) {
|
---|
119 |
|
---|
120 | if ( !empty( afterDecls ) ) { splice( std::inserter( statements, i ), afterDecls ); }
|
---|
121 | if ( !empty( afterStmts ) ) { statements.splice( i, *afterStmts ); }
|
---|
122 |
|
---|
123 | try {
|
---|
124 | func( *i );
|
---|
125 | assert(( empty( beforeStmts ) && empty( afterStmts ))
|
---|
126 | || ( empty( beforeDecls ) && empty( afterDecls )) );
|
---|
127 |
|
---|
128 | } catch ( SemanticError &e ) {
|
---|
129 | errors.append( e );
|
---|
130 | }
|
---|
131 |
|
---|
132 | if ( !empty( beforeDecls ) ) { splice( std::inserter( statements, i ), beforeDecls ); }
|
---|
133 | if ( !empty( beforeStmts ) ) { statements.splice( i, *beforeStmts ); }
|
---|
134 | }
|
---|
135 |
|
---|
136 | if ( !empty( afterDecls ) ) { splice( std::back_inserter( statements ), afterDecls); }
|
---|
137 | if ( !empty( afterStmts ) ) { statements.splice( statements.end(), *afterStmts ); }
|
---|
138 | if ( !errors.isEmpty() ) { throw errors; }
|
---|
139 | }
|
---|
140 |
|
---|
141 | template< typename pass_type >
|
---|
142 | void PassVisitor< pass_type >::visitStatementList( std::list< Statement * > & statements ) {
|
---|
143 | handleStatementList( statements, [this]( Statement * stmt) {
|
---|
144 | stmt->accept( *this );
|
---|
145 | });
|
---|
146 | }
|
---|
147 |
|
---|
148 | template< typename pass_type >
|
---|
149 | void PassVisitor< pass_type >::mutateStatementList( std::list< Statement * > & statements ) {
|
---|
150 | handleStatementList( statements, [this]( Statement *& stmt) {
|
---|
151 | stmt = stmt->acceptMutator( *this );
|
---|
152 | });
|
---|
153 | }
|
---|
154 |
|
---|
155 |
|
---|
156 | template< typename pass_type >
|
---|
157 | template< typename func_t >
|
---|
158 | Statement * PassVisitor< pass_type >::handleStatement( Statement * stmt, func_t func ) {
|
---|
159 | // don't want statements from outer CompoundStmts to be added to this CompoundStmt
|
---|
160 | ValueGuardPtr< TypeSubstitution * > oldEnv ( get_env_ptr () );
|
---|
161 | ValueGuardPtr< DeclList_t > oldBeforeDecls( get_beforeDecls() );
|
---|
162 | ValueGuardPtr< DeclList_t > oldAfterDecls ( get_afterDecls () );
|
---|
163 | ValueGuardPtr< StmtList_t > oldBeforeStmts( get_beforeStmts() );
|
---|
164 | ValueGuardPtr< StmtList_t > oldAfterStmts ( get_afterStmts () );
|
---|
165 |
|
---|
166 | Statement *newStmt = func( stmt );
|
---|
167 |
|
---|
168 | StmtList_t* beforeStmts = get_beforeStmts();
|
---|
169 | StmtList_t* afterStmts = get_afterStmts();
|
---|
170 | DeclList_t* beforeDecls = get_beforeDecls();
|
---|
171 | DeclList_t* afterDecls = get_afterDecls();
|
---|
172 |
|
---|
173 | if( empty(beforeStmts) && empty(afterStmts) && empty(beforeDecls) && empty(afterDecls) ) { return newStmt; }
|
---|
174 | assert(( empty( beforeStmts ) && empty( afterStmts ))
|
---|
175 | || ( empty( beforeDecls ) && empty( afterDecls )) );
|
---|
176 |
|
---|
177 | CompoundStmt *compound = new CompoundStmt( noLabels );
|
---|
178 | if( !empty(beforeDecls) ) { splice( std::back_inserter( compound->get_kids() ), beforeDecls ); }
|
---|
179 | if( !empty(beforeStmts) ) { compound->get_kids().splice( compound->get_kids().end(), *beforeStmts ); }
|
---|
180 | compound->get_kids().push_back( newStmt );
|
---|
181 | if( !empty(afterDecls) ) { splice( std::back_inserter( compound->get_kids() ), afterDecls ); }
|
---|
182 | if( !empty(afterStmts) ) { compound->get_kids().splice( compound->get_kids().end(), *afterStmts ); }
|
---|
183 | return compound;
|
---|
184 | }
|
---|
185 |
|
---|
186 | template< typename pass_type >
|
---|
187 | Statement * PassVisitor< pass_type >::visitStatement( Statement * stmt ) {
|
---|
188 | return handleStatement( stmt, [this]( Statement * stmt ) {
|
---|
189 | maybeAccept( stmt, *this );
|
---|
190 | return stmt;
|
---|
191 | });
|
---|
192 | }
|
---|
193 |
|
---|
194 | template< typename pass_type >
|
---|
195 | Statement * PassVisitor< pass_type >::mutateStatement( Statement * stmt ) {
|
---|
196 | return handleStatement( stmt, [this]( Statement * stmt ) {
|
---|
197 | return maybeMutate( stmt, *this );
|
---|
198 | });
|
---|
199 | }
|
---|
200 |
|
---|
201 | template< typename pass_type >
|
---|
202 | template< typename func_t >
|
---|
203 | Expression * PassVisitor< pass_type >::handleExpression( Expression * expr, func_t func ) {
|
---|
204 | if( !expr ) return nullptr;
|
---|
205 |
|
---|
206 | auto env_ptr = get_env_ptr();
|
---|
207 | if ( env_ptr && expr->get_env() ) {
|
---|
208 | *env_ptr = expr->get_env();
|
---|
209 | }
|
---|
210 |
|
---|
211 | // should env be cloned (or moved) onto the result of the mutate?
|
---|
212 | return func( expr );
|
---|
213 | }
|
---|
214 |
|
---|
215 | template< typename pass_type >
|
---|
216 | Expression * PassVisitor< pass_type >::visitExpression( Expression * expr ) {
|
---|
217 | return handleExpression(expr, [this]( Expression * expr ) {
|
---|
218 | expr->accept( *this );
|
---|
219 | return expr;
|
---|
220 | });
|
---|
221 | }
|
---|
222 |
|
---|
223 | template< typename pass_type >
|
---|
224 | Expression * PassVisitor< pass_type >::mutateExpression( Expression * expr ) {
|
---|
225 | return handleExpression(expr, [this]( Expression * expr ) {
|
---|
226 | return expr->acceptMutator( *this );
|
---|
227 | });
|
---|
228 | }
|
---|
229 |
|
---|
230 | //------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
---|
231 |
|
---|
232 | template< typename pass_type >
|
---|
233 | void PassVisitor< pass_type >::visit( ObjectDecl * node ) {
|
---|
234 | VISIT_BODY( node );
|
---|
235 | }
|
---|
236 |
|
---|
237 | template< typename pass_type >
|
---|
238 | void PassVisitor< pass_type >::visit( FunctionDecl * node ) {
|
---|
239 | VISIT_BODY( node );
|
---|
240 | }
|
---|
241 |
|
---|
242 | template< typename pass_type >
|
---|
243 | void PassVisitor< pass_type >::visit( StructDecl * node ) {
|
---|
244 | VISIT_BODY( node );
|
---|
245 | }
|
---|
246 |
|
---|
247 | template< typename pass_type >
|
---|
248 | void PassVisitor< pass_type >::visit( UnionDecl * node ) {
|
---|
249 | VISIT_BODY( node );
|
---|
250 | }
|
---|
251 |
|
---|
252 | template< typename pass_type >
|
---|
253 | void PassVisitor< pass_type >::visit( EnumDecl * node ) {
|
---|
254 | VISIT_BODY( node );
|
---|
255 | }
|
---|
256 |
|
---|
257 | template< typename pass_type >
|
---|
258 | void PassVisitor< pass_type >::visit( TraitDecl * node ) {
|
---|
259 | VISIT_BODY( node );
|
---|
260 | }
|
---|
261 |
|
---|
262 | template< typename pass_type >
|
---|
263 | void PassVisitor< pass_type >::visit( TypeDecl * node ) {
|
---|
264 | VISIT_BODY( node );
|
---|
265 | }
|
---|
266 |
|
---|
267 | template< typename pass_type >
|
---|
268 | void PassVisitor< pass_type >::visit( TypedefDecl * node ) {
|
---|
269 | VISIT_BODY( node );
|
---|
270 | }
|
---|
271 |
|
---|
272 | template< typename pass_type >
|
---|
273 | void PassVisitor< pass_type >::visit( AsmDecl * node ) {
|
---|
274 | VISIT_BODY( node );
|
---|
275 | }
|
---|
276 |
|
---|
277 | //--------------------------------------------------------------------------
|
---|
278 | // CompoundStmt
|
---|
279 | template< typename pass_type >
|
---|
280 | void PassVisitor< pass_type >::visit( CompoundStmt * node ) {
|
---|
281 | VISIT_START( node );
|
---|
282 | call_beginScope();
|
---|
283 |
|
---|
284 | visitStatementList( node->get_kids() );
|
---|
285 |
|
---|
286 | call_endScope();
|
---|
287 | VISIT_END( node );
|
---|
288 | }
|
---|
289 |
|
---|
290 | template< typename pass_type >
|
---|
291 | CompoundStmt * PassVisitor< pass_type >::mutate( CompoundStmt * node ) {
|
---|
292 | MUTATE_START( node );
|
---|
293 | call_beginScope();
|
---|
294 |
|
---|
295 | mutateStatementList( node->get_kids() );
|
---|
296 |
|
---|
297 | call_endScope();
|
---|
298 | MUTATE_END( CompoundStmt, node );
|
---|
299 | }
|
---|
300 |
|
---|
301 | //--------------------------------------------------------------------------
|
---|
302 | // ExprStmt
|
---|
303 | template< typename pass_type >
|
---|
304 | void PassVisitor< pass_type >::visit( ExprStmt * node ) {
|
---|
305 | VISIT_START( node );
|
---|
306 |
|
---|
307 | visitExpression( node->get_expr() );
|
---|
308 |
|
---|
309 | VISIT_END( node );
|
---|
310 | }
|
---|
311 |
|
---|
312 | template< typename pass_type >
|
---|
313 | Statement * PassVisitor< pass_type >::mutate( ExprStmt * node ) {
|
---|
314 | MUTATE_START( node );
|
---|
315 |
|
---|
316 | node->set_expr( mutateExpression( node->get_expr() ) );
|
---|
317 |
|
---|
318 | MUTATE_END( Statement, node );
|
---|
319 | }
|
---|
320 |
|
---|
321 | //--------------------------------------------------------------------------
|
---|
322 | // AsmStmt
|
---|
323 | template< typename pass_type >
|
---|
324 | void PassVisitor< pass_type >::visit( AsmStmt * node ) {
|
---|
325 | VISIT_BODY( node );
|
---|
326 | }
|
---|
327 |
|
---|
328 | template< typename pass_type >
|
---|
329 | Statement * PassVisitor< pass_type >::mutate( AsmStmt * node ) {
|
---|
330 | MUTATE_BODY( Statement, node );
|
---|
331 | }
|
---|
332 |
|
---|
333 | //--------------------------------------------------------------------------
|
---|
334 | // IfStmt
|
---|
335 | template< typename pass_type >
|
---|
336 | void PassVisitor< pass_type >::visit( IfStmt * node ) {
|
---|
337 | VISIT_START( node );
|
---|
338 |
|
---|
339 | visitExpression( node->get_condition() );
|
---|
340 | node->set_thenPart ( visitStatement( node->get_thenPart() ) );
|
---|
341 | node->set_elsePart ( visitStatement( node->get_elsePart() ) );
|
---|
342 |
|
---|
343 | VISIT_END( node );
|
---|
344 | }
|
---|
345 |
|
---|
346 | template< typename pass_type >
|
---|
347 | Statement * PassVisitor< pass_type >::mutate( IfStmt * node ) {
|
---|
348 | MUTATE_START( node );
|
---|
349 |
|
---|
350 | node->set_condition( mutateExpression( node->get_condition() ) );
|
---|
351 | node->set_thenPart ( mutateStatement ( node->get_thenPart() ) );
|
---|
352 | node->set_elsePart ( mutateStatement ( node->get_elsePart() ) );
|
---|
353 |
|
---|
354 | MUTATE_END( Statement, node );
|
---|
355 | }
|
---|
356 |
|
---|
357 | //--------------------------------------------------------------------------
|
---|
358 | // WhileStmt
|
---|
359 | template< typename pass_type >
|
---|
360 | void PassVisitor< pass_type >::visit( WhileStmt * node ) {
|
---|
361 | VISIT_START( node );
|
---|
362 |
|
---|
363 | visitExpression( node->get_condition() );
|
---|
364 | node->set_body( visitStatement( node->get_body() ) );
|
---|
365 |
|
---|
366 | VISIT_END( node );
|
---|
367 | }
|
---|
368 |
|
---|
369 | template< typename pass_type >
|
---|
370 | Statement * PassVisitor< pass_type >::mutate( WhileStmt * node ) {
|
---|
371 | MUTATE_START( node );
|
---|
372 |
|
---|
373 | node->set_condition( mutateExpression( node->get_condition() ) );
|
---|
374 | node->set_body( mutateStatement( node->get_body() ) );
|
---|
375 |
|
---|
376 | MUTATE_END( Statement, node );
|
---|
377 | }
|
---|
378 |
|
---|
379 | //--------------------------------------------------------------------------
|
---|
380 | // ForStmt
|
---|
381 | template< typename pass_type >
|
---|
382 | void PassVisitor< pass_type >::visit( ForStmt * node ) {
|
---|
383 | VISIT_START( node );
|
---|
384 |
|
---|
385 | acceptAll( node->get_initialization(), *this );
|
---|
386 | visitExpression( node->get_condition() );
|
---|
387 | visitExpression( node->get_increment() );
|
---|
388 | node->set_body( visitStatement( node->get_body() ) );
|
---|
389 |
|
---|
390 | VISIT_END( node );
|
---|
391 | }
|
---|
392 |
|
---|
393 | template< typename pass_type >
|
---|
394 | Statement * PassVisitor< pass_type >::mutate( ForStmt * node ) {
|
---|
395 | MUTATE_START( node );
|
---|
396 |
|
---|
397 | mutateAll( node->get_initialization(), *this );
|
---|
398 | node->set_condition( mutateExpression( node->get_condition() ) );
|
---|
399 | node->set_increment( mutateExpression( node->get_increment() ) );
|
---|
400 | node->set_body( mutateStatement( node->get_body() ) );
|
---|
401 |
|
---|
402 | MUTATE_END( Statement, node );
|
---|
403 | }
|
---|
404 |
|
---|
405 | //--------------------------------------------------------------------------
|
---|
406 | // SwitchStmt
|
---|
407 | template< typename pass_type >
|
---|
408 | void PassVisitor< pass_type >::visit( SwitchStmt * node ) {
|
---|
409 | VISIT_START( node );
|
---|
410 |
|
---|
411 | visitExpression( node->get_condition() );
|
---|
412 | visitStatementList( node->get_statements() );
|
---|
413 |
|
---|
414 | VISIT_END( node );
|
---|
415 | }
|
---|
416 |
|
---|
417 | template< typename pass_type >
|
---|
418 | Statement * PassVisitor< pass_type >::mutate( SwitchStmt * node ) {
|
---|
419 | MUTATE_START( node );
|
---|
420 |
|
---|
421 | node->set_condition( mutateExpression( node->get_condition() ) );
|
---|
422 | mutateStatementList( node->get_statements() );
|
---|
423 |
|
---|
424 | MUTATE_END( Statement, node );
|
---|
425 | }
|
---|
426 |
|
---|
427 | //--------------------------------------------------------------------------
|
---|
428 | // CaseStmt
|
---|
429 | template< typename pass_type >
|
---|
430 | void PassVisitor< pass_type >::visit( CaseStmt * node ) {
|
---|
431 | VISIT_START( node );
|
---|
432 |
|
---|
433 | visitExpression( node->get_condition() );
|
---|
434 | visitStatementList( node->get_statements() );
|
---|
435 |
|
---|
436 | VISIT_END( node );
|
---|
437 | }
|
---|
438 |
|
---|
439 | template< typename pass_type >
|
---|
440 | Statement * PassVisitor< pass_type >::mutate( CaseStmt * node ) {
|
---|
441 | MUTATE_START( node );
|
---|
442 |
|
---|
443 | node->set_condition( mutateExpression( node->get_condition() ) );
|
---|
444 | mutateStatementList( node->get_statements() );
|
---|
445 |
|
---|
446 | MUTATE_END( Statement, node );
|
---|
447 | }
|
---|
448 |
|
---|
449 | //--------------------------------------------------------------------------
|
---|
450 | // BranchStmt
|
---|
451 | template< typename pass_type >
|
---|
452 | void PassVisitor< pass_type >::visit( BranchStmt * node ) {
|
---|
453 | VISIT_BODY( node );
|
---|
454 | }
|
---|
455 |
|
---|
456 | template< typename pass_type >
|
---|
457 | Statement * PassVisitor< pass_type >::mutate( BranchStmt * node ) {
|
---|
458 | MUTATE_BODY( Statement, node );
|
---|
459 | }
|
---|
460 |
|
---|
461 | //--------------------------------------------------------------------------
|
---|
462 | // ReturnStmt
|
---|
463 | template< typename pass_type >
|
---|
464 | void PassVisitor< pass_type >::visit( ReturnStmt * node ) {
|
---|
465 | VISIT_START( node );
|
---|
466 |
|
---|
467 | visitExpression( node->get_expr() );
|
---|
468 |
|
---|
469 | VISIT_END( node );
|
---|
470 | }
|
---|
471 |
|
---|
472 | template< typename pass_type >
|
---|
473 | Statement * PassVisitor< pass_type >::mutate( ReturnStmt * node ) {
|
---|
474 | MUTATE_START( node );
|
---|
475 |
|
---|
476 | node->set_expr( mutateExpression( node->get_expr() ) );
|
---|
477 |
|
---|
478 | MUTATE_END( Statement, node );
|
---|
479 | }
|
---|
480 |
|
---|
481 | //--------------------------------------------------------------------------
|
---|
482 | // ThrowStmt
|
---|
483 |
|
---|
484 | template< typename pass_type >
|
---|
485 | void PassVisitor< pass_type >::visit( ThrowStmt * node ) {
|
---|
486 | VISIT_BODY( node );
|
---|
487 | }
|
---|
488 |
|
---|
489 | template< typename pass_type >
|
---|
490 | Statement * PassVisitor< pass_type >::mutate( ThrowStmt * node ) {
|
---|
491 | MUTATE_BODY( Statement, node );
|
---|
492 | }
|
---|
493 |
|
---|
494 | //--------------------------------------------------------------------------
|
---|
495 | // TryStmt
|
---|
496 | template< typename pass_type >
|
---|
497 | void PassVisitor< pass_type >::visit( TryStmt * node ) {
|
---|
498 | VISIT_START( node );
|
---|
499 |
|
---|
500 | maybeAccept( node->get_block(), *this );
|
---|
501 | acceptAll( node->get_catchers(), *this );
|
---|
502 | maybeAccept( node->get_finally(), *this );
|
---|
503 |
|
---|
504 | VISIT_END( node );
|
---|
505 | }
|
---|
506 |
|
---|
507 | template< typename pass_type >
|
---|
508 | Statement * PassVisitor< pass_type >::mutate( TryStmt * node ) {
|
---|
509 | MUTATE_START( node );
|
---|
510 |
|
---|
511 | node->set_block( maybeMutate( node->get_block(), *this ) );
|
---|
512 | mutateAll( node->get_catchers(), *this );
|
---|
513 | node->set_finally( maybeMutate( node->get_finally(), *this ) );
|
---|
514 |
|
---|
515 | MUTATE_END( Statement, node );
|
---|
516 | }
|
---|
517 |
|
---|
518 | //--------------------------------------------------------------------------
|
---|
519 | // CatchStmt
|
---|
520 | template< typename pass_type >
|
---|
521 | void PassVisitor< pass_type >::visit( CatchStmt * node ) {
|
---|
522 | VISIT_START( node );
|
---|
523 |
|
---|
524 | maybeAccept( node->get_decl(), *this );
|
---|
525 | node->set_cond( visitExpression( node->get_cond() ) );
|
---|
526 | node->set_body( visitStatement( node->get_body() ) );
|
---|
527 |
|
---|
528 | VISIT_END( node );
|
---|
529 | }
|
---|
530 |
|
---|
531 | template< typename pass_type >
|
---|
532 | Statement * PassVisitor< pass_type >::mutate( CatchStmt * node ) {
|
---|
533 | MUTATE_START( node );
|
---|
534 |
|
---|
535 | node->set_decl( maybeMutate( node->get_decl(), *this ) );
|
---|
536 | node->set_cond( mutateExpression( node->get_cond() ) );
|
---|
537 | node->set_body( mutateStatement( node->get_body() ) );
|
---|
538 |
|
---|
539 | MUTATE_END( Statement, node );
|
---|
540 | }
|
---|
541 |
|
---|
542 | template< typename pass_type >
|
---|
543 | void PassVisitor< pass_type >::visit( FinallyStmt * node ) {
|
---|
544 | VISIT_BODY( node );
|
---|
545 | }
|
---|
546 |
|
---|
547 | template< typename pass_type >
|
---|
548 | void PassVisitor< pass_type >::visit( NullStmt * node ) {
|
---|
549 | VISIT_BODY( node );
|
---|
550 | }
|
---|
551 |
|
---|
552 | template< typename pass_type >
|
---|
553 | void PassVisitor< pass_type >::visit( DeclStmt * node ) {
|
---|
554 | VISIT_BODY( node );
|
---|
555 | }
|
---|
556 |
|
---|
557 | template< typename pass_type >
|
---|
558 | void PassVisitor< pass_type >::visit( ImplicitCtorDtorStmt * node ) {
|
---|
559 | VISIT_BODY( node );
|
---|
560 | }
|
---|
561 |
|
---|
562 | template< typename pass_type >
|
---|
563 | void PassVisitor< pass_type >::visit( ApplicationExpr * node ) {
|
---|
564 | VISIT_BODY( node );
|
---|
565 | }
|
---|
566 |
|
---|
567 | //--------------------------------------------------------------------------
|
---|
568 | // UntypedExpr
|
---|
569 | template< typename pass_type >
|
---|
570 | void PassVisitor< pass_type >::visit( UntypedExpr * node ) {
|
---|
571 | VISIT_START( node );
|
---|
572 |
|
---|
573 | // maybeAccept( node->get_env(), *this );
|
---|
574 | maybeAccept( node->get_result(), *this );
|
---|
575 |
|
---|
576 | for ( auto expr : node->get_args() ) {
|
---|
577 | visitExpression( expr );
|
---|
578 | }
|
---|
579 |
|
---|
580 | VISIT_END( node );
|
---|
581 | }
|
---|
582 |
|
---|
583 | template< typename pass_type >
|
---|
584 | Expression * PassVisitor< pass_type >::mutate( UntypedExpr * node ) {
|
---|
585 | MUTATE_START( node );
|
---|
586 |
|
---|
587 | node->set_env( maybeMutate( node->get_env(), *this ) );
|
---|
588 | node->set_result( maybeMutate( node->get_result(), *this ) );
|
---|
589 |
|
---|
590 | for ( auto& expr : node->get_args() ) {
|
---|
591 | expr = mutateExpression( expr );
|
---|
592 | }
|
---|
593 |
|
---|
594 | MUTATE_END( Expression, node );
|
---|
595 | }
|
---|
596 |
|
---|
597 | template< typename pass_type >
|
---|
598 | void PassVisitor< pass_type >::visit( NameExpr * node ) {
|
---|
599 | VISIT_BODY( node );
|
---|
600 | }
|
---|
601 |
|
---|
602 | template< typename pass_type >
|
---|
603 | void PassVisitor< pass_type >::visit( CastExpr * node ) {
|
---|
604 | VISIT_BODY( node );
|
---|
605 | }
|
---|
606 |
|
---|
607 | template< typename pass_type >
|
---|
608 | void PassVisitor< pass_type >::visit( AddressExpr * node ) {
|
---|
609 | VISIT_BODY( node );
|
---|
610 | }
|
---|
611 |
|
---|
612 | template< typename pass_type >
|
---|
613 | void PassVisitor< pass_type >::visit( LabelAddressExpr * node ) {
|
---|
614 | VISIT_BODY( node );
|
---|
615 | }
|
---|
616 |
|
---|
617 | template< typename pass_type >
|
---|
618 | void PassVisitor< pass_type >::visit( UntypedMemberExpr * node ) {
|
---|
619 | VISIT_BODY( node );
|
---|
620 | }
|
---|
621 |
|
---|
622 | template< typename pass_type >
|
---|
623 | void PassVisitor< pass_type >::visit( MemberExpr * node ) {
|
---|
624 | VISIT_BODY( node );
|
---|
625 | }
|
---|
626 |
|
---|
627 | template< typename pass_type >
|
---|
628 | void PassVisitor< pass_type >::visit( VariableExpr * node ) {
|
---|
629 | VISIT_BODY( node );
|
---|
630 | }
|
---|
631 |
|
---|
632 | template< typename pass_type >
|
---|
633 | void PassVisitor< pass_type >::visit( ConstantExpr * node ) {
|
---|
634 | VISIT_BODY( node );
|
---|
635 | }
|
---|
636 |
|
---|
637 | template< typename pass_type >
|
---|
638 | void PassVisitor< pass_type >::visit( SizeofExpr * node ) {
|
---|
639 | VISIT_BODY( node );
|
---|
640 | }
|
---|
641 |
|
---|
642 | template< typename pass_type >
|
---|
643 | void PassVisitor< pass_type >::visit( AlignofExpr * node ) {
|
---|
644 | VISIT_BODY( node );
|
---|
645 | }
|
---|
646 |
|
---|
647 | template< typename pass_type >
|
---|
648 | void PassVisitor< pass_type >::visit( UntypedOffsetofExpr * node ) {
|
---|
649 | VISIT_BODY( node );
|
---|
650 | }
|
---|
651 |
|
---|
652 | template< typename pass_type >
|
---|
653 | void PassVisitor< pass_type >::visit( OffsetofExpr * node ) {
|
---|
654 | VISIT_BODY( node );
|
---|
655 | }
|
---|
656 |
|
---|
657 | template< typename pass_type >
|
---|
658 | void PassVisitor< pass_type >::visit( OffsetPackExpr * node ) {
|
---|
659 | VISIT_BODY( node );
|
---|
660 | }
|
---|
661 |
|
---|
662 | template< typename pass_type >
|
---|
663 | void PassVisitor< pass_type >::visit( AttrExpr * node ) {
|
---|
664 | VISIT_BODY( node );
|
---|
665 | }
|
---|
666 |
|
---|
667 | template< typename pass_type >
|
---|
668 | void PassVisitor< pass_type >::visit( LogicalExpr * node ) {
|
---|
669 | VISIT_BODY( node );
|
---|
670 | }
|
---|
671 |
|
---|
672 | template< typename pass_type >
|
---|
673 | void PassVisitor< pass_type >::visit( ConditionalExpr * node ) {
|
---|
674 | VISIT_BODY( node );
|
---|
675 | }
|
---|
676 |
|
---|
677 | template< typename pass_type >
|
---|
678 | void PassVisitor< pass_type >::visit( CommaExpr * node ) {
|
---|
679 | VISIT_BODY( node );
|
---|
680 | }
|
---|
681 |
|
---|
682 | template< typename pass_type >
|
---|
683 | void PassVisitor< pass_type >::visit( TypeExpr * node ) {
|
---|
684 | VISIT_BODY( node );
|
---|
685 | }
|
---|
686 |
|
---|
687 | template< typename pass_type >
|
---|
688 | void PassVisitor< pass_type >::visit( AsmExpr * node ) {
|
---|
689 | VISIT_BODY( node );
|
---|
690 | }
|
---|
691 |
|
---|
692 | template< typename pass_type >
|
---|
693 | void PassVisitor< pass_type >::visit( ImplicitCopyCtorExpr * node ) {
|
---|
694 | VISIT_BODY( node );
|
---|
695 | }
|
---|
696 |
|
---|
697 | template< typename pass_type >
|
---|
698 | void PassVisitor< pass_type >::visit( ConstructorExpr * node ) {
|
---|
699 | VISIT_BODY( node );
|
---|
700 | }
|
---|
701 |
|
---|
702 | template< typename pass_type >
|
---|
703 | void PassVisitor< pass_type >::visit( CompoundLiteralExpr * node ) {
|
---|
704 | VISIT_BODY( node );
|
---|
705 | }
|
---|
706 |
|
---|
707 | template< typename pass_type >
|
---|
708 | void PassVisitor< pass_type >::visit( RangeExpr * node ) {
|
---|
709 | VISIT_BODY( node );
|
---|
710 | }
|
---|
711 |
|
---|
712 | template< typename pass_type >
|
---|
713 | void PassVisitor< pass_type >::visit( UntypedTupleExpr * node ) {
|
---|
714 | VISIT_BODY( node );
|
---|
715 | }
|
---|
716 |
|
---|
717 | template< typename pass_type >
|
---|
718 | void PassVisitor< pass_type >::visit( TupleExpr * node ) {
|
---|
719 | VISIT_BODY( node );
|
---|
720 | }
|
---|
721 |
|
---|
722 | template< typename pass_type >
|
---|
723 | void PassVisitor< pass_type >::visit( TupleIndexExpr * node ) {
|
---|
724 | VISIT_BODY( node );
|
---|
725 | }
|
---|
726 |
|
---|
727 | template< typename pass_type >
|
---|
728 | void PassVisitor< pass_type >::visit( TupleAssignExpr * node ) {
|
---|
729 | VISIT_BODY( node );
|
---|
730 | }
|
---|
731 |
|
---|
732 | //--------------------------------------------------------------------------
|
---|
733 | // UntypedExpr
|
---|
734 | template< typename pass_type >
|
---|
735 | void PassVisitor< pass_type >::visit( StmtExpr * node ) {
|
---|
736 | VISIT_START( node );
|
---|
737 |
|
---|
738 | // don't want statements from outer CompoundStmts to be added to this StmtExpr
|
---|
739 | ValueGuardPtr< TypeSubstitution * > oldEnv ( get_env_ptr() );
|
---|
740 | ValueGuardPtr< std::list< Statement* > > oldBeforeStmts( get_beforeStmts() );
|
---|
741 | ValueGuardPtr< std::list< Statement* > > oldAfterStmts ( get_afterStmts () );
|
---|
742 |
|
---|
743 | Visitor::visit( node );
|
---|
744 |
|
---|
745 | VISIT_END( node );
|
---|
746 | }
|
---|
747 |
|
---|
748 | template< typename pass_type >
|
---|
749 | Expression * PassVisitor< pass_type >::mutate( StmtExpr * node ) {
|
---|
750 | MUTATE_START( node );
|
---|
751 |
|
---|
752 | // don't want statements from outer CompoundStmts to be added to this StmtExpr
|
---|
753 | ValueGuardPtr< TypeSubstitution * > oldEnv ( get_env_ptr() );
|
---|
754 | ValueGuardPtr< std::list< Statement* > > oldBeforeStmts( get_beforeStmts() );
|
---|
755 | ValueGuardPtr< std::list< Statement* > > oldAfterStmts ( get_afterStmts () );
|
---|
756 |
|
---|
757 | Mutator::mutate( node );
|
---|
758 |
|
---|
759 | MUTATE_END( Expression, node );
|
---|
760 | }
|
---|
761 |
|
---|
762 | template< typename pass_type >
|
---|
763 | void PassVisitor< pass_type >::visit( UniqueExpr * node ) {
|
---|
764 | VISIT_BODY( node );
|
---|
765 | }
|
---|
766 |
|
---|
767 | template< typename pass_type >
|
---|
768 | void PassVisitor< pass_type >::visit( VoidType * node ) {
|
---|
769 | VISIT_BODY( node );
|
---|
770 | }
|
---|
771 |
|
---|
772 | template< typename pass_type >
|
---|
773 | void PassVisitor< pass_type >::visit( BasicType * node ) {
|
---|
774 | VISIT_BODY( node );
|
---|
775 | }
|
---|
776 |
|
---|
777 | template< typename pass_type >
|
---|
778 | void PassVisitor< pass_type >::visit( PointerType * node ) {
|
---|
779 | VISIT_BODY( node );
|
---|
780 | }
|
---|
781 |
|
---|
782 | template< typename pass_type >
|
---|
783 | void PassVisitor< pass_type >::visit( ArrayType * node ) {
|
---|
784 | VISIT_BODY( node );
|
---|
785 | }
|
---|
786 |
|
---|
787 | template< typename pass_type >
|
---|
788 | void PassVisitor< pass_type >::visit( FunctionType * node ) {
|
---|
789 | VISIT_BODY( node );
|
---|
790 | }
|
---|
791 |
|
---|
792 | template< typename pass_type >
|
---|
793 | void PassVisitor< pass_type >::visit( StructInstType * node ) {
|
---|
794 | VISIT_BODY( node );
|
---|
795 | }
|
---|
796 |
|
---|
797 | template< typename pass_type >
|
---|
798 | void PassVisitor< pass_type >::visit( UnionInstType * node ) {
|
---|
799 | VISIT_BODY( node );
|
---|
800 | }
|
---|
801 |
|
---|
802 | template< typename pass_type >
|
---|
803 | void PassVisitor< pass_type >::visit( EnumInstType * node ) {
|
---|
804 | VISIT_BODY( node );
|
---|
805 | }
|
---|
806 |
|
---|
807 | template< typename pass_type >
|
---|
808 | void PassVisitor< pass_type >::visit( TraitInstType * node ) {
|
---|
809 | VISIT_BODY( node );
|
---|
810 | }
|
---|
811 |
|
---|
812 | template< typename pass_type >
|
---|
813 | void PassVisitor< pass_type >::visit( TypeInstType * node ) {
|
---|
814 | VISIT_BODY( node );
|
---|
815 | }
|
---|
816 |
|
---|
817 | template< typename pass_type >
|
---|
818 | void PassVisitor< pass_type >::visit( TupleType * node ) {
|
---|
819 | VISIT_BODY( node );
|
---|
820 | }
|
---|
821 |
|
---|
822 | template< typename pass_type >
|
---|
823 | void PassVisitor< pass_type >::visit( TypeofType * node ) {
|
---|
824 | VISIT_BODY( node );
|
---|
825 | }
|
---|
826 |
|
---|
827 | template< typename pass_type >
|
---|
828 | void PassVisitor< pass_type >::visit( AttrType * node ) {
|
---|
829 | VISIT_BODY( node );
|
---|
830 | }
|
---|
831 |
|
---|
832 | template< typename pass_type >
|
---|
833 | void PassVisitor< pass_type >::visit( VarArgsType * node ) {
|
---|
834 | VISIT_BODY( node );
|
---|
835 | }
|
---|
836 |
|
---|
837 | template< typename pass_type >
|
---|
838 | void PassVisitor< pass_type >::visit( ZeroType * node ) {
|
---|
839 | VISIT_BODY( node );
|
---|
840 | }
|
---|
841 |
|
---|
842 | template< typename pass_type >
|
---|
843 | void PassVisitor< pass_type >::visit( OneType * node ) {
|
---|
844 | VISIT_BODY( node );
|
---|
845 | }
|
---|
846 |
|
---|
847 | //--------------------------------------------------------------------------
|
---|
848 | // UntypedExpr
|
---|
849 | template< typename pass_type >
|
---|
850 | void PassVisitor< pass_type >::visit( SingleInit * node ) {
|
---|
851 | VISIT_START( node );
|
---|
852 |
|
---|
853 | visitExpression( node->get_value() );
|
---|
854 |
|
---|
855 | VISIT_END( node );
|
---|
856 | }
|
---|
857 |
|
---|
858 | template< typename pass_type >
|
---|
859 | Initializer * PassVisitor< pass_type >::mutate( SingleInit * node ) {
|
---|
860 | MUTATE_START( node );
|
---|
861 |
|
---|
862 | node->set_value( mutateExpression( node->get_value() ) );
|
---|
863 |
|
---|
864 | MUTATE_END( Initializer, node );
|
---|
865 | }
|
---|
866 |
|
---|
867 | template< typename pass_type >
|
---|
868 | void PassVisitor< pass_type >::visit( ListInit * node ) {
|
---|
869 | VISIT_BODY( node );
|
---|
870 | }
|
---|
871 |
|
---|
872 | template< typename pass_type >
|
---|
873 | void PassVisitor< pass_type >::visit( ConstructorInit * node ) {
|
---|
874 | VISIT_BODY( node );
|
---|
875 | }
|
---|
876 |
|
---|
877 | template< typename pass_type >
|
---|
878 | void PassVisitor< pass_type >::visit( Subrange * node ) {
|
---|
879 | VISIT_BODY( node );
|
---|
880 | }
|
---|
881 |
|
---|
882 | template< typename pass_type >
|
---|
883 | void PassVisitor< pass_type >::visit( Constant * node ) {
|
---|
884 | VISIT_BODY( node );
|
---|
885 | }
|
---|
886 |
|
---|
887 | //---------------------------------------------------------------------------------------------------------------
|
---|
888 |
|
---|
889 | template< typename pass_type >
|
---|
890 | DeclarationWithType * PassVisitor< pass_type >::mutate( ObjectDecl * node ) {
|
---|
891 | MUTATE_BODY( DeclarationWithType, node );
|
---|
892 | }
|
---|
893 |
|
---|
894 | template< typename pass_type >
|
---|
895 | DeclarationWithType * PassVisitor< pass_type >::mutate( FunctionDecl * node ) {
|
---|
896 | MUTATE_BODY( DeclarationWithType, node );
|
---|
897 | }
|
---|
898 |
|
---|
899 | template< typename pass_type >
|
---|
900 | Declaration * PassVisitor< pass_type >::mutate( StructDecl * node ) {
|
---|
901 | MUTATE_BODY( Declaration, node );
|
---|
902 | }
|
---|
903 |
|
---|
904 | template< typename pass_type >
|
---|
905 | Declaration * PassVisitor< pass_type >::mutate( UnionDecl * node ) {
|
---|
906 | MUTATE_BODY( Declaration, node );
|
---|
907 | }
|
---|
908 |
|
---|
909 | template< typename pass_type >
|
---|
910 | Declaration * PassVisitor< pass_type >::mutate( EnumDecl * node ) {
|
---|
911 | MUTATE_BODY( Declaration, node );
|
---|
912 | }
|
---|
913 |
|
---|
914 | template< typename pass_type >
|
---|
915 | Declaration * PassVisitor< pass_type >::mutate( TraitDecl * node ) {
|
---|
916 | MUTATE_BODY( Declaration, node );
|
---|
917 | }
|
---|
918 |
|
---|
919 | template< typename pass_type >
|
---|
920 | TypeDecl * PassVisitor< pass_type >::mutate( TypeDecl * node ) {
|
---|
921 | MUTATE_BODY( TypeDecl, node );
|
---|
922 | }
|
---|
923 |
|
---|
924 | template< typename pass_type >
|
---|
925 | Declaration * PassVisitor< pass_type >::mutate( TypedefDecl * node ) {
|
---|
926 | MUTATE_BODY( Declaration, node );
|
---|
927 | }
|
---|
928 |
|
---|
929 | template< typename pass_type >
|
---|
930 | AsmDecl * PassVisitor< pass_type >::mutate( AsmDecl * node ) {
|
---|
931 | MUTATE_BODY( AsmDecl, node );
|
---|
932 | }
|
---|
933 |
|
---|
934 | template< typename pass_type >
|
---|
935 | Statement * PassVisitor< pass_type >::mutate( FinallyStmt * node ) {
|
---|
936 | MUTATE_BODY( Statement, node );
|
---|
937 | }
|
---|
938 |
|
---|
939 | template< typename pass_type >
|
---|
940 | NullStmt * PassVisitor< pass_type >::mutate( NullStmt * node ) {
|
---|
941 | MUTATE_BODY( NullStmt, node );
|
---|
942 | }
|
---|
943 |
|
---|
944 | template< typename pass_type >
|
---|
945 | Statement * PassVisitor< pass_type >::mutate( DeclStmt * node ) {
|
---|
946 | MUTATE_BODY( Statement, node );
|
---|
947 | }
|
---|
948 |
|
---|
949 | template< typename pass_type >
|
---|
950 | Statement * PassVisitor< pass_type >::mutate( ImplicitCtorDtorStmt * node ) {
|
---|
951 | MUTATE_BODY( Statement, node );
|
---|
952 | }
|
---|
953 |
|
---|
954 | template< typename pass_type >
|
---|
955 | Expression * PassVisitor< pass_type >::mutate( ApplicationExpr * node ) {
|
---|
956 | MUTATE_BODY( Expression, node );
|
---|
957 | }
|
---|
958 |
|
---|
959 | template< typename pass_type >
|
---|
960 | Expression * PassVisitor< pass_type >::mutate( NameExpr * node ) {
|
---|
961 | MUTATE_BODY( Expression, node );
|
---|
962 | }
|
---|
963 |
|
---|
964 | template< typename pass_type >
|
---|
965 | Expression * PassVisitor< pass_type >::mutate( AddressExpr * node ) {
|
---|
966 | MUTATE_BODY( Expression, node );
|
---|
967 | }
|
---|
968 |
|
---|
969 | template< typename pass_type >
|
---|
970 | Expression * PassVisitor< pass_type >::mutate( LabelAddressExpr * node ) {
|
---|
971 | MUTATE_BODY( Expression, node );
|
---|
972 | }
|
---|
973 |
|
---|
974 | template< typename pass_type >
|
---|
975 | Expression * PassVisitor< pass_type >::mutate( CastExpr * node ) {
|
---|
976 | MUTATE_BODY( Expression, node );
|
---|
977 | }
|
---|
978 |
|
---|
979 | template< typename pass_type >
|
---|
980 | Expression * PassVisitor< pass_type >::mutate( UntypedMemberExpr * node ) {
|
---|
981 | MUTATE_BODY( Expression, node );
|
---|
982 | }
|
---|
983 |
|
---|
984 | template< typename pass_type >
|
---|
985 | Expression * PassVisitor< pass_type >::mutate( MemberExpr * node ) {
|
---|
986 | MUTATE_BODY( Expression, node );
|
---|
987 | }
|
---|
988 |
|
---|
989 | template< typename pass_type >
|
---|
990 | Expression * PassVisitor< pass_type >::mutate( VariableExpr * node ) {
|
---|
991 | MUTATE_BODY( Expression, node );
|
---|
992 | }
|
---|
993 |
|
---|
994 | template< typename pass_type >
|
---|
995 | Expression * PassVisitor< pass_type >::mutate( ConstantExpr * node ) {
|
---|
996 | MUTATE_BODY( Expression, node );
|
---|
997 | }
|
---|
998 |
|
---|
999 | template< typename pass_type >
|
---|
1000 | Expression * PassVisitor< pass_type >::mutate( SizeofExpr * node ) {
|
---|
1001 | MUTATE_BODY( Expression, node );
|
---|
1002 | }
|
---|
1003 |
|
---|
1004 | template< typename pass_type >
|
---|
1005 | Expression * PassVisitor< pass_type >::mutate( AlignofExpr * node ) {
|
---|
1006 | MUTATE_BODY( Expression, node );
|
---|
1007 | }
|
---|
1008 |
|
---|
1009 | template< typename pass_type >
|
---|
1010 | Expression * PassVisitor< pass_type >::mutate( UntypedOffsetofExpr * node ) {
|
---|
1011 | MUTATE_BODY( Expression, node );
|
---|
1012 | }
|
---|
1013 |
|
---|
1014 | template< typename pass_type >
|
---|
1015 | Expression * PassVisitor< pass_type >::mutate( OffsetofExpr * node ) {
|
---|
1016 | MUTATE_BODY( Expression, node );
|
---|
1017 | }
|
---|
1018 |
|
---|
1019 | template< typename pass_type >
|
---|
1020 | Expression * PassVisitor< pass_type >::mutate( OffsetPackExpr * node ) {
|
---|
1021 | MUTATE_BODY( Expression, node );
|
---|
1022 | }
|
---|
1023 |
|
---|
1024 | template< typename pass_type >
|
---|
1025 | Expression * PassVisitor< pass_type >::mutate( AttrExpr * node ) {
|
---|
1026 | MUTATE_BODY( Expression, node );
|
---|
1027 | }
|
---|
1028 |
|
---|
1029 | template< typename pass_type >
|
---|
1030 | Expression * PassVisitor< pass_type >::mutate( LogicalExpr * node ) {
|
---|
1031 | MUTATE_BODY( Expression, node );
|
---|
1032 | }
|
---|
1033 |
|
---|
1034 | template< typename pass_type >
|
---|
1035 | Expression * PassVisitor< pass_type >::mutate( ConditionalExpr * node ) {
|
---|
1036 | MUTATE_BODY( Expression, node );
|
---|
1037 | }
|
---|
1038 |
|
---|
1039 | template< typename pass_type >
|
---|
1040 | Expression * PassVisitor< pass_type >::mutate( CommaExpr * node ) {
|
---|
1041 | MUTATE_BODY( Expression, node );
|
---|
1042 | }
|
---|
1043 |
|
---|
1044 | template< typename pass_type >
|
---|
1045 | Expression * PassVisitor< pass_type >::mutate( TypeExpr * node ) {
|
---|
1046 | MUTATE_BODY( Expression, node );
|
---|
1047 | }
|
---|
1048 |
|
---|
1049 | template< typename pass_type >
|
---|
1050 | Expression * PassVisitor< pass_type >::mutate( AsmExpr * node ) {
|
---|
1051 | MUTATE_BODY( Expression, node );
|
---|
1052 | }
|
---|
1053 |
|
---|
1054 | template< typename pass_type >
|
---|
1055 | Expression * PassVisitor< pass_type >::mutate( ImplicitCopyCtorExpr * node ) {
|
---|
1056 | MUTATE_BODY( Expression, node );
|
---|
1057 | }
|
---|
1058 |
|
---|
1059 | template< typename pass_type >
|
---|
1060 | Expression * PassVisitor< pass_type >::mutate( ConstructorExpr * node ) {
|
---|
1061 | MUTATE_BODY( Expression, node );
|
---|
1062 | }
|
---|
1063 |
|
---|
1064 | template< typename pass_type >
|
---|
1065 | Expression * PassVisitor< pass_type >::mutate( CompoundLiteralExpr * node ) {
|
---|
1066 | MUTATE_BODY( Expression, node );
|
---|
1067 | }
|
---|
1068 |
|
---|
1069 | template< typename pass_type >
|
---|
1070 | Expression * PassVisitor< pass_type >::mutate( RangeExpr * node ) {
|
---|
1071 | MUTATE_BODY( Expression, node );
|
---|
1072 | }
|
---|
1073 |
|
---|
1074 | template< typename pass_type >
|
---|
1075 | Expression * PassVisitor< pass_type >::mutate( UntypedTupleExpr * node ) {
|
---|
1076 | MUTATE_BODY( Expression, node );
|
---|
1077 | }
|
---|
1078 |
|
---|
1079 | template< typename pass_type >
|
---|
1080 | Expression * PassVisitor< pass_type >::mutate( TupleExpr * node ) {
|
---|
1081 | MUTATE_BODY( Expression, node );
|
---|
1082 | }
|
---|
1083 |
|
---|
1084 | template< typename pass_type >
|
---|
1085 | Expression * PassVisitor< pass_type >::mutate( TupleIndexExpr * node ) {
|
---|
1086 | MUTATE_BODY( Expression, node );
|
---|
1087 | }
|
---|
1088 |
|
---|
1089 | template< typename pass_type >
|
---|
1090 | Expression * PassVisitor< pass_type >::mutate( TupleAssignExpr * node ) {
|
---|
1091 | MUTATE_BODY( Expression, node );
|
---|
1092 | }
|
---|
1093 |
|
---|
1094 | template< typename pass_type >
|
---|
1095 | Expression * PassVisitor< pass_type >::mutate( UniqueExpr * node ) {
|
---|
1096 | MUTATE_BODY( Expression, node );
|
---|
1097 | }
|
---|
1098 |
|
---|
1099 | template< typename pass_type >
|
---|
1100 | Type * PassVisitor< pass_type >::mutate( VoidType * node ) {
|
---|
1101 | MUTATE_BODY( Type, node );
|
---|
1102 | }
|
---|
1103 |
|
---|
1104 | template< typename pass_type >
|
---|
1105 | Type * PassVisitor< pass_type >::mutate( BasicType * node ) {
|
---|
1106 | MUTATE_BODY( Type, node );
|
---|
1107 | }
|
---|
1108 |
|
---|
1109 | template< typename pass_type >
|
---|
1110 | Type * PassVisitor< pass_type >::mutate( PointerType * node ) {
|
---|
1111 | MUTATE_BODY( Type, node );
|
---|
1112 | }
|
---|
1113 |
|
---|
1114 | template< typename pass_type >
|
---|
1115 | Type * PassVisitor< pass_type >::mutate( ArrayType * node ) {
|
---|
1116 | MUTATE_BODY( Type, node );
|
---|
1117 | }
|
---|
1118 |
|
---|
1119 | template< typename pass_type >
|
---|
1120 | Type * PassVisitor< pass_type >::mutate( FunctionType * node ) {
|
---|
1121 | MUTATE_BODY( Type, node );
|
---|
1122 | }
|
---|
1123 |
|
---|
1124 | template< typename pass_type >
|
---|
1125 | Type * PassVisitor< pass_type >::mutate( StructInstType * node ) {
|
---|
1126 | MUTATE_BODY( Type, node );
|
---|
1127 | }
|
---|
1128 |
|
---|
1129 | template< typename pass_type >
|
---|
1130 | Type * PassVisitor< pass_type >::mutate( UnionInstType * node ) {
|
---|
1131 | MUTATE_BODY( Type, node );
|
---|
1132 | }
|
---|
1133 |
|
---|
1134 | template< typename pass_type >
|
---|
1135 | Type * PassVisitor< pass_type >::mutate( EnumInstType * node ) {
|
---|
1136 | MUTATE_BODY( Type, node );
|
---|
1137 | }
|
---|
1138 |
|
---|
1139 | template< typename pass_type >
|
---|
1140 | Type * PassVisitor< pass_type >::mutate( TraitInstType * node ) {
|
---|
1141 | MUTATE_BODY( Type, node );
|
---|
1142 | }
|
---|
1143 |
|
---|
1144 | template< typename pass_type >
|
---|
1145 | Type * PassVisitor< pass_type >::mutate( TypeInstType * node ) {
|
---|
1146 | MUTATE_BODY( Type, node );
|
---|
1147 | }
|
---|
1148 |
|
---|
1149 | template< typename pass_type >
|
---|
1150 | Type * PassVisitor< pass_type >::mutate( TupleType * node ) {
|
---|
1151 | MUTATE_BODY( Type, node );
|
---|
1152 | }
|
---|
1153 |
|
---|
1154 | template< typename pass_type >
|
---|
1155 | Type * PassVisitor< pass_type >::mutate( TypeofType * node ) {
|
---|
1156 | MUTATE_BODY( Type, node );
|
---|
1157 | }
|
---|
1158 |
|
---|
1159 | template< typename pass_type >
|
---|
1160 | Type * PassVisitor< pass_type >::mutate( AttrType * node ) {
|
---|
1161 | MUTATE_BODY( Type, node );
|
---|
1162 | }
|
---|
1163 |
|
---|
1164 | template< typename pass_type >
|
---|
1165 | Type * PassVisitor< pass_type >::mutate( VarArgsType * node ) {
|
---|
1166 | MUTATE_BODY( Type, node );
|
---|
1167 | }
|
---|
1168 |
|
---|
1169 | template< typename pass_type >
|
---|
1170 | Type * PassVisitor< pass_type >::mutate( ZeroType * node ) {
|
---|
1171 | MUTATE_BODY( Type, node );
|
---|
1172 | }
|
---|
1173 |
|
---|
1174 | template< typename pass_type >
|
---|
1175 | Type * PassVisitor< pass_type >::mutate( OneType * node ) {
|
---|
1176 | MUTATE_BODY( Type, node );
|
---|
1177 | }
|
---|
1178 |
|
---|
1179 | template< typename pass_type >
|
---|
1180 | Initializer * PassVisitor< pass_type >::mutate( ListInit * node ) {
|
---|
1181 | MUTATE_BODY( Initializer, node );
|
---|
1182 | }
|
---|
1183 |
|
---|
1184 | template< typename pass_type >
|
---|
1185 | Initializer * PassVisitor< pass_type >::mutate( ConstructorInit * node ) {
|
---|
1186 | MUTATE_BODY( Initializer, node );
|
---|
1187 | }
|
---|
1188 |
|
---|
1189 | template< typename pass_type >
|
---|
1190 | Subrange * PassVisitor< pass_type >::mutate( Subrange * node ) {
|
---|
1191 | MUTATE_BODY( Subrange, node );
|
---|
1192 | }
|
---|
1193 |
|
---|
1194 | template< typename pass_type >
|
---|
1195 | Constant * PassVisitor< pass_type >::mutate( Constant * node ) {
|
---|
1196 | MUTATE_BODY( Constant, node );
|
---|
1197 | }
|
---|