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