Changes in / [0f740d6:37eef7a]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/AST/Convert.cpp
r0f740d6 r37eef7a 265 265 stmt->location = node->location; 266 266 stmt->labels = makeLabelL( stmt, node->labels ); 267 cache.emplace( node, stmt ); 267 268 this->node = stmt; 268 269 return nullptr; … … 270 271 271 272 const ast::CompoundStmt * visit( const ast::CompoundStmt * node ) override final { 273 if ( inCache( node ) ) return nullptr; 272 274 auto stmt = new CompoundStmt( get<Statement>().acceptL( node->kids ) ); 273 275 stmtPostamble( stmt, node ); … … 276 278 277 279 const ast::Stmt * visit( const ast::ExprStmt * node ) override final { 280 if ( inCache( node ) ) return nullptr; 278 281 auto stmt = new ExprStmt( get<Expression>().accept1( node->expr ) ); 279 282 return stmtPostamble( stmt, node ); … … 281 284 282 285 const ast::Stmt * visit( const ast::AsmStmt * node ) override final { 286 if ( inCache( node ) ) return nullptr; 283 287 auto stmt = new AsmStmt( 284 288 node->isVolatile, … … 293 297 294 298 const ast::Stmt * visit( const ast::DirectiveStmt * node ) override final { 299 if ( inCache( node ) ) return nullptr; 295 300 auto stmt = new DirectiveStmt( node->directive ); 296 301 return stmtPostamble( stmt, node ); … … 298 303 299 304 const ast::Stmt * visit( const ast::IfStmt * node ) override final { 305 if ( inCache( node ) ) return nullptr; 300 306 auto stmt = new IfStmt( 301 307 get<Expression>().accept1( node->cond ), … … 308 314 309 315 const ast::Stmt * visit( const ast::SwitchStmt * node ) override final { 316 if ( inCache( node ) ) return nullptr; 310 317 auto stmt = new SwitchStmt( 311 318 get<Expression>().accept1( node->cond ), … … 316 323 317 324 const ast::Stmt * visit( const ast::CaseStmt * node ) override final { 325 if ( inCache( node ) ) return nullptr; 318 326 auto stmt = new CaseStmt( 319 327 get<Expression>().accept1( node->cond ), … … 325 333 326 334 const ast::Stmt * visit( const ast::WhileStmt * node ) override final { 335 if ( inCache( node ) ) return nullptr; 327 336 auto inits = get<Statement>().acceptL( node->inits ); 328 337 auto stmt = new WhileStmt( … … 336 345 337 346 const ast::Stmt * visit( const ast::ForStmt * node ) override final { 347 if ( inCache( node ) ) return nullptr; 338 348 auto stmt = new ForStmt( 339 349 get<Statement>().acceptL( node->inits ), … … 346 356 347 357 const ast::Stmt * visit( const ast::BranchStmt * node ) override final { 358 if ( inCache( node ) ) return nullptr; 348 359 BranchStmt * stmt; 349 360 if (node->computedTarget) { … … 375 386 376 387 const ast::Stmt * visit( const ast::ReturnStmt * node ) override final { 388 if ( inCache( node ) ) return nullptr; 377 389 auto stmt = new ReturnStmt( get<Expression>().accept1( node->expr ) ); 378 390 return stmtPostamble( stmt, node ); … … 380 392 381 393 const ast::Stmt * visit( const ast::ThrowStmt * node ) override final { 394 if ( inCache( node ) ) return nullptr; 382 395 ThrowStmt::Kind kind; 383 396 switch (node->kind) { … … 400 413 401 414 const ast::Stmt * visit( const ast::TryStmt * node ) override final { 415 if ( inCache( node ) ) return nullptr; 402 416 auto handlers = get<CatchStmt>().acceptL( node->handlers ); 403 417 auto stmt = new TryStmt( … … 410 424 411 425 const ast::Stmt * visit( const ast::CatchStmt * node ) override final { 426 if ( inCache( node ) ) return nullptr; 412 427 CatchStmt::Kind kind; 413 428 switch (node->kind) { … … 431 446 432 447 const ast::Stmt * visit( const ast::FinallyStmt * node ) override final { 448 if ( inCache( node ) ) return nullptr; 433 449 auto stmt = new FinallyStmt( get<CompoundStmt>().accept1( node->body ) ); 434 450 return stmtPostamble( stmt, node ); … … 436 452 437 453 const ast::Stmt * visit( const ast::WaitForStmt * node ) override final { 454 if ( inCache( node ) ) return nullptr; 438 455 auto stmt = new WaitForStmt; 439 456 stmt->clauses.reserve( node->clauses.size() ); … … 460 477 461 478 const ast::Stmt * visit( const ast::WithStmt * node ) override final { 479 if ( inCache( node ) ) return nullptr; 462 480 auto stmt = new WithStmt( 463 481 get<Expression>().acceptL( node->exprs ), … … 468 486 469 487 const ast::NullStmt * visit( const ast::NullStmt * node ) override final { 488 if ( inCache( node ) ) return nullptr; 470 489 auto stmt = new NullStmt(); 471 490 stmtPostamble( stmt, node ); … … 474 493 475 494 const ast::Stmt * visit( const ast::DeclStmt * node ) override final { 495 if ( inCache( node ) ) return nullptr; 476 496 auto stmt = new DeclStmt( get<Declaration>().accept1( node->decl ) ); 477 497 return stmtPostamble( stmt, node ); … … 479 499 480 500 const ast::Stmt * visit( const ast::ImplicitCtorDtorStmt * node ) override final { 481 (void)node; 482 return nullptr; 501 if ( inCache( node ) ) return nullptr; 502 auto stmt = new ImplicitCtorDtorStmt{ 503 get<Statement>().accept1( node->callStmt ) 504 }; 505 return stmtPostamble( stmt, node ); 483 506 } 484 507 … … 1583 1606 1584 1607 virtual void visit( CompoundStmt * old ) override final { 1608 if ( inCache( old ) ) return; 1585 1609 auto stmt = new ast::CompoundStmt( 1586 1610 old->location, … … 1590 1614 1591 1615 this->node = stmt; 1616 cache.emplace( old, this->node ); 1592 1617 } 1593 1618 1594 1619 virtual void visit( ExprStmt * old ) override final { 1620 if ( inCache( old ) ) return; 1595 1621 this->node = new ast::ExprStmt( 1596 1622 old->location, … … 1598 1624 GET_LABELS_V(old->labels) 1599 1625 ); 1626 cache.emplace( old, this->node ); 1600 1627 } 1601 1628 1602 1629 virtual void visit( AsmStmt * old ) override final { 1630 if ( inCache( old ) ) return; 1603 1631 this->node = new ast::AsmStmt( 1604 1632 old->location, … … 1611 1639 GET_LABELS_V(old->labels) 1612 1640 ); 1641 cache.emplace( old, this->node ); 1613 1642 } 1614 1643 1615 1644 virtual void visit( DirectiveStmt * old ) override final { 1645 if ( inCache( old ) ) return; 1616 1646 this->node = new ast::DirectiveStmt( 1617 1647 old->location, … … 1619 1649 GET_LABELS_V(old->labels) 1620 1650 ); 1651 cache.emplace( old, this->node ); 1621 1652 } 1622 1653 1623 1654 virtual void visit( IfStmt * old ) override final { 1655 if ( inCache( old ) ) return; 1624 1656 this->node = new ast::IfStmt( 1625 1657 old->location, … … 1630 1662 GET_LABELS_V(old->labels) 1631 1663 ); 1664 cache.emplace( old, this->node ); 1632 1665 } 1633 1666 1634 1667 virtual void visit( SwitchStmt * old ) override final { 1668 if ( inCache( old ) ) return; 1635 1669 this->node = new ast::SwitchStmt( 1636 1670 old->location, … … 1639 1673 GET_LABELS_V(old->labels) 1640 1674 ); 1675 cache.emplace( old, this->node ); 1641 1676 } 1642 1677 1643 1678 virtual void visit( CaseStmt * old ) override final { 1679 if ( inCache( old ) ) return; 1644 1680 this->node = new ast::CaseStmt( 1645 1681 old->location, … … 1648 1684 GET_LABELS_V(old->labels) 1649 1685 ); 1686 cache.emplace( old, this->node ); 1650 1687 } 1651 1688 1652 1689 virtual void visit( WhileStmt * old ) override final { 1690 if ( inCache( old ) ) return; 1653 1691 this->node = new ast::WhileStmt( 1654 1692 old->location, … … 1659 1697 GET_LABELS_V(old->labels) 1660 1698 ); 1699 cache.emplace( old, this->node ); 1661 1700 } 1662 1701 1663 1702 virtual void visit( ForStmt * old ) override final { 1703 if ( inCache( old ) ) return; 1664 1704 this->node = new ast::ForStmt( 1665 1705 old->location, … … 1670 1710 GET_LABELS_V(old->labels) 1671 1711 ); 1712 cache.emplace( old, this->node ); 1672 1713 } 1673 1714 1674 1715 virtual void visit( BranchStmt * old ) override final { 1716 if ( inCache( old ) ) return; 1675 1717 if (old->computedTarget) { 1676 1718 this->node = new ast::BranchStmt( … … 1706 1748 this->node = stmt; 1707 1749 } 1750 cache.emplace( old, this->node ); 1708 1751 } 1709 1752 1710 1753 virtual void visit( ReturnStmt * old ) override final { 1754 if ( inCache( old ) ) return; 1711 1755 this->node = new ast::ReturnStmt( 1712 1756 old->location, … … 1714 1758 GET_LABELS_V(old->labels) 1715 1759 ); 1760 cache.emplace( old, this->node ); 1716 1761 } 1717 1762 1718 1763 virtual void visit( ThrowStmt * old ) override final { 1764 if ( inCache( old ) ) return; 1719 1765 ast::ThrowStmt::Kind kind; 1720 1766 switch (old->kind) { … … 1736 1782 GET_LABELS_V(old->labels) 1737 1783 ); 1784 cache.emplace( old, this->node ); 1738 1785 } 1739 1786 1740 1787 virtual void visit( TryStmt * old ) override final { 1788 if ( inCache( old ) ) return; 1741 1789 this->node = new ast::TryStmt( 1742 1790 old->location, … … 1746 1794 GET_LABELS_V(old->labels) 1747 1795 ); 1796 cache.emplace( old, this->node ); 1748 1797 } 1749 1798 1750 1799 virtual void visit( CatchStmt * old ) override final { 1800 if ( inCache( old ) ) return; 1751 1801 ast::CatchStmt::Kind kind; 1752 1802 switch (old->kind) { … … 1769 1819 GET_LABELS_V(old->labels) 1770 1820 ); 1821 cache.emplace( old, this->node ); 1771 1822 } 1772 1823 1773 1824 virtual void visit( FinallyStmt * old ) override final { 1825 if ( inCache( old ) ) return; 1774 1826 this->node = new ast::FinallyStmt( 1775 1827 old->location, … … 1777 1829 GET_LABELS_V(old->labels) 1778 1830 ); 1831 cache.emplace( old, this->node ); 1779 1832 } 1780 1833 1781 1834 virtual void visit( WaitForStmt * old ) override final { 1835 if ( inCache( old ) ) return; 1782 1836 ast::WaitForStmt * stmt = new ast::WaitForStmt( 1783 1837 old->location, … … 1807 1861 1808 1862 this->node = stmt; 1863 cache.emplace( old, this->node ); 1809 1864 } 1810 1865 1811 1866 virtual void visit( WithStmt * old ) override final { 1867 if ( inCache( old ) ) return; 1812 1868 this->node = new ast::WithStmt( 1813 1869 old->location, … … 1816 1872 GET_LABELS_V(old->labels) 1817 1873 ); 1874 cache.emplace( old, this->node ); 1818 1875 } 1819 1876 1820 1877 virtual void visit( NullStmt * old ) override final { 1878 if ( inCache( old ) ) return; 1821 1879 this->node = new ast::NullStmt( 1822 1880 old->location, 1823 1881 GET_LABELS_V(old->labels) 1824 1882 ); 1883 cache.emplace( old, this->node ); 1825 1884 } 1826 1885 1827 1886 virtual void visit( DeclStmt * old ) override final { 1887 if ( inCache( old ) ) return; 1828 1888 this->node = new ast::DeclStmt( 1829 1889 old->location, … … 1831 1891 GET_LABELS_V(old->labels) 1832 1892 ); 1893 cache.emplace( old, this->node ); 1833 1894 } 1834 1895 1835 1896 virtual void visit( ImplicitCtorDtorStmt * old ) override final { 1897 if ( inCache( old ) ) return; 1836 1898 this->node = new ast::ImplicitCtorDtorStmt( 1837 1899 old->location, … … 1839 1901 GET_LABELS_V(old->labels) 1840 1902 ); 1903 cache.emplace( old, this->node ); 1841 1904 } 1842 1905
Note:
See TracChangeset
for help on using the changeset viewer.