1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977
|
//===-- GoAST.h -------------------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// DO NOT EDIT.
// Generated by gen_go_ast.py
#ifndef liblldb_GoAST_h
#define liblldb_GoAST_h
#include "Plugins/ExpressionParser/Go/GoLexer.h"
#include "lldb/lldb-forward.h"
#include "lldb/lldb-private.h"
#include "llvm/Support/Casting.h"
namespace lldb_private {
class GoASTNode {
public:
typedef GoLexer::TokenType TokenType;
typedef GoLexer::Token Token;
enum ChanDir {
eChanBidir,
eChanSend,
eChanRecv,
};
enum NodeKind {
eBadDecl,
eFuncDecl,
eGenDecl,
eArrayType,
eBadExpr,
eBasicLit,
eBinaryExpr,
eIdent,
eCallExpr,
eChanType,
eCompositeLit,
eEllipsis,
eFuncType,
eFuncLit,
eIndexExpr,
eInterfaceType,
eKeyValueExpr,
eMapType,
eParenExpr,
eSelectorExpr,
eSliceExpr,
eStarExpr,
eStructType,
eTypeAssertExpr,
eUnaryExpr,
eImportSpec,
eTypeSpec,
eValueSpec,
eAssignStmt,
eBadStmt,
eBlockStmt,
eBranchStmt,
eCaseClause,
eCommClause,
eDeclStmt,
eDeferStmt,
eEmptyStmt,
eExprStmt,
eForStmt,
eGoStmt,
eIfStmt,
eIncDecStmt,
eLabeledStmt,
eRangeStmt,
eReturnStmt,
eSelectStmt,
eSendStmt,
eSwitchStmt,
eTypeSwitchStmt,
eField,
eFieldList,
};
virtual ~GoASTNode() = default;
NodeKind GetKind() const { return m_kind; }
virtual const char *GetKindName() const = 0;
template <typename V> void WalkChildren(V &v);
protected:
explicit GoASTNode(NodeKind kind) : m_kind(kind) {}
private:
const NodeKind m_kind;
GoASTNode(const GoASTNode &) = delete;
const GoASTNode &operator=(const GoASTNode &) = delete;
};
class GoASTDecl : public GoASTNode {
public:
template <typename R, typename V> R Visit(V *v) const;
static bool classof(const GoASTNode *n) {
return n->GetKind() >= eBadDecl && n->GetKind() <= eGenDecl;
}
protected:
explicit GoASTDecl(NodeKind kind) : GoASTNode(kind) {}
private:
GoASTDecl(const GoASTDecl &) = delete;
const GoASTDecl &operator=(const GoASTDecl &) = delete;
};
class GoASTExpr : public GoASTNode {
public:
template <typename R, typename V> R Visit(V *v) const;
static bool classof(const GoASTNode *n) {
return n->GetKind() >= eArrayType && n->GetKind() <= eUnaryExpr;
}
protected:
explicit GoASTExpr(NodeKind kind) : GoASTNode(kind) {}
private:
GoASTExpr(const GoASTExpr &) = delete;
const GoASTExpr &operator=(const GoASTExpr &) = delete;
};
class GoASTSpec : public GoASTNode {
public:
template <typename R, typename V> R Visit(V *v) const;
static bool classof(const GoASTNode *n) {
return n->GetKind() >= eImportSpec && n->GetKind() <= eValueSpec;
}
protected:
explicit GoASTSpec(NodeKind kind) : GoASTNode(kind) {}
private:
GoASTSpec(const GoASTSpec &) = delete;
const GoASTSpec &operator=(const GoASTSpec &) = delete;
};
class GoASTStmt : public GoASTNode {
public:
template <typename R, typename V> R Visit(V *v) const;
static bool classof(const GoASTNode *n) {
return n->GetKind() >= eAssignStmt && n->GetKind() <= eTypeSwitchStmt;
}
protected:
explicit GoASTStmt(NodeKind kind) : GoASTNode(kind) {}
private:
GoASTStmt(const GoASTStmt &) = delete;
const GoASTStmt &operator=(const GoASTStmt &) = delete;
};
class GoASTArrayType : public GoASTExpr {
public:
GoASTArrayType(GoASTExpr *len, GoASTExpr *elt)
: GoASTExpr(eArrayType), m_len_up(len), m_elt_up(elt) {}
~GoASTArrayType() override = default;
const char *GetKindName() const override { return "ArrayType"; }
static bool classof(const GoASTNode *n) { return n->GetKind() == eArrayType; }
const GoASTExpr *GetLen() const { return m_len_up.get(); }
void SetLen(GoASTExpr *len) { m_len_up.reset(len); }
const GoASTExpr *GetElt() const { return m_elt_up.get(); }
void SetElt(GoASTExpr *elt) { m_elt_up.reset(elt); }
private:
friend class GoASTNode;
std::unique_ptr<GoASTExpr> m_len_up;
std::unique_ptr<GoASTExpr> m_elt_up;
GoASTArrayType(const GoASTArrayType &) = delete;
const GoASTArrayType &operator=(const GoASTArrayType &) = delete;
};
class GoASTAssignStmt : public GoASTStmt {
public:
explicit GoASTAssignStmt(bool define)
: GoASTStmt(eAssignStmt), m_define(define) {}
~GoASTAssignStmt() override = default;
const char *GetKindName() const override { return "AssignStmt"; }
static bool classof(const GoASTNode *n) {
return n->GetKind() == eAssignStmt;
}
size_t NumLhs() const { return m_lhs.size(); }
const GoASTExpr *GetLhs(int i) const { return m_lhs[i].get(); }
void AddLhs(GoASTExpr *lhs) {
m_lhs.push_back(std::unique_ptr<GoASTExpr>(lhs));
}
size_t NumRhs() const { return m_rhs.size(); }
const GoASTExpr *GetRhs(int i) const { return m_rhs[i].get(); }
void AddRhs(GoASTExpr *rhs) {
m_rhs.push_back(std::unique_ptr<GoASTExpr>(rhs));
}
bool GetDefine() const { return m_define; }
void SetDefine(bool define) { m_define = define; }
private:
friend class GoASTNode;
std::vector<std::unique_ptr<GoASTExpr>> m_lhs;
std::vector<std::unique_ptr<GoASTExpr>> m_rhs;
bool m_define;
GoASTAssignStmt(const GoASTAssignStmt &) = delete;
const GoASTAssignStmt &operator=(const GoASTAssignStmt &) = delete;
};
class GoASTBadDecl : public GoASTDecl {
public:
GoASTBadDecl() : GoASTDecl(eBadDecl) {}
~GoASTBadDecl() override = default;
const char *GetKindName() const override { return "BadDecl"; }
static bool classof(const GoASTNode *n) { return n->GetKind() == eBadDecl; }
GoASTBadDecl(const GoASTBadDecl &) = delete;
const GoASTBadDecl &operator=(const GoASTBadDecl &) = delete;
};
class GoASTBadExpr : public GoASTExpr {
public:
GoASTBadExpr() : GoASTExpr(eBadExpr) {}
~GoASTBadExpr() override = default;
const char *GetKindName() const override { return "BadExpr"; }
static bool classof(const GoASTNode *n) { return n->GetKind() == eBadExpr; }
GoASTBadExpr(const GoASTBadExpr &) = delete;
const GoASTBadExpr &operator=(const GoASTBadExpr &) = delete;
};
class GoASTBadStmt : public GoASTStmt {
public:
GoASTBadStmt() : GoASTStmt(eBadStmt) {}
~GoASTBadStmt() override = default;
const char *GetKindName() const override { return "BadStmt"; }
static bool classof(const GoASTNode *n) { return n->GetKind() == eBadStmt; }
GoASTBadStmt(const GoASTBadStmt &) = delete;
const GoASTBadStmt &operator=(const GoASTBadStmt &) = delete;
};
class GoASTBasicLit : public GoASTExpr {
public:
explicit GoASTBasicLit(Token value) : GoASTExpr(eBasicLit), m_value(value) {}
~GoASTBasicLit() override = default;
const char *GetKindName() const override { return "BasicLit"; }
static bool classof(const GoASTNode *n) { return n->GetKind() == eBasicLit; }
Token GetValue() const { return m_value; }
void SetValue(Token value) { m_value = value; }
private:
friend class GoASTNode;
Token m_value;
GoASTBasicLit(const GoASTBasicLit &) = delete;
const GoASTBasicLit &operator=(const GoASTBasicLit &) = delete;
};
class GoASTBinaryExpr : public GoASTExpr {
public:
GoASTBinaryExpr(GoASTExpr *x, GoASTExpr *y, TokenType op)
: GoASTExpr(eBinaryExpr), m_x_up(x), m_y_up(y), m_op(op) {}
~GoASTBinaryExpr() override = default;
const char *GetKindName() const override { return "BinaryExpr"; }
static bool classof(const GoASTNode *n) {
return n->GetKind() == eBinaryExpr;
}
const GoASTExpr *GetX() const { return m_x_up.get(); }
void SetX(GoASTExpr *x) { m_x_up.reset(x); }
const GoASTExpr *GetY() const { return m_y_up.get(); }
void SetY(GoASTExpr *y) { m_y_up.reset(y); }
TokenType GetOp() const { return m_op; }
void SetOp(TokenType op) { m_op = op; }
private:
friend class GoASTNode;
std::unique_ptr<GoASTExpr> m_x_up;
std::unique_ptr<GoASTExpr> m_y_up;
TokenType m_op;
GoASTBinaryExpr(const GoASTBinaryExpr &) = delete;
const GoASTBinaryExpr &operator=(const GoASTBinaryExpr &) = delete;
};
class GoASTBlockStmt : public GoASTStmt {
public:
GoASTBlockStmt() : GoASTStmt(eBlockStmt) {}
~GoASTBlockStmt() override = default;
const char *GetKindName() const override { return "BlockStmt"; }
static bool classof(const GoASTNode *n) { return n->GetKind() == eBlockStmt; }
size_t NumList() const { return m_list.size(); }
const GoASTStmt *GetList(int i) const { return m_list[i].get(); }
void AddList(GoASTStmt *list) {
m_list.push_back(std::unique_ptr<GoASTStmt>(list));
}
private:
friend class GoASTNode;
std::vector<std::unique_ptr<GoASTStmt>> m_list;
GoASTBlockStmt(const GoASTBlockStmt &) = delete;
const GoASTBlockStmt &operator=(const GoASTBlockStmt &) = delete;
};
class GoASTIdent : public GoASTExpr {
public:
explicit GoASTIdent(Token name) : GoASTExpr(eIdent), m_name(name) {}
~GoASTIdent() override = default;
const char *GetKindName() const override { return "Ident"; }
static bool classof(const GoASTNode *n) { return n->GetKind() == eIdent; }
Token GetName() const { return m_name; }
void SetName(Token name) { m_name = name; }
private:
friend class GoASTNode;
Token m_name;
GoASTIdent(const GoASTIdent &) = delete;
const GoASTIdent &operator=(const GoASTIdent &) = delete;
};
class GoASTBranchStmt : public GoASTStmt {
public:
GoASTBranchStmt(GoASTIdent *label, TokenType tok)
: GoASTStmt(eBranchStmt), m_label_up(label), m_tok(tok) {}
~GoASTBranchStmt() override = default;
const char *GetKindName() const override { return "BranchStmt"; }
static bool classof(const GoASTNode *n) {
return n->GetKind() == eBranchStmt;
}
const GoASTIdent *GetLabel() const { return m_label_up.get(); }
void SetLabel(GoASTIdent *label) { m_label_up.reset(label); }
TokenType GetTok() const { return m_tok; }
void SetTok(TokenType tok) { m_tok = tok; }
private:
friend class GoASTNode;
std::unique_ptr<GoASTIdent> m_label_up;
TokenType m_tok;
GoASTBranchStmt(const GoASTBranchStmt &) = delete;
const GoASTBranchStmt &operator=(const GoASTBranchStmt &) = delete;
};
class GoASTCallExpr : public GoASTExpr {
public:
explicit GoASTCallExpr(bool ellipsis)
: GoASTExpr(eCallExpr), m_ellipsis(ellipsis) {}
~GoASTCallExpr() override = default;
const char *GetKindName() const override { return "CallExpr"; }
static bool classof(const GoASTNode *n) { return n->GetKind() == eCallExpr; }
const GoASTExpr *GetFun() const { return m_fun_up.get(); }
void SetFun(GoASTExpr *fun) { m_fun_up.reset(fun); }
size_t NumArgs() const { return m_args.size(); }
const GoASTExpr *GetArgs(int i) const { return m_args[i].get(); }
void AddArgs(GoASTExpr *args) {
m_args.push_back(std::unique_ptr<GoASTExpr>(args));
}
bool GetEllipsis() const { return m_ellipsis; }
void SetEllipsis(bool ellipsis) { m_ellipsis = ellipsis; }
private:
friend class GoASTNode;
std::unique_ptr<GoASTExpr> m_fun_up;
std::vector<std::unique_ptr<GoASTExpr>> m_args;
bool m_ellipsis;
GoASTCallExpr(const GoASTCallExpr &) = delete;
const GoASTCallExpr &operator=(const GoASTCallExpr &) = delete;
};
class GoASTCaseClause : public GoASTStmt {
public:
GoASTCaseClause() : GoASTStmt(eCaseClause) {}
~GoASTCaseClause() override = default;
const char *GetKindName() const override { return "CaseClause"; }
static bool classof(const GoASTNode *n) {
return n->GetKind() == eCaseClause;
}
size_t NumList() const { return m_list.size(); }
const GoASTExpr *GetList(int i) const { return m_list[i].get(); }
void AddList(GoASTExpr *list) {
m_list.push_back(std::unique_ptr<GoASTExpr>(list));
}
size_t NumBody() const { return m_body.size(); }
const GoASTStmt *GetBody(int i) const { return m_body[i].get(); }
void AddBody(GoASTStmt *body) {
m_body.push_back(std::unique_ptr<GoASTStmt>(body));
}
private:
friend class GoASTNode;
std::vector<std::unique_ptr<GoASTExpr>> m_list;
std::vector<std::unique_ptr<GoASTStmt>> m_body;
GoASTCaseClause(const GoASTCaseClause &) = delete;
const GoASTCaseClause &operator=(const GoASTCaseClause &) = delete;
};
class GoASTChanType : public GoASTExpr {
public:
GoASTChanType(ChanDir dir, GoASTExpr *value)
: GoASTExpr(eChanType), m_dir(dir), m_value_up(value) {}
~GoASTChanType() override = default;
const char *GetKindName() const override { return "ChanType"; }
static bool classof(const GoASTNode *n) { return n->GetKind() == eChanType; }
ChanDir GetDir() const { return m_dir; }
void SetDir(ChanDir dir) { m_dir = dir; }
const GoASTExpr *GetValue() const { return m_value_up.get(); }
void SetValue(GoASTExpr *value) { m_value_up.reset(value); }
private:
friend class GoASTNode;
ChanDir m_dir;
std::unique_ptr<GoASTExpr> m_value_up;
GoASTChanType(const GoASTChanType &) = delete;
const GoASTChanType &operator=(const GoASTChanType &) = delete;
};
class GoASTCommClause : public GoASTStmt {
public:
GoASTCommClause() : GoASTStmt(eCommClause) {}
~GoASTCommClause() override = default;
const char *GetKindName() const override { return "CommClause"; }
static bool classof(const GoASTNode *n) {
return n->GetKind() == eCommClause;
}
const GoASTStmt *GetComm() const { return m_comm_up.get(); }
void SetComm(GoASTStmt *comm) { m_comm_up.reset(comm); }
size_t NumBody() const { return m_body.size(); }
const GoASTStmt *GetBody(int i) const { return m_body[i].get(); }
void AddBody(GoASTStmt *body) {
m_body.push_back(std::unique_ptr<GoASTStmt>(body));
}
private:
friend class GoASTNode;
std::unique_ptr<GoASTStmt> m_comm_up;
std::vector<std::unique_ptr<GoASTStmt>> m_body;
GoASTCommClause(const GoASTCommClause &) = delete;
const GoASTCommClause &operator=(const GoASTCommClause &) = delete;
};
class GoASTCompositeLit : public GoASTExpr {
public:
GoASTCompositeLit() : GoASTExpr(eCompositeLit) {}
~GoASTCompositeLit() override = default;
const char *GetKindName() const override { return "CompositeLit"; }
static bool classof(const GoASTNode *n) {
return n->GetKind() == eCompositeLit;
}
const GoASTExpr *GetType() const { return m_type_up.get(); }
void SetType(GoASTExpr *type) { m_type_up.reset(type); }
size_t NumElts() const { return m_elts.size(); }
const GoASTExpr *GetElts(int i) const { return m_elts[i].get(); }
void AddElts(GoASTExpr *elts) {
m_elts.push_back(std::unique_ptr<GoASTExpr>(elts));
}
private:
friend class GoASTNode;
std::unique_ptr<GoASTExpr> m_type_up;
std::vector<std::unique_ptr<GoASTExpr>> m_elts;
GoASTCompositeLit(const GoASTCompositeLit &) = delete;
const GoASTCompositeLit &operator=(const GoASTCompositeLit &) = delete;
};
class GoASTDeclStmt : public GoASTStmt {
public:
explicit GoASTDeclStmt(GoASTDecl *decl)
: GoASTStmt(eDeclStmt), m_decl_up(decl) {}
~GoASTDeclStmt() override = default;
const char *GetKindName() const override { return "DeclStmt"; }
static bool classof(const GoASTNode *n) { return n->GetKind() == eDeclStmt; }
const GoASTDecl *GetDecl() const { return m_decl_up.get(); }
void SetDecl(GoASTDecl *decl) { m_decl_up.reset(decl); }
private:
friend class GoASTNode;
std::unique_ptr<GoASTDecl> m_decl_up;
GoASTDeclStmt(const GoASTDeclStmt &) = delete;
const GoASTDeclStmt &operator=(const GoASTDeclStmt &) = delete;
};
class GoASTDeferStmt : public GoASTStmt {
public:
explicit GoASTDeferStmt(GoASTCallExpr *call)
: GoASTStmt(eDeferStmt), m_call_up(call) {}
~GoASTDeferStmt() override = default;
const char *GetKindName() const override { return "DeferStmt"; }
static bool classof(const GoASTNode *n) { return n->GetKind() == eDeferStmt; }
const GoASTCallExpr *GetCall() const { return m_call_up.get(); }
void SetCall(GoASTCallExpr *call) { m_call_up.reset(call); }
private:
friend class GoASTNode;
std::unique_ptr<GoASTCallExpr> m_call_up;
GoASTDeferStmt(const GoASTDeferStmt &) = delete;
const GoASTDeferStmt &operator=(const GoASTDeferStmt &) = delete;
};
class GoASTEllipsis : public GoASTExpr {
public:
explicit GoASTEllipsis(GoASTExpr *elt)
: GoASTExpr(eEllipsis), m_elt_up(elt) {}
~GoASTEllipsis() override = default;
const char *GetKindName() const override { return "Ellipsis"; }
static bool classof(const GoASTNode *n) { return n->GetKind() == eEllipsis; }
const GoASTExpr *GetElt() const { return m_elt_up.get(); }
void SetElt(GoASTExpr *elt) { m_elt_up.reset(elt); }
private:
friend class GoASTNode;
std::unique_ptr<GoASTExpr> m_elt_up;
GoASTEllipsis(const GoASTEllipsis &) = delete;
const GoASTEllipsis &operator=(const GoASTEllipsis &) = delete;
};
class GoASTEmptyStmt : public GoASTStmt {
public:
GoASTEmptyStmt() : GoASTStmt(eEmptyStmt) {}
~GoASTEmptyStmt() override = default;
const char *GetKindName() const override { return "EmptyStmt"; }
static bool classof(const GoASTNode *n) { return n->GetKind() == eEmptyStmt; }
GoASTEmptyStmt(const GoASTEmptyStmt &) = delete;
const GoASTEmptyStmt &operator=(const GoASTEmptyStmt &) = delete;
};
class GoASTExprStmt : public GoASTStmt {
public:
explicit GoASTExprStmt(GoASTExpr *x) : GoASTStmt(eExprStmt), m_x_up(x) {}
~GoASTExprStmt() override = default;
const char *GetKindName() const override { return "ExprStmt"; }
static bool classof(const GoASTNode *n) { return n->GetKind() == eExprStmt; }
const GoASTExpr *GetX() const { return m_x_up.get(); }
void SetX(GoASTExpr *x) { m_x_up.reset(x); }
private:
friend class GoASTNode;
std::unique_ptr<GoASTExpr> m_x_up;
GoASTExprStmt(const GoASTExprStmt &) = delete;
const GoASTExprStmt &operator=(const GoASTExprStmt &) = delete;
};
class GoASTField : public GoASTNode {
public:
GoASTField() : GoASTNode(eField) {}
~GoASTField() override = default;
const char *GetKindName() const override { return "Field"; }
static bool classof(const GoASTNode *n) { return n->GetKind() == eField; }
size_t NumNames() const { return m_names.size(); }
const GoASTIdent *GetNames(int i) const { return m_names[i].get(); }
void AddNames(GoASTIdent *names) {
m_names.push_back(std::unique_ptr<GoASTIdent>(names));
}
const GoASTExpr *GetType() const { return m_type_up.get(); }
void SetType(GoASTExpr *type) { m_type_up.reset(type); }
const GoASTBasicLit *GetTag() const { return m_tag_up.get(); }
void SetTag(GoASTBasicLit *tag) { m_tag_up.reset(tag); }
private:
friend class GoASTNode;
std::vector<std::unique_ptr<GoASTIdent>> m_names;
std::unique_ptr<GoASTExpr> m_type_up;
std::unique_ptr<GoASTBasicLit> m_tag_up;
GoASTField(const GoASTField &) = delete;
const GoASTField &operator=(const GoASTField &) = delete;
};
class GoASTFieldList : public GoASTNode {
public:
GoASTFieldList() : GoASTNode(eFieldList) {}
~GoASTFieldList() override = default;
const char *GetKindName() const override { return "FieldList"; }
static bool classof(const GoASTNode *n) { return n->GetKind() == eFieldList; }
size_t NumList() const { return m_list.size(); }
const GoASTField *GetList(int i) const { return m_list[i].get(); }
void AddList(GoASTField *list) {
m_list.push_back(std::unique_ptr<GoASTField>(list));
}
private:
friend class GoASTNode;
std::vector<std::unique_ptr<GoASTField>> m_list;
GoASTFieldList(const GoASTFieldList &) = delete;
const GoASTFieldList &operator=(const GoASTFieldList &) = delete;
};
class GoASTForStmt : public GoASTStmt {
public:
GoASTForStmt(GoASTStmt *init, GoASTExpr *cond, GoASTStmt *post,
GoASTBlockStmt *body)
: GoASTStmt(eForStmt), m_init_up(init), m_cond_up(cond), m_post_up(post),
m_body_up(body) {}
~GoASTForStmt() override = default;
const char *GetKindName() const override { return "ForStmt"; }
static bool classof(const GoASTNode *n) { return n->GetKind() == eForStmt; }
const GoASTStmt *GetInit() const { return m_init_up.get(); }
void SetInit(GoASTStmt *init) { m_init_up.reset(init); }
const GoASTExpr *GetCond() const { return m_cond_up.get(); }
void SetCond(GoASTExpr *cond) { m_cond_up.reset(cond); }
const GoASTStmt *GetPost() const { return m_post_up.get(); }
void SetPost(GoASTStmt *post) { m_post_up.reset(post); }
const GoASTBlockStmt *GetBody() const { return m_body_up.get(); }
void SetBody(GoASTBlockStmt *body) { m_body_up.reset(body); }
private:
friend class GoASTNode;
std::unique_ptr<GoASTStmt> m_init_up;
std::unique_ptr<GoASTExpr> m_cond_up;
std::unique_ptr<GoASTStmt> m_post_up;
std::unique_ptr<GoASTBlockStmt> m_body_up;
GoASTForStmt(const GoASTForStmt &) = delete;
const GoASTForStmt &operator=(const GoASTForStmt &) = delete;
};
class GoASTFuncType : public GoASTExpr {
public:
GoASTFuncType(GoASTFieldList *params, GoASTFieldList *results)
: GoASTExpr(eFuncType), m_params_up(params), m_results_up(results) {}
~GoASTFuncType() override = default;
const char *GetKindName() const override { return "FuncType"; }
static bool classof(const GoASTNode *n) { return n->GetKind() == eFuncType; }
const GoASTFieldList *GetParams() const { return m_params_up.get(); }
void SetParams(GoASTFieldList *params) { m_params_up.reset(params); }
const GoASTFieldList *GetResults() const { return m_results_up.get(); }
void SetResults(GoASTFieldList *results) { m_results_up.reset(results); }
private:
friend class GoASTNode;
std::unique_ptr<GoASTFieldList> m_params_up;
std::unique_ptr<GoASTFieldList> m_results_up;
GoASTFuncType(const GoASTFuncType &) = delete;
const GoASTFuncType &operator=(const GoASTFuncType &) = delete;
};
class GoASTFuncDecl : public GoASTDecl {
public:
GoASTFuncDecl(GoASTFieldList *recv, GoASTIdent *name, GoASTFuncType *type,
GoASTBlockStmt *body)
: GoASTDecl(eFuncDecl), m_recv_up(recv), m_name_up(name), m_type_up(type),
m_body_up(body) {}
~GoASTFuncDecl() override = default;
const char *GetKindName() const override { return "FuncDecl"; }
static bool classof(const GoASTNode *n) { return n->GetKind() == eFuncDecl; }
const GoASTFieldList *GetRecv() const { return m_recv_up.get(); }
void SetRecv(GoASTFieldList *recv) { m_recv_up.reset(recv); }
const GoASTIdent *GetName() const { return m_name_up.get(); }
void SetName(GoASTIdent *name) { m_name_up.reset(name); }
const GoASTFuncType *GetType() const { return m_type_up.get(); }
void SetType(GoASTFuncType *type) { m_type_up.reset(type); }
const GoASTBlockStmt *GetBody() const { return m_body_up.get(); }
void SetBody(GoASTBlockStmt *body) { m_body_up.reset(body); }
private:
friend class GoASTNode;
std::unique_ptr<GoASTFieldList> m_recv_up;
std::unique_ptr<GoASTIdent> m_name_up;
std::unique_ptr<GoASTFuncType> m_type_up;
std::unique_ptr<GoASTBlockStmt> m_body_up;
GoASTFuncDecl(const GoASTFuncDecl &) = delete;
const GoASTFuncDecl &operator=(const GoASTFuncDecl &) = delete;
};
class GoASTFuncLit : public GoASTExpr {
public:
GoASTFuncLit(GoASTFuncType *type, GoASTBlockStmt *body)
: GoASTExpr(eFuncLit), m_type_up(type), m_body_up(body) {}
~GoASTFuncLit() override = default;
const char *GetKindName() const override { return "FuncLit"; }
static bool classof(const GoASTNode *n) { return n->GetKind() == eFuncLit; }
const GoASTFuncType *GetType() const { return m_type_up.get(); }
void SetType(GoASTFuncType *type) { m_type_up.reset(type); }
const GoASTBlockStmt *GetBody() const { return m_body_up.get(); }
void SetBody(GoASTBlockStmt *body) { m_body_up.reset(body); }
private:
friend class GoASTNode;
std::unique_ptr<GoASTFuncType> m_type_up;
std::unique_ptr<GoASTBlockStmt> m_body_up;
GoASTFuncLit(const GoASTFuncLit &) = delete;
const GoASTFuncLit &operator=(const GoASTFuncLit &) = delete;
};
class GoASTGenDecl : public GoASTDecl {
public:
explicit GoASTGenDecl(TokenType tok) : GoASTDecl(eGenDecl), m_tok(tok) {}
~GoASTGenDecl() override = default;
const char *GetKindName() const override { return "GenDecl"; }
static bool classof(const GoASTNode *n) { return n->GetKind() == eGenDecl; }
TokenType GetTok() const { return m_tok; }
void SetTok(TokenType tok) { m_tok = tok; }
size_t NumSpecs() const { return m_specs.size(); }
const GoASTSpec *GetSpecs(int i) const { return m_specs[i].get(); }
void AddSpecs(GoASTSpec *specs) {
m_specs.push_back(std::unique_ptr<GoASTSpec>(specs));
}
private:
friend class GoASTNode;
TokenType m_tok;
std::vector<std::unique_ptr<GoASTSpec>> m_specs;
GoASTGenDecl(const GoASTGenDecl &) = delete;
const GoASTGenDecl &operator=(const GoASTGenDecl &) = delete;
};
class GoASTGoStmt : public GoASTStmt {
public:
explicit GoASTGoStmt(GoASTCallExpr *call)
: GoASTStmt(eGoStmt), m_call_up(call) {}
~GoASTGoStmt() override = default;
const char *GetKindName() const override { return "GoStmt"; }
static bool classof(const GoASTNode *n) { return n->GetKind() == eGoStmt; }
const GoASTCallExpr *GetCall() const { return m_call_up.get(); }
void SetCall(GoASTCallExpr *call) { m_call_up.reset(call); }
private:
friend class GoASTNode;
std::unique_ptr<GoASTCallExpr> m_call_up;
GoASTGoStmt(const GoASTGoStmt &) = delete;
const GoASTGoStmt &operator=(const GoASTGoStmt &) = delete;
};
class GoASTIfStmt : public GoASTStmt {
public:
GoASTIfStmt(GoASTStmt *init, GoASTExpr *cond, GoASTBlockStmt *body,
GoASTStmt *els)
: GoASTStmt(eIfStmt), m_init_up(init), m_cond_up(cond), m_body_up(body),
m_els_up(els) {}
~GoASTIfStmt() override = default;
const char *GetKindName() const override { return "IfStmt"; }
static bool classof(const GoASTNode *n) { return n->GetKind() == eIfStmt; }
const GoASTStmt *GetInit() const { return m_init_up.get(); }
void SetInit(GoASTStmt *init) { m_init_up.reset(init); }
const GoASTExpr *GetCond() const { return m_cond_up.get(); }
void SetCond(GoASTExpr *cond) { m_cond_up.reset(cond); }
const GoASTBlockStmt *GetBody() const { return m_body_up.get(); }
void SetBody(GoASTBlockStmt *body) { m_body_up.reset(body); }
const GoASTStmt *GetEls() const { return m_els_up.get(); }
void SetEls(GoASTStmt *els) { m_els_up.reset(els); }
private:
friend class GoASTNode;
std::unique_ptr<GoASTStmt> m_init_up;
std::unique_ptr<GoASTExpr> m_cond_up;
std::unique_ptr<GoASTBlockStmt> m_body_up;
std::unique_ptr<GoASTStmt> m_els_up;
GoASTIfStmt(const GoASTIfStmt &) = delete;
const GoASTIfStmt &operator=(const GoASTIfStmt &) = delete;
};
class GoASTImportSpec : public GoASTSpec {
public:
GoASTImportSpec(GoASTIdent *name, GoASTBasicLit *path)
: GoASTSpec(eImportSpec), m_name_up(name), m_path_up(path) {}
~GoASTImportSpec() override = default;
const char *GetKindName() const override { return "ImportSpec"; }
static bool classof(const GoASTNode *n) {
return n->GetKind() == eImportSpec;
}
const GoASTIdent *GetName() const { return m_name_up.get(); }
void SetName(GoASTIdent *name) { m_name_up.reset(name); }
const GoASTBasicLit *GetPath() const { return m_path_up.get(); }
void SetPath(GoASTBasicLit *path) { m_path_up.reset(path); }
private:
friend class GoASTNode;
std::unique_ptr<GoASTIdent> m_name_up;
std::unique_ptr<GoASTBasicLit> m_path_up;
GoASTImportSpec(const GoASTImportSpec &) = delete;
const GoASTImportSpec &operator=(const GoASTImportSpec &) = delete;
};
class GoASTIncDecStmt : public GoASTStmt {
public:
GoASTIncDecStmt(GoASTExpr *x, TokenType tok)
: GoASTStmt(eIncDecStmt), m_x_up(x), m_tok(tok) {}
~GoASTIncDecStmt() override = default;
const char *GetKindName() const override { return "IncDecStmt"; }
static bool classof(const GoASTNode *n) {
return n->GetKind() == eIncDecStmt;
}
const GoASTExpr *GetX() const { return m_x_up.get(); }
void SetX(GoASTExpr *x) { m_x_up.reset(x); }
TokenType GetTok() const { return m_tok; }
void SetTok(TokenType tok) { m_tok = tok; }
private:
friend class GoASTNode;
std::unique_ptr<GoASTExpr> m_x_up;
TokenType m_tok;
GoASTIncDecStmt(const GoASTIncDecStmt &) = delete;
const GoASTIncDecStmt &operator=(const GoASTIncDecStmt &) = delete;
};
class GoASTIndexExpr : public GoASTExpr {
public:
GoASTIndexExpr(GoASTExpr *x, GoASTExpr *index)
: GoASTExpr(eIndexExpr), m_x_up(x), m_index_up(index) {}
~GoASTIndexExpr() override = default;
const char *GetKindName() const override { return "IndexExpr"; }
static bool classof(const GoASTNode *n) { return n->GetKind() == eIndexExpr; }
const GoASTExpr *GetX() const { return m_x_up.get(); }
void SetX(GoASTExpr *x) { m_x_up.reset(x); }
const GoASTExpr *GetIndex() const { return m_index_up.get(); }
void SetIndex(GoASTExpr *index) { m_index_up.reset(index); }
private:
friend class GoASTNode;
std::unique_ptr<GoASTExpr> m_x_up;
std::unique_ptr<GoASTExpr> m_index_up;
GoASTIndexExpr(const GoASTIndexExpr &) = delete;
const GoASTIndexExpr &operator=(const GoASTIndexExpr &) = delete;
};
class GoASTInterfaceType : public GoASTExpr {
public:
explicit GoASTInterfaceType(GoASTFieldList *methods)
: GoASTExpr(eInterfaceType), m_methods_up(methods) {}
~GoASTInterfaceType() override = default;
const char *GetKindName() const override { return "InterfaceType"; }
static bool classof(const GoASTNode *n) {
return n->GetKind() == eInterfaceType;
}
const GoASTFieldList *GetMethods() const { return m_methods_up.get(); }
void SetMethods(GoASTFieldList *methods) { m_methods_up.reset(methods); }
private:
friend class GoASTNode;
std::unique_ptr<GoASTFieldList> m_methods_up;
GoASTInterfaceType(const GoASTInterfaceType &) = delete;
const GoASTInterfaceType &operator=(const GoASTInterfaceType &) = delete;
};
class GoASTKeyValueExpr : public GoASTExpr {
public:
GoASTKeyValueExpr(GoASTExpr *key, GoASTExpr *value)
: GoASTExpr(eKeyValueExpr), m_key_up(key), m_value_up(value) {}
~GoASTKeyValueExpr() override = default;
const char *GetKindName() const override { return "KeyValueExpr"; }
static bool classof(const GoASTNode *n) {
return n->GetKind() == eKeyValueExpr;
}
const GoASTExpr *GetKey() const { return m_key_up.get(); }
void SetKey(GoASTExpr *key) { m_key_up.reset(key); }
const GoASTExpr *GetValue() const { return m_value_up.get(); }
void SetValue(GoASTExpr *value) { m_value_up.reset(value); }
private:
friend class GoASTNode;
std::unique_ptr<GoASTExpr> m_key_up;
std::unique_ptr<GoASTExpr> m_value_up;
GoASTKeyValueExpr(const GoASTKeyValueExpr &) = delete;
const GoASTKeyValueExpr &operator=(const GoASTKeyValueExpr &) = delete;
};
class GoASTLabeledStmt : public GoASTStmt {
public:
GoASTLabeledStmt(GoASTIdent *label, GoASTStmt *stmt)
: GoASTStmt(eLabeledStmt), m_label_up(label), m_stmt_up(stmt) {}
~GoASTLabeledStmt() override = default;
const char *GetKindName() const override { return "LabeledStmt"; }
static bool classof(const GoASTNode *n) {
return n->GetKind() == eLabeledStmt;
}
const GoASTIdent *GetLabel() const { return m_label_up.get(); }
void SetLabel(GoASTIdent *label) { m_label_up.reset(label); }
const GoASTStmt *GetStmt() const { return m_stmt_up.get(); }
void SetStmt(GoASTStmt *stmt) { m_stmt_up.reset(stmt); }
private:
friend class GoASTNode;
std::unique_ptr<GoASTIdent> m_label_up;
std::unique_ptr<GoASTStmt> m_stmt_up;
GoASTLabeledStmt(const GoASTLabeledStmt &) = delete;
const GoASTLabeledStmt &operator=(const GoASTLabeledStmt &) = delete;
};
class GoASTMapType : public GoASTExpr {
public:
GoASTMapType(GoASTExpr *key, GoASTExpr *value)
: GoASTExpr(eMapType), m_key_up(key), m_value_up(value) {}
~GoASTMapType() override = default;
const char *GetKindName() const override { return "MapType"; }
static bool classof(const GoASTNode *n) { return n->GetKind() == eMapType; }
const GoASTExpr *GetKey() const { return m_key_up.get(); }
void SetKey(GoASTExpr *key) { m_key_up.reset(key); }
const GoASTExpr *GetValue() const { return m_value_up.get(); }
void SetValue(GoASTExpr *value) { m_value_up.reset(value); }
private:
friend class GoASTNode;
std::unique_ptr<GoASTExpr> m_key_up;
std::unique_ptr<GoASTExpr> m_value_up;
GoASTMapType(const GoASTMapType &) = delete;
const GoASTMapType &operator=(const GoASTMapType &) = delete;
};
class GoASTParenExpr : public GoASTExpr {
public:
explicit GoASTParenExpr(GoASTExpr *x) : GoASTExpr(eParenExpr), m_x_up(x) {}
~GoASTParenExpr() override = default;
const char *GetKindName() const override { return "ParenExpr"; }
static bool classof(const GoASTNode *n) { return n->GetKind() == eParenExpr; }
const GoASTExpr *GetX() const { return m_x_up.get(); }
void SetX(GoASTExpr *x) { m_x_up.reset(x); }
private:
friend class GoASTNode;
std::unique_ptr<GoASTExpr> m_x_up;
GoASTParenExpr(const GoASTParenExpr &) = delete;
const GoASTParenExpr &operator=(const GoASTParenExpr &) = delete;
};
class GoASTRangeStmt : public GoASTStmt {
public:
GoASTRangeStmt(GoASTExpr *key, GoASTExpr *value, bool define, GoASTExpr *x,
GoASTBlockStmt *body)
: GoASTStmt(eRangeStmt), m_key_up(key), m_value_up(value),
m_define(define), m_x_up(x), m_body_up(body) {}
~GoASTRangeStmt() override = default;
const char *GetKindName() const override { return "RangeStmt"; }
static bool classof(const GoASTNode *n) { return n->GetKind() == eRangeStmt; }
const GoASTExpr *GetKey() const { return m_key_up.get(); }
void SetKey(GoASTExpr *key) { m_key_up.reset(key); }
const GoASTExpr *GetValue() const { return m_value_up.get(); }
void SetValue(GoASTExpr *value) { m_value_up.reset(value); }
bool GetDefine() const { return m_define; }
void SetDefine(bool define) { m_define = define; }
const GoASTExpr *GetX() const { return m_x_up.get(); }
void SetX(GoASTExpr *x) { m_x_up.reset(x); }
const GoASTBlockStmt *GetBody() const { return m_body_up.get(); }
void SetBody(GoASTBlockStmt *body) { m_body_up.reset(body); }
private:
friend class GoASTNode;
std::unique_ptr<GoASTExpr> m_key_up;
std::unique_ptr<GoASTExpr> m_value_up;
bool m_define;
std::unique_ptr<GoASTExpr> m_x_up;
std::unique_ptr<GoASTBlockStmt> m_body_up;
GoASTRangeStmt(const GoASTRangeStmt &) = delete;
const GoASTRangeStmt &operator=(const GoASTRangeStmt &) = delete;
};
class GoASTReturnStmt : public GoASTStmt {
public:
GoASTReturnStmt() : GoASTStmt(eReturnStmt) {}
~GoASTReturnStmt() override = default;
const char *GetKindName() const override { return "ReturnStmt"; }
static bool classof(const GoASTNode *n) {
return n->GetKind() == eReturnStmt;
}
size_t NumResults() const { return m_results.size(); }
const GoASTExpr *GetResults(int i) const { return m_results[i].get(); }
void AddResults(GoASTExpr *results) {
m_results.push_back(std::unique_ptr<GoASTExpr>(results));
}
private:
friend class GoASTNode;
std::vector<std::unique_ptr<GoASTExpr>> m_results;
GoASTReturnStmt(const GoASTReturnStmt &) = delete;
const GoASTReturnStmt &operator=(const GoASTReturnStmt &) = delete;
};
class GoASTSelectStmt : public GoASTStmt {
public:
explicit GoASTSelectStmt(GoASTBlockStmt *body)
: GoASTStmt(eSelectStmt), m_body_up(body) {}
~GoASTSelectStmt() override = default;
const char *GetKindName() const override { return "SelectStmt"; }
static bool classof(const GoASTNode *n) {
return n->GetKind() == eSelectStmt;
}
const GoASTBlockStmt *GetBody() const { return m_body_up.get(); }
void SetBody(GoASTBlockStmt *body) { m_body_up.reset(body); }
private:
friend class GoASTNode;
std::unique_ptr<GoASTBlockStmt> m_body_up;
GoASTSelectStmt(const GoASTSelectStmt &) = delete;
const GoASTSelectStmt &operator=(const GoASTSelectStmt &) = delete;
};
class GoASTSelectorExpr : public GoASTExpr {
public:
GoASTSelectorExpr(GoASTExpr *x, GoASTIdent *sel)
: GoASTExpr(eSelectorExpr), m_x_up(x), m_sel_up(sel) {}
~GoASTSelectorExpr() override = default;
const char *GetKindName() const override { return "SelectorExpr"; }
static bool classof(const GoASTNode *n) {
return n->GetKind() == eSelectorExpr;
}
const GoASTExpr *GetX() const { return m_x_up.get(); }
void SetX(GoASTExpr *x) { m_x_up.reset(x); }
const GoASTIdent *GetSel() const { return m_sel_up.get(); }
void SetSel(GoASTIdent *sel) { m_sel_up.reset(sel); }
private:
friend class GoASTNode;
std::unique_ptr<GoASTExpr> m_x_up;
std::unique_ptr<GoASTIdent> m_sel_up;
GoASTSelectorExpr(const GoASTSelectorExpr &) = delete;
const GoASTSelectorExpr &operator=(const GoASTSelectorExpr &) = delete;
};
class GoASTSendStmt : public GoASTStmt {
public:
GoASTSendStmt(GoASTExpr *chan, GoASTExpr *value)
: GoASTStmt(eSendStmt), m_chan_up(chan), m_value_up(value) {}
~GoASTSendStmt() override = default;
const char *GetKindName() const override { return "SendStmt"; }
static bool classof(const GoASTNode *n) { return n->GetKind() == eSendStmt; }
const GoASTExpr *GetChan() const { return m_chan_up.get(); }
void SetChan(GoASTExpr *chan) { m_chan_up.reset(chan); }
const GoASTExpr *GetValue() const { return m_value_up.get(); }
void SetValue(GoASTExpr *value) { m_value_up.reset(value); }
private:
friend class GoASTNode;
std::unique_ptr<GoASTExpr> m_chan_up;
std::unique_ptr<GoASTExpr> m_value_up;
GoASTSendStmt(const GoASTSendStmt &) = delete;
const GoASTSendStmt &operator=(const GoASTSendStmt &) = delete;
};
class GoASTSliceExpr : public GoASTExpr {
public:
GoASTSliceExpr(GoASTExpr *x, GoASTExpr *low, GoASTExpr *high, GoASTExpr *max,
bool slice3)
: GoASTExpr(eSliceExpr), m_x_up(x), m_low_up(low), m_high_up(high),
m_max_up(max), m_slice3(slice3) {}
~GoASTSliceExpr() override = default;
const char *GetKindName() const override { return "SliceExpr"; }
static bool classof(const GoASTNode *n) { return n->GetKind() == eSliceExpr; }
const GoASTExpr *GetX() const { return m_x_up.get(); }
void SetX(GoASTExpr *x) { m_x_up.reset(x); }
const GoASTExpr *GetLow() const { return m_low_up.get(); }
void SetLow(GoASTExpr *low) { m_low_up.reset(low); }
const GoASTExpr *GetHigh() const { return m_high_up.get(); }
void SetHigh(GoASTExpr *high) { m_high_up.reset(high); }
const GoASTExpr *GetMax() const { return m_max_up.get(); }
void SetMax(GoASTExpr *max) { m_max_up.reset(max); }
bool GetSlice3() const { return m_slice3; }
void SetSlice3(bool slice3) { m_slice3 = slice3; }
private:
friend class GoASTNode;
std::unique_ptr<GoASTExpr> m_x_up;
std::unique_ptr<GoASTExpr> m_low_up;
std::unique_ptr<GoASTExpr> m_high_up;
std::unique_ptr<GoASTExpr> m_max_up;
bool m_slice3;
GoASTSliceExpr(const GoASTSliceExpr &) = delete;
const GoASTSliceExpr &operator=(const GoASTSliceExpr &) = delete;
};
class GoASTStarExpr : public GoASTExpr {
public:
explicit GoASTStarExpr(GoASTExpr *x) : GoASTExpr(eStarExpr), m_x_up(x) {}
~GoASTStarExpr() override = default;
const char *GetKindName() const override { return "StarExpr"; }
static bool classof(const GoASTNode *n) { return n->GetKind() == eStarExpr; }
const GoASTExpr *GetX() const { return m_x_up.get(); }
void SetX(GoASTExpr *x) { m_x_up.reset(x); }
private:
friend class GoASTNode;
std::unique_ptr<GoASTExpr> m_x_up;
GoASTStarExpr(const GoASTStarExpr &) = delete;
const GoASTStarExpr &operator=(const GoASTStarExpr &) = delete;
};
class GoASTStructType : public GoASTExpr {
public:
explicit GoASTStructType(GoASTFieldList *fields)
: GoASTExpr(eStructType), m_fields_up(fields) {}
~GoASTStructType() override = default;
const char *GetKindName() const override { return "StructType"; }
static bool classof(const GoASTNode *n) {
return n->GetKind() == eStructType;
}
const GoASTFieldList *GetFields() const { return m_fields_up.get(); }
void SetFields(GoASTFieldList *fields) { m_fields_up.reset(fields); }
private:
friend class GoASTNode;
std::unique_ptr<GoASTFieldList> m_fields_up;
GoASTStructType(const GoASTStructType &) = delete;
const GoASTStructType &operator=(const GoASTStructType &) = delete;
};
class GoASTSwitchStmt : public GoASTStmt {
public:
GoASTSwitchStmt(GoASTStmt *init, GoASTExpr *tag, GoASTBlockStmt *body)
: GoASTStmt(eSwitchStmt), m_init_up(init), m_tag_up(tag),
m_body_up(body) {}
~GoASTSwitchStmt() override = default;
const char *GetKindName() const override { return "SwitchStmt"; }
static bool classof(const GoASTNode *n) {
return n->GetKind() == eSwitchStmt;
}
const GoASTStmt *GetInit() const { return m_init_up.get(); }
void SetInit(GoASTStmt *init) { m_init_up.reset(init); }
const GoASTExpr *GetTag() const { return m_tag_up.get(); }
void SetTag(GoASTExpr *tag) { m_tag_up.reset(tag); }
const GoASTBlockStmt *GetBody() const { return m_body_up.get(); }
void SetBody(GoASTBlockStmt *body) { m_body_up.reset(body); }
private:
friend class GoASTNode;
std::unique_ptr<GoASTStmt> m_init_up;
std::unique_ptr<GoASTExpr> m_tag_up;
std::unique_ptr<GoASTBlockStmt> m_body_up;
GoASTSwitchStmt(const GoASTSwitchStmt &) = delete;
const GoASTSwitchStmt &operator=(const GoASTSwitchStmt &) = delete;
};
class GoASTTypeAssertExpr : public GoASTExpr {
public:
GoASTTypeAssertExpr(GoASTExpr *x, GoASTExpr *type)
: GoASTExpr(eTypeAssertExpr), m_x_up(x), m_type_up(type) {}
~GoASTTypeAssertExpr() override = default;
const char *GetKindName() const override { return "TypeAssertExpr"; }
static bool classof(const GoASTNode *n) {
return n->GetKind() == eTypeAssertExpr;
}
const GoASTExpr *GetX() const { return m_x_up.get(); }
void SetX(GoASTExpr *x) { m_x_up.reset(x); }
const GoASTExpr *GetType() const { return m_type_up.get(); }
void SetType(GoASTExpr *type) { m_type_up.reset(type); }
private:
friend class GoASTNode;
std::unique_ptr<GoASTExpr> m_x_up;
std::unique_ptr<GoASTExpr> m_type_up;
GoASTTypeAssertExpr(const GoASTTypeAssertExpr &) = delete;
const GoASTTypeAssertExpr &operator=(const GoASTTypeAssertExpr &) = delete;
};
class GoASTTypeSpec : public GoASTSpec {
public:
GoASTTypeSpec(GoASTIdent *name, GoASTExpr *type)
: GoASTSpec(eTypeSpec), m_name_up(name), m_type_up(type) {}
~GoASTTypeSpec() override = default;
const char *GetKindName() const override { return "TypeSpec"; }
static bool classof(const GoASTNode *n) { return n->GetKind() == eTypeSpec; }
const GoASTIdent *GetName() const { return m_name_up.get(); }
void SetName(GoASTIdent *name) { m_name_up.reset(name); }
const GoASTExpr *GetType() const { return m_type_up.get(); }
void SetType(GoASTExpr *type) { m_type_up.reset(type); }
private:
friend class GoASTNode;
std::unique_ptr<GoASTIdent> m_name_up;
std::unique_ptr<GoASTExpr> m_type_up;
GoASTTypeSpec(const GoASTTypeSpec &) = delete;
const GoASTTypeSpec &operator=(const GoASTTypeSpec &) = delete;
};
class GoASTTypeSwitchStmt : public GoASTStmt {
public:
GoASTTypeSwitchStmt(GoASTStmt *init, GoASTStmt *assign, GoASTBlockStmt *body)
: GoASTStmt(eTypeSwitchStmt), m_init_up(init), m_assign_up(assign),
m_body_up(body) {}
~GoASTTypeSwitchStmt() override = default;
const char *GetKindName() const override { return "TypeSwitchStmt"; }
static bool classof(const GoASTNode *n) {
return n->GetKind() == eTypeSwitchStmt;
}
const GoASTStmt *GetInit() const { return m_init_up.get(); }
void SetInit(GoASTStmt *init) { m_init_up.reset(init); }
const GoASTStmt *GetAssign() const { return m_assign_up.get(); }
void SetAssign(GoASTStmt *assign) { m_assign_up.reset(assign); }
const GoASTBlockStmt *GetBody() const { return m_body_up.get(); }
void SetBody(GoASTBlockStmt *body) { m_body_up.reset(body); }
private:
friend class GoASTNode;
std::unique_ptr<GoASTStmt> m_init_up;
std::unique_ptr<GoASTStmt> m_assign_up;
std::unique_ptr<GoASTBlockStmt> m_body_up;
GoASTTypeSwitchStmt(const GoASTTypeSwitchStmt &) = delete;
const GoASTTypeSwitchStmt &operator=(const GoASTTypeSwitchStmt &) = delete;
};
class GoASTUnaryExpr : public GoASTExpr {
public:
GoASTUnaryExpr(TokenType op, GoASTExpr *x)
: GoASTExpr(eUnaryExpr), m_op(op), m_x_up(x) {}
~GoASTUnaryExpr() override = default;
const char *GetKindName() const override { return "UnaryExpr"; }
static bool classof(const GoASTNode *n) { return n->GetKind() == eUnaryExpr; }
TokenType GetOp() const { return m_op; }
void SetOp(TokenType op) { m_op = op; }
const GoASTExpr *GetX() const { return m_x_up.get(); }
void SetX(GoASTExpr *x) { m_x_up.reset(x); }
private:
friend class GoASTNode;
TokenType m_op;
std::unique_ptr<GoASTExpr> m_x_up;
GoASTUnaryExpr(const GoASTUnaryExpr &) = delete;
const GoASTUnaryExpr &operator=(const GoASTUnaryExpr &) = delete;
};
class GoASTValueSpec : public GoASTSpec {
public:
GoASTValueSpec() : GoASTSpec(eValueSpec) {}
~GoASTValueSpec() override = default;
const char *GetKindName() const override { return "ValueSpec"; }
static bool classof(const GoASTNode *n) { return n->GetKind() == eValueSpec; }
size_t NumNames() const { return m_names.size(); }
const GoASTIdent *GetNames(int i) const { return m_names[i].get(); }
void AddNames(GoASTIdent *names) {
m_names.push_back(std::unique_ptr<GoASTIdent>(names));
}
const GoASTExpr *GetType() const { return m_type_up.get(); }
void SetType(GoASTExpr *type) { m_type_up.reset(type); }
size_t NumValues() const { return m_values.size(); }
const GoASTExpr *GetValues(int i) const { return m_values[i].get(); }
void AddValues(GoASTExpr *values) {
m_values.push_back(std::unique_ptr<GoASTExpr>(values));
}
private:
friend class GoASTNode;
std::vector<std::unique_ptr<GoASTIdent>> m_names;
std::unique_ptr<GoASTExpr> m_type_up;
std::vector<std::unique_ptr<GoASTExpr>> m_values;
GoASTValueSpec(const GoASTValueSpec &) = delete;
const GoASTValueSpec &operator=(const GoASTValueSpec &) = delete;
};
template <typename R, typename V> R GoASTDecl::Visit(V *v) const {
switch (GetKind()) {
case eBadDecl:
return v->VisitBadDecl(llvm::cast<const GoASTBadDecl>(this));
case eFuncDecl:
return v->VisitFuncDecl(llvm::cast<const GoASTFuncDecl>(this));
case eGenDecl:
return v->VisitGenDecl(llvm::cast<const GoASTGenDecl>(this));
default:
assert(false && "Invalid kind");
}
}
template <typename R, typename V> R GoASTExpr::Visit(V *v) const {
switch (GetKind()) {
case eArrayType:
return v->VisitArrayType(llvm::cast<const GoASTArrayType>(this));
case eBadExpr:
return v->VisitBadExpr(llvm::cast<const GoASTBadExpr>(this));
case eBasicLit:
return v->VisitBasicLit(llvm::cast<const GoASTBasicLit>(this));
case eBinaryExpr:
return v->VisitBinaryExpr(llvm::cast<const GoASTBinaryExpr>(this));
case eIdent:
return v->VisitIdent(llvm::cast<const GoASTIdent>(this));
case eCallExpr:
return v->VisitCallExpr(llvm::cast<const GoASTCallExpr>(this));
case eChanType:
return v->VisitChanType(llvm::cast<const GoASTChanType>(this));
case eCompositeLit:
return v->VisitCompositeLit(llvm::cast<const GoASTCompositeLit>(this));
case eEllipsis:
return v->VisitEllipsis(llvm::cast<const GoASTEllipsis>(this));
case eFuncType:
return v->VisitFuncType(llvm::cast<const GoASTFuncType>(this));
case eFuncLit:
return v->VisitFuncLit(llvm::cast<const GoASTFuncLit>(this));
case eIndexExpr:
return v->VisitIndexExpr(llvm::cast<const GoASTIndexExpr>(this));
case eInterfaceType:
return v->VisitInterfaceType(llvm::cast<const GoASTInterfaceType>(this));
case eKeyValueExpr:
return v->VisitKeyValueExpr(llvm::cast<const GoASTKeyValueExpr>(this));
case eMapType:
return v->VisitMapType(llvm::cast<const GoASTMapType>(this));
case eParenExpr:
return v->VisitParenExpr(llvm::cast<const GoASTParenExpr>(this));
case eSelectorExpr:
return v->VisitSelectorExpr(llvm::cast<const GoASTSelectorExpr>(this));
case eSliceExpr:
return v->VisitSliceExpr(llvm::cast<const GoASTSliceExpr>(this));
case eStarExpr:
return v->VisitStarExpr(llvm::cast<const GoASTStarExpr>(this));
case eStructType:
return v->VisitStructType(llvm::cast<const GoASTStructType>(this));
case eTypeAssertExpr:
return v->VisitTypeAssertExpr(llvm::cast<const GoASTTypeAssertExpr>(this));
case eUnaryExpr:
return v->VisitUnaryExpr(llvm::cast<const GoASTUnaryExpr>(this));
default:
assert(false && "Invalid kind");
return R();
}
}
template <typename R, typename V> R GoASTSpec::Visit(V *v) const {
switch (GetKind()) {
case eImportSpec:
return v->VisitImportSpec(llvm::cast<const GoASTImportSpec>(this));
case eTypeSpec:
return v->VisitTypeSpec(llvm::cast<const GoASTTypeSpec>(this));
case eValueSpec:
return v->VisitValueSpec(llvm::cast<const GoASTValueSpec>(this));
default:
assert(false && "Invalid kind");
}
}
template <typename R, typename V> R GoASTStmt::Visit(V *v) const {
switch (GetKind()) {
case eAssignStmt:
return v->VisitAssignStmt(llvm::cast<const GoASTAssignStmt>(this));
case eBadStmt:
return v->VisitBadStmt(llvm::cast<const GoASTBadStmt>(this));
case eBlockStmt:
return v->VisitBlockStmt(llvm::cast<const GoASTBlockStmt>(this));
case eBranchStmt:
return v->VisitBranchStmt(llvm::cast<const GoASTBranchStmt>(this));
case eCaseClause:
return v->VisitCaseClause(llvm::cast<const GoASTCaseClause>(this));
case eCommClause:
return v->VisitCommClause(llvm::cast<const GoASTCommClause>(this));
case eDeclStmt:
return v->VisitDeclStmt(llvm::cast<const GoASTDeclStmt>(this));
case eDeferStmt:
return v->VisitDeferStmt(llvm::cast<const GoASTDeferStmt>(this));
case eEmptyStmt:
return v->VisitEmptyStmt(llvm::cast<const GoASTEmptyStmt>(this));
case eExprStmt:
return v->VisitExprStmt(llvm::cast<const GoASTExprStmt>(this));
case eForStmt:
return v->VisitForStmt(llvm::cast<const GoASTForStmt>(this));
case eGoStmt:
return v->VisitGoStmt(llvm::cast<const GoASTGoStmt>(this));
case eIfStmt:
return v->VisitIfStmt(llvm::cast<const GoASTIfStmt>(this));
case eIncDecStmt:
return v->VisitIncDecStmt(llvm::cast<const GoASTIncDecStmt>(this));
case eLabeledStmt:
return v->VisitLabeledStmt(llvm::cast<const GoASTLabeledStmt>(this));
case eRangeStmt:
return v->VisitRangeStmt(llvm::cast<const GoASTRangeStmt>(this));
case eReturnStmt:
return v->VisitReturnStmt(llvm::cast<const GoASTReturnStmt>(this));
case eSelectStmt:
return v->VisitSelectStmt(llvm::cast<const GoASTSelectStmt>(this));
case eSendStmt:
return v->VisitSendStmt(llvm::cast<const GoASTSendStmt>(this));
case eSwitchStmt:
return v->VisitSwitchStmt(llvm::cast<const GoASTSwitchStmt>(this));
case eTypeSwitchStmt:
return v->VisitTypeSwitchStmt(llvm::cast<const GoASTTypeSwitchStmt>(this));
default:
assert(false && "Invalid kind");
}
}
template <typename V> void GoASTNode::WalkChildren(V &v) {
switch (m_kind) {
case eArrayType: {
GoASTArrayType *n = llvm::cast<GoASTArrayType>(this);
(void)n;
v(n->m_len_up.get());
v(n->m_elt_up.get());
return;
}
case eAssignStmt: {
GoASTAssignStmt *n = llvm::cast<GoASTAssignStmt>(this);
(void)n;
for (auto &e : n->m_lhs) {
v(e.get());
}
for (auto &e : n->m_rhs) {
v(e.get());
}
return;
}
case eBasicLit: {
GoASTBasicLit *n = llvm::cast<GoASTBasicLit>(this);
(void)n;
return;
}
case eBinaryExpr: {
GoASTBinaryExpr *n = llvm::cast<GoASTBinaryExpr>(this);
(void)n;
v(n->m_x_up.get());
v(n->m_y_up.get());
return;
}
case eBlockStmt: {
GoASTBlockStmt *n = llvm::cast<GoASTBlockStmt>(this);
(void)n;
for (auto &e : n->m_list) {
v(e.get());
}
return;
}
case eIdent: {
GoASTIdent *n = llvm::cast<GoASTIdent>(this);
(void)n;
return;
}
case eBranchStmt: {
GoASTBranchStmt *n = llvm::cast<GoASTBranchStmt>(this);
(void)n;
v(n->m_label_up.get());
return;
}
case eCallExpr: {
GoASTCallExpr *n = llvm::cast<GoASTCallExpr>(this);
(void)n;
v(n->m_fun_up.get());
for (auto &e : n->m_args) {
v(e.get());
}
return;
}
case eCaseClause: {
GoASTCaseClause *n = llvm::cast<GoASTCaseClause>(this);
(void)n;
for (auto &e : n->m_list) {
v(e.get());
}
for (auto &e : n->m_body) {
v(e.get());
}
return;
}
case eChanType: {
GoASTChanType *n = llvm::cast<GoASTChanType>(this);
(void)n;
v(n->m_value_up.get());
return;
}
case eCommClause: {
GoASTCommClause *n = llvm::cast<GoASTCommClause>(this);
(void)n;
v(n->m_comm_up.get());
for (auto &e : n->m_body) {
v(e.get());
}
return;
}
case eCompositeLit: {
GoASTCompositeLit *n = llvm::cast<GoASTCompositeLit>(this);
(void)n;
v(n->m_type_up.get());
for (auto &e : n->m_elts) {
v(e.get());
}
return;
}
case eDeclStmt: {
GoASTDeclStmt *n = llvm::cast<GoASTDeclStmt>(this);
(void)n;
v(n->m_decl_up.get());
return;
}
case eDeferStmt: {
GoASTDeferStmt *n = llvm::cast<GoASTDeferStmt>(this);
(void)n;
v(n->m_call_up.get());
return;
}
case eEllipsis: {
GoASTEllipsis *n = llvm::cast<GoASTEllipsis>(this);
(void)n;
v(n->m_elt_up.get());
return;
}
case eExprStmt: {
GoASTExprStmt *n = llvm::cast<GoASTExprStmt>(this);
(void)n;
v(n->m_x_up.get());
return;
}
case eField: {
GoASTField *n = llvm::cast<GoASTField>(this);
(void)n;
for (auto &e : n->m_names) {
v(e.get());
}
v(n->m_type_up.get());
v(n->m_tag_up.get());
return;
}
case eFieldList: {
GoASTFieldList *n = llvm::cast<GoASTFieldList>(this);
(void)n;
for (auto &e : n->m_list) {
v(e.get());
}
return;
}
case eForStmt: {
GoASTForStmt *n = llvm::cast<GoASTForStmt>(this);
(void)n;
v(n->m_init_up.get());
v(n->m_cond_up.get());
v(n->m_post_up.get());
v(n->m_body_up.get());
return;
}
case eFuncType: {
GoASTFuncType *n = llvm::cast<GoASTFuncType>(this);
(void)n;
v(n->m_params_up.get());
v(n->m_results_up.get());
return;
}
case eFuncDecl: {
GoASTFuncDecl *n = llvm::cast<GoASTFuncDecl>(this);
(void)n;
v(n->m_recv_up.get());
v(n->m_name_up.get());
v(n->m_type_up.get());
v(n->m_body_up.get());
return;
}
case eFuncLit: {
GoASTFuncLit *n = llvm::cast<GoASTFuncLit>(this);
(void)n;
v(n->m_type_up.get());
v(n->m_body_up.get());
return;
}
case eGenDecl: {
GoASTGenDecl *n = llvm::cast<GoASTGenDecl>(this);
(void)n;
for (auto &e : n->m_specs) {
v(e.get());
}
return;
}
case eGoStmt: {
GoASTGoStmt *n = llvm::cast<GoASTGoStmt>(this);
(void)n;
v(n->m_call_up.get());
return;
}
case eIfStmt: {
GoASTIfStmt *n = llvm::cast<GoASTIfStmt>(this);
(void)n;
v(n->m_init_up.get());
v(n->m_cond_up.get());
v(n->m_body_up.get());
v(n->m_els_up.get());
return;
}
case eImportSpec: {
GoASTImportSpec *n = llvm::cast<GoASTImportSpec>(this);
(void)n;
v(n->m_name_up.get());
v(n->m_path_up.get());
return;
}
case eIncDecStmt: {
GoASTIncDecStmt *n = llvm::cast<GoASTIncDecStmt>(this);
(void)n;
v(n->m_x_up.get());
return;
}
case eIndexExpr: {
GoASTIndexExpr *n = llvm::cast<GoASTIndexExpr>(this);
(void)n;
v(n->m_x_up.get());
v(n->m_index_up.get());
return;
}
case eInterfaceType: {
GoASTInterfaceType *n = llvm::cast<GoASTInterfaceType>(this);
(void)n;
v(n->m_methods_up.get());
return;
}
case eKeyValueExpr: {
GoASTKeyValueExpr *n = llvm::cast<GoASTKeyValueExpr>(this);
(void)n;
v(n->m_key_up.get());
v(n->m_value_up.get());
return;
}
case eLabeledStmt: {
GoASTLabeledStmt *n = llvm::cast<GoASTLabeledStmt>(this);
(void)n;
v(n->m_label_up.get());
v(n->m_stmt_up.get());
return;
}
case eMapType: {
GoASTMapType *n = llvm::cast<GoASTMapType>(this);
(void)n;
v(n->m_key_up.get());
v(n->m_value_up.get());
return;
}
case eParenExpr: {
GoASTParenExpr *n = llvm::cast<GoASTParenExpr>(this);
(void)n;
v(n->m_x_up.get());
return;
}
case eRangeStmt: {
GoASTRangeStmt *n = llvm::cast<GoASTRangeStmt>(this);
(void)n;
v(n->m_key_up.get());
v(n->m_value_up.get());
v(n->m_x_up.get());
v(n->m_body_up.get());
return;
}
case eReturnStmt: {
GoASTReturnStmt *n = llvm::cast<GoASTReturnStmt>(this);
(void)n;
for (auto &e : n->m_results) {
v(e.get());
}
return;
}
case eSelectStmt: {
GoASTSelectStmt *n = llvm::cast<GoASTSelectStmt>(this);
(void)n;
v(n->m_body_up.get());
return;
}
case eSelectorExpr: {
GoASTSelectorExpr *n = llvm::cast<GoASTSelectorExpr>(this);
(void)n;
v(n->m_x_up.get());
v(n->m_sel_up.get());
return;
}
case eSendStmt: {
GoASTSendStmt *n = llvm::cast<GoASTSendStmt>(this);
(void)n;
v(n->m_chan_up.get());
v(n->m_value_up.get());
return;
}
case eSliceExpr: {
GoASTSliceExpr *n = llvm::cast<GoASTSliceExpr>(this);
(void)n;
v(n->m_x_up.get());
v(n->m_low_up.get());
v(n->m_high_up.get());
v(n->m_max_up.get());
return;
}
case eStarExpr: {
GoASTStarExpr *n = llvm::cast<GoASTStarExpr>(this);
(void)n;
v(n->m_x_up.get());
return;
}
case eStructType: {
GoASTStructType *n = llvm::cast<GoASTStructType>(this);
(void)n;
v(n->m_fields_up.get());
return;
}
case eSwitchStmt: {
GoASTSwitchStmt *n = llvm::cast<GoASTSwitchStmt>(this);
(void)n;
v(n->m_init_up.get());
v(n->m_tag_up.get());
v(n->m_body_up.get());
return;
}
case eTypeAssertExpr: {
GoASTTypeAssertExpr *n = llvm::cast<GoASTTypeAssertExpr>(this);
(void)n;
v(n->m_x_up.get());
v(n->m_type_up.get());
return;
}
case eTypeSpec: {
GoASTTypeSpec *n = llvm::cast<GoASTTypeSpec>(this);
(void)n;
v(n->m_name_up.get());
v(n->m_type_up.get());
return;
}
case eTypeSwitchStmt: {
GoASTTypeSwitchStmt *n = llvm::cast<GoASTTypeSwitchStmt>(this);
(void)n;
v(n->m_init_up.get());
v(n->m_assign_up.get());
v(n->m_body_up.get());
return;
}
case eUnaryExpr: {
GoASTUnaryExpr *n = llvm::cast<GoASTUnaryExpr>(this);
(void)n;
v(n->m_x_up.get());
return;
}
case eValueSpec: {
GoASTValueSpec *n = llvm::cast<GoASTValueSpec>(this);
(void)n;
for (auto &e : n->m_names) {
v(e.get());
}
v(n->m_type_up.get());
for (auto &e : n->m_values) {
v(e.get());
}
return;
}
case eEmptyStmt:
case eBadDecl:
case eBadExpr:
case eBadStmt:
break;
}
}
} // namespace lldb_private
#endif
|