Changes in src/Common/PassVisitor.impl.h [6ca154b:6e09f211]
- File:
-
- 1 edited
-
src/Common/PassVisitor.impl.h (modified) (28 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Common/PassVisitor.impl.h
r6ca154b r6e09f211 4 4 __attribute__((unused)) \ 5 5 const auto & guard = init_guard(); \ 6 bool visit_children = true; \7 set_visit_children( visit_children ); \8 6 call_previsit( node ); \ 9 if( visit_children ) { \ 7 if( visit_children() ) { \ 8 reset_visit(); \ 10 9 11 10 #define VISIT_END( node ) \ … … 16 15 __attribute__((unused)) \ 17 16 const auto & guard = init_guard(); \ 18 bool visit_children = true; \19 set_visit_children( visit_children ); \20 17 call_premutate( node ); \ 21 if( visit_children ) { \ 18 if( visit_children() ) { \ 19 reset_visit(); \ 22 20 23 21 #define MUTATE_END( type, node ) \ … … 44 42 } 45 43 46 typedef std::list< Statement * > StmtList_t; 47 typedef std::list< Declaration * > DeclList_t; 48 49 template<typename iterator_t> 50 static inline void splice( iterator_t it, DeclList_t * decls ) { 51 std::transform( 52 decls->begin(), 53 decls->end(), 54 it, 55 [](Declaration * decl) -> auto { 56 return new DeclStmt( noLabels, decl ); 57 } 58 ); 59 decls->clear(); 60 } 61 62 template< typename pass_type > 63 static inline void acceptAll( std::list< Declaration* > &decls, PassVisitor< pass_type >& visitor ) { 64 65 DeclList_t* beforeDecls = visitor.get_beforeDecls(); 66 DeclList_t* afterDecls = visitor.get_afterDecls(); 67 68 for ( std::list< Declaration* >::iterator i = decls.begin(); ; ++i ) { 69 // splice in new declarations after previous decl 70 if ( !empty( afterDecls ) ) { decls.splice( i, *afterDecls ); } 71 72 if ( i == decls.end() ) break; 73 74 // run mutator on declaration 75 maybeAccept( *i, visitor ); 76 77 // splice in new declarations before current decl 78 if ( !empty( beforeDecls ) ) { decls.splice( i, *beforeDecls ); } 79 } 80 } 81 82 template< typename pass_type > 83 static inline void mutateAll( std::list< Declaration* > &decls, PassVisitor< pass_type >& mutator ) { 84 85 DeclList_t* beforeDecls = mutator.get_beforeDecls(); 86 DeclList_t* afterDecls = mutator.get_afterDecls(); 87 88 for ( std::list< Declaration* >::iterator i = decls.begin(); ; ++i ) { 89 // splice in new declarations after previous decl 90 if ( !empty( afterDecls ) ) { decls.splice( i, *afterDecls ); } 91 92 if ( i == decls.end() ) break; 93 94 // run mutator on declaration 95 *i = maybeMutate( *i, mutator ); 96 97 // splice in new declarations before current decl 98 if ( !empty( beforeDecls ) ) { decls.splice( i, *beforeDecls ); } 99 } 100 } 101 102 template< typename pass_type > 103 template< typename func_t > 104 void PassVisitor< pass_type >::handleStatementList( std::list< Statement * > & statements, func_t func ) { 44 typedef std::list< Statement * > StmtList_t; 45 46 template< typename pass_type > 47 void PassVisitor< pass_type >::visitStatementList( std::list< Statement * > & statements ) { 105 48 SemanticError errors; 106 49 107 50 StmtList_t* beforeStmts = get_beforeStmts(); 108 51 StmtList_t* afterStmts = get_afterStmts(); 109 DeclList_t* beforeDecls = get_beforeDecls();110 DeclList_t* afterDecls = get_afterDecls();111 52 112 53 for ( std::list< Statement* >::iterator i = statements.begin(); i != statements.end(); ++i ) { 113 114 if ( !empty( afterDecls ) ) { splice( std::inserter( statements, i ), afterDecls ); }115 54 if ( !empty( afterStmts ) ) { statements.splice( i, *afterStmts ); } 116 117 55 try { 118 func( *i ); 119 assert(( empty( beforeStmts ) && empty( afterStmts )) 120 || ( empty( beforeDecls ) && empty( afterDecls )) ); 121 56 (*i)->accept( *this ); 122 57 } catch ( SemanticError &e ) { 123 58 errors.append( e ); 124 59 } 125 126 if ( !empty( beforeDecls ) ) { splice( std::inserter( statements, i ), beforeDecls ); }127 60 if ( !empty( beforeStmts ) ) { statements.splice( i, *beforeStmts ); } 128 61 } 129 62 130 if ( !empty( afterDecls ) ) { splice( std::back_inserter( statements ), afterDecls); }131 63 if ( !empty( afterStmts ) ) { statements.splice( statements.end(), *afterStmts ); } 132 64 if ( !errors.isEmpty() ) { throw errors; } … … 134 66 135 67 template< typename pass_type > 136 void PassVisitor< pass_type >::visitStatementList( std::list< Statement * > & statements ) {137 handleStatementList( statements, [this]( Statement * stmt) {138 stmt->accept( *this );139 });140 }141 142 template< typename pass_type >143 68 void PassVisitor< pass_type >::mutateStatementList( std::list< Statement * > & statements ) { 144 handleStatementList( statements, [this]( Statement *& stmt) { 145 stmt = stmt->acceptMutator( *this ); 146 }); 147 } 148 149 150 template< typename pass_type > 151 template< typename func_t > 152 Statement * PassVisitor< pass_type >::handleStatement( Statement * stmt, func_t func ) { 153 // don't want statements from outer CompoundStmts to be added to this CompoundStmt 154 ValueGuardPtr< TypeSubstitution * > oldEnv ( get_env_ptr () ); 155 ValueGuardPtr< DeclList_t > oldBeforeDecls( get_beforeDecls() ); 156 ValueGuardPtr< DeclList_t > oldAfterDecls ( get_afterDecls () ); 157 ValueGuardPtr< StmtList_t > oldBeforeStmts( get_beforeStmts() ); 158 ValueGuardPtr< StmtList_t > oldAfterStmts ( get_afterStmts () ); 159 160 Statement *newStmt = func( stmt ); 69 SemanticError errors; 161 70 162 71 StmtList_t* beforeStmts = get_beforeStmts(); 163 72 StmtList_t* afterStmts = get_afterStmts(); 164 DeclList_t* beforeDecls = get_beforeDecls(); 165 DeclList_t* afterDecls = get_afterDecls(); 166 167 if( empty(beforeStmts) && empty(afterStmts) && empty(beforeDecls) && empty(afterDecls) ) { return newStmt; } 168 assert(( empty( beforeStmts ) && empty( afterStmts )) 169 || ( empty( beforeDecls ) && empty( afterDecls )) ); 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; } 170 101 171 102 CompoundStmt *compound = new CompoundStmt( noLabels ); 172 if( !empty(beforeDecls) ) { splice( std::back_inserter( compound->get_kids() ), beforeDecls ); } 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 ); 173 124 if( !empty(beforeStmts) ) { compound->get_kids().splice( compound->get_kids().end(), *beforeStmts ); } 174 125 compound->get_kids().push_back( newStmt ); 175 if( !empty(afterDecls) ) { splice( std::back_inserter( compound->get_kids() ), afterDecls ); }176 126 if( !empty(afterStmts) ) { compound->get_kids().splice( compound->get_kids().end(), *afterStmts ); } 177 127 return compound; 178 128 } 179 129 180 template< typename pass_type > 181 Statement * PassVisitor< pass_type >::visitStatement( Statement * stmt ) { 182 return handleStatement( stmt, [this]( Statement * stmt ) { 183 maybeAccept( stmt, *this ); 184 return stmt; 185 }); 186 } 187 188 template< typename pass_type > 189 Statement * PassVisitor< pass_type >::mutateStatement( Statement * stmt ) { 190 return handleStatement( stmt, [this]( Statement * stmt ) { 191 return maybeMutate( stmt, *this ); 192 }); 193 } 194 195 template< typename pass_type > 196 template< typename func_t > 197 Expression * PassVisitor< pass_type >::handleExpression( Expression * expr, func_t func ) { 198 if( !expr ) return nullptr; 130 131 132 template< typename pass_type > 133 void PassVisitor< pass_type >::visitExpression( Expression * expr ) { 134 if( !expr ) return; 199 135 200 136 auto env_ptr = get_env_ptr(); … … 202 138 *env_ptr = expr->get_env(); 203 139 } 204 205 // should env be cloned (or moved) onto the result of the mutate? 206 return func( expr ); 207 } 208 209 template< typename pass_type > 210 Expression * PassVisitor< pass_type >::visitExpression( Expression * expr ) { 211 return handleExpression(expr, [this]( Expression * expr ) { 212 expr->accept( *this ); 213 return expr; 214 }); 140 // xxx - should env be cloned (or moved) onto the result of the mutate? 141 expr->accept( *this ); 215 142 } 216 143 217 144 template< typename pass_type > 218 145 Expression * PassVisitor< pass_type >::mutateExpression( Expression * expr ) { 219 return handleExpression(expr, [this]( Expression * expr ) { 220 return expr->acceptMutator( *this ); 221 }); 222 } 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 223 156 224 157 //------------------------------------------------------------------------------------------------------------------------------------------------------------------------ … … 226 159 template< typename pass_type > 227 160 void PassVisitor< pass_type >::visit( ObjectDecl * node ) { 228 VISIT_BODY( node ); 161 VISIT_BODY( node ); 229 162 } 230 163 231 164 template< typename pass_type > 232 165 void PassVisitor< pass_type >::visit( FunctionDecl * node ) { 233 VISIT_BODY( node ); 166 VISIT_BODY( node ); 234 167 } 235 168 236 169 template< typename pass_type > 237 170 void PassVisitor< pass_type >::visit( StructDecl * node ) { 238 VISIT_BODY( node ); 171 VISIT_BODY( node ); 239 172 } 240 173 241 174 template< typename pass_type > 242 175 void PassVisitor< pass_type >::visit( UnionDecl * node ) { 243 VISIT_BODY( node ); 176 VISIT_BODY( node ); 244 177 } 245 178 246 179 template< typename pass_type > 247 180 void PassVisitor< pass_type >::visit( EnumDecl * node ) { 248 VISIT_BODY( node ); 181 VISIT_BODY( node ); 249 182 } 250 183 251 184 template< typename pass_type > 252 185 void PassVisitor< pass_type >::visit( TraitDecl * node ) { 253 VISIT_BODY( node ); 186 VISIT_BODY( node ); 254 187 } 255 188 256 189 template< typename pass_type > 257 190 void PassVisitor< pass_type >::visit( TypeDecl * node ) { 258 VISIT_BODY( node ); 191 VISIT_BODY( node ); 259 192 } 260 193 261 194 template< typename pass_type > 262 195 void PassVisitor< pass_type >::visit( TypedefDecl * node ) { 263 VISIT_BODY( node ); 196 VISIT_BODY( node ); 264 197 } 265 198 266 199 template< typename pass_type > 267 200 void PassVisitor< pass_type >::visit( AsmDecl * node ) { 268 VISIT_BODY( node ); 201 VISIT_BODY( node ); 269 202 } 270 203 … … 298 231 void PassVisitor< pass_type >::visit( ExprStmt * node ) { 299 232 VISIT_START( node ); 233 call_beginScope(); 300 234 301 235 visitExpression( node->get_expr() ); 302 236 237 call_endScope(); 303 238 VISIT_END( node ); 304 239 } … … 313 248 } 314 249 315 //--------------------------------------------------------------------------316 // AsmStmt317 250 template< typename pass_type > 318 251 void PassVisitor< pass_type >::visit( AsmStmt * node ) { 319 VISIT_BODY( node ); 320 } 321 322 template< typename pass_type > 323 Statement * PassVisitor< pass_type >::mutate( AsmStmt * node ) { 324 MUTATE_BODY( Statement, node ); 252 VISIT_BODY( node ); 325 253 } 326 254 … … 329 257 template< typename pass_type > 330 258 void PassVisitor< pass_type >::visit( IfStmt * node ) { 331 VISIT_START( node ); 259 VISIT_START( node ); 332 260 333 261 visitExpression( node->get_condition() ); … … 340 268 template< typename pass_type > 341 269 Statement * PassVisitor< pass_type >::mutate( IfStmt * node ) { 342 MUTATE_START( node ); 270 MUTATE_START( node ); 343 271 344 272 node->set_condition( mutateExpression( node->get_condition() ) ); … … 353 281 template< typename pass_type > 354 282 void PassVisitor< pass_type >::visit( WhileStmt * node ) { 355 VISIT_START( node ); 283 VISIT_START( node ); 356 284 357 285 visitExpression( node->get_condition() ); … … 363 291 template< typename pass_type > 364 292 Statement * PassVisitor< pass_type >::mutate( WhileStmt * node ) { 365 MUTATE_START( node ); 293 MUTATE_START( node ); 366 294 367 295 node->set_condition( mutateExpression( node->get_condition() ) ); … … 372 300 373 301 //-------------------------------------------------------------------------- 374 // ForStmt302 // WhileStmt 375 303 template< typename pass_type > 376 304 void PassVisitor< pass_type >::visit( ForStmt * node ) { 377 VISIT_START( node ); 305 VISIT_START( node ); 378 306 379 307 acceptAll( node->get_initialization(), *this ); … … 387 315 template< typename pass_type > 388 316 Statement * PassVisitor< pass_type >::mutate( ForStmt * node ) { 389 MUTATE_START( node ); 317 MUTATE_START( node ); 390 318 391 319 mutateAll( node->get_initialization(), *this ); … … 401 329 template< typename pass_type > 402 330 void PassVisitor< pass_type >::visit( SwitchStmt * node ) { 403 VISIT_START( node ); 331 VISIT_START( node ); 404 332 405 333 visitExpression( node->get_condition() ); … … 411 339 template< typename pass_type > 412 340 Statement * PassVisitor< pass_type >::mutate( SwitchStmt * node ) { 413 MUTATE_START( node ); 414 341 MUTATE_START( node ); 342 415 343 node->set_condition( mutateExpression( node->get_condition() ) ); 416 344 mutateStatementList( node->get_statements() ); 417 345 418 346 MUTATE_END( Statement, node ); 419 347 } 420 348 421 349 //-------------------------------------------------------------------------- 422 // CaseStmt350 // SwitchStmt 423 351 template< typename pass_type > 424 352 void PassVisitor< pass_type >::visit( CaseStmt * node ) { 425 VISIT_START( node ); 426 353 VISIT_START( node ); 354 427 355 visitExpression( node->get_condition() ); 428 356 visitStatementList( node->get_statements() ); 429 357 430 358 VISIT_END( node ); 431 359 } … … 433 361 template< typename pass_type > 434 362 Statement * PassVisitor< pass_type >::mutate( CaseStmt * node ) { 435 MUTATE_START( node ); 436 363 MUTATE_START( node ); 364 437 365 node->set_condition( mutateExpression( node->get_condition() ) ); 438 366 mutateStatementList( node->get_statements() ); 439 367 440 368 MUTATE_END( Statement, node ); 441 369 } 442 370 443 //--------------------------------------------------------------------------444 // BranchStmt445 371 template< typename pass_type > 446 372 void PassVisitor< pass_type >::visit( BranchStmt * node ) { 447 VISIT_BODY( node ); 448 } 449 450 template< typename pass_type > 451 Statement * PassVisitor< pass_type >::mutate( BranchStmt * node ) { 452 MUTATE_BODY( Statement, node ); 373 VISIT_BODY( node ); 453 374 } 454 375 … … 494 415 maybeAccept( node->get_block(), *this ); 495 416 acceptAll( node->get_catchers(), *this ); 496 maybeAccept( node->get_finally(), *this );497 417 498 418 VISIT_END( node ); … … 505 425 node->set_block( maybeMutate( node->get_block(), *this ) ); 506 426 mutateAll( node->get_catchers(), *this ); 507 node->set_finally( maybeMutate( node->get_finally(), *this ) ); 508 427 509 428 MUTATE_END( Statement, node ); 510 429 } … … 516 435 VISIT_START( node ); 517 436 437 node->set_body( visitStatement( node->get_body() ) ); 518 438 maybeAccept( node->get_decl(), *this ); 519 node->set_cond( visitExpression( node->get_cond() ) );520 node->set_body( visitStatement( node->get_body() ) );521 439 522 440 VISIT_END( node ); … … 526 444 Statement * PassVisitor< pass_type >::mutate( CatchStmt * node ) { 527 445 MUTATE_START( node ); 528 529 node->set_decl( maybeMutate( node->get_decl(), *this ) ); 530 node->set_cond( mutateExpression( node->get_cond() ) ); 531 node->set_body( mutateStatement( node->get_body() ) ); 532 446 447 node->set_body( mutateStatement( node->get_body() ) ); 448 node->set_decl( maybeMutate( node->get_decl(), *this ) ); 449 533 450 MUTATE_END( Statement, node ); 534 451 } … … 536 453 template< typename pass_type > 537 454 void PassVisitor< pass_type >::visit( FinallyStmt * node ) { 538 VISIT_BODY( node ); 455 VISIT_BODY( node ); 539 456 } 540 457 541 458 template< typename pass_type > 542 459 void PassVisitor< pass_type >::visit( NullStmt * node ) { 543 VISIT_BODY( node ); 460 VISIT_BODY( node ); 544 461 } 545 462 546 463 template< typename pass_type > 547 464 void PassVisitor< pass_type >::visit( DeclStmt * node ) { 548 VISIT_BODY( node ); 465 VISIT_BODY( node ); 549 466 } 550 467 551 468 template< typename pass_type > 552 469 void PassVisitor< pass_type >::visit( ImplicitCtorDtorStmt * node ) { 553 VISIT_BODY( node ); 470 VISIT_BODY( node ); 554 471 } 555 472 556 473 template< typename pass_type > 557 474 void PassVisitor< pass_type >::visit( ApplicationExpr * node ) { 558 VISIT_BODY( node ); 475 VISIT_BODY( node ); 559 476 } 560 477 … … 585 502 template< typename pass_type > 586 503 void PassVisitor< pass_type >::visit( NameExpr * node ) { 587 VISIT_BODY( node ); 504 VISIT_BODY( node ); 588 505 } 589 506 590 507 template< typename pass_type > 591 508 void PassVisitor< pass_type >::visit( CastExpr * node ) { 592 VISIT_BODY( node ); 509 VISIT_BODY( node ); 593 510 } 594 511 595 512 template< typename pass_type > 596 513 void PassVisitor< pass_type >::visit( AddressExpr * node ) { 597 VISIT_BODY( node ); 514 VISIT_BODY( node ); 598 515 } 599 516 600 517 template< typename pass_type > 601 518 void PassVisitor< pass_type >::visit( LabelAddressExpr * node ) { 602 VISIT_BODY( node ); 519 VISIT_BODY( node ); 603 520 } 604 521 605 522 template< typename pass_type > 606 523 void PassVisitor< pass_type >::visit( UntypedMemberExpr * node ) { 607 VISIT_BODY( node ); 524 VISIT_BODY( node ); 608 525 } 609 526 610 527 template< typename pass_type > 611 528 void PassVisitor< pass_type >::visit( MemberExpr * node ) { 612 VISIT_BODY( node ); 529 VISIT_BODY( node ); 613 530 } 614 531 615 532 template< typename pass_type > 616 533 void PassVisitor< pass_type >::visit( VariableExpr * node ) { 617 VISIT_BODY( node ); 534 VISIT_BODY( node ); 618 535 } 619 536 620 537 template< typename pass_type > 621 538 void PassVisitor< pass_type >::visit( ConstantExpr * node ) { 622 VISIT_BODY( node ); 539 VISIT_BODY( node ); 623 540 } 624 541 625 542 template< typename pass_type > 626 543 void PassVisitor< pass_type >::visit( SizeofExpr * node ) { 627 VISIT_BODY( node ); 544 VISIT_BODY( node ); 628 545 } 629 546 630 547 template< typename pass_type > 631 548 void PassVisitor< pass_type >::visit( AlignofExpr * node ) { 632 VISIT_BODY( node ); 549 VISIT_BODY( node ); 633 550 } 634 551 635 552 template< typename pass_type > 636 553 void PassVisitor< pass_type >::visit( UntypedOffsetofExpr * node ) { 637 VISIT_BODY( node ); 554 VISIT_BODY( node ); 638 555 } 639 556 640 557 template< typename pass_type > 641 558 void PassVisitor< pass_type >::visit( OffsetofExpr * node ) { 642 VISIT_BODY( node ); 559 VISIT_BODY( node ); 643 560 } 644 561 645 562 template< typename pass_type > 646 563 void PassVisitor< pass_type >::visit( OffsetPackExpr * node ) { 647 VISIT_BODY( node ); 564 VISIT_BODY( node ); 648 565 } 649 566 650 567 template< typename pass_type > 651 568 void PassVisitor< pass_type >::visit( AttrExpr * node ) { 652 VISIT_BODY( node ); 569 VISIT_BODY( node ); 653 570 } 654 571 655 572 template< typename pass_type > 656 573 void PassVisitor< pass_type >::visit( LogicalExpr * node ) { 657 VISIT_BODY( node ); 574 VISIT_BODY( node ); 658 575 } 659 576 660 577 template< typename pass_type > 661 578 void PassVisitor< pass_type >::visit( ConditionalExpr * node ) { 662 VISIT_BODY( node ); 579 VISIT_BODY( node ); 663 580 } 664 581 665 582 template< typename pass_type > 666 583 void PassVisitor< pass_type >::visit( CommaExpr * node ) { 667 VISIT_BODY( node ); 584 VISIT_BODY( node ); 668 585 } 669 586 670 587 template< typename pass_type > 671 588 void PassVisitor< pass_type >::visit( TypeExpr * node ) { 672 VISIT_BODY( node ); 589 VISIT_BODY( node ); 673 590 } 674 591 675 592 template< typename pass_type > 676 593 void PassVisitor< pass_type >::visit( AsmExpr * node ) { 677 VISIT_BODY( node ); 594 VISIT_BODY( node ); 678 595 } 679 596 680 597 template< typename pass_type > 681 598 void PassVisitor< pass_type >::visit( ImplicitCopyCtorExpr * node ) { 682 VISIT_BODY( node ); 599 VISIT_BODY( node ); 683 600 } 684 601 685 602 template< typename pass_type > 686 603 void PassVisitor< pass_type >::visit( ConstructorExpr * node ) { 687 VISIT_BODY( node ); 604 VISIT_BODY( node ); 688 605 } 689 606 690 607 template< typename pass_type > 691 608 void PassVisitor< pass_type >::visit( CompoundLiteralExpr * node ) { 692 VISIT_BODY( node ); 609 VISIT_BODY( node ); 610 } 611 612 template< typename pass_type > 613 void PassVisitor< pass_type >::visit( UntypedValofExpr * node ) { 614 VISIT_BODY( node ); 693 615 } 694 616 695 617 template< typename pass_type > 696 618 void PassVisitor< pass_type >::visit( RangeExpr * node ) { 697 VISIT_BODY( node ); 619 VISIT_BODY( node ); 698 620 } 699 621 700 622 template< typename pass_type > 701 623 void PassVisitor< pass_type >::visit( UntypedTupleExpr * node ) { 702 VISIT_BODY( node ); 624 VISIT_BODY( node ); 703 625 } 704 626 705 627 template< typename pass_type > 706 628 void PassVisitor< pass_type >::visit( TupleExpr * node ) { 707 VISIT_BODY( node ); 629 VISIT_BODY( node ); 708 630 } 709 631 710 632 template< typename pass_type > 711 633 void PassVisitor< pass_type >::visit( TupleIndexExpr * node ) { 712 VISIT_BODY( node ); 634 VISIT_BODY( node ); 713 635 } 714 636 715 637 template< typename pass_type > 716 638 void PassVisitor< pass_type >::visit( TupleAssignExpr * node ) { 717 VISIT_BODY( node ); 639 VISIT_BODY( node ); 718 640 } 719 641 … … 737 659 Expression * PassVisitor< pass_type >::mutate( StmtExpr * node ) { 738 660 MUTATE_START( node ); 739 661 740 662 // don't want statements from outer CompoundStmts to be added to this StmtExpr 741 663 ValueGuardPtr< TypeSubstitution * > oldEnv ( get_env_ptr() ); … … 750 672 template< typename pass_type > 751 673 void PassVisitor< pass_type >::visit( UniqueExpr * node ) { 752 VISIT_BODY( node ); 674 VISIT_BODY( node ); 753 675 } 754 676 755 677 template< typename pass_type > 756 678 void PassVisitor< pass_type >::visit( VoidType * node ) { 757 VISIT_BODY( node ); 679 VISIT_BODY( node ); 758 680 } 759 681 760 682 template< typename pass_type > 761 683 void PassVisitor< pass_type >::visit( BasicType * node ) { 762 VISIT_BODY( node ); 684 VISIT_BODY( node ); 763 685 } 764 686 765 687 template< typename pass_type > 766 688 void PassVisitor< pass_type >::visit( PointerType * node ) { 767 VISIT_BODY( node ); 689 VISIT_BODY( node ); 768 690 } 769 691 770 692 template< typename pass_type > 771 693 void PassVisitor< pass_type >::visit( ArrayType * node ) { 772 VISIT_BODY( node ); 694 VISIT_BODY( node ); 773 695 } 774 696 775 697 template< typename pass_type > 776 698 void PassVisitor< pass_type >::visit( FunctionType * node ) { 777 VISIT_BODY( node ); 699 VISIT_BODY( node ); 778 700 } 779 701 780 702 template< typename pass_type > 781 703 void PassVisitor< pass_type >::visit( StructInstType * node ) { 782 VISIT_BODY( node ); 704 VISIT_BODY( node ); 783 705 } 784 706 785 707 template< typename pass_type > 786 708 void PassVisitor< pass_type >::visit( UnionInstType * node ) { 787 VISIT_BODY( node ); 709 VISIT_BODY( node ); 788 710 } 789 711 790 712 template< typename pass_type > 791 713 void PassVisitor< pass_type >::visit( EnumInstType * node ) { 792 VISIT_BODY( node ); 714 VISIT_BODY( node ); 793 715 } 794 716 795 717 template< typename pass_type > 796 718 void PassVisitor< pass_type >::visit( TraitInstType * node ) { 797 VISIT_BODY( node ); 719 VISIT_BODY( node ); 798 720 } 799 721 800 722 template< typename pass_type > 801 723 void PassVisitor< pass_type >::visit( TypeInstType * node ) { 802 VISIT_BODY( node ); 724 VISIT_BODY( node ); 803 725 } 804 726 805 727 template< typename pass_type > 806 728 void PassVisitor< pass_type >::visit( TupleType * node ) { 807 VISIT_BODY( node ); 729 VISIT_BODY( node ); 808 730 } 809 731 810 732 template< typename pass_type > 811 733 void PassVisitor< pass_type >::visit( TypeofType * node ) { 812 VISIT_BODY( node ); 734 VISIT_BODY( node ); 813 735 } 814 736 815 737 template< typename pass_type > 816 738 void PassVisitor< pass_type >::visit( AttrType * node ) { 817 VISIT_BODY( node ); 739 VISIT_BODY( node ); 818 740 } 819 741 820 742 template< typename pass_type > 821 743 void PassVisitor< pass_type >::visit( VarArgsType * node ) { 822 VISIT_BODY( node ); 744 VISIT_BODY( node ); 823 745 } 824 746 825 747 template< typename pass_type > 826 748 void PassVisitor< pass_type >::visit( ZeroType * node ) { 827 VISIT_BODY( node ); 749 VISIT_BODY( node ); 828 750 } 829 751 830 752 template< typename pass_type > 831 753 void PassVisitor< pass_type >::visit( OneType * node ) { 832 VISIT_BODY( node ); 754 VISIT_BODY( node ); 833 755 } 834 756 … … 855 777 template< typename pass_type > 856 778 void PassVisitor< pass_type >::visit( ListInit * node ) { 857 VISIT_BODY( node ); 779 VISIT_BODY( node ); 858 780 } 859 781 860 782 template< typename pass_type > 861 783 void PassVisitor< pass_type >::visit( ConstructorInit * node ) { 862 VISIT_BODY( node ); 784 VISIT_BODY( node ); 863 785 } 864 786 865 787 template< typename pass_type > 866 788 void PassVisitor< pass_type >::visit( Subrange * node ) { 867 VISIT_BODY( node ); 789 VISIT_BODY( node ); 868 790 } 869 791 870 792 template< typename pass_type > 871 793 void PassVisitor< pass_type >::visit( Constant * node ) { 872 VISIT_BODY( node ); 794 VISIT_BODY( node ); 873 795 } 874 796 … … 921 843 922 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 > 923 855 Statement * PassVisitor< pass_type >::mutate( FinallyStmt * node ) { 924 856 MUTATE_BODY( Statement, node ); … … 1056 988 1057 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 > 1058 995 Expression * PassVisitor< pass_type >::mutate( RangeExpr * node ) { 1059 996 MUTATE_BODY( Expression, node );
Note:
See TracChangeset
for help on using the changeset viewer.