Changeset 8a5530c for src/AST/Pass.impl.hpp
- Timestamp:
- May 16, 2019, 10:58:52 AM (5 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, cleanup-dtors, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- f2e482cb
- Parents:
- 89c2f7c9
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/AST/Pass.impl.hpp
r89c2f7c9 r8a5530c 64 64 65 65 std::transform(decls->begin(), decls->end(), it, [](const ast::Decl * decl) -> auto { 66 return new DeclStmt( decl );66 return new DeclStmt( decl->location, decl ); 67 67 }); 68 68 decls->clear(); … … 119 119 template< typename pass_t > 120 120 template< typename node_t > 121 auto Pass< pass_t >::call_accept( const node_t * node ) -> decltype( node->accept(*this) ) { 121 auto Pass< pass_t >::call_accept( const node_t * node ) 122 -> typename std::enable_if< 123 !std::is_base_of<ast::Expr, node_t>::value && 124 !std::is_base_of<ast::Stmt, node_t>::value 125 , decltype( node->accept(*this) ) 126 >::type 127 128 { 122 129 __pedantic_pass_assert( __visit_children() ); 123 130 __pedantic_pass_assert( expr ); … … 296 303 child_t parent_t::*child 297 304 ) { 298 static_assert( std::is_base_of<parent_t, node_t>::value, "Error deduc tiing member object" );305 static_assert( std::is_base_of<parent_t, node_t>::value, "Error deducing member object" ); 299 306 300 307 if(__pass::skip(parent->*child)) return; … … 424 431 new ast::ArrayType( 425 432 new ast::BasicType( ast::BasicType::Char, ast::CV::Qualifiers( ast::CV::Const ) ), 426 nullptr, true, false433 nullptr, VariableLen, DynamicDim 427 434 ) 428 435 ); … … 434 441 ValueGuard< bool > oldInFunction( inFunction ); 435 442 inFunction = true; 436 maybe_accept( node, &FunctionDecl::st atements );443 maybe_accept( node, &FunctionDecl::stmts ); 437 444 maybe_accept( node, &FunctionDecl::attributes ); 438 445 ) … … 537 544 538 545 VISIT( 539 maybe_accept( node, &TypeDecl::assertions , *this);546 maybe_accept( node, &TypeDecl::assertions ); 540 547 541 548 { … … 614 621 } 615 622 623 //-------------------------------------------------------------------------- 624 // ExprStmt 625 template< typename pass_t > 626 const ast::Stmt * ast::Pass< pass_t >::visit( const ExprStmt * node ) { 627 VISIT_START( node ); 628 629 VISIT( 630 maybe_accept( node, &ExprStmt::expr ); 631 ) 632 633 VISIT_END( Stmt, node ); 634 } 635 636 //-------------------------------------------------------------------------- 637 // AsmStmt 638 template< typename pass_t > 639 const ast::Stmt * ast::Pass< pass_t >::visit( const ast::AsmStmt * node ) { 640 VISIT_START( node ) 641 642 VISIT( 643 maybe_accept( node, &AsmStmt::instruction ); 644 maybe_accept( node, &AsmStmt::output ); 645 maybe_accept( node, &AsmStmt::input ); 646 maybe_accept( node, &AsmStmt::clobber ); 647 ) 648 649 VISIT_END( Stmt, node ); 650 } 651 652 //-------------------------------------------------------------------------- 653 // DirectiveStmt 654 template< typename pass_t > 655 const ast::Stmt * ast::Pass< pass_t >::visit( const ast::DirectiveStmt * node ) { 656 VISIT_START( node ) 657 658 VISIT_END( Stmt, node ); 659 } 660 661 //-------------------------------------------------------------------------- 662 // IfStmt 663 template< typename pass_t > 664 const ast::Stmt * ast::Pass< pass_t >::visit( const ast::IfStmt * node ) { 665 VISIT_START( node ); 666 VISIT({ 667 // if statements introduce a level of scope (for the initialization) 668 guard_indexer guard { *this }; 669 maybe_accept( node, &IfStmt::inits ); 670 maybe_accept( node, &IfStmt::cond ); 671 maybe_accept( node, &IfStmt::thenPart ); 672 maybe_accept( node, &IfStmt::elsePart ); 673 }) 674 VISIT_END( Stmt, node ); 675 } 676 677 //-------------------------------------------------------------------------- 678 // WhileStmt 679 template< typename pass_t > 680 const ast::Stmt * ast::Pass< pass_t >::visit( const WhileStmt * node ) { 681 VISIT_START( node ); 682 683 VISIT({ 684 // while statements introduce a level of scope (for the initialization) 685 guard_indexer guard { *this }; 686 maybe_accept( node, &WhileStmt::inits ); 687 maybe_accept( node, &WhileStmt::cond ); 688 maybe_accept( node, &WhileStmt::body ); 689 }) 690 691 VISIT_END( Stmt, node ); 692 } 616 693 617 694 //-------------------------------------------------------------------------- … … 667 744 ) 668 745 669 VISIT_END( Attribute *, node );746 VISIT_END( Attribute, node ); 670 747 } 671 748
Note: See TracChangeset
for help on using the changeset viewer.