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