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