Snippets
Created by
JUNHWI KIM
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 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 4338 4339 4340 4341 4342 4343 4344 4345 4346 4347 4348 4349 4350 4351 4352 4353 4354 4355 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 4376 4377 4378 4379 4380 4381 4382 4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 4396 4397 4398 4399 4400 4401 4402 4403 4404 4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 4468 4469 4470 4471 4472 4473 4474 4475 4476 4477 4478 4479 4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 4490 4491 4492 4493 4494 4495 4496 4497 4498 4499 4500 4501 4502 4503 4504 4505 4506 4507 4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535 4536 4537 4538 4539 4540 4541 4542 4543 4544 4545 4546 4547 4548 4549 4550 4551 4552 4553 4554 4555 4556 4557 4558 4559 4560 4561 4562 4563 4564 4565 4566 4567 4568 4569 4570 4571 4572 4573 4574 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 4592 4593 4594 4595 4596 4597 4598 4599 4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 4610 4611 4612 4613 4614 4615 4616 4617 4618 4619 4620 4621 4622 4623 4624 4625 4626 4627 4628 4629 4630 4631 4632 4633 4634 4635 4636 4637 4638 4639 4640 4641 4642 4643 4644 4645 4646 4647 4648 4649 4650 4651 4652 4653 4654 4655 4656 4657 4658 4659 4660 4661 4662 4663 4664 4665 4666 4667 4668 4669 4670 4671 4672 4673 4674 4675 4676 4677 4678 4679 4680 4681 4682 4683 4684 4685 4686 4687 4688 4689 4690 4691 4692 4693 4694 4695 4696 4697 4698 4699 4700 4701 4702 4703 4704 4705 4706 4707 4708 4709 4710 4711 4712 4713 4714 4715 4716 4717 4718 4719 4720 4721 4722 4723 4724 4725 4726 4727 4728 4729 4730 4731 4732 4733 4734 4735 4736 4737 4738 4739 4740 4741 4742 4743 4744 4745 4746 4747 4748 4749 4750 4751 4752 4753 4754 4755 4756 4757 4758 4759 4760 4761 4762 4763 4764 4765 4766 4767 4768 4769 4770 4771 4772 4773 4774 4775 4776 4777 4778 4779 4780 4781 4782 4783 4784 4785 4786 4787 4788 4789 4790 4791 4792 4793 4794 4795 4796 4797 4798 4799 4800 4801 4802 4803 4804 4805 4806 4807 4808 4809 4810 4811 4812 4813 4814 4815 4816 4817 4818 4819 4820 4821 4822 4823 4824 4825 4826 4827 4828 4829 4830 4831 4832 4833 4834 4835 4836 4837 4838 4839 4840 4841 4842 4843 4844 4845 4846 4847 4848 4849 4850 4851 4852 4853 4854 4855 4856 4857 4858 4859 4860 4861 4862 4863 4864 4865 4866 4867 4868 4869 4870 4871 4872 4873 4874 4875 4876 4877 4878 4879 4880 4881 4882 4883 4884 4885 4886 4887 4888 4889 4890 4891 4892 4893 4894 4895 4896 4897 4898 4899 4900 4901 4902 4903 4904 4905 4906 4907 4908 4909 4910 4911 4912 4913 4914 4915 4916 4917 4918 4919 4920 4921 4922 4923 4924 4925 4926 4927 4928 4929 4930 4931 4932 4933 4934 4935 4936 4937 4938 4939 4940 4941 4942 4943 4944 4945 4946 4947 4948 4949 4950 4951 4952 4953 4954 4955 4956 4957 4958 4959 4960 4961 4962 4963 4964 4965 4966 4967 4968 4969 4970 4971 4972 4973 4974 4975 4976 4977 4978 4979 4980 4981 4982 4983 4984 4985 4986 4987 4988 4989 4990 4991 4992 4993 4994 4995 4996 4997 4998 4999 5000 5001 5002 5003 5004 5005 5006 5007 5008 5009 5010 5011 5012 5013 5014 5015 5016 5017 5018 5019 5020 5021 5022 5023 5024 5025 5026 5027 5028 5029 5030 5031 5032 5033 5034 5035 5036 5037 5038 5039 5040 5041 5042 5043 5044 5045 5046 5047 5048 5049 5050 5051 5052 5053 5054 5055 5056 5057 5058 5059 5060 5061 5062 5063 5064 5065 5066 5067 5068 5069 5070 5071 5072 5073 5074 5075 5076 5077 5078 5079 5080 5081 5082 5083 5084 5085 5086 5087 5088 5089 5090 5091 5092 5093 5094 5095 5096 5097 5098 5099 5100 5101 5102 5103 5104 5105 5106 5107 5108 5109 5110 5111 5112 5113 5114 5115 5116 5117 5118 5119 5120 5121 5122 5123 5124 5125 5126 5127 5128 5129 5130 5131 5132 5133 5134 5135 5136 5137 5138 5139 5140 5141 5142 5143 5144 5145 5146 5147 5148 5149 5150 5151 5152 5153 5154 5155 5156 5157 5158 5159 5160 5161 5162 5163 5164 5165 5166 5167 5168 5169 5170 5171 5172 5173 5174 5175 5176 5177 5178 5179 5180 5181 5182 5183 5184 5185 5186 5187 5188 5189 5190 5191 5192 5193 5194 5195 5196 5197 5198 5199 5200 5201 5202 5203 5204 5205 5206 5207 5208 5209 5210 5211 5212 5213 5214 5215 5216 5217 5218 5219 5220 5221 5222 5223 5224 5225 5226 5227 5228 5229 5230 5231 5232 5233 5234 5235 5236 5237 5238 5239 5240 5241 5242 5243 5244 5245 5246 5247 5248 5249 5250 5251 5252 5253 5254 5255 5256 5257 5258 5259 5260 5261 5262 5263 5264 5265 5266 5267 5268 5269 5270 5271 5272 5273 5274 5275 5276 5277 5278 5279 5280 5281 5282 5283 5284 5285 5286 5287 5288 5289 5290 5291 5292 5293 5294 5295 5296 5297 5298 5299 5300 5301 5302 5303 5304 5305 5306 5307 5308 5309 5310 5311 5312 5313 5314 5315 5316 5317 5318 5319 5320 5321 5322 5323 5324 5325 5326 5327 5328 5329 5330 5331 5332 5333 5334 5335 5336 5337 5338 5339 5340 5341 5342 5343 5344 5345 5346 5347 5348 5349 5350 5351 5352 5353 5354 5355 5356 5357 5358 5359 5360 5361 5362 5363 5364 5365 5366 5367 5368 5369 5370 5371 5372 5373 5374 5375 5376 5377 5378 5379 5380 5381 5382 5383 5384 5385 5386 5387 5388 5389 5390 5391 5392 5393 5394 5395 5396 5397 5398 5399 5400 5401 5402 5403 5404 5405 5406 5407 5408 5409 5410 5411 5412 5413 5414 5415 5416 5417 5418 5419 5420 5421 5422 5423 5424 5425 5426 5427 5428 5429 5430 5431 5432 5433 5434 5435 5436 5437 5438 5439 5440 5441 5442 5443 5444 5445 5446 5447 5448 5449 5450 5451 5452 5453 5454 5455 5456 5457 5458 5459 5460 5461 5462 5463 5464 5465 5466 5467 5468 5469 5470 5471 5472 5473 5474 5475 5476 5477 5478 5479 5480 5481 5482 5483 5484 5485 5486 5487 5488 5489 5490 5491 5492 5493 5494 5495 5496 5497 5498 5499 5500 5501 5502 5503 5504 5505 5506 5507 5508 5509 5510 5511 5512 5513 5514 5515 5516 5517 5518 5519 5520 5521 5522 5523 5524 5525 5526 5527 5528 5529 5530 5531 5532 5533 5534 5535 5536 5537 5538 5539 5540 5541 5542 5543 5544 5545 5546 5547 5548 5549 5550 5551 5552 5553 5554 5555 5556 5557 5558 5559 5560 5561 5562 5563 5564 5565 5566 5567 5568 5569 5570 5571 5572 5573 5574 5575 5576 5577 5578 5579 5580 5581 5582 5583 5584 5585 5586 5587 5588 5589 5590 5591 5592 5593 5594 5595 5596 5597 5598 5599 5600 5601 5602 5603 5604 5605 5606 5607 5608 5609 5610 5611 5612 5613 5614 5615 5616 5617 5618 5619 5620 5621 5622 5623 5624 5625 5626 5627 5628 5629 5630 5631 5632 5633 5634 5635 5636 5637 5638 5639 5640 5641 5642 5643 5644 5645 5646 5647 5648 5649 5650 5651 5652 5653 5654 5655 5656 5657 5658 5659 5660 5661 5662 5663 5664 5665 5666 5667 5668 5669 5670 5671 5672 5673 5674 5675 5676 5677 5678 5679 5680 5681 5682 5683 5684 5685 5686 5687 5688 5689 5690 5691 5692 5693 5694 5695 5696 5697 5698 5699 5700 5701 5702 5703 5704 5705 5706 5707 5708 5709 5710 5711 5712 5713 5714 5715 5716 5717 5718 5719 5720 5721 5722 5723 5724 5725 5726 5727 5728 5729 5730 5731 5732 5733 5734 5735 5736 5737 5738 5739 5740 5741 5742 5743 5744 5745 5746 5747 5748 5749 5750 5751 5752 5753 5754 5755 5756 5757 5758 5759 5760 5761 5762 5763 5764 5765 5766 5767 5768 5769 5770 5771 5772 5773 5774 5775 5776 5777 5778 5779 5780 5781 5782 5783 5784 5785 5786 5787 5788 5789 5790 5791 5792 5793 5794 5795 5796 5797 5798 5799 5800 5801 5802 5803 5804 5805 5806 5807 5808 5809 5810 5811 5812 5813 5814 5815 5816 5817 5818 5819 5820 5821 5822 5823 5824 5825 5826 5827 5828 5829 5830 5831 5832 5833 5834 5835 5836 5837 5838 5839 5840 5841 5842 5843 5844 5845 5846 5847 5848 5849 5850 5851 5852 5853 5854 5855 5856 5857 5858 5859 5860 5861 5862 5863 5864 5865 5866 5867 5868 5869 5870 5871 5872 5873 5874 5875 5876 5877 5878 5879 5880 5881 5882 5883 5884 5885 5886 5887 5888 5889 5890 5891 5892 5893 5894 5895 5896 5897 5898 5899 5900 5901 5902 5903 5904 5905 5906 5907 5908 5909 5910 5911 5912 5913 5914 5915 5916 5917 5918 5919 5920 5921 5922 5923 5924 5925 5926 5927 5928 5929 5930 5931 5932 5933 5934 5935 5936 5937 5938 5939 5940 5941 5942 5943 5944 5945 5946 5947 5948 5949 5950 5951 5952 5953 5954 5955 5956 5957 5958 5959 5960 5961 5962 5963 5964 5965 5966 5967 5968 5969 5970 5971 5972 5973 5974 5975 5976 5977 5978 5979 5980 5981 5982 5983 5984 5985 5986 5987 5988 5989 5990 5991 5992 5993 5994 5995 5996 5997 5998 5999 6000 6001 6002 6003 6004 6005 6006 6007 6008 6009 6010 6011 6012 6013 6014 6015 6016 6017 6018 6019 6020 6021 6022 6023 6024 6025 6026 6027 6028 6029 6030 6031 6032 6033 6034 6035 6036 6037 6038 6039 6040 6041 6042 6043 6044 6045 6046 6047 6048 6049 6050 6051 6052 6053 6054 6055 6056 6057 6058 6059 6060 6061 6062 6063 6064 6065 6066 6067 6068 6069 6070 6071 6072 6073 6074 6075 6076 6077 6078 6079 6080 6081 6082 6083 6084 6085 6086 6087 6088 6089 6090 6091 6092 6093 6094 6095 6096 6097 6098 6099 6100 6101 6102 6103 6104 6105 6106 6107 6108 6109 6110 6111 6112 6113 6114 6115 6116 6117 6118 6119 6120 6121 6122 6123 6124 6125 6126 6127 6128 6129 6130 6131 6132 6133 6134 6135 6136 6137 6138 6139 6140 6141 6142 6143 6144 6145 6146 6147 6148 6149 6150 6151 6152 6153 6154 6155 6156 6157 6158 6159 6160 6161 6162 6163 6164 6165 6166 6167 6168 6169 6170 6171 6172 6173 6174 6175 6176 6177 6178 6179 6180 6181 6182 6183 6184 6185 6186 6187 6188 6189 6190 6191 6192 6193 6194 6195 6196 6197 6198 6199 6200 6201 6202 6203 6204 6205 6206 6207 6208 6209 6210 6211 6212 6213 6214 6215 6216 6217 6218 6219 6220 6221 6222 6223 6224 6225 6226 6227 6228 6229 6230 6231 6232 6233 6234 6235 6236 6237 6238 6239 6240 6241 6242 6243 6244 6245 6246 6247 6248 6249 6250 6251 6252 6253 6254 6255 6256 6257 6258 6259 6260 6261 6262 6263 6264 6265 6266 6267 6268 6269 6270 6271 6272 6273 6274 6275 6276 6277 6278 6279 6280 6281 6282 6283 6284 6285 6286 6287 6288 6289 6290 6291 6292 6293 6294 6295 6296 6297 6298 6299 6300 6301 6302 6303 6304 6305 6306 6307 6308 6309 6310 6311 6312 6313 6314 6315 6316 6317 6318 6319 6320 6321 6322 6323 6324 6325 6326 6327 6328 6329 6330 6331 6332 6333 6334 6335 6336 6337 6338 6339 6340 6341 6342 6343 6344 6345 6346 6347 6348 6349 6350 6351 6352 6353 6354 6355 6356 6357 6358 6359 6360 6361 6362 6363 6364 6365 6366 6367 6368 6369 6370 6371 6372 6373 6374 6375 6376 6377 6378 6379 6380 6381 6382 6383 6384 6385 6386 6387 6388 6389 6390 6391 6392 6393 6394 6395 6396 6397 6398 6399 6400 6401 6402 6403 6404 6405 6406 6407 6408 6409 6410 6411 6412 6413 6414 6415 6416 6417 6418 6419 6420 6421 6422 6423 6424 6425 6426 6427 6428 6429 6430 6431 6432 6433 6434 6435 6436 6437 6438 6439 6440 6441 6442 6443 6444 6445 6446 6447 6448 6449 6450 6451 6452 6453 6454 6455 6456 6457 6458 6459 6460 6461 6462 6463 6464 6465 6466 6467 6468 6469 6470 6471 6472 6473 6474 6475 6476 6477 6478 6479 6480 6481 6482 6483 6484 6485 6486 6487 6488 6489 6490 6491 6492 6493 6494 6495 6496 6497 6498 6499 6500 6501 6502 6503 6504 6505 6506 6507 6508 6509 6510 6511 6512 6513 6514 6515 6516 6517 6518 6519 6520 6521 6522 6523 6524 6525 6526 6527 6528 6529 6530 6531 6532 6533 6534 6535 6536 6537 6538 6539 6540 6541 6542 6543 6544 6545 6546 6547 6548 6549 6550 6551 6552 6553 6554 6555 6556 6557 6558 6559 6560 6561 6562 6563 6564 6565 6566 6567 6568 6569 6570 6571 6572 6573 6574 6575 6576 6577 6578 6579 6580 6581 6582 6583 6584 6585 6586 6587 6588 6589 6590 6591 6592 6593 6594 6595 6596 6597 6598 6599 6600 6601 6602 6603 6604 6605 6606 6607 6608 6609 6610 6611 6612 6613 6614 6615 6616 6617 6618 6619 6620 6621 6622 6623 6624 6625 6626 6627 6628 6629 6630 6631 6632 6633 6634 6635 6636 6637 6638 6639 6640 6641 6642 6643 6644 6645 6646 6647 6648 6649 6650 6651 6652 6653 6654 6655 6656 6657 6658 6659 6660 6661 6662 6663 6664 6665 6666 6667 6668 6669 6670 6671 6672 6673 6674 6675 6676 6677 6678 6679 6680 6681 6682 6683 6684 6685 6686 6687 6688 6689 6690 6691 6692 6693 6694 6695 6696 6697 6698 6699 6700 6701 6702 6703 6704 6705 6706 6707 6708 6709 6710 6711 6712 6713 6714 6715 6716 6717 6718 6719 6720 6721 6722 6723 6724 6725 6726 6727 6728 6729 6730 6731 6732 6733 6734 6735 6736 6737 6738 6739 6740 6741 6742 6743 6744 6745 6746 6747 6748 6749 6750 6751 6752 6753 6754 6755 6756 6757 6758 6759 6760 6761 6762 6763 6764 6765 6766 6767 6768 6769 6770 6771 6772 6773 6774 6775 6776 6777 6778 6779 6780 6781 6782 6783 6784 6785 6786 6787 6788 6789 6790 6791 6792 6793 6794 6795 6796 6797 6798 6799 6800 6801 6802 6803 6804 6805 6806 6807 6808 6809 6810 6811 6812 6813 6814 6815 6816 6817 6818 6819 6820 6821 6822 6823 6824 6825 6826 6827 6828 6829 6830 6831 6832 6833 6834 6835 6836 6837 6838 6839 6840 6841 6842 6843 6844 6845 6846 6847 6848 6849 6850 6851 6852 6853 6854 6855 6856 6857 6858 6859 6860 6861 6862 6863 6864 6865 6866 6867 6868 6869 6870 6871 6872 6873 6874 6875 6876 6877 6878 6879 6880 6881 6882 6883 6884 6885 6886 6887 6888 6889 6890 6891 6892 6893 6894 6895 6896 6897 6898 6899 6900 6901 6902 6903 6904 6905 6906 6907 6908 6909 6910 6911 6912 6913 6914 6915 6916 6917 6918 6919 6920 6921 6922 6923 6924 6925 6926 6927 6928 6929 6930 6931 6932 6933 6934 6935 6936 6937 6938 6939 6940 6941 6942 6943 6944 6945 6946 6947 6948 6949 6950 6951 6952 6953 6954 6955 6956 6957 6958 6959 6960 6961 6962 6963 6964 6965 6966 6967 6968 6969 6970 6971 6972 6973 6974 6975 6976 6977 6978 6979 6980 6981 6982 6983 6984 6985 6986 6987 6988 6989 6990 6991 6992 6993 6994 6995 6996 6997 6998 6999 7000 7001 7002 7003 7004 7005 7006 7007 7008 7009 7010 7011 7012 7013 7014 7015 7016 7017 7018 7019 7020 7021 7022 7023 7024 7025 7026 7027 7028 7029 7030 7031 7032 7033 7034 7035 7036 7037 7038 7039 7040 7041 7042 7043 7044 7045 7046 7047 7048 7049 7050 7051 7052 7053 7054 7055 7056 7057 7058 7059 7060 7061 7062 7063 7064 7065 7066 7067 7068 7069 7070 7071 7072 7073 7074 7075 7076 7077 7078 7079 7080 7081 7082 7083 7084 7085 7086 7087 7088 7089 7090 7091 7092 7093 7094 7095 7096 7097 7098 7099 7100 7101 7102 7103 7104 7105 7106 7107 7108 7109 7110 7111 7112 7113 7114 7115 7116 7117 7118 7119 7120 7121 7122 7123 7124 7125 7126 7127 7128 7129 7130 7131 7132 7133 7134 7135 7136 7137 7138 7139 7140 7141 7142 7143 7144 7145 7146 7147 7148 7149 7150 7151 7152 7153 7154 7155 7156 7157 7158 7159 7160 7161 7162 7163 7164 7165 7166 7167 7168 7169 7170 7171 7172 7173 7174 7175 7176 7177 7178 7179 7180 7181 7182 7183 7184 7185 7186 7187 7188 7189 7190 7191 7192 7193 7194 7195 7196 7197 7198 7199 7200 7201 7202 7203 7204 7205 7206 7207 7208 7209 7210 7211 7212 7213 7214 7215 7216 7217 7218 7219 7220 7221 7222 7223 7224 7225 7226 7227 7228 7229 7230 7231 7232 7233 7234 7235 7236 7237 7238 7239 7240 7241 7242 7243 7244 7245 7246 7247 7248 7249 7250 7251 7252 7253 7254 7255 7256 7257 7258 7259 7260 7261 7262 7263 7264 7265 7266 7267 7268 7269 7270 7271 7272 7273 7274 7275 7276 7277 7278 7279 7280 7281 7282 7283 7284 7285 7286 7287 7288 7289 7290 7291 7292 7293 7294 7295 7296 7297 7298 7299 7300 7301 7302 7303 7304 7305 7306 7307 7308 7309 7310 7311 7312 7313 7314 7315 7316 7317 7318 7319 7320 7321 7322 7323 7324 7325 7326 7327 7328 7329 7330 7331 7332 7333 7334 7335 7336 7337 7338 7339 7340 7341 7342 7343 7344 7345 7346 7347 7348 7349 7350 7351 7352 7353 7354 7355 7356 7357 7358 7359 7360 7361 7362 7363 7364 7365 7366 7367 7368 7369 7370 7371 7372 7373 7374 7375 7376 7377 7378 7379 7380 7381 7382 7383 7384 7385 7386 7387 7388 7389 7390 7391 7392 7393 7394 7395 7396 7397 7398 7399 7400 7401 7402 7403 7404 7405 7406 7407 7408 7409 7410 7411 7412 7413 7414 7415 7416 7417 7418 7419 7420 7421 7422 7423 7424 7425 7426 7427 7428 7429 7430 7431 7432 7433 7434 7435 7436 7437 7438 7439 7440 7441 7442 7443 7444 7445 7446 7447 7448 7449 7450 7451 7452 7453 7454 7455 7456 7457 7458 7459 7460 7461 7462 7463 7464 7465 7466 7467 7468 7469 7470 7471 7472 7473 7474 7475 7476 7477 7478 7479 7480 7481 7482 7483 7484 7485 7486 7487 7488 7489 7490 7491 7492 7493 7494 7495 7496 7497 7498 7499 7500 7501 7502 7503 7504 7505 7506 7507 7508 7509 7510 7511 7512 7513 7514 7515 7516 7517 7518 7519 7520 7521 7522 7523 7524 7525 7526 7527 7528 7529 7530 7531 7532 7533 7534 7535 7536 7537 7538 7539 7540 7541 7542 7543 7544 7545 7546 7547 7548 7549 7550 7551 7552 7553 7554 7555 7556 7557 7558 7559 7560 7561 7562 7563 7564 7565 7566 7567 7568 7569 7570 7571 7572 7573 7574 7575 7576 7577 7578 7579 7580 7581 7582 7583 7584 7585 7586 7587 7588 7589 7590 7591 7592 7593 7594 7595 7596 7597 7598 7599 7600 7601 7602 7603 7604 7605 7606 7607 7608 7609 7610 7611 7612 7613 7614 7615 7616 7617 |
/******************************************************************************
* \ ___ / *
* / \ *
* Edison Design Group C++/C Front End - | \^/ | - *
* \ / *
* / | | \ *
* Copyright 1996-2012 Edison Design Group Inc. [_] *
* *
******************************************************************************/
/*
Redistribution and use in source and binary forms are permitted
provided that the above copyright notice and this paragraph are
duplicated in all source code forms. The name of Edison Design
Group, Inc. may not be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
Any use of this software is at the user's own risk.
*/
/*
decode.c -- Name demangler for C++.
The demangling is intended to work only on names of external entities.
There is some name mangling done for internal entities, or by the
C-generating back end, that this program does not try to decode.
When IA64_ABI is defined as 1, the demangling matches the IA-64 ABI,
which in addition to its use on Itanium is used on a lot of versions of
gcc.
*/
#if COMPILE_DECODE_FOR_LIB_SRC
/*
When COMPILE_DECODE_FOR_LIB_SRC is TRUE, this file is being cross compiled for
inclusion in the runtime library (so that __cxa_demangle is available).
Compiling in this mode implies that IA64_ABI is TRUE (no externally visible
symbols are defined in Cfront mode). When cross compiling, don't include any
header files from the front end. Since we don't have access to the settings of
the front end configuration macros, make sure the ones we use have been
defined.
*/
#ifndef IA64_ABI
#define IA64_ABI 1
#else /* defined(IA64_ABI) */
#if !IA64_ABI
#error IA64_ABI macro must be TRUE when COMPILE_DECODE_FOR_LIB_SRC is TRUE
#endif /* !IA64_ABI */
#endif /* ifndef IA64_ABI */
#ifndef DEFAULT_EMULATE_GNU_ABI_BUGS
#error DEFAULT_EMULATE_GNU_ABI_BUGS macro must be set when \
COMPILE_DECODE_FOR_LIB_SRC is TRUE
#endif /* ifndef DEFAULT_EMULATE_GNU_ABI_BUGS */
#ifndef USE_LONG_DOUBLE_FOR_HOST_FP_VALUE
#error USE_LONG_DOUBLE_FOR_HOST_FP_VALUE macro must be set when \
COMPILE_DECODE_FOR_LIB_SRC is TRUE
#endif /* ifndef USE_LONG_DOUBLE_FOR_HOST_FP_VALUE */
#include "basics.h" /* Includes version in lib_src directory. */
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <stdio.h>
#ifndef sizeof_t
typedef size_t sizeof_t;
#endif /* ifndef sizeof_t */
#ifndef true_size_t
typedef size_t true_size_t;
#endif /* ifndef true_size_t */
#else /* !COMPILE_DECODE_FOR_LIB_SRC */
#include "basics.h" /* Includes version in src directory. */
#include "host_envir.h"
#if IA64_ABI
#include "targ_def.h" /* For DEFAULT_EMULATE_GNU_ABI_BUGS and others. */
#endif /* IA64_ABI */
#include "decode.h"
#endif /* COMPILE_DECODE_FOR_LIB_SRC */
/*
Block used to hold state variables. A block is used so that these routines
will be reentrant.
*/
typedef struct a_decode_control_block *a_decode_control_block_ptr;
typedef struct a_decode_control_block {
char *output_id;
/* Pointer to buffer for demangled version of
the current identifier. */
sizeof_t output_id_len;
/* Length of output_id, not counting the final
null. */
sizeof_t output_id_size;
/* Allocated size of output_id. */
a_boolean err_in_id;
/* TRUE if any error was encountered in the current
identifier. */
a_boolean output_overflow_err;
/* TRUE if the demangled output overflowed the
output buffer. */
unsigned long suppress_id_output;
/* If > 0, demangled id output is suppressed. This
might be because of an error or just as a way
of avoiding output during some processing. */
sizeof_t uncompressed_length;
/* If non-zero, the original name was compressed,
and this indicates the length of the uncompressed
(but still mangled) name. */
#if !IA64_ABI
char *end_of_name;
/* Set to the character position just after the end of
the mangled name. When sections with indicated
lengths are scanned, set temporarily to just after
that section of the name. */
#else /* IA64_ABI */
unsigned long suppress_substitution_recording;
/* If > 0, suppress recording of substitutions. */
a_boolean contains_conversion_operator;
/* TRUE if the name being demangled contains a
conversion operator (i.e., "cv <type>"). Such
names may require a second pass at demangling
if the first pass ends in failure. */
a_boolean parse_template_args_after_conversion_operator;
/* TRUE if template arguments should be parsed
as part of the type following a templated conversion
operator. The initial attempt at demangling uses
a value of FALSE, but a subsequent attempt will
have this field set to TRUE. */
#endif /* IA64_ABI */
} a_decode_control_block;
static void clear_control_block(a_decode_control_block_ptr dctl)
/*
Clear a decoding control block.
*/
{
dctl->output_id = NULL;
dctl->output_id_len = 0;
dctl->output_id_size = 0;
dctl->err_in_id = FALSE;
dctl->output_overflow_err = FALSE;
dctl->suppress_id_output = 0;
dctl->uncompressed_length = 0;
#if !IA64_ABI
dctl->end_of_name = NULL;
#else /* IA64_ABI */
dctl->suppress_substitution_recording = 0;
dctl->contains_conversion_operator = FALSE;
dctl->parse_template_args_after_conversion_operator = FALSE;
#endif /* IA64_ABI */
} /* clear_control_block */
#if !IA64_ABI
/*
Block that contains information used to control the output of template
parameter lists.
*/
typedef struct a_template_param_block *a_template_param_block_ptr;
typedef struct a_template_param_block {
unsigned long nesting_level;
/* Number of levels of template nesting at this
point (1 == top level). */
char *final_specialization;
/* Set to point to the mangled encoding for the final
specialization encountered while working from
outermost template to innermost. NULL if
no specialization has been found yet. */
a_boolean set_final_specialization;
/* TRUE if final_specialization should be set while
scanning. */
a_boolean actual_template_args_until_final_specialization;
/* TRUE if template parameter names should not be
put out. Reset when the final_specialization
position is reached. */
a_boolean output_only_correspondences;
/* TRUE if doing a post-pass to output only template
parameter/argument correspondences and not
anything else. suppress_id_output will have been
incremented to suppress everything else, and
gets decremented temporarily when correspondences
are output. */
a_boolean first_correspondence;
/* TRUE until the first template parameter/argument
correspondence is put out. */
a_boolean use_old_form_for_template_output;
/* TRUE if templates should be output in the old
form that always puts actual argument values
in template argument lists. */
} a_template_param_block;
/*
Declarations needed because of forward references:
*/
static char *demangle_identifier_with_preceding_length(
char *ptr,
a_boolean suppress_parent_and_local_info,
a_decode_control_block_ptr dctl);
static char *demangle_operation(char *ptr,
a_boolean need_parens,
a_decode_control_block_ptr dctl);
static char *demangle_operator(char *ptr,
int *mangled_length,
a_boolean *takes_type,
a_boolean *is_new_style_cast,
a_boolean *is_postfix,
a_boolean *need_adl_parens,
a_boolean *is_initializer_list,
a_decode_control_block_ptr dctl);
static char *demangle_type(char *ptr,
a_decode_control_block_ptr dctl);
static char *full_demangle_type_name(
char *ptr,
a_boolean base_name_only,
a_template_param_block_ptr temp_par_info,
a_boolean is_destructor_name,
a_decode_control_block_ptr dctl);
char *demangle_template_arguments(
char *ptr,
a_boolean emit_arg_values,
a_template_param_block_ptr temp_par_info,
a_decode_control_block_ptr dctl);
a_boolean is_mangled_type_name(char *ptr,
a_decode_control_block_ptr dctl);
static char *demangle_name(char *ptr,
unsigned long nchars,
a_boolean stop_on_underscores,
unsigned long *nchars_left,
char *mclass,
a_template_param_block_ptr temp_par_info,
a_boolean *instance_emitted,
a_decode_control_block_ptr dctl);
/*
Interface to full_demangle_type_name for the simple case.
*/
#define demangle_type_name(ptr, dctl) \
full_demangle_type_name((ptr), /*base_name_only=*/FALSE, \
/*temp_par_info=*/(a_template_param_block_ptr)NULL, \
/*is_destructor_name=*/FALSE, \
(dctl))
static char *full_demangle_identifier(
char *ptr,
unsigned long nchars,
a_boolean suppress_parent_and_local_info,
a_decode_control_block_ptr dctl);
/* Interface to full_demangle_identifier for the simple case. */
#define demangle_identifier(ptr, dctl) \
full_demangle_identifier((ptr), (unsigned long)0, FALSE, (dctl))
#endif /* !IA64_ABI */
void write_id_ch(char ch,
a_decode_control_block_ptr dctl)
/*
Add the indicated character to the demangled version of the current identifier.
*/
{
if (!dctl->suppress_id_output) {
if (!dctl->output_overflow_err) {
/* Test for buffer overflow, leaving room for a terminating null. */
if (dctl->output_id_len+1 >= dctl->output_id_size) {
/* There's no room for the character in the buffer. */
dctl->output_overflow_err = TRUE;
/* Make sure the (truncated) output is null-terminated. */
if (dctl->output_id_size != 0) {
dctl->output_id[dctl->output_id_size-1] = '\0';
} /* if */
} else {
/* No overflow; put the character in the buffer. */
dctl->output_id[dctl->output_id_len] = ch;
} /* if */
} /* if */
/* Keep track of the number of characters (even if output has overflowed
the buffer). */
dctl->output_id_len++;
} /* if */
} /* write_id_ch */
void write_id_str(char *str,
a_decode_control_block_ptr dctl)
/*
Add the indicated string to the demangled version of the current identifier.
*/
{
char *p = str;
if (!dctl->suppress_id_output) {
for (; *p != '\0'; p++) write_id_ch(*p, dctl);
} /* if */
} /* write_id_str */
static void write_id_number(unsigned long num,
a_decode_control_block_ptr dctl)
/*
Utility to write the specified non-negative number to the demangled version
of the current identifier.
*/
{
char buffer[50];
(void)sprintf(buffer, "%lu", num);
write_id_str(buffer, dctl);
} /* write_id_number */
#if IA64_ABI
static void write_id_signed_number(long num,
a_decode_control_block_ptr dctl)
/*
Utility to write the specified signed number to the demangled version
of the current identifier.
*/
{
char buffer[50];
(void)sprintf(buffer, "%ld", num);
write_id_str(buffer, dctl);
} /* write_id_signed_number */
#endif /* IA64_ABI */
void bad_mangled_name(a_decode_control_block_ptr dctl)
/*
A bad name mangling has been encountered. Record an error.
*/
{
if (!dctl->err_in_id) {
dctl->err_in_id = TRUE;
dctl->suppress_id_output++;
#if IA64_ABI
dctl->suppress_substitution_recording++;
#endif /* IA64_ABI */
} /* if */
} /* bad_mangled_name */
#if IA64_ABI
/*ARGSUSED*/
char get_char(char *ptr,
a_decode_control_block_ptr dctl)
/*
Get and return the character pointed to by ptr. Stub version; this
does nothing in the IA-64 ABI, but it's called from some low-level routines.
*/
{
return *ptr;
} /* get_char */
a_boolean start_of_id_is(char *str,
char *id)
/*
Return TRUE if the part of the mangled name at id begins with the string str.
*/
{
a_boolean is_start = FALSE;
for (;;) {
char chs = *str++;
if (chs == '\0') {
is_start = TRUE;
break;
} /* if */
if (chs != *id++) break;
} /* for */
return is_start;
} /* start_of_id_is */
#else /* !IA64_ABI */
char get_char(char *ptr,
a_decode_control_block_ptr dctl)
/*
Get and return the character pointed to by ptr. However, if that
position is at or beyond dctl->end_of_name, return a null character
instead.
*/
{
char ch;
if (ptr >= dctl->end_of_name) {
ch = '\0';
} else {
ch = *ptr;
} /* if */
return ch;
} /* get_char */
a_boolean start_of_id_is(char *str,
char *id,
a_decode_control_block_ptr dctl)
/*
Return TRUE if the part of the mangled name at id begins with the string str.
*/
{
a_boolean is_start = FALSE;
for (;;) {
char chs = *str++;
if (chs == '\0') {
is_start = TRUE;
break;
} /* if */
if (chs != get_char(id++, dctl)) break;
} /* for */
return is_start;
} /* start_of_id_is */
#endif /* IA64_ABI */
char *advance_past(char ch,
char *p,
a_decode_control_block_ptr dctl)
/*
The character ch is expected at *p. If it's there, advance past it. If
not, call bad_mangled_name. In either case, return the updated value of p.
*/
{
if (get_char(p, dctl) == ch) {
p++;
} else {
bad_mangled_name(dctl);
} /* if */
return p;
} /* advance_past */
static char *advance_past_underscore(char *p,
a_decode_control_block_ptr dctl)
/*
An underscore is expected at *p. If it's there, advance past it. If
not, call bad_mangled_name. In either case, return the updated value of p.
*/
{
return advance_past('_', p, dctl);
} /* advance_past_underscore */
#if IA64_ABI
char *get_number(char *p,
long *num,
a_decode_control_block_ptr dctl);
#else /* !IA64_ABI */
char *get_number(char *p,
unsigned long *num,
a_decode_control_block_ptr dctl);
#endif /* IA64_ABI */
char *demangle_module_id(char *ptr,
unsigned long num,
char *prefix,
a_decode_control_block_ptr dctl)
/*
Demangle a module id name (an EDG extension), which has the form
_ <file-name-length> _ <file-name> _ <str1> [ _ <str2> ]
Only the file name part is parsed and put out. num specifies the number of
characters in the entire module id. prefix points earlier in the mangled
name to a prefix that may precede the module id (if no such prefix is used,
prefix == NULL). Return a pointer to the character position following the
entire module id.
*/
{
#if IA64_ABI
long num_chars_to_output;
#else /* !IA64_ABI */
unsigned long num_chars_to_output;
#endif /* IA64_ABI */
char *start;
if (*ptr != '_' || !isdigit((unsigned char)ptr[1])) {
/* May not be an EDG module_id, in which case, emit the entire string
(including any prefix that may have been parsed by the caller). */
if (prefix != NULL) {
while (prefix != ptr) write_id_ch(*prefix++, dctl);
} /* if */
num_chars_to_output = num;
start = ptr;
} else {
start = get_number(ptr+1, &num_chars_to_output, dctl);
if (!dctl->err_in_id) {
uint32_t prefix_len = (uint32_t)((start-ptr)+1);
if (*start != '_' ||
#if IA64_ABI
num_chars_to_output <= 0 ||
#endif /* IA64_ABI */
num < ((unsigned long)num_chars_to_output + prefix_len)) {
bad_mangled_name(dctl);
} else {
/* Skip the underscore. */
start++;
} /* if */
} /* if */
} /* if */
if (!dctl->err_in_id) {
/* Write the filename (or entire module id). */
while (num_chars_to_output-- > 0) write_id_ch(*start++, dctl);
} /* if */
return ptr+num;
} /* demangle_module_id */
#if !IA64_ABI
static char *get_length(char *p,
unsigned long *num,
char **prev_end,
a_decode_control_block_ptr dctl)
/*
Accumulate a number indicating a length, starting at position p, and
return its value in *num. Return a pointer to the character position
following the number. dctl->end_of_name is updated to reflect the location
after the end of the entity with the length, and *prev_end is set to the
previous value of dctl->end_of_name for later restoration.
*/
{
unsigned long n = 0;
char ch;
*prev_end = dctl->end_of_name;
ch = get_char(p, dctl);
if (!isdigit((unsigned char)ch)) {
bad_mangled_name(dctl);
goto end_of_routine;
} /* if */
do {
n = n*10 + (ch - '0');
if (n > (unsigned long)((dctl->end_of_name - p) - 1)) {
/* Bad number (bigger than the amount of text remaining). */
bad_mangled_name(dctl);
n = ((dctl->end_of_name - p) - 1);
goto end_of_routine;
} /* if */
p++;
ch = get_char(p, dctl);
} while (isdigit((unsigned char)ch));
dctl->end_of_name = p + n;
end_of_routine:
*num = n;
return p;
} /* get_length */
char *get_number(char *p,
unsigned long *num,
a_decode_control_block_ptr dctl)
/*
Accumulate a number starting at position p and return its value in *num.
Return a pointer to the character position following the number.
*/
{
unsigned long n = 0;
char ch;
ch = get_char(p, dctl);
if (!isdigit((unsigned char)ch)) {
bad_mangled_name(dctl);
goto end_of_routine;
} /* if */
do {
n = n*10 + (ch - '0');
p++;
ch = get_char(p, dctl);
} while (isdigit((unsigned char)ch));
end_of_routine:
*num = n;
return p;
} /* get_number */
char *get_single_digit_number(char *p,
unsigned long *num,
a_decode_control_block_ptr dctl)
/*
Accumulate a number starting at position p and return its value in *num.
The number is a single digit. Return a pointer to the character position
following the number.
*/
{
char ch;
*num = 0;
ch = get_char(p, dctl);
if (!isdigit((unsigned char)ch)) {
bad_mangled_name(dctl);
goto end_of_routine;
} /* if */
*num = (ch - '0');
p++;
end_of_routine:
return p;
} /* get_single_digit_number */
static char *get_single_digit_length(char *p,
unsigned long *num,
char **prev_end,
a_decode_control_block_ptr dctl)
/*
Accumulate a length starting at position p and return its value in *num.
The length is a single digit. Return a pointer to the character position
following the length. dctl->end_of_name is updated to reflect the location
after the end of the entity with the length, and *prev_end is set to the
previous value of dctl->end_of_name for later restoration.
*/
{
p = get_single_digit_number(p, num, dctl);
*prev_end = dctl->end_of_name;
if (*num > (unsigned long)(dctl->end_of_name - p)) {
/* Bad length (too large). */
bad_mangled_name(dctl);
} else {
dctl->end_of_name = p + *num;
} /* if */
return p;
} /* get_single_digit_length */
static char *get_length_with_optional_underscore(
char *p,
unsigned long *num,
char **prev_end,
a_decode_control_block_ptr dctl)
/*
Accumulate a number starting at position p and return its value in *num.
If the number has more than one digit, it is followed by an underscore.
(Or, in a newer representation, surrounded by underscores.)
Return a pointer to the character position following the number.
dctl->end_of_name is updated to reflect the location after the end
of the entity with the length, and *prev_end is set to the previous value
of dctl->end_of_name for later restoration.
*/
{
if (get_char(p, dctl) == '_') {
/* New encoding (not from cfront) -- the length is surrounded by
underscores whether it's a single digit or several digits,
e.g., "L_10_1234567890". */
p++;
/* Multi-digit number followed by underscore. */
p = get_length(p, num, prev_end, dctl);
p = advance_past_underscore(p, dctl);
dctl->end_of_name++; /* Adjust for underscore. */
} else if (isdigit((unsigned char)get_char(p, dctl)) &&
isdigit((unsigned char)get_char(p+1, dctl)) &&
get_char(p+2, dctl) == '_') {
/* The cfront version -- a multi-digit length is followed by an
underscore, e.g., "L10_1234567890". This doesn't work well because
something like "L11", intended to have a one-digit length, can
be made ambiguous by following it by a "_" for some other reason.
So this form is not used in new cases where that can come up, e.g.,
nontype template arguments for functions. In any case, interpret
"multi-digit" as "2-digit" and don't look further for the underscore. */
/* Multi-digit number followed by underscore. */
p = get_length(p, num, prev_end, dctl);
p = advance_past_underscore(p, dctl);
dctl->end_of_name++; /* Adjust for underscore. */
} else {
/* Single-digit number not followed by underscore. */
p = get_single_digit_length(p, num, prev_end, dctl);
} /* if */
return p;
} /* get_length_with_optional_underscore */
char *get_number_with_optional_underscore(
char *p,
unsigned long *num,
a_decode_control_block_ptr dctl)
/*
Accumulate a number starting at position p and return its value in *num.
If the number has more than one digit, it is followed by an underscore.
(Or, in a newer representation, surrounded by underscores.)
Return a pointer to the character position following the number.
Parses the same string as get_length_with_optional_underscore, except that
dctl->end_of_name is not altered (meaning that this routine can be used to
retrieve a count of something other than the number of characters that
immediately follow the number).
*/
{
if (get_char(p, dctl) == '_') {
/* New encoding (not from cfront) -- the number is surrounded by
underscores whether it's a single digit or several digits,
e.g., "L_10_". */
p++;
/* Multi-digit number followed by underscore. */
p = get_number(p, num, dctl);
p = advance_past_underscore(p, dctl);
} else if (isdigit((unsigned char)get_char(p, dctl)) &&
isdigit((unsigned char)get_char(p+1, dctl)) &&
get_char(p+2, dctl) == '_') {
/* The cfront version -- a multi-digit number is followed by an
underscore, e.g., "L10_". This doesn't work well because
something like "L11", intended to have a one-digit length, can
be made ambiguous by following it by a "_" for some other reason.
So this form is not used in new cases where that can come up, e.g.,
nontype template arguments for functions. In any case, interpret
"multi-digit" as "2-digit" and don't look further for the underscore. */
/* Multi-digit number followed by underscore. */
p = get_number(p, num, dctl);
p = advance_past_underscore(p, dctl);
} else {
/* Single-digit number not followed by underscore. */
p = get_single_digit_number(p, num, dctl);
} /* if */
return p;
} /* get_number_with_optional_underscore */
a_boolean is_immediate_type_qualifier(char *p,
a_decode_control_block_ptr dctl)
/*
Return TRUE if the encoding pointed to is one that indicates type
qualification.
*/
{
a_boolean is_type_qual = FALSE;
char ch;
ch = get_char(p, dctl);
if (ch == 'C' || ch == 'V' || (ch == 'D' && get_char(p+1, dctl) == 'r')) {
/* This is a type qualifier. */
is_type_qual = TRUE;
} /* if */
return is_type_qual;
} /* is_immediate_type_qualifier */
char *remove_immediate_type_qualifiers(char *p,
a_decode_control_block_ptr dctl)
/*
Return a pointer to the mangled name after removing any type qualifiers
that might be present.
*/
{
while (is_immediate_type_qualifier(p, dctl)) {
if (get_char(p, dctl) == 'D' && get_char(p+1, dctl) == 'r') {
/* Two-character qualifier. */
p+=2;
} else {
/* One-character qualifier. */
p++;
} /* if */
} /* while */
return p;
} /* remove_immediate_type_qualifiers */
void write_template_parameter_name(unsigned long depth,
unsigned long position,
a_boolean nontype,
a_decode_control_block_ptr dctl)
/*
Output a representation of a template parameter with depth and position
as indicated. It's a nontype parameter if nontype is TRUE.
*/
{
char buffer[100];
char letter = '\0';
if (nontype) {
/* Nontype parameter. */
/* Use a code letter for the first few levels, then the depth number. */
if (depth == 1) {
letter = 'N';
} else if (depth == 2) {
letter = 'O';
} else if (depth == 3) {
letter = 'P';
} /* if */
if (letter != '\0') {
(void)sprintf(buffer, "%c%lu", letter, position);
} else {
(void)sprintf(buffer, "N_%lu_%lu", depth, position);
} /* if */
} else {
/* Normal type parameter. */
/* Use a code letter for the first few levels, then the depth number. */
if (depth == 1) {
letter = 'T';
} else if (depth == 2) {
letter = 'U';
} else if (depth == 3) {
letter = 'V';
} /* if */
if (letter != '\0') {
(void)sprintf(buffer, "%c%lu", letter, position);
} else {
(void)sprintf(buffer, "T_%lu_%lu", depth, position);
} /* if */
} /* if */
write_id_str(buffer, dctl);
} /* write_template_parameter_name */
char *demangle_template_parameter_name(
char *ptr,
a_boolean nontype,
a_decode_control_block_ptr dctl)
/*
Demangle a template parameter name at the indicated location. The parameter
is a nontype parameter if nontype is TRUE. Return a pointer to the character
position following what was demangled.
*/
{
char *p = ptr;
unsigned long position, depth = 1;
/* This comes up with the modern mangling for template functions.
Form is "ZnZ" or "Zn_mZ", where n is the parameter number and m
is the depth number (1 if not specified). */
p++; /* Advance past the "Z". */
/* Get the position number. */
p = get_number(p, &position, dctl);
if (get_char(p, dctl) == '_' && get_char(p+1, dctl) != '_') {
/* Form including depth ("Zn_mZ"). */
p++;
p = get_number(p, &depth, dctl);
} /* if */
/* Output the template parameter name. */
write_template_parameter_name(depth, position, nontype, dctl);
if (get_char(p , dctl) == '_' &&
get_char(p+1, dctl) == '_' &&
get_char(p+2, dctl) == 't' &&
get_char(p+3, dctl) == 'm' &&
get_char(p+4, dctl) == '_' &&
get_char(p+5, dctl) == '_') {
/* A template template parameter followed by a template
argument list. */
p = demangle_template_arguments(p+6, /*emit_arg_values=*/FALSE,
(a_template_param_block_ptr)NULL, dctl);
} /* if */
/* Check for the final "Z". This appears in the mangling to avoid
ambiguities when the template parameter is followed by something whose
encoding begins with a digit, e.g., a class name. */
if (get_char(p, dctl) != 'Z') {
bad_mangled_name(dctl);
} else {
p++;
} /* if */
return p;
} /* demangle_template_parameter_name */
char *demangle_constant_value(char *ptr,
a_boolean is_bool,
a_boolean is_nullptr,
a_decode_control_block_ptr dctl)
/*
Demangle a constant value that is part of a literal. The form of the
constant has an initial length (which may or may not use the new underscore
for specifying the length), followed by some number of characters, for example:
3n12 encoding for -12
^^^---- Characters of constant. Some characters get remapped:
n --> -
p --> +
d --> .
^------- Length of constant (may or may not include underscores).
When is_bool is TRUE, emit "true"/"false" instead of 1/0. Likewise when
is_nullptr is TRUE (emits "nullptr" rather than 0).
*/
{
char *p = ptr, *prev_end, ch;
unsigned long nchars;
a_boolean is_nonzero = FALSE;
/* Get the length of the constant. */
p = get_length_with_optional_underscore(p, &nchars, &prev_end, dctl);
/* Process the characters of the literal constant. */
for (; nchars > 0; nchars--, p++) {
/* Remap characters where necessary. */
ch = get_char(p, dctl);
switch (ch) {
case '\0':
case '_':
/* Ran off end of string. */
bad_mangled_name(dctl);
goto end_of_routine;
case 'p':
ch = '+';
break;
case 'n':
ch = '-';
break;
case 'd':
ch = '.';
break;
} /* switch */
if (is_bool) {
/* For the bool case, just keep track of whether the constant is
non-zero; true or false will be output later. */
if (ch != '0') is_nonzero = TRUE;
} else if (is_nullptr) {
/* Constant should only ever be zero. Suppress it. */
} else {
/* Normal (non-bool, non-nullptr) case. Output the character of the
constant. */
write_id_ch(ch, dctl);
} /* if */
} /* for */
dctl->end_of_name = prev_end;
if (is_bool) {
/* For bool, output true or false. */
write_id_str((char *)(is_nonzero ? "true" : "false"), dctl);
} /* if */
if (is_nullptr) write_id_str("nullptr", dctl);
end_of_routine:
return p;
} /* demangle_constant_value */
char *demangle_constant(char *ptr,
a_boolean suppress_address_of,
a_boolean need_parens,
a_decode_control_block_ptr dctl)
/*
Demangle a constant (e.g., a nontype template class argument) beginning at
ptr, and output the demangled form. When suppress_address_of is TRUE, the
ampersand that is normally emitted before an address constant is suppressed
(this is used when demangling expressions where any "address of" operation is
explicit). When need_parens is TRUE, parentheses are emitted around literals
and expressions (but not addresses or template parameters). Return a pointer
to the character position following what was demangled.
*/
{
char *p = ptr, *type = NULL, *index, *prev_end;
unsigned long nchars;
char ch;
/* A constant has a form like
CiL15 <-- integer constant 5
^-- Literal constant representation.
^--- Length of literal constant.
^---- L indicates literal constant; c indicates address
of variable, etc.
^^----- Type of template argument, with "const" added.
A template parameter constant or a constant expression does not have
the initial "C" and type.
*/
if (get_char(p, dctl) == 'C') {
/* Advance past the type. */
type = p;
dctl->suppress_id_output++;
p = demangle_type(p, dctl);
dctl->suppress_id_output--;
} /* if */
/* The next thing has one of the following forms:
3abc Address of "abc".
L211 Literal constant; length ("2") followed by the characters of
the constant ("11").
LM0_L2n1_1j Pointer-to-member-function constant; the three parts
correspond to the triplet of values in the __mptr
data structure.
Z1Z Template parameter.
Opl2Z1ZZ2ZO Expression.
*/
ch = get_char(p, dctl);
if (isdigit((unsigned char)ch)) {
/* A name preceded by its length, e.g., "3abc". Put out "&name". */
if (!suppress_address_of) write_id_ch('&', dctl);
/* Process the length and name. */
p = demangle_identifier_with_preceding_length(
p,
/*suppress_parent_and_local_info=*/FALSE,
dctl);
} else if (ch == 'L') {
/* Emit parentheses around the literal if requested. */
if (need_parens) write_id_ch('(', dctl);
if (type == NULL) {
bad_mangled_name(dctl);
} else if (get_char(p+1, dctl) == 'M') {
/* Pointer-to-member-function. The form of the constant is
LM0_L2n1_1j Non-virtual function
LM0_L11_0 Virtual function
LM0_L10_0 Null pointer
The three parts match the three components of the __mptr structure:
(delta, index, function or offset). The index is -1 for a non-virtual
function, 0 for a null pointer, and greater than 0 for a virtual
function. The index is represented like an integer constant (see
above). For virtual functions, the last component is always "0"
even if the offset is not zero. */
/* Advance past the "LM". */
p += 2;
/* Advance over the first component, ignoring it. */
while (isdigit((unsigned char)get_char(p, dctl))) p++;
p = advance_past_underscore(p, dctl);
/* The index component should be next. */
if (get_char(p, dctl) != 'L') {
bad_mangled_name(dctl);
goto end_of_routine;
} /* if */
p++;
/* Get the index length. */
/* Note that get_length_with_optional_underscore is not used because
this is an ambiguous situation: an underscore follows the index
value, and there's no way to tell if it's the multi-digit
indicator for the length or the separator between fields. */
if (get_char(p, dctl) == '_') {
/* New-form encoding, no ambiguity. */
p = get_length_with_optional_underscore(p, &nchars, &prev_end, dctl);
} else {
p = get_single_digit_length(p, &nchars, &prev_end, dctl);
} /* if */
/* Remember the start of the index. */
index = p;
/* Skip the rest of the index. */
while (isdigit((unsigned char)get_char(p, dctl)) ||
(get_char(p, dctl) == 'n')) p++;
dctl->end_of_name = prev_end;
p = advance_past_underscore(p, dctl);
/* If the index number starts with 'n', this is a non-virtual
function. */
if (*index == 'n') {
/* Non-virtual function. */
/* The third component is a name preceded by its length, e.g.,
"1f". Put out "&A::f", where "A" is the class type retrieved
from the type. */
write_id_ch('&', dctl);
/* Start at type+2 to skip the "C" for const and the "M" for
pointer-to-member. */
(void)demangle_type_name(type+2, dctl);
write_id_str("::", dctl);
/* Demangle the length and name. */
p = demangle_identifier_with_preceding_length(
p,
/*suppress_parent_and_local_info=*/TRUE,
dctl);
} else {
/* Not a non-virtual function. The encoding for the third component
should be simply "0". */
if (get_char(p, dctl) != '0') {
bad_mangled_name(dctl);
goto end_of_routine;
} /* if */
p++;
if (nchars == 1 && *index == '0') {
/* Null pointer constant. Output "(type)0", that is, a zero cast
to the pointer-to-member type. */
write_id_ch('(', dctl);
(void)demangle_type(type, dctl);
write_id_str(")0", dctl);
} else {
/* Virtual function. This case can't really be demangled properly,
because the mangled name doesn't have enough information.
Output "&A::virtual-function-n". */
write_id_ch('&', dctl);
/* Start at type+2 to skip the "C" for const and the "M" for
pointer-to-member. */
(void)demangle_type_name(type+2, dctl);
write_id_str("::", dctl);
write_id_str("virtual-function-", dctl);
/* Write the index number. */
for (; nchars > 0; nchars--, index++) write_id_ch(*index, dctl);
} /* if */
} /* if */
} else if (get_char(p+1, dctl) == 'S') {
/* String literal constant. */
p+=2;
if (type == NULL) {
bad_mangled_name(dctl);
} else {
/* The type is the type of the string. Emit "..." cast to the
proper type. */
write_id_ch('(', dctl);
(void)demangle_type(type+1, dctl);
write_id_str(")\"...\"", dctl);
} /* if */
} else {
/* Normal literal constant. Form is something like
L3n12 encoding for -12
^^^---- Characters of constant. Some characters get remapped:
n --> -
p --> +
d --> .
^------- Length of constant.
Output is
(type)constant
That is, the literal constant preceded by a cast to the right type.
*/
/* See if the type is bool. */
a_boolean is_bool = (type+2 == p && *(type+1) == 'b');
a_boolean is_managed_nullptr = (type+2 == p && *(type+1) == 'j');
a_boolean is_nullptr = (type+2 == p && *(type+1) == 'n') ||
is_managed_nullptr;
a_boolean is_complex = (type+3 == p && *(type+1) == 'x');
/* If the type is bool or nullptr, don't put out the cast. */
if (!(is_bool || is_nullptr)) {
write_id_ch('(', dctl);
/* Start at type+1 to avoid the "C" for const. */
(void)demangle_type(type+1, dctl);
write_id_ch(')', dctl);
} /* if */
if (is_complex) write_id_ch('(', dctl);
p++; /* Advance past the "L". */
if (is_managed_nullptr) {
/* If this is a managed C++/CLI __nullptr, emit the underscores to
distinguish it from the standard nullptr. */
write_id_str("__", dctl);
} /* if */
p = demangle_constant_value(p, is_bool, is_nullptr, dctl);
if (!dctl->err_in_id && is_complex) {
/* Now emit the imaginary portion of the complex number. */
write_id_ch('+', dctl);
p = demangle_constant_value(p, /*is_bool=*/FALSE, /*is_nullptr=*/FALSE,
dctl);
write_id_str("i)", dctl);
} /* if */
} /* if */
if (need_parens) write_id_ch(')', dctl);
} else if (ch == 'Z') {
/* A template parameter. */
p = demangle_template_parameter_name(p, /*nontype=*/TRUE, dctl);
} else if (ch == 'O') {
/* An operation. */
p = demangle_operation(p, need_parens, dctl);
} else {
/* The constant starts with something unexpected. */
bad_mangled_name(dctl);
} /* if */
end_of_routine:
return p;
} /* demangle_constant */
static char *demangle_type_qualifiers(
char *ptr,
a_boolean trailing_space,
a_decode_control_block_ptr dctl);
char *demangle_parameter_reference(char *ptr,
a_decode_control_block_ptr dctl)
/*
Demangle a function parameter reference (e.g., in a late specified return
type) as pointed to by ptr:
v-vv----- These are optional.
IC1_2I <-- "const param#1 two levels up"
^---- Terminating non-digit character so parameter number won't run
into an entity with an initial length.
^^----- Number of "levels up" for this parameter (0-based). Omitted
if zero.
^------- Parameter number (1-based) or 0 for "this".
^-------- Optional cv-qualifiers.
^--------- "I" indicates parameter reference.
*/
{
char *p = ptr;
unsigned long num, level = 0;
char buffer[50];
/* Advance past the initial "I" (verified by caller). */
p++;
if (is_immediate_type_qualifier(p, dctl)) {
/* Get any optional cv-qualifiers. */
p = demangle_type_qualifiers(p, /*trailing_space=*/TRUE, dctl);
} /* if */
p = get_number(p, &num, dctl);
if (!dctl->err_in_id) {
if (get_char(p, dctl) != 'I') {
p = advance_past_underscore(p, dctl);
if (!dctl->err_in_id) {
p = get_number(p, &level, dctl);
} /* if */
} /* if */
} /* if */
if (!dctl->err_in_id) {
if (num == 0) {
/* An explicit "this" in a trailing return type. */
write_id_str("this", dctl);
} else {
if (level == 0) {
(void)sprintf(buffer, "param#%ld", num);
} else {
(void)sprintf(buffer, "param#%ld[up %ld level%s]", num, level,
level > 1 ? "s" : "");
} /* if */
write_id_str(buffer, dctl);
} /* if */
p = advance_past('I', p, dctl);
} /* if */
return p;
} /* demangle_parameter_reference */
static char *demangle_expression(char *ptr,
a_boolean need_parens,
a_decode_control_block_ptr dctl)
/*
Demangle an expression; ensure that the expression is enclosed in
parentheses when necessary if need_parens is TRUE (names aren't parenthesized
even when need_parens is TRUE).
*/
{
char *p = ptr;
if (get_char(p, dctl) == 'I') {
/* A function parameter reference. */
p = demangle_parameter_reference(p, dctl);
} else if (get_char(p, dctl) == '_' && get_char(p+1, dctl) == '_') {
/* Certain special names can occur here, for example, an operator name
that appears as the first operand of a call. */
p = demangle_name(p, (unsigned long)0, /*stop_on_underscores=*/TRUE,
(unsigned long *)NULL, (char *)NULL,
(a_template_param_block_ptr)NULL, (a_boolean *)NULL,
dctl);
if (get_char(p, dctl) == '_' && get_char(p+1, dctl) == '_') {
p += 2;
} else {
bad_mangled_name(dctl);
} /* if */
} else {
/* Used to demangle literals as well as template parameters, operations.
Within an expression, suppress implicit "&"s during the demangling. */
p = demangle_constant(p, /*suppress_address_of=*/TRUE, need_parens, dctl);
} /* if */
return p;
} /* demangle_expression */
static char *demangle_operation(char *ptr,
a_boolean need_parens,
a_decode_control_block_ptr dctl)
/*
Demangle an operation in a constant expression (these come up in template
arguments and array sizes, in template function parameter lists) beginning
at ptr, and output the demangled form. When need_parens is TRUE, parentheses
are emitted around the operation. Return a pointer to the character
position following what was demangled.
*/
{
char *p = ptr, *operator_str, *close_str = "";
int op_length;
unsigned long num_operands, i, num_dimensions;
a_boolean takes_type, is_new_style_cast, is_postfix, need_adl_parens;
a_boolean has_variable_number_of_operands = FALSE, is_initializer_list;
a_boolean is_call = FALSE, is_cli_subscript = FALSE;
/* An operation has the form
Opl2Z1ZZ2ZO <-- "Z1 + Z2", Z1/Z2 indicating nontype template parameters.
^---- "O" to end the operation encoding.
^^^----- Second operand.
^^^-------- First operand.
^----------- Count of operands (which may or may not have an
initial "_" indicating possibly more than 9 operands).
^^------------ Operation, using same encoding as for operator
function names.
^-------------- "O" for operation.
*/
p++; /* Advance past the "O". */
/* Decode the operator name, e.g., "pl" is "+". */
operator_str = demangle_operator(p, &op_length, &takes_type,
&is_new_style_cast, &is_postfix,
&need_adl_parens, &is_initializer_list,
dctl);
if (operator_str == NULL) {
bad_mangled_name(dctl);
} else {
p += op_length;
/* Put parentheses around the operation if necessary. */
if (need_parens) write_id_ch('(', dctl);
if (is_initializer_list) {
/* An initializer list (with an optional type). */
if (takes_type) {
p = demangle_type(p, dctl);
} /* if */
write_id_str(operator_str, dctl);
has_variable_number_of_operands = TRUE;
close_str = "}";
} else if (takes_type) {
/* For casts, sizeof, __alignof__, __uuidof__, typeid, new, or sizeof...
get the type. */
if (strcmp(operator_str, "cast") == 0) {
char *num_args_ptr;
/* A "cast" can have zero or more operands (aside from the type).
For casts with exactly one operand, emit "(type)arg", but for
other cases, emit the functional-notation type conversion syntax:
"type(args)". Look ahead at the number of arguments to determine
which case we have. */
dctl->suppress_id_output++;
num_args_ptr = demangle_type(p, dctl);
dctl->suppress_id_output--;
(void)get_number_with_optional_underscore(num_args_ptr,
&num_operands, dctl);
if (!dctl->err_in_id) {
operator_str = "";
if (num_operands == 1) {
/* Output as "(type)arg". */
write_id_ch('(', dctl);
p = demangle_type(p, dctl);
write_id_ch(')', dctl);
} else {
/* Output as "type(args)". */
p = demangle_type(p, dctl);
write_id_ch('(', dctl);
has_variable_number_of_operands = TRUE;
close_str = ")";
} /* if */
} /* if */
} else if (strcmp(operator_str, "sizeof(") == 0 ||
strcmp(operator_str, "__alignof__(") == 0 ||
strcmp(operator_str, "__uuidof(") == 0 ||
strcmp(operator_str, "typeid(") == 0 ||
strcmp(operator_str, "sizeof...(") == 0) {
/* These manglings have three forms, dependent on the next character
in the mangled name. They're sufficiently different that they
are handled (mostly separately) here. */
write_id_str(operator_str, dctl);
operator_str = "";
if (get_char(p, dctl) == 'e') {
/* An "old style expression" where the expression was not
encoded (and the operand count is zero). Just note that there
was an expression and we're done. */
write_id_str("expr)", dctl);
p++;
} else if (get_char(p, dctl) == 'X') {
/* A "new style expression" where the expression is
included in the mangled name and will be demangled below. */
close_str = ")";
p++;
} else {
/* The "type" case; simply decode the type (the mangled
encoding specifies zero operands -- which are ignored below). */
p = demangle_type(p, dctl);
write_id_ch(')', dctl);
} /* if */
} else if (strcmp(operator_str, "::typeid") == 0) {
/* C++/CLI T::typeid. */
p = demangle_type(p, dctl);
write_id_str(operator_str, dctl);
} else {
/* Generic processing of items that take a type (e.g., static_cast). */
write_id_str(operator_str, dctl);
p = demangle_type(p, dctl);
if (is_new_style_cast) {
/* Something like static_cast<type>(expression). The operator and
type have been emitted, close the type with a right angle
bracket and parse the expression below. */
operator_str = "";
write_id_str(">(", dctl);
close_str = ")";
} else {
write_id_ch(')', dctl);
} /* if */
} /* if */
} else if (strcmp(operator_str, "builtin-operation") == 0) {
unsigned long kind;
/* A builtin operation. */
has_variable_number_of_operands = TRUE;
write_id_str("builtin-operation-", dctl);
/* Extract the operation number following the "bi". */
p = advance_past_underscore(p, dctl);
p = get_number(p, &kind, dctl);
if (kind > 99) {
bad_mangled_name(dctl);
} else {
write_id_number(kind, dctl);
} /* if */
p = advance_past_underscore(p, dctl);
write_id_ch('(', dctl);
close_str = ")";
} else if (strcmp(operator_str, "__real(") == 0 ||
strcmp(operator_str, "__imag(") == 0 ||
strcmp(operator_str, "noexcept(") == 0) {
/* These need a closing paren after their operand. */
close_str = ")";
} else if (strcmp(operator_str, "()") == 0) {
/* A call operation. The first operand is the target of the call,
the rest are arguments. */
operator_str = "";
is_call = TRUE;
has_variable_number_of_operands = TRUE;
} else if (strcmp(operator_str, "new") == 0 ||
strcmp(operator_str, "new[]") == 0) {
/* new has an optional "g" (indicating that ::new was used), followed by
an optional initial list of placement expressions, followed
by a type and then another optional list of initializer
expressions. Handle the first expression list and the type here,
then let the generic loop below handle the initializer list. */
/* new may have an optional "g" indicating a global scope new. */
if (get_char(p, dctl) == 'g') {
p++;
write_id_str("::", dctl);
} /* if */
write_id_str(operator_str, dctl);
write_id_ch(' ', dctl);
operator_str = "";
has_variable_number_of_operands = TRUE;
/* Get the count of operands. */
p = get_number_with_optional_underscore(p, &num_operands, dctl);
if (num_operands != 0) {
write_id_ch('(', dctl);
for (i = 1; i <= num_operands; i++) {
p = demangle_expression(p, /*need_parens=*/FALSE, dctl);
if (i != num_operands) write_id_str(", ", dctl);
} /* for */
write_id_str(") ", dctl);
} /* if */
p = demangle_type(p, dctl);
handle_new_operands:
if (get_char(p, dctl) == 'O') {
/* There are no initializers; skip the loop below. */
goto skip_operand_loop;
} /* if */
if (get_char(p, dctl) == 'b' && get_char(p+1, dctl) == 'i') {
/* A brace-enclosed initializer list. */
p += 2;
write_id_ch('{', dctl);
close_str = "}";
} else {
/* A parenthesized initializer list. */
write_id_ch('(', dctl);
close_str = ")";
} /* if */
} else if (strcmp(operator_str, "gcnew") == 0) {
/* C++/CLI gcnew. */
write_id_str(operator_str, dctl);
write_id_ch(' ', dctl);
operator_str = "";
has_variable_number_of_operands = TRUE;
/* Get the count of dimensions. */
p = get_number_with_optional_underscore(p, &num_dimensions, dctl);
if (num_dimensions == 0) {
/* Non-array case. */
p = demangle_type(p, dctl);
} else {
char *dim_p = p;
/* Array case; emit the dimensions (but emit the type first). */
dctl->suppress_id_output++;
for (i = 1; i <= num_dimensions; i++) {
p = demangle_expression(p, /*need_parens=*/FALSE, dctl);
} /* for */
dctl->suppress_id_output--;
p = demangle_type(p, dctl);
write_id_ch('(', dctl);
for (i = 1; i <= num_dimensions; i++) {
dim_p = demangle_expression(dim_p, /*need_parens=*/FALSE, dctl);
if (i != num_dimensions) write_id_str(", ", dctl);
} /* for */
write_id_str(") ", dctl);
} /* if */
goto handle_new_operands;
} else if (strcmp(operator_str, "delete") == 0 ||
strcmp(operator_str, "delete[]") == 0) {
/* delete may have an optional "g" indicating a global scope delete. */
if (get_char(p, dctl) == 'g') {
p++;
write_id_str("::", dctl);
} /* if */
} else if (strcmp(operator_str, "subscript") == 0) {
/* A C++/CLI subscript operation (with a variable number of operands). */
has_variable_number_of_operands = TRUE;
is_cli_subscript = TRUE;
} /* if */
/* Get the count of operands. */
p = get_number_with_optional_underscore(p, &num_operands, dctl);
/* Some operations (e.g., sizeof(type), __alignof__(type), etc.) take
zero operands. */
if (num_operands != 0) {
if (has_variable_number_of_operands) {
/* Operation has a variable number of operations, and
they may be type operands (i.e., builtin-operation). */
for (i = 1; i <= num_operands; i++) {
if (get_char(p, dctl) == 'T') {
/* Type operand. */
p = demangle_type(p+1, dctl);
} else {
p = demangle_expression(p, need_adl_parens, dctl);
} /* if */
if (is_call) {
/* This is a call to the target just emitted; the rest are
arguments. */
write_id_str("(", dctl);
close_str = ")";
is_call = FALSE;
} else if (is_cli_subscript) {
/* This is a C++/CLI subscript operation, we've just emitted
the array, the remaining operands are subscripts. */
write_id_str("[", dctl);
close_str = "]";
is_cli_subscript = FALSE;
} else if (i != num_operands) {
write_id_str(", ", dctl);
} /* if */
} /* for */
} else {
/* Normal case, i.e., the operation has one, two, or three operands
(and isn't an operation that has a variable number of operands --
some of which may be types -- like a builtin-operation). */
if (num_operands == 1 && !is_postfix) {
/* Prefix unary operator -- operator comes first. */
write_id_str(operator_str, dctl);
if (strcmp(operator_str, "delete") == 0 ||
strcmp(operator_str, "delete[]") == 0) {
/* Add a space to separate from expression. */
write_id_ch(' ', dctl);
} /* if */
} /* if */
/* Process the first operand. */
p = demangle_expression(p, /*need_parens=*/TRUE, dctl);
if (num_operands == 1 && is_postfix) {
/* Postfix unary operator -- operator comes last. */
write_id_str(operator_str, dctl);
} /* if */
if (num_operands > 1) {
/* Binary and ternary operators -- operator comes after first
operand. */
if (strcmp(operator_str, "[]") == 0) {
/* For subscripting, put one "[" between the operands and one
at the end. */
operator_str = "[";
close_str = "]";
} /* if */
write_id_str(operator_str, dctl);
/* Process the second operand. */
p = demangle_expression(p, /*need_parens=*/TRUE, dctl);
if (num_operands > 2) {
/* Ternary operand -- "?". */
write_id_ch(':', dctl);
/* Process the third operand. */
p = demangle_expression(p, /*need_parens=*/TRUE, dctl);
} /* if */
} /* if */
} /* if */
} else if (strcmp(operator_str, "throw ") == 0) {
/* A rethrow has no operands, just put out the string. */
write_id_str(operator_str, dctl);
} /* if */
write_id_str(close_str, dctl);
skip_operand_loop:
if (need_parens) write_id_ch(')', dctl);
/* Check for the final "O". */
if (get_char(p, dctl) != 'O') {
bad_mangled_name(dctl);
} else {
p++;
} /* if */
} /* if */
return p;
} /* demangle_operation */
static void clear_template_param_block(a_template_param_block_ptr tpbp)
/*
Clear the fields of the indicated template parameter block.
*/
{
tpbp->nesting_level = 0;
tpbp->final_specialization = NULL;
tpbp->set_final_specialization = FALSE;
tpbp->actual_template_args_until_final_specialization = FALSE;
tpbp->output_only_correspondences = FALSE;
tpbp->first_correspondence = FALSE;
tpbp->use_old_form_for_template_output = FALSE;
} /* clear_template_param_block */
char *demangle_template_arguments(
char *ptr,
a_boolean emit_arg_values,
a_template_param_block_ptr temp_par_info,
a_decode_control_block_ptr dctl)
/*
Demangle the template class arguments or template parameter pack beginning at
ptr and output the demangled form. Return a pointer to the character position
following what was demangled. ptr points to just past the "__tm__", "__ps__",
"__pt__", or "__pk__" string. emit_arg_values is TRUE if the template
argument "values" (i.e., type or nontype value) should be emitted rather than
the template parameter name. This is used for a partial-specialization
parameter list ("__ps__") or parameter pack ("__pk__"). When temp_par_info !=
NULL, it points to a block that controls output of extra information on
template parameters.
*/
{
char *p = ptr, *arg_base, ch, *prev_end;
unsigned long nchars, position;
a_boolean nontype, skipped, unskipped, is_pack;
if (temp_par_info != NULL && !emit_arg_values) {
temp_par_info->nesting_level++;
} /* if */
/* A template argument list looks like
__tm__3_ii
^^---- Argument types.
^------- Size of argument types, including the underscore.
^------- ptr points here.
For the first argument list of a partial specialization, "__tm__" is
replaced by "__ps__". For old-form mangling of templates, "__tm__"
is replaced by "__pt__". Template arguments can be either nontype
(as identified by an "X"), a template argument pack (as identified
by "__pk__"), or types (otherwise).
*/
write_id_ch('<', dctl);
/* Scan the size. */
p = get_length(p, &nchars, &prev_end, dctl);
arg_base = p;
p = advance_past_underscore(p, dctl);
/* Loop to process the arguments. */
for (position = 1;; position++) {
/* Check for zero arguments case. */
if ((unsigned long)(p - arg_base) >= nchars) break;
if (dctl->err_in_id) break; /* Avoid infinite loops on errors. */
if (start_of_id_is("__pk__", p, dctl)) {
/* Template argument packs are encoded much like a template argument
list, except "__pk__" is used to introduce them:
__pk__3_sc
^^---- Argument types.
^------- Size of argument types, including the underscore.
*/
is_pack = TRUE;
p+=6; /* Advance past the "__pk__". */
} else {
is_pack = FALSE;
} /* if */
ch = get_char(p, dctl);
if (ch == '\0' || (ch == '_' && !is_pack)) {
/* We ran off the end of the string. */
bad_mangled_name(dctl);
break;
} /* if */
/* "X" identifies the beginning of a nontype argument. */
nontype = (ch == 'X');
skipped = unskipped = FALSE;
if (!emit_arg_values && temp_par_info != NULL &&
!temp_par_info->use_old_form_for_template_output &&
!temp_par_info->actual_template_args_until_final_specialization) {
/* Doing something special: writing out the template parameter name. */
if (temp_par_info->output_only_correspondences) {
/* This is the second pass, which writes out parameter/argument
correspondences, e.g., "T1=int". Output has been suppressed
in general, and is turned on briefly here. */
dctl->suppress_id_output--;
unskipped = TRUE;
/* Put out a comma between entries and a left bracket preceding the
first entry. */
if (temp_par_info->first_correspondence) {
write_id_str(" [with ", dctl);
temp_par_info->first_correspondence = FALSE;
} else {
write_id_str(", ", dctl);
} /* if */
} /* if */
/* Write the template parameter name. */
write_template_parameter_name(temp_par_info->nesting_level, position,
nontype, dctl);
if (temp_par_info->output_only_correspondences) {
/* This is the second pass, to write out correspondences, so put the
argument value out after the parameter name. */
if (is_pack) {
/* Indicate this is a pack (only in the correspondences). */
write_id_str("...", dctl);
} /* if */
write_id_ch('=', dctl);
} else {
/* This is the first pass. The argument value is skipped. In
the second pass, its value will be written out. */
/* We still have to scan over the argument value, but suppress
output. */
dctl->suppress_id_output++;
skipped = TRUE;
} /* if */
} /* if */
/* Write the argument value. */
if (nontype) {
/* Nontype argument. */
p++; /* Advance past the "X". */
p = demangle_constant(p, /*suppress_address_of=*/FALSE,
/*need_parens=*/FALSE, dctl);
} else if (is_pack) {
/* A template argument pack. */
a_template_param_block pack_temp_par_info;
clear_template_param_block(&pack_temp_par_info);
/* Recurse to handle the template argument pack. */
p = demangle_template_arguments(p, /*emit_arg_values=*/TRUE,
&pack_temp_par_info, dctl);
} else {
/* Type argument. */
p = demangle_type(p, dctl);
} /* if */
if (skipped) dctl->suppress_id_output--;
if (unskipped) dctl->suppress_id_output++;
/* Stop after the last argument. */
if ((unsigned long)(p - arg_base) >= nchars) break;
write_id_str(", ", dctl);
} /* for */
dctl->end_of_name = prev_end;
write_id_ch('>', dctl);
return p;
} /* demangle_template_arguments */
static char *demangle_operator(char *ptr,
int *mangled_length,
a_boolean *takes_type,
a_boolean *is_new_style_cast,
a_boolean *is_postfix,
a_boolean *need_adl_parens,
a_boolean *is_initializer_list,
a_decode_control_block_ptr dctl)
/*
Examine the first few characters at ptr to see if they are an encoding for
an operator (e.g., "pl" for plus). If so, return a pointer to a string for
the operator (e.g., "+"), set *mangled_length to the number of characters
in the encoding, and *takes_type to TRUE if the operator takes a type
modifier (e.g., cast). *is_new_style_cast is set to TRUE if the operator
is a new style cast (and needs a closing '>' and expression emitted).
*is_postfix is set to TRUE if the operator is a postfix operator (unary
operators are typically emitted as prefix). *need_adl_parens is set to TRUE
if the operator is a call that requires parentheses to suppress ADL.
*is_initializer_list is set to TRUE if the operator is an initializer list.
If the first few characters are not an operator encoding, return NULL.
*/
{
char *s;
int len = 2;
*takes_type = FALSE;
*is_new_style_cast = FALSE;
*is_postfix = FALSE;
*need_adl_parens = FALSE;
*is_initializer_list = FALSE;
/* The length-3 codes are tested first to avoid taking their first two
letters as one of the length-2 codes. */
if (start_of_id_is("apl", ptr, dctl)) {
s = "+=";
len = 3;
} else if (start_of_id_is("ami", ptr, dctl)) {
s = "-=";
len = 3;
} else if (start_of_id_is("amu", ptr, dctl)) {
s = "*=";
len = 3;
} else if (start_of_id_is("adv", ptr, dctl)) {
s = "/=";
len = 3;
} else if (start_of_id_is("amd", ptr, dctl)) {
s = "%=";
len = 3;
} else if (start_of_id_is("aer", ptr, dctl)) {
s = "^=";
len = 3;
} else if (start_of_id_is("aad", ptr, dctl)) {
s = "&=";
len = 3;
} else if (start_of_id_is("aor", ptr, dctl)) {
s = "|=";
len = 3;
} else if (start_of_id_is("ars", ptr, dctl)) {
s = ">>=";
len = 3;
} else if (start_of_id_is("als", ptr, dctl)) {
s = "<<=";
len = 3;
} else if (start_of_id_is("ppe", ptr, dctl)) {
s = "++";
len = 3;
} else if (start_of_id_is("mme", ptr, dctl)) {
s = "--";
len = 3;
} else if (start_of_id_is("nwa", ptr, dctl)) {
s = "new[]";
len = 3;
} else if (start_of_id_is("dla", ptr, dctl)) {
s = "delete[]";
len = 3;
} else if (start_of_id_is("nw", ptr, dctl)) {
s = "new";
} else if (start_of_id_is("gc", ptr, dctl)) {
s = "gcnew";
} else if (start_of_id_is("dl", ptr, dctl)) {
s = "delete";
} else if (start_of_id_is("pl", ptr, dctl)) {
s = "+";
} else if (start_of_id_is("mi", ptr, dctl)) {
s = "-";
} else if (start_of_id_is("ml", ptr, dctl)) {
s = "*";
} else if (start_of_id_is("dv", ptr, dctl)) {
s = "/";
} else if (start_of_id_is("md", ptr, dctl)) {
s = "%";
} else if (start_of_id_is("er", ptr, dctl)) {
s = "^";
} else if (start_of_id_is("ad", ptr, dctl)) {
s = "&";
} else if (start_of_id_is("or", ptr, dctl)) {
s = "|";
} else if (start_of_id_is("co", ptr, dctl)) {
s = "~";
} else if (start_of_id_is("nt", ptr, dctl)) {
s = "!";
} else if (start_of_id_is("as", ptr, dctl)) {
s = "=";
} else if (start_of_id_is("lt", ptr, dctl)) {
s = "<";
} else if (start_of_id_is("gt", ptr, dctl)) {
s = ">";
} else if (start_of_id_is("ls", ptr, dctl)) {
s = "<<";
} else if (start_of_id_is("rs", ptr, dctl)) {
s = ">>";
} else if (start_of_id_is("eq", ptr, dctl)) {
s = "==";
} else if (start_of_id_is("ne", ptr, dctl)) {
s = "!=";
} else if (start_of_id_is("le", ptr, dctl)) {
s = "<=";
} else if (start_of_id_is("ge", ptr, dctl)) {
s = ">=";
} else if (start_of_id_is("aa", ptr, dctl)) {
s = "&&";
} else if (start_of_id_is("oo", ptr, dctl)) {
s = "||";
} else if (start_of_id_is("pp", ptr, dctl)) {
s = "++";
*is_postfix = TRUE;
} else if (start_of_id_is("mm", ptr, dctl)) {
s = "--";
*is_postfix = TRUE;
} else if (start_of_id_is("cm", ptr, dctl)) {
s = ",";
} else if (start_of_id_is("rm", ptr, dctl)) {
s = "->*";
} else if (start_of_id_is("rf", ptr, dctl)) {
s = "->";
} else if (start_of_id_is("cl", ptr, dctl)) {
s = "()";
} else if (start_of_id_is("cp", ptr, dctl)) {
*need_adl_parens = TRUE;
s = "()";
} else if (start_of_id_is("vc", ptr, dctl)) {
s = "[]";
} else if (start_of_id_is("qs", ptr, dctl)) {
s = "?";
} else if (start_of_id_is("mn", ptr, dctl)) {
s = "<?";
} else if (start_of_id_is("mx", ptr, dctl)) {
s = ">?";
} else if (start_of_id_is("ds", ptr, dctl)) {
s = ".*";
} else if (start_of_id_is("dt", ptr, dctl)) {
s = ".";
} else if (start_of_id_is("ps", ptr, dctl)) {
s = "+";
} else if (start_of_id_is("ng", ptr, dctl)) {
s = "-";
} else if (start_of_id_is("de", ptr, dctl)) {
s = "*";
} else if (start_of_id_is("ao", ptr, dctl)) {
s = "&";
} else if (start_of_id_is("rl", ptr, dctl)) {
s = "__real(";
} else if (start_of_id_is("im", ptr, dctl)) {
s = "__imag(";
} else if (start_of_id_is("dc", ptr, dctl)) {
s = "dynamic_cast<";
*is_new_style_cast = TRUE;
*takes_type = TRUE;
} else if (start_of_id_is("sc", ptr, dctl)) {
s = "static_cast<";
*is_new_style_cast = TRUE;
*takes_type = TRUE;
} else if (start_of_id_is("cc", ptr, dctl)) {
s = "const_cast<";
*is_new_style_cast = TRUE;
*takes_type = TRUE;
} else if (start_of_id_is("rc", ptr, dctl)) {
s = "reinterpret_cast<";
*is_new_style_cast = TRUE;
*takes_type = TRUE;
} else if (start_of_id_is("sf", ptr, dctl)) {
s = "safe_cast<";
*is_new_style_cast = TRUE;
*takes_type = TRUE;
} else if (start_of_id_is("tw", ptr, dctl)) {
s = "throw ";
} else if (start_of_id_is("sz", ptr, dctl)) {
s = "sizeof(";
*takes_type = TRUE;
} else if (start_of_id_is("cs", ptr, dctl)) {
s = "cast";
*takes_type = TRUE;
} else if (start_of_id_is("af", ptr, dctl)) {
s = "__alignof__(";
*takes_type = TRUE;
} else if (start_of_id_is("uu", ptr, dctl)) {
s = "__uuidof(";
*takes_type = TRUE;
} else if (start_of_id_is("ty", ptr, dctl)) {
s = "typeid(";
*takes_type = TRUE;
} else if (start_of_id_is("ct", ptr, dctl)) {
s = "::typeid";
*takes_type = TRUE;
} else if (start_of_id_is("bi", ptr, dctl)) {
s = "builtin-operation";
} else if (start_of_id_is("sp", ptr, dctl)) {
s = "...";
*is_postfix = TRUE;
} else if (start_of_id_is("sk", ptr, dctl)) {
s = "sizeof...(";
*takes_type = TRUE;
} else if (start_of_id_is("ht", ptr, dctl)) {
s = "%";
} else if (start_of_id_is("sb", ptr, dctl)) {
s = "subscript";
} else if (start_of_id_is("il", ptr, dctl)) {
s = "{";
*is_initializer_list = TRUE;
} else if (start_of_id_is("tl", ptr, dctl)) {
s = "{";
*takes_type = TRUE;
*is_initializer_list = TRUE;
} else if (start_of_id_is("nx", ptr, dctl)) {
s = "noexcept(";
} else {
s = NULL;
} /* if */
*mangled_length = len;
return s;
} /* demangle_operator */
static a_boolean is_operator_function_name(
char *ptr,
char **demangled_name,
int *mangled_length,
a_decode_control_block_ptr dctl)
/*
Examine the string beginning at ptr to see if it is the mangled name for
an operator function. If so, return TRUE and set *demangled_name to
the demangled form, and *mangled_length to the length of the mangled form.
*/
{
char *s, *end_ptr;
int len;
a_boolean takes_type, is_new_style_cast, is_postfix, need_adl_parens;
a_boolean is_initializer_list;
/* Get the operator name. */
s = demangle_operator(ptr, &len, &takes_type, &is_new_style_cast,
&is_postfix, &need_adl_parens, &is_initializer_list,
dctl);
if (s != NULL) {
/* Make sure we took the whole name and nothing more. */
end_ptr = ptr + len;
if (get_char(end_ptr, dctl) == '\0' ||
(get_char(end_ptr, dctl) == '_' && get_char(end_ptr+1, dctl) == '_')) {
/* Okay. */
} else {
s = NULL;
} /* if */
} /* if */
*demangled_name = s;
*mangled_length = len;
return (s != NULL);
} /* is_operator_function_name */
static void note_specialization(char *ptr,
a_template_param_block_ptr temp_par_info)
/*
Note the fact that a specialization indication has been encountered at ptr
while scanning a mangled name. temp_par_info, if non-NULL, points to
a block of information related to template parameter processing.
*/
{
if (temp_par_info != NULL) {
if (temp_par_info->set_final_specialization) {
/* Remember the location of the last specialization seen. */
temp_par_info->final_specialization = ptr;
} else if (temp_par_info->actual_template_args_until_final_specialization&&
ptr == temp_par_info->final_specialization) {
/* Stop doing the special processing for specializations when the
final specialization is reached. */
temp_par_info->actual_template_args_until_final_specialization = FALSE;
} /* if */
} /* if */
} /* note_specialization */
static char *demangle_function_local_indication(
char *ptr,
unsigned long nchars,
unsigned long *instance,
a_decode_control_block_ptr dctl)
/*
Demangle the function name and id number in a function-local indication:
__L2__f__Fv
^-- returned pointer points here
^------- mangled function name
^---------- instance number within function (ptr points here on entry)
ptr points to the character after the "__L". If nchars is non-zero, it
indicates the length of the string, starting from ptr. Return a pointer
to the character following the mangled function name. Output a function
indication like "f(void)::". The instance number is simply a way of
differentiating between similarly named entities in the same function and
may be a discriminator (for class/scoped enums), scope number, or block number
depending what is being mangled and is returned to the caller in *instance.
This allows the caller to emit it later (after the name of the entity) or
suppress it (in cases where it is duplicated).
*/
{
char *p = ptr, *prev_end = NULL;
if (nchars != 0) {
prev_end = dctl->end_of_name;
dctl->end_of_name = ptr + nchars;
} /* if */
/* Get the instance number. */
p = get_number(ptr, instance, dctl);
/* Check for the two underscores following the instance number. For local
class names in some older versions of the mangling scheme, there is no
following function name. */
if (get_char(p, dctl) == '_' && get_char(p+1, dctl) == '_') {
p += 2;
/* Put out the function name. */
if (nchars != 0) nchars -= (p - ptr);
p = full_demangle_identifier(p, nchars,
/*suppress_parent_and_local_info=*/FALSE,
dctl);
write_id_str("::", dctl);
} /* if */
if (prev_end != NULL) dctl->end_of_name = prev_end;
return p;
} /* demangle_function_local_indication */
static void emit_instance(unsigned long instance,
a_decode_control_block_ptr dctl)
/*
The instance number is part of a local function mangling (used to
differentiate between entities with the same name within the same function).
This could represent a discriminator, scope number or block number depending
on what has been mangled. Emit it as an instance number.
*/
{
if (!dctl->err_in_id) {
write_id_str(" (instance ", dctl);
write_id_number(instance, dctl);
write_id_str(")", dctl);
} /* if */
} /* emit_instance */
static char *demangle_name(char *ptr,
unsigned long nchars,
a_boolean stop_on_underscores,
unsigned long *nchars_left,
char *mclass,
a_template_param_block_ptr temp_par_info,
a_boolean *instance_emitted,
a_decode_control_block_ptr dctl)
/*
Demangle the name at ptr and output the demangled form. Return a pointer
to the character position following what was demangled. A "name" is
usually just a string of alphanumeric characters. However, names of
constructors, destructors, and operator functions require special
handling, as do template entity names. A name at this level
does not include any associated parent or function-local information,
nor function-parameter information. nchars indicates the number
of characters in the name, or is zero if the name is open-ended
(it's ended by a null or double underscore). A double underscore
ends the name if stop_on_underscores is TRUE (though some sequences
beginning with two underscores and related to templates, e.g., "__pt",
are recognized and processed locally regardless of the setting of
stop_on_underscores). If nchars_left is non-NULL, no error is
issued if too few characters are taken to satisfy nchars;
the count of remaining characters is placed in *nchars_left.
mclass, when non-NULL, points to the mangled form of the class of
which this name is a member. When it's non-NULL, constructor and
destructor names will be put out in the proper form (otherwise,
they are left in their original forms). If instance_emitted is non-NULL,
it is set to TRUE if the name has an instance number (as is the case
with unnamed types and lambdas); this allows the caller to suppress
duplicate instance numbers when the type appears in a local environment.
instance_emitted is set to FALSE otherwise. When temp_par_info != NULL,
it points to a block that controls output of extra information on
template parameters.
*/
{
char *p, *end_ptr = NULL, *prev_end = NULL;
a_boolean is_special_name = FALSE, is_pt, is_partial_spec = FALSE;
a_boolean partial_spec_output_suppressed = FALSE;
char *demangled_name;
int mangled_length;
unsigned long discriminator;
if (instance_emitted != NULL) *instance_emitted = FALSE;
if (nchars != 0) {
prev_end = dctl->end_of_name;
dctl->end_of_name = ptr + nchars;
} /* if */
if (nchars_left != NULL) *nchars_left = 0;
/* See if the name is special in some way. */
if (get_char(ptr, dctl) == '_' && get_char(ptr+1, dctl) == '_') {
/* Name beginning with two underscores. */
p = ptr + 2;
if (start_of_id_is("ct__", p, dctl) ||
start_of_id_is("st__", p, dctl)) {
/* Constructor or C++/CLI static constructor. */
end_ptr = p + 2;
if (mclass == NULL) {
/* The mangled name for the class is not provided, so handle this as
a normal name. */
} else {
/* Output the class name for the constructor name. */
is_special_name = TRUE;
(void)full_demangle_type_name(mclass, /*base_name_only=*/TRUE,
/*temp_par_info=*/
(a_template_param_block_ptr)NULL,
/*is_destructor_name=*/FALSE,
dctl);
if (start_of_id_is("st__", p, dctl)) {
/* Add an indication that this is a C++/CLI static constructor. */
write_id_str("[static]", dctl);
} /* if */
} /* if */
} else if (start_of_id_is("dt__", p, dctl) ||
start_of_id_is("df__", p, dctl)) {
/* Destructor or C++/CLI finalizer. */
end_ptr = p + 2;
if (mclass == NULL) {
/* The mangled name for the class is not provided, so handle this as
a normal name. */
} else {
/* Output ~class-name for the destructor name, or !class-name for
a C++/CLI finalizer. */
is_special_name = TRUE;
if (start_of_id_is("df__", p, dctl)) {
write_id_ch('!', dctl);
} else {
write_id_ch('~', dctl);
} /* if */
(void)full_demangle_type_name(mclass, /*base_name_only=*/TRUE,
/*temp_par_info=*/
(a_template_param_block_ptr)NULL,
/*is_destructor_name=*/FALSE,
dctl);
} /* if */
} else if (start_of_id_is("dn__", p, dctl)) {
/* Destructor name. */
/* This differs from the dt__ case above in two ways: its demangling
doesn't always have a scope operator (i.e., ::), and it doesn't
require that the destructor name be the same as the qualifying type
(e.g., it can handle T::~X()). What follows (a "destructor name")
can be parsed as a nested type, but has an implied ~ before the
final qualifier. For example, Q4_1A1B1C1D would demangle as
A::B::C::~D and 1A would demangle as ~A (as in a.~A()). */
is_special_name = TRUE;
if (get_char(p+4, dctl) == 'Q') {
/* Destructor is qualified. */
end_ptr = full_demangle_type_name(p+4, /*base_name_only=*/FALSE,
/*temp_par_info=*/
(a_template_param_block_ptr)NULL,
/*is_destructor_name=*/TRUE,
dctl);
} else {
/* An unqualified type. */
write_id_ch('~', dctl);
end_ptr = demangle_type(p+4, dctl);
} /* if */
} else if (start_of_id_is("op", p, dctl)) {
/* Conversion function. Name looks like __opi__... where the part
after "op" encodes the type (e.g., "opi" is "operator int"). */
is_special_name = TRUE;
write_id_str("operator ", dctl);
end_ptr = demangle_type(p+2, dctl);
} else if (is_operator_function_name(p, &demangled_name,
&mangled_length, dctl)) {
/* Operator function. */
is_special_name = TRUE;
write_id_str("operator ", dctl);
write_id_str(demangled_name, dctl);
end_ptr = p + mangled_length;
} else if (nchars != 0 && start_of_id_is("N", p, dctl)) {
/* __Nxxxx: unnamed namespace name. Put out "<unnamed>" and ignore
the characters after "__N". For nested unnamed namespaces there
is no number after the "__N". */
is_special_name = TRUE;
write_id_str("<unnamed>", dctl);
end_ptr = p + nchars - 2;
} else if (nchars != 0 && start_of_id_is("INTERNAL", p, dctl)) {
/* __INTERNAL<module_id>: An individuated namespace name. */
is_special_name = TRUE;
write_id_str("[local to ", dctl);
end_ptr = demangle_module_id(p+8, nchars-(8+2), p-2, dctl);
write_id_str("]", dctl);
} else if (start_of_id_is("Ut", p, dctl)) {
/* __Utnn: An unnamed type. */
write_id_str("[unnamed type", dctl);
p = get_number(p+2, &discriminator, dctl);
if (discriminator > 0) {
write_id_str(" (instance ", dctl);
write_id_number(discriminator, dctl);
write_id_str(")", dctl);
is_special_name = TRUE;
end_ptr = p;
if (instance_emitted != NULL) *instance_emitted = TRUE;
} else {
bad_mangled_name(dctl);
} /* if */
write_id_str("]", dctl);
} else if (start_of_id_is("Ul", p, dctl) ||
start_of_id_is("Um", p, dctl)) {
/* __Ulnn_<function-type> or __Umnn_<function-type>: Lambda closure.
For demangling purposes, treat these the same; the member initializer
case will be preceded by the name of the member being initialized,
so no further words are necessary. */
p = get_number(p+2, &discriminator, dctl);
if (get_char(p, dctl) == '_') {
write_id_str("[lambda", dctl);
p = demangle_type(p+1, dctl);
if (discriminator > 0) {
write_id_str(" (instance ", dctl);
write_id_number(discriminator, dctl);
write_id_str(")", dctl);
is_special_name = TRUE;
end_ptr = p;
if (instance_emitted != NULL) *instance_emitted = TRUE;
} else {
bad_mangled_name(dctl);
} /* if */
write_id_str("]", dctl);
} else {
bad_mangled_name(dctl);
} /* if */
} else if (start_of_id_is("Ud", p, dctl)) {
/* __Udnn_p_<function-type>: Lambda closure in default argument.
Note that this will always appear in a local function context, but
that is handled at a higher level. */
unsigned long param_num;
p = get_number(p+2, &discriminator, dctl);
if (get_char(p, dctl) == '_') {
p = get_number(p+1, ¶m_num, dctl);
if (get_char(p, dctl) == '_') {
write_id_str("[lambda", dctl);
p = demangle_type(p+1, dctl);
write_id_str(" in default argument ", dctl);
write_id_number(param_num, dctl);
write_id_str(" (from end)", dctl);
if (discriminator > 0) {
write_id_str(" (instance ", dctl);
write_id_number(discriminator, dctl);
write_id_str(")", dctl);
is_special_name = TRUE;
end_ptr = p;
if (instance_emitted != NULL) *instance_emitted = TRUE;
} else {
bad_mangled_name(dctl);
} /* if */
write_id_str("]", dctl);
} else {
bad_mangled_name(dctl);
} /* if */
} /* if */
} else {
/* Something unrecognized. */
} /* if */
} /* if */
/* Here, end_ptr non-null means the end of the string has been found
already (because the name is special in some way). */
if (end_ptr == NULL) {
/* Not a special name. Find the end of the string and set end_ptr.
Also look for template-related things that terminate the name
earlier. */
for (p = ptr; ; p++) {
char ch = get_char(p, dctl);
/* Stop at the end of the string. */
if (ch == '\0') break;
/* Stop on a double underscore, but not one at the start of the string.
More than 2 underscores in a row does not terminate the string,
so that something like the name for "void f_()" (i.e., "f___Fv")
can be demangled successfully. */
if (ch == '_' && p != ptr &&
get_char(p+1, dctl) == '_' &&
get_char(p+2, dctl) != '_' &&
/* When stop_on_underscores is FALSE, stop only on "__tm__",
"__ps__", "__pt__", or "__S". Double underscores can appear
in the middle of some names, e.g., member names used as
template arguments. */
(stop_on_underscores ||
(get_char(p+2, dctl) == 't' &&
get_char(p+3, dctl) == 'm' &&
get_char(p+4, dctl) == '_' &&
get_char(p+5, dctl) == '_') ||
(get_char(p+2, dctl) == 'p' &&
get_char(p+3, dctl) == 's' &&
get_char(p+4, dctl) == '_' &&
get_char(p+5, dctl) == '_') ||
(get_char(p+2, dctl) == 'p' &&
get_char(p+3, dctl) == 't' &&
get_char(p+4, dctl) == '_' &&
get_char(p+5, dctl) == '_') ||
get_char(p+2, dctl) == 'S')) {
break;
} /* if */
} /* for */
end_ptr = p;
} /* if */
/* Here, end_ptr indicates the character after the end of the initial
part of the name. */
if (!is_special_name) {
/* Output the characters of the base name. */
for (p = ptr; p < end_ptr; p++) write_id_ch(*p, dctl);
} /* if */
/* If there's a template argument list for a partial specialization
(beginning with "__ps__"), process it. */
if (start_of_id_is("__ps__", end_ptr, dctl)) {
/* Write the arguments. This first argument list gives the arguments
that appear in the partial specialization declaration:
template <class T, class U> struct A { ... };
template <class T> struct A<T *, int> { ... };
^^^^^^^^this argument list
This first argument list will be followed by another argument list
that gives the arguments according to the partial specialization.
For A<int *, int> according to the example above, the second
argument list is <int>. The second argument list is scanned but
not put out, except when argument correspondences are output. */
end_ptr = demangle_template_arguments(end_ptr+6, /*emit_arg_values=*/TRUE,
temp_par_info, dctl);
note_specialization(end_ptr, temp_par_info);
is_partial_spec = TRUE;
} /* if */
/* If there's a specialization indication ("__S"), ignore it. */
if (get_char(end_ptr, dctl) == '_' &&
get_char(end_ptr+1, dctl) == '_' &&
get_char(end_ptr+2, dctl) == 'S' &&
(!stop_on_underscores ||
get_char(end_ptr+3, dctl) == '\0' ||
(get_char(end_ptr+3, dctl) == '_' &&
get_char(end_ptr+4, dctl) == '_'))) {
note_specialization(end_ptr, temp_par_info);
end_ptr += 3;
} /* if */
/* If there's a template argument list (beginning with "__pt__" or "__tm__"),
process it. */
if ((is_pt = start_of_id_is("__pt__", end_ptr, dctl)) ||
start_of_id_is("__tm__", end_ptr, dctl)) {
/* The "__pt__ form indicates an old-style mangled template name. */
if (is_pt && temp_par_info != NULL ) {
temp_par_info->use_old_form_for_template_output = TRUE;
} /* if */
/* For the second argument list of a partial specialization,
process the argument list but suppress output. */
if (is_partial_spec && temp_par_info != NULL &&
!temp_par_info->output_only_correspondences) {
dctl->suppress_id_output++;
partial_spec_output_suppressed = TRUE;
} /* if */
/* Write the arguments. */
end_ptr = demangle_template_arguments(end_ptr+6, /*emit_arg_values=*/FALSE,
temp_par_info, dctl);
if (partial_spec_output_suppressed) dctl->suppress_id_output--;
/* If there's a(nother) specialization indication ("__S"), ignore it. */
if (get_char(end_ptr, dctl) == '_' &&
get_char(end_ptr+1, dctl) == '_' &&
get_char(end_ptr+2, dctl) == 'S' &&
(!stop_on_underscores ||
get_char(end_ptr+3, dctl) == '\0' ||
(get_char(end_ptr+3, dctl) == '_' &&
get_char(end_ptr+4, dctl) == '_'))) {
note_specialization(end_ptr, temp_par_info);
end_ptr += 3;
} /* if */
} /* if */
/* Check that we took exactly the characters we should have. */
if (nchars_left != NULL) {
/* Return the count of characters not taken. We're not required to
end at the right place. */
*nchars_left = nchars-(end_ptr-ptr);
} else if (((nchars != 0) ? (end_ptr-ptr == nchars) : (*end_ptr == '\0')) ||
(stop_on_underscores &&
get_char(end_ptr, dctl) == '_' &&
get_char(end_ptr+1, dctl) == '_')) {
/* Okay. */
} else {
bad_mangled_name(dctl);
} /* if */
if (prev_end != NULL) dctl->end_of_name = prev_end;
return end_ptr;
} /* demangle_name */
static char *demangle_type_name_with_preceding_length(
char *ptr,
a_boolean base_name_only,
unsigned long nchars,
unsigned long *nchars_left,
a_template_param_block_ptr temp_par_info,
a_decode_control_block_ptr dctl)
/*
Demangle a type name (or namespace name) that is preceded by a length, e.g.,
"3abc" for the type name "abc". The name can include template parameters or a
function-local indication but is not a nested type. If nchars is non-zero on
input, the length has already been scanned and nchars gives its value. In that
case, not all nchars characters of input need be taken, scanning will
stop on a "__", and *nchars_left is set to the number of characters not
taken. Return a pointer to the character position following what was
demangled. When temp_par_info != NULL, it points to a block that controls
output of extra information on template parameters. When base_name_only
is TRUE, suppress any function-local information.
*/
{
char *p = ptr, *orig_end, *prev_end;
char *p2;
unsigned long nchars2, instance;
a_boolean has_function_local_info = FALSE;
a_boolean instance_emitted;
a_boolean stop_on_underscores;
if (nchars == 0) {
/* Get the length. */
p = get_length(p, &nchars, &prev_end, dctl);
nchars_left = NULL;
stop_on_underscores = FALSE;
} else {
/* Length was gotten by the caller. */
if (nchars_left != NULL) *nchars_left = 0;
prev_end = dctl->end_of_name;
dctl->end_of_name = orig_end = ptr+nchars;
stop_on_underscores = TRUE;
} /* if */
if (nchars >= 8) {
/* Look for a function-local indication, e.g., "__Ln__f" for block
"n" of function "f". */
for (p2 = p+1; p2+6 < p+nchars; p2++) {
if (get_char(p2, dctl) == '_' &&
get_char(p2+1, dctl) == '_' &&
get_char(p2+2, dctl) == 'L') {
has_function_local_info = TRUE;
nchars2 = nchars;
/* Set the length for the scan below to stop just before "__L". */
nchars = p2 - p;
p2 += 3; /* Points to block number after "__L". */
nchars2 -= (p2 - p);
/* Output the block number and function name. */
if (base_name_only) dctl->suppress_id_output++;
p2 = demangle_function_local_indication(p2, nchars2, &instance, dctl);
if (base_name_only) dctl->suppress_id_output--;
break;
} /* if */
} /* for */
} /* if */
/* Demangle the name. */
p = demangle_name(p, nchars, stop_on_underscores,
nchars_left, (char *)NULL, temp_par_info,
&instance_emitted, dctl);
if (has_function_local_info) {
/* Don't write the instance number in cases where an unnamed type or
lambda has already emitted it. */
if (!instance_emitted && !base_name_only) emit_instance(instance, dctl);
p = p2;
if (nchars_left != NULL) *nchars_left = orig_end - p2;
} /* if */
dctl->end_of_name = prev_end;
return p;
} /* demangle_type_name_with_preceding_length */
static char *demangle_simple_type_name(
char *ptr,
a_boolean base_name_only,
a_template_param_block_ptr temp_par_info,
a_decode_control_block_ptr dctl)
/*
Demangle a type name (or namespace name) that can appear as part of a
nested name. Return a pointer to the character position following what
was demangled. The name is not a nested name, but it can have template
arguments. When temp_par_info != NULL, it points to a block that
controls output of extra information on template parameters.
When base_name_only is TRUE, suppress any function-local information.
*/
{
char *p = ptr;
if (get_char(p, dctl) == 'Z') {
/* A template parameter name. */
p = demangle_template_parameter_name(p, /*nontype=*/FALSE, dctl);
} else if (get_char(p, dctl) == 'G') {
/* A global scope indicator (e.g., ::A). This only occurs in the
context of a qualified name, so the caller will emit the requisite
"::" string (this is basically treated as a null qualifier). */
p++;
} else if (isdigit((unsigned char)get_char(p, dctl))) {
/* A simple mangled type name consists of digits indicating the length of
the name followed by the name itself, e.g., "3abc". */
p = demangle_type_name_with_preceding_length(p, base_name_only,
(unsigned long)0,
(unsigned long *)NULL,
temp_par_info, dctl);
} else {
/* Presumably a decltype or typeof. */
p = demangle_type(p, dctl);
} /* if */
return p;
} /* demangle_simple_type_name */
static char *full_demangle_type_name(
char *ptr,
a_boolean base_name_only,
a_template_param_block_ptr temp_par_info,
a_boolean is_destructor_name,
a_decode_control_block_ptr dctl)
/*
Demangle the type name at ptr and output the demangled form. Return a pointer
to the character position following what was demangled. The name can be
a simple type name or a nested type name, or the name of a namespace.
If base_name_only is TRUE, do not put out any nested type qualifiers,
e.g., put out "A::x" as simply "x". When temp_par_info != NULL, it
points to a block that controls output of extra information on template
parameters. Note that this routine is called for namespaces too
(the mangling is the same as for class names; you can't actually tell
the difference in a mangled name). If is_destructor_name is TRUE, this type is
actually the name of a destructor and an implied "~" should be emitted before
the last component of a qualified name (e.g., T::~X). See demangle_type_name
for an interface to this routine for the simple case.
*/
{
char *p = ptr;
unsigned long nquals;
if (get_char(p, dctl) == 'Q') {
/* A nested type name has the form
Q2_5outer5inner (outer::inner)
^-----^--------Names from outermost to innermost
^----------------Number of levels of qualification.
Note that the levels in the qualifier can be class names or namespace
names. */
p = get_number(p+1, &nquals, dctl);
p = advance_past_underscore(p, dctl);
/* Handle each level of qualification. */
for (; nquals > 0; nquals--) {
if (dctl->err_in_id) break; /* Avoid infinite loops on errors. */
/* Do not put out the nested type qualifiers if base_name_only is
TRUE. */
if (base_name_only && nquals != 1) dctl->suppress_id_output++;
if (is_destructor_name && nquals == 1) write_id_ch('~', dctl);
p = demangle_simple_type_name(p, base_name_only, temp_par_info, dctl);
if (nquals != 1) write_id_str("::", dctl);
if (base_name_only && nquals != 1) dctl->suppress_id_output--;
} /* for */
} else {
/* A simple (non-nested) type name. */
if (is_destructor_name) write_id_ch('~', dctl);
p = demangle_simple_type_name(p, base_name_only, temp_par_info, dctl);
} /* if */
return p;
} /* full_demangle_type_name */
static char *demangle_vtbl_class_name(char *ptr,
a_decode_control_block_ptr dctl)
/*
Demangle a class or base class name that is one component of a virtual
function table name. Such names are mangled mostly as types, but with
a few special quirks.
*/
{
char *p = ptr, *prev_end;
unsigned long nchars, nchars_left;
/* This code handles both the base class part of the name and
the class part. A base class name has the form
<length> followed by one or more <class spec> optionally followed
by an ambiguity specification, __A optionally followed by a number.
The ambiguity specification is not included in the length.
A <class spec> is a class name mangling without preceding length, or
a "Q" nested-type-name specification.
A class name has the form
<length> <class spec>
or
Q nested-type-name specification (i.e., without preceding length).
*/
if (get_char(p, dctl) == 'Q') {
/* Nested-type-name "Q" without preceding length. This is used only
for the complete object class (the last section), not for the
base classes. */
p = demangle_type_name(p, dctl);
} else {
/* Get the length. */
p = get_length(p, &nchars, &prev_end, dctl);
while (!dctl->err_in_id) {
a_boolean nested_name_case = FALSE;
/* Check a "Q" nested-type-name specification by checking for "Q",
some digits, and an underscore. This rules out class names that
start with "Q". A class whose name starts with something like
"Q2_" is still going to be a problem, but that's a truly
ambiguous case. This is inherited from Cfront. */
if (get_char(p, dctl) == 'Q') {
char *p2 = p+1;
if (isdigit((unsigned char)get_char(p2, dctl))) {
do { p2++; } while (isdigit((unsigned char)get_char(p2, dctl)));
if (get_char(p2, dctl) == '_') {
nested_name_case = TRUE;
} /* if */
} /* if */
} /* if */
if (nested_name_case) {
/* Nested class name. */
char *end_ptr = demangle_type_name(p, dctl);
unsigned long chars_taken = end_ptr - p;
nchars -= chars_taken;
p = end_ptr;
} else {
/* Non-nested class name without preceding length. */
p = demangle_type_name_with_preceding_length(
p, /*base_name_only=*/FALSE,
nchars, &nchars_left,
(a_template_param_block_ptr)NULL,
dctl);
nchars = nchars_left;
} /* if */
/* Leave the loop if there is not another base class in the
derivation. */
if (nchars < 3 || !start_of_id_is("__", p, dctl)) break;
p += 2;
nchars -= 2;
write_id_str(" in ", dctl);
} /* while */
/* Make sure we took all the characters indicated by the length. */
if (nchars != 0) {
bad_mangled_name(dctl);
} /* if */
dctl->end_of_name = prev_end;
if (start_of_id_is("__A", p, dctl)) {
/* "__A" indicates an ambiguous base class. This is used only on
the base class specifications. */
write_id_str(" (ambiguous)", dctl);
p += 3;
/* Ignore the number following __A, if any. */
while (isdigit((unsigned char)get_char(p, dctl))) p++;
} /* if */
} /* if */
return p;
} /* demangle_vtbl_class_name */
static char *demangle_type_qualifiers(
char *ptr,
a_boolean trailing_space,
a_decode_control_block_ptr dctl)
/*
Demangle any type qualifiers (const/volatile/restrict) at the indicated
location. Return a pointer to the character position following what was
demangled. If trailing_space is TRUE, add a space at the end if any qualifiers
were put out.
*/
{
char *p = ptr;
a_boolean any_quals = FALSE;
for (;; p++) {
if (get_char(p, dctl) == 'C') {
if (any_quals) write_id_ch(' ', dctl);
write_id_str("const", dctl);
} else if (get_char(p, dctl) == 'V') {
if (any_quals) write_id_ch(' ', dctl);
write_id_str("volatile", dctl);
} else if (get_char(p, dctl) == 'D' && get_char(p+1, dctl) == 'r') {
if (any_quals) write_id_ch(' ', dctl);
write_id_str("restrict", dctl);
p++;
} else {
break;
} /* if */
any_quals = TRUE;
} /* for */
if (any_quals && trailing_space) write_id_ch(' ', dctl);
return p;
} /* demangle_type_qualifiers */
static char *demangle_type_specifier(char *ptr,
a_decode_control_block_ptr dctl)
/*
Demangle the type at ptr and output the specifier part. Return a pointer
to the character position following what was demangled.
*/
{
char *p = ptr, *s, ch;
/* Process type qualifiers. */
p = demangle_type_qualifiers(p, /*trailing_space=*/TRUE, dctl);
ch = get_char(p, dctl);
if (isdigit((unsigned char)ch) || ch == 'Q' || ch == 'Z') {
/* Named type, like class or enum, e.g., "3abc". */
p = demangle_type_name(p, dctl);
} else {
/* Builtin type. */
if (ch == 'a') {
/* GNU vector_size attribute. */
write_id_str("__attribute__((vector_size(", dctl);
p++;
/* Scan the size. */
while (ch = get_char(p, dctl), isdigit((unsigned char)ch)) {
write_id_ch(ch, dctl);
p++;
} /* while */
write_id_str("))) ", dctl);
/* The underlying type follows an underscore. */
p = advance_past_underscore(p, dctl);
ch = get_char(p, dctl);
} /* if */
/* Handle signed and unsigned, and _Complex. */
if (ch == 'S') {
write_id_str("signed ", dctl);
p++;
} else if (ch == 'U') {
write_id_str("unsigned ", dctl);
p++;
} else if (ch == 'x') {
write_id_str("_Complex ", dctl);
p++;
} /* if */
switch (get_char(p++, dctl)) {
case 'v':
s = "void";
break;
case 'c':
s = "char";
break;
case 'w':
s = "wchar_t";
break;
case 'b':
s = "bool";
break;
case 's':
s = "short";
break;
case 'i':
s = "int";
break;
case 'l':
s = "long";
break;
case 'L':
s = "long long";
break;
case 'f':
s = "float";
break;
case 'd':
s = "double";
break;
case 'r':
s = "long double";
break;
case 'm':
/* Microsoft intrinsic __intN types (Visual C++ 6.0 and later), as
well as GNU 128-bit integers (m16). */
switch (get_char(p++, dctl)) {
case '1':
if (get_char(p, dctl) == '6') {
s = "__int128";
p++;
} else {
s = "__int8";
} /* if */
break;
case '2':
s = "__int16";
break;
case '4':
s = "__int32";
break;
case '8':
s = "__int64";
break;
default:
bad_mangled_name(dctl);
s = "";
} /* switch */
break;
case 'n':
s = "std::nullptr_t";
break;
case 'j':
s = "__nullptr";
break;
case 'u':
s = "auto";
break;
case 'g':
s = "char16_t";
break;
case 'k':
s = "char32_t";
break;
case 't':
/* typeof(type) */
write_id_str("typeof(", dctl);
p = demangle_type(p, dctl);
s = ")";
break;
case 'p':
/* typeof(expression) */
write_id_str("typeof(", dctl);
p = demangle_expression(p, /*need_parens=*/FALSE, dctl);
s = ")";
break;
case 'y':
/* decltype of an id-expression or class member access. */
write_id_str("decltype(", dctl);
p = demangle_expression(p, /*need_parens=*/FALSE, dctl);
s = ")";
break;
case 'Y':
/* decltype of an expression. */
write_id_str("decltype((", dctl);
p = demangle_expression(p, /*need_parens=*/FALSE, dctl);
s = "))";
break;
case 'o':
/* __underlying_type(type) */
write_id_str("__underlying_type(", dctl);
p = demangle_type(p, dctl);
s = ")";
break;
default:
bad_mangled_name(dctl);
s = "";
} /* switch */
write_id_str(s, dctl);
} /* if */
return p;
} /* demangle_type_specifier */
static char *demangle_function_parameters(char *ptr,
a_decode_control_block_ptr dctl)
/*
Demangle the parameter list beginning at ptr and output the demangled form.
Return a pointer to the character position following what was demangled.
*/
{
char *p = ptr;
char *param_pos[10];
unsigned long curr_param_num, param_num, nreps;
a_boolean any_params = FALSE;
write_id_ch('(', dctl);
if (get_char(p, dctl) == 'v') {
/* Void parameter list. */
p++;
} else {
any_params = TRUE;
/* Loop for each parameter. */
curr_param_num = 1;
for (;;) {
char ch;
if (dctl->err_in_id) break; /* Avoid infinite loops on errors. */
ch = get_char(p, dctl);
if ((ch == 'T' && isdigit((unsigned char)get_char(p+1, dctl))) ||
ch == 'N') {
/* Tn means repeat the type of parameter "n". Note that a type can
begin with "Tr" (i.e., a C++/CLI tracking reference), so check for
a digit following the "T" to differentiate the two cases. */
/* Nmn means "m" repetitions of the type of parameter "n". "m"
is a one-digit number. */
/* "n" is also treated as a single-digit number; the front end enforces
that (in non-cfront object code compatibility mode). cfront does
not, which leads to some ambiguities when "n" is followed by
a class name. */
if (get_char(p++, dctl) == 'N') {
/* Get the number of repetitions. */
p = get_single_digit_number(p, &nreps, dctl);
} else {
nreps = 1;
} /* if */
/* Get the parameter number. */
p = get_single_digit_number(p, ¶m_num, dctl);
if (param_num < 1 || param_num >= curr_param_num ||
param_pos[param_num] == NULL) {
/* Parameter number out of range. */
bad_mangled_name(dctl);
goto end_of_routine;
} /* if */
/* Produce "nreps" copies of parameter "param_num". */
for (; nreps > 0; nreps--) {
if (dctl->err_in_id) break; /* Avoid infinite loops on errors. */
if (curr_param_num < 10) param_pos[curr_param_num] = NULL;
(void)demangle_type(param_pos[param_num], dctl);
if (nreps != 1) write_id_str(", ", dctl);
curr_param_num++;
} /* if */
} else {
/* A normal parameter. */
if (curr_param_num < 10) param_pos[curr_param_num] = p;
p = demangle_type(p, dctl);
curr_param_num++;
} /* if */
/* Stop after the last parameter. */
ch = get_char(p, dctl);
if (ch == '\0' || ch == 'e' || ch == '_' || ch == 'F') break;
write_id_str(", ", dctl);
} /* for */
} /* if */
if (get_char(p, dctl) == 'e') {
/* Ellipsis. */
if (any_params) write_id_str(", ", dctl);
write_id_str("...", dctl);
p++;
} /* if */
write_id_ch(')', dctl);
end_of_routine:
return p;
} /* demangle_function_parameters */
static char *skip_extern_C_indication(char *ptr,
a_decode_control_block_ptr dctl)
/*
ptr points to the character after the "F" of a function type. Skip over
and ignore an indication of extern "C" following the "F", if one is present.
Return a pointer to the character following the extern "C" indication.
There's no syntax for representing the extern "C" in the function type, so
just ignore it.
*/
{
if (get_char(ptr, dctl) == 'K') ptr++;
return ptr;
} /* skip_extern_C_indication */
char *demangle_type_first_part(
char *ptr,
a_boolean under_lhs_declarator,
a_boolean need_trailing_space,
a_decode_control_block_ptr dctl)
/*
Demangle the type at ptr and output the specifier part and the part of the
declarator that precedes the name. Return a pointer to the character
position following what was demangled. If under_lhs_declarator is TRUE,
this type is directly under a type that uses a left-side declarator,
e.g., a pointer type. (That's used to control use of parentheses around
parts of the declarator.) If need_trailing_space is TRUE, put a space
at the end of the type first part (needed if the declarator part is
not empty, because it contains a name or a derived type).
*/
{
char *p = ptr, *qualp = p;
char kind, ext_kind;
/* Remove type qualifiers. */
p = remove_immediate_type_qualifiers(p, dctl);
kind = get_char(p, dctl);
if (kind == 'P' || kind == 'R' || kind == 'E' || kind == 'H') {
a_boolean need_space = TRUE;
/* Pointer, reference, rvalue reference, or C++/CLI pointer-like type.
For example, "Pc" is pointer to char. */
if (kind == 'H') {
/* Some kind of C++/CLI pointer-like type (handle, tracking reference,
interior_ptr, pin_ptr). */
p++;
ext_kind = get_char(p, dctl);
if (ext_kind == 'i') {
write_id_str("interior_ptr<", dctl);
need_space = FALSE;
} else if (ext_kind == 'p') {
write_id_str("pin_ptr<", dctl);
need_space = FALSE;
} /* if */
} /* if */
p = demangle_type_first_part(p+1, /*under_lhs_declarator=*/TRUE,
need_space, dctl);
/* Output "*" (pointer), "&" (reference), "&&" (rvalue reference),
"^" (handle), or "%" (tracking reference). */
if (kind == 'R') {
write_id_ch('&', dctl);
} else if (kind == 'E') {
write_id_str("&&", dctl);
} else if (kind == 'H') {
if (ext_kind == 'h') {
write_id_ch('^', dctl);
} else if (ext_kind == 't') {
write_id_ch('%', dctl);
} else if (ext_kind == 'i') {
write_id_ch('>', dctl);
} else if (ext_kind == 'p') {
write_id_ch('>', dctl);
} else {
bad_mangled_name(dctl);
} /* if */
} else {
write_id_ch('*', dctl);
} /* if */
/* Output the type qualifiers on the pointer, if any. */
(void)demangle_type_qualifiers(qualp, need_trailing_space, dctl);
} else if (kind == 'M') {
/* Pointer-to-member type, e.g., "M1Ai" is pointer to member of A of
type int. */
char *classp = p+1;
/* Skip over the class name. */
dctl->suppress_id_output++;
p = demangle_type_name(classp, dctl);
dctl->suppress_id_output--;
p = demangle_type_first_part(p, /*under_lhs_declarator=*/TRUE,
/*need_trailing_space=*/TRUE, dctl);
/* Output Classname::*. */
(void)demangle_type_name(classp, dctl);
write_id_str("::*", dctl);
/* Output the type qualifiers on the pointer, if any. */
(void)demangle_type_qualifiers(qualp, need_trailing_space, dctl);
} else if (kind == 'F') {
/* Function type, e.g., "Fii_f" is function(int, int) returning float.
The return type is not present for top-level function types (except
for template functions). */
p = skip_extern_C_indication(p+1, dctl);
/* Skip over the parameter types without outputting anything. */
dctl->suppress_id_output++;
p = demangle_function_parameters(p, dctl);
dctl->suppress_id_output--;
if (get_char(p, dctl) == '_' && get_char(p+1, dctl) != '_') {
/* The return type is present. */
p = demangle_type_first_part(p+1, /*under_lhs_declarator=*/FALSE,
/*need_trailing_space=*/TRUE, dctl);
} /* if */
/* This is a right-side declarator, so if it's under a left-side declarator
parentheses are needed. */
if (under_lhs_declarator) write_id_ch('(', dctl);
} else if (kind == 'A') {
/* Array type, e.g., "A10_i" is array[10] of int. */
p++;
if (get_char(p, dctl) == '_') {
/* Length is specified by a constant expression based on template
parameters. Ignore the expression. */
p++;
dctl->suppress_id_output++;
p = demangle_constant(p, /*suppress_address_of=*/FALSE,
/*need_parens=*/FALSE, dctl);
dctl->suppress_id_output--;
} else {
/* Normal constant number of elements. */
/* Skip the array size. */
while (isdigit((unsigned char)get_char(p, dctl))) p++;
} /* if */
p = advance_past_underscore(p, dctl);
/* Process the element type. */
p = demangle_type_first_part(p, /*under_lhs_declarator=*/FALSE,
/*need_trailing_space=*/TRUE, dctl);
/* This is a right-side declarator, so if it's under a left-side declarator
parentheses are needed. */
if (under_lhs_declarator) write_id_ch('(', dctl);
} else if (kind == 'D') {
/* The 'D' is used as an "escape" character. The following character
determines the actual action to be taken. */
p++;
kind = get_char(p, dctl);
if (kind == 'p') {
/* A pack expansion. */
p = demangle_type_first_part(p+1, /*under_lhs_declarator=*/FALSE,
/*need_trailing_space=*/FALSE, dctl);
} else {
bad_mangled_name(dctl);
} /* if */
} else {
/* No declarator part to process. Handle the specifier type. */
p = demangle_type_specifier(qualp, dctl);
if (need_trailing_space) write_id_ch(' ', dctl);
} /* if */
return p;
} /* demangle_type_first_part */
void demangle_type_second_part(
char *ptr,
a_boolean under_lhs_declarator,
a_decode_control_block_ptr dctl)
/*
Demangle the type at ptr and output the part of the declarator that follows the
name. This routine does not return a pointer to the character position
following what was demangled; it is assumed that the caller will save
that from the call of demangle_type_first_part, and it saves a lot of
time if this routine can avoid scanning the specifiers again.
If under_lhs_declarator is TRUE, this type is directly under a type that
uses a left-side declarator, e.g., a pointer type. (That's used to control
use of parentheses around parts of the declarator.)
*/
{
char *p = ptr, *qualp = p;
char kind;
/* Remove type qualifiers. */
p = remove_immediate_type_qualifiers(p, dctl);
kind = get_char(p, dctl);
if (kind == 'P' || kind == 'R' || kind == 'E' || kind == 'H') {
/* Pointer, reference, rvalue reference, or C++/CLI pointer-like type.
For example, "Pc" is pointer to char. */
/* If it's a C++/CLI pointer-like type, there's a second character after
the "H", but we ignore that here. */
if (kind == 'H') p++;
demangle_type_second_part(p+1, /*under_lhs_declarator=*/TRUE, dctl);
} else if (kind == 'M') {
/* Pointer-to-member type, e.g., "M1Ai" is pointer to member of A of
type int. */
/* Advance over the class name. */
dctl->suppress_id_output++;
p = demangle_type_name(p+1, dctl);
dctl->suppress_id_output--;
demangle_type_second_part(p, /*under_lhs_declarator=*/TRUE, dctl);
} else if (kind == 'F') {
/* Function type, e.g., "Fii_f" is function(int, int) returning float.
The return type is not present for top-level function types (except
for template functions). */
/* This is a right-side declarator, so if it's under a left-side declarator
parentheses are needed. */
if (under_lhs_declarator) write_id_ch(')', dctl);
p = skip_extern_C_indication(p+1, dctl);
/* Put out the parameter types. */
p = demangle_function_parameters(p, dctl);
/* Put out any cv-qualifiers (member functions). */
/* Note that such things could come up on nonmember functions in the
presence of typedefs. In such a case what we generate here will not
be valid C, but it's a reasonable representation of the mangled
type, and there's no way of getting the typedef name in there,
so let it be. */
if (*qualp != 'F') {
write_id_ch(' ', dctl);
(void)demangle_type_qualifiers(qualp, /*trailing_space=*/FALSE, dctl);
} /* if */
if (get_char(p, dctl) == '_' && get_char(p+1, dctl) != '_') {
/* Process the return type. */
demangle_type_second_part(p+1, /*under_lhs_declarator=*/FALSE, dctl);
} /* if */
} else if (kind == 'A') {
/* Array type, e.g., "A10_i" is array[10] of int. */
/* This is a right-side declarator, so if it's under a left-side declarator
parentheses are needed. */
if (under_lhs_declarator) write_id_ch(')', dctl);
write_id_ch('[', dctl);
p++;
if (get_char(p, dctl) == '_') {
/* Length is specified by a constant expression based on template
parameters. */
p++;
p = demangle_constant(p, /*suppress_address_of=*/FALSE,
/*need_parens=*/FALSE, dctl);
} else {
/* Normal constant number of elements. */
if (get_char(p, dctl) == '0' && get_char(p+1, dctl) == '_') {
/* Size is zero, so do not put out a size (the result is "[]"). */
p++;
} else {
/* Put out the array size. */
while (isdigit((unsigned char)get_char(p, dctl))) {
write_id_ch(*p++, dctl);
} /* while */
} /* if */
} /* if */
p = advance_past_underscore(p, dctl);
write_id_ch(']', dctl);
/* Process the element type. */
demangle_type_second_part(p, /*under_lhs_declarator=*/FALSE, dctl);
} else if (kind == 'D') {
/* The 'D' is used as an "escape" character. The following character
determines the actual action to be taken. */
p++;
kind = get_char(p, dctl);
if (kind == 'p') {
/* A pack expansion. */
p++;
write_id_str("...", dctl);
demangle_type_second_part(p, /*under_lhs_declarator=*/FALSE, dctl);
} else {
bad_mangled_name(dctl);
} /* if */
} else {
/* No declarator part to process. No need to scan the specifiers type --
it was done by demangle_type_first_part. */
} /* if */
} /* demangle_type_second_part */
static char *demangle_type(char *ptr,
a_decode_control_block_ptr dctl)
/*
Demangle the type at ptr and output the demangled form. Return a pointer to
the character position following what was demangled.
*/
{
char *p;
/* Generate the specifier part of the type. */
p = demangle_type_first_part(ptr, /*under_lhs_declarator=*/FALSE,
/*need_trailing_space=*/FALSE, dctl);
/* Generate the declarator part of the type. */
demangle_type_second_part(ptr, /*under_lhs_declarator=*/FALSE, dctl);
return p;
} /* demangle_type */
static char *demangle_identifier_with_preceding_length(
char *ptr,
a_boolean suppress_parent_and_local_info,
a_decode_control_block_ptr dctl)
/*
Demangle the identifier at ptr and output the demangled form. The
identifier is preceded by a length. Return a pointer to the character
position following what was demangled. An identifier can include template
argument, parent, and function-local information.
If suppress_parent_and_local_info is TRUE, do not output parent and
function-local information if present (but do scan over it).
*/
{
char *p = ptr, *prev_end;
unsigned long nchars;
p = get_length(p, &nchars, &prev_end, dctl);
p = full_demangle_identifier(p, nchars, suppress_parent_and_local_info,
dctl);
dctl->end_of_name = prev_end;
return p;
} /* demangle_identifier_with_preceding_length */
static char *full_demangle_identifier(
char *ptr,
unsigned long nchars,
a_boolean suppress_parent_and_local_info,
a_decode_control_block_ptr dctl)
/*
Demangle the identifier at ptr and output the demangled form. Return
a pointer to the character position following what was demangled.
If nchars > 0, take no more than that many characters.
If suppress_parent_and_local_info is TRUE, do not output parent
and function-local information if present (but do scan over it).
An identifier can include template argument, parent, and function-local
information.
*/
{
char *p = ptr, *pname, *end_ptr, *function_local_end_ptr = NULL;
char *final_specialization, *end_ptr_first_scan, *prev_end = NULL;
char ch, *oname;
a_boolean is_function = TRUE;
a_template_param_block
temp_par_info;
a_boolean is_externalized_static = FALSE;
a_boolean has_function_local_info = FALSE;
unsigned long instance;
clear_template_param_block(&temp_par_info);
if (nchars != 0) {
prev_end = dctl->end_of_name;
dctl->end_of_name = ptr + nchars;
} /* if */
if (start_of_id_is("__STF__", ptr, dctl)) {
/* Static function made external by addition of prefix "__STF__" and
suffix of module id. */
is_externalized_static = TRUE;
/* Advance past __STF__. */
ptr += 7;
if (nchars != 0) nchars -= 7;
p = ptr;
} /* if */
/* Scan through the name (the first part of the mangled name) without
generating output, to see what's beyond it. Special processing is
necessary for names of constructors, conversion routines, etc. */
/* If the name has a specialization indication in it (which can happen for
function names), note that fact. */
temp_par_info.set_final_specialization = TRUE;
dctl->suppress_id_output++;
p = demangle_name(ptr, nchars, /*stop_on_underscores=*/TRUE,
(unsigned long *)NULL,
(char *)NULL, &temp_par_info,
(a_boolean *)NULL, dctl);
dctl->suppress_id_output--;
final_specialization = temp_par_info.final_specialization;
clear_template_param_block(&temp_par_info);
temp_par_info.final_specialization = final_specialization;
if (get_char(p, dctl) == '\0') {
/* There is no mangled part of the name. This happens for strange
cases like
extern "C" int operator +(A, A);
which gets mangled as "__pl". Just write out the name and stop. */
end_ptr = demangle_name(ptr, nchars,
/*stop_on_underscores=*/TRUE,
(unsigned long *)NULL,
(char *)NULL,
(a_template_param_block_ptr)NULL,
(a_boolean *)NULL, dctl);
} else {
/* There's more. There should be a "__" between the name and the
additional mangled information. */
if (get_char(p, dctl) != '_' || get_char(p+1, dctl) != '_') {
bad_mangled_name(dctl);
end_ptr = p;
goto end_of_routine;
} /* if */
end_ptr = p + 2;
/* Now ptr points to the original-name part of the mangled name, and
end_ptr points to the mangled-name part at the end.
f__1AFv
^---- end_ptr
^------- ptr
The mangled-name part is
(a) A class name for a static data member.
(b) A class name followed by "F" followed by the encoding for the
parameter types for a member function.
(c) "F" followed by the encoding for the parameter types for a
nonmember function.
(d) "L" plus a local block number, followed by the mangled function
name, for a function-local entity.
Members of namespaces are encoded similarly. */
p = end_ptr;
pname = NULL;
if (suppress_parent_and_local_info) dctl->suppress_id_output++;
ch = get_char(end_ptr, dctl);
if (ch == 'L') {
unsigned long nchars2 = nchars;
/* The name of an entity within a function, mangled on promotion out
of the function. For example, "i__L1__f__Fv" for "i" from block 1
of function "f(void)". Note that this is not the same mangling
used by cfront (in the cfront scheme, the __L1 is at the end, and
the number is different). */
/* Set a length for the name without the function-local indication,
for the processing in the rest of this routine. */
nchars = (p - 2) - ptr;
/* Demangle the function name and block number. */
p++; /* Points to the block number following "__L". */
if (nchars2 != 0) nchars2 -= (p - ptr);
function_local_end_ptr =
demangle_function_local_indication(p, nchars2, &instance, dctl);
has_function_local_info = TRUE;
p = end_ptr = ptr + nchars;
is_function = FALSE;
/* Go on to demangle the name of the local entity. */
} else if (ch != 'F') {
/* A class (or namespace) name must be next. */
/* Remember the location of the parent entity name. */
pname = end_ptr;
/* Scan over the class name, producing no output, and remembering the
position of the final specialization, if any. If we already
found a specialization on the function name, it's the final one
and we shouldn't change it. */
dctl->suppress_id_output++;
if (temp_par_info.final_specialization == NULL) {
temp_par_info.set_final_specialization = TRUE;
} /* if */
end_ptr = full_demangle_type_name(pname, /*base_name_only=*/FALSE,
&temp_par_info,
/*is_destructor_name=*/FALSE,
dctl);
temp_par_info.set_final_specialization = FALSE;
dctl->suppress_id_output--;
/* If the name ends here, this is a simple member (e.g., a static
data member). */
ch = get_char(end_ptr, dctl);
if (ch == '\0' ||
(ch == '_' && get_char(end_ptr+1, dctl) == '_')) {
is_function = FALSE;
} /* if */
} /* if */
if (suppress_parent_and_local_info) dctl->suppress_id_output--;
oname = NULL;
if (is_function) {
/* "S" here means a static member function (ignore). */
if (get_char(end_ptr, dctl) == 'S') end_ptr++;
/* "O" here means the base class of a function that this function
explicitly overrides (a Microsoft extension) is next. */
if (get_char(end_ptr, dctl) == 'O') {
/* Skip over the class name, producing no output. Remember its
position for later output. */
oname = ++end_ptr;
dctl->suppress_id_output++;
end_ptr = demangle_type_name(oname, dctl);
dctl->suppress_id_output--;
} /* if */
/* Write the specifier part of the type. */
end_ptr_first_scan =
demangle_type_first_part(end_ptr,
/*under_lhs_declarator=*/FALSE,
/*need_trailing_space=*/TRUE, dctl);
} /* if */
temp_par_info.nesting_level = 0;
if (pname != NULL &&
!suppress_parent_and_local_info) {
/* Write the parent class or namespace qualifier. */
if (temp_par_info.final_specialization != NULL) {
/* Up to the final specialization, put out actual template arguments
for specializations. */
temp_par_info.actual_template_args_until_final_specialization = TRUE;
} /* if */
(void)full_demangle_type_name(pname, /*base_name_only=*/FALSE,
&temp_par_info,
/*is_destructor_name=*/FALSE,
dctl);
/* Force template parameter information out on the function even if
it is specialized. */
temp_par_info.actual_template_args_until_final_specialization = FALSE;
write_id_str("::", dctl);
} /* if */
/* Write the name of the member. */
(void)demangle_name(ptr, nchars, /*stop_on_underscores=*/TRUE,
(unsigned long *)NULL,
pname, &temp_par_info,
(a_boolean *)NULL, dctl);
if (oname != NULL) {
/* Put out the name of the class of the function explicitly overridden,
if noted above. */
write_id_str(" [overriding function in ", dctl);
(void)demangle_type_name(oname, dctl);
write_id_str("] ", dctl);
} /* if */
if (is_function) {
/* Write the declarator part of the type. */
demangle_type_second_part(end_ptr, /*under_lhs_declarator=*/FALSE,
dctl);
end_ptr = end_ptr_first_scan;
} /* if */
if (!temp_par_info.use_old_form_for_template_output &&
temp_par_info.nesting_level != 0) {
/* Put out correspondences for template parameters, e.g, "T=int". */
temp_par_info.nesting_level = 0;
temp_par_info.first_correspondence = TRUE;
temp_par_info.output_only_correspondences = TRUE;
/* Output is suppressed in general, and turned on only where
appropriate. */
dctl->suppress_id_output++;
if (pname != NULL) {
/* Write the parent class or namespace qualifier. */
if (temp_par_info.final_specialization != NULL) {
/* Up to the final specialization, put out actual template arguments
for specializations. */
temp_par_info.actual_template_args_until_final_specialization = TRUE;
} /* if */
(void)full_demangle_type_name(pname, /*base_name_only=*/FALSE,
&temp_par_info,
/*is_destructor_name=*/FALSE,
dctl);
} /* if */
/* Force template parameter information out on the function even if
it is specialized. */
temp_par_info.actual_template_args_until_final_specialization = FALSE;
/* Write the name of the member. */
(void)demangle_name(ptr, nchars, /*stop_on_underscores=*/TRUE,
(unsigned long *)NULL,
pname, &temp_par_info,
(a_boolean *)NULL, dctl);
dctl->suppress_id_output--;
if (!temp_par_info.first_correspondence) {
/* End the list of correspondences. */
write_id_ch(']', dctl);
} /* if */
} /* if */
} /* if */
end_of_routine:
/* If the identifier had local function information, write the instance
number now. */
if (has_function_local_info) emit_instance(instance, dctl);
/* When a function-local indication is scanned, end_ptr has been set
to the end of the local entity name, and needs to be set to after the
function-local indication at the end of the whole name. */
if (function_local_end_ptr != NULL) end_ptr = function_local_end_ptr;
if (is_externalized_static) {
/* Advance over the module id part of the name. */
while (get_char(end_ptr, dctl) != '\0') end_ptr++;
} /* if */
if (prev_end != NULL) dctl->end_of_name = prev_end;
return end_ptr;
} /* full_demangle_identifier */
a_boolean is_mangled_type_name(char *ptr,
a_decode_control_block_ptr dctl)
/*
Return TRUE if the encoding beginning at ptr appears to be a mangled
type name. This is used to distinguish a local mangled non-nested
type name with template arguments (e.g., __15MyTemp__tm__2_i) from a
cfront-style local name (e.g., __2name); the character passed in is
the one after the double underscore.
*/
{
a_boolean is_type_name = FALSE;
char *p = ptr;
if (isdigit((unsigned char)get_char(p, dctl))) {
/* Skip over the number. */
do { p++; } while (isdigit((unsigned char)get_char(p, dctl)));
/* The next character is typically alphabetic. */
if (isalpha((unsigned char)get_char(p, dctl))) {
/* This doesn't have to be a full recognizer; it just has to distinguish
the two cases given above. To do that, look for the double underscore
that must appear in a mangled name that has template arguments. */
for (p++; get_char(p, dctl) != '\0'; p++) {
if (get_char(p, dctl) == '_' && get_char(p+1, dctl) == '_') {
is_type_name = TRUE;
break;
} /* if */
} /* for */
} else if (get_char(p, dctl) == '_' &&
get_char(p+1, dctl) == '_' &&
get_char(p+2, dctl) == 'U' &&
(get_char(p+3, dctl) == 't' ||
get_char(p+3, dctl) == 'l' ||
get_char(p+3, dctl) == 'm' ||
get_char(p+3, dctl) == 'd')) {
/* An unnamed type or lambda. */
is_type_name = TRUE;
} /* if */
} /* if */
return is_type_name;
} /* is_mangled_type_name */
static char *demangle_static_variable_name(char *ptr,
a_decode_control_block_ptr dctl)
/*
Demangle the name of a static variable promoted to being external by
addition of a prefix "__STV__" and a suffix of a module id. Just put out
the part in the middle, which is the original name.
*/
{
char *start_ptr;
ptr += 7; /* Move to after "__STV__". */
/* Copy the name until "__". */
start_ptr = ptr;
while (get_char(ptr, dctl) != '_' ||
get_char(ptr+1, dctl) != '_' ||
ptr == start_ptr) {
if (get_char(ptr, dctl) == '\0') {
bad_mangled_name(dctl);
break;
} /* if */
write_id_ch(*ptr, dctl);
ptr++;
} /* while */
/* Advance over the module id part of the name. */
while (get_char(ptr, dctl) != '\0') ptr++;
return ptr;
} /* demangle_static_variable_name */
char *demangle_local_name(char *ptr,
a_decode_control_block_ptr dctl)
/*
Demangle the local name at ptr and output the demangled form. Return
a pointer to the character position following what was demangled.
This demangles the "__nn_mm_name" form produced by the C-generating
back end. This is not something visible unless the C-generating back end
is used, and it's a local name, which is ordinarily outside the charter
of these demangling routines, but it's an easy and common case, so...
Also handles the cfront-style __nnName form.
*/
{
char *p = ptr+2;
/* Check for the initial two numbers and underscores. The caller checked
for the two initial underscores and the digit following that. */
do { p++; } while (isdigit((unsigned char)get_char(p, dctl)));
if (isalpha((unsigned char)get_char(p, dctl))) {
/* Cfront-style local name, like "__2name". */
} else {
if (get_char(p, dctl) != '_') {
bad_mangled_name(dctl);
goto end_of_routine;
} /* if */
p++;
if (!isdigit((unsigned char)get_char(p, dctl))) {
bad_mangled_name(dctl);
goto end_of_routine;
} /* if */
do { p++; } while (isdigit((unsigned char)get_char(p, dctl)));
if (get_char(p, dctl) != '_') {
bad_mangled_name(dctl);
goto end_of_routine;
} /* if */
p++;
} /* if */
/* Copy the rest of the string to output. */
while (get_char(p, dctl) != '\0') {
write_id_ch(*p, dctl);
p++;
} /* while */
end_of_routine:
return p;
} /* demangle_local_name */
char *uncompress_mangled_name(char *id,
a_decode_control_block_ptr dctl)
/*
Uncompress the compressed mangled name beginning at id. Return the
address of the uncompressed name.
*/
{
char *uncompressed_name = id, *src_end = dctl->end_of_name;
unsigned long length;
/* Advance past "__CPR". */
id += 5;
/* Accumulate the length of the uncompressed name. */
if (!isdigit((unsigned char)*id)) {
bad_mangled_name(dctl);
goto end_of_routine;
} /* if */
id = get_number(id, &length, dctl);
/* Check for the two underscores following the length. */
if (id[0] != '_' || id[1] != '_') {
bad_mangled_name(dctl);
goto end_of_routine;
} /* if */
/* Save the uncompressed length so it can be used later in telling the
caller how big a buffer is required. */
dctl->uncompressed_length = length;
id += 2;
if (length+1 >= dctl->output_id_size) {
/* The buffer supplied by the caller is too small to contain the
uncompressed name. */
dctl->output_overflow_err = TRUE;
goto end_of_routine;
} else {
char *src, *dst, *dst_end = dctl->output_id+dctl->output_id_size;
/* Uncompress to the end of the buffer supplied by the caller, then
do the demangling in the space remaining at the beginning. */
uncompressed_name = dst_end-(length+1);
dctl->output_id_size -= length+1;
dst = uncompressed_name;
for (src = id; *src != '\0';) {
char ch = *src++;
if (ch != 'J') {
/* Just copy this character. */
if (dst >= dst_end) {
/* Overflowed buffer (probably malformed input). */
bad_mangled_name(dctl);
goto end_of_routine;
} /* if */
*dst++ = ch;
} else {
if (*src == 'J') {
/* "JJ" indicates a simple "J". */
/* Simple "J". */
if (dst >= dst_end) {
/* Overflowed buffer (probably malformed input). */
bad_mangled_name(dctl);
goto end_of_routine;
} /* if */
*dst++ = 'J';
} else {
/* "JnnnJ" indicates a repetition of a string that appeared
earlier, at position "nnn". */
unsigned long pos, prev_len;
char *prev_str, *prev_str2, *prev_end;
dctl->end_of_name = src_end;
src = get_number(src, &pos, dctl);
if (*src != 'J' || pos > length) {
bad_mangled_name(dctl);
goto end_of_routine;
} /* if */
prev_str = uncompressed_name+pos;
if (!isdigit(*prev_str)) {
bad_mangled_name(dctl);
goto end_of_routine;
} /* if */
/* Get the length of the repeated string. */
dctl->end_of_name = uncompressed_name + length;
prev_str2 = get_length(prev_str, &prev_len, &prev_end, dctl);
/* Copy the repeated string to the uncompressed output. */
prev_str2 += prev_len;
if (dst+prev_len >= dst_end) {
/* Overflowed buffer (probably malformed input). */
bad_mangled_name(dctl);
goto end_of_routine;
} /* if */
while (prev_str < prev_str2) *dst++ = *prev_str++;
} /* if */
/* Advance past the final "J". */
src++;
} /* if */
} /* for */
if (dst - uncompressed_name != length) {
/* The length didn't come out right. */
bad_mangled_name(dctl);
} /* if */
if (dst >= dst_end) {
/* Overflowed buffer (probably malformed input). */
bad_mangled_name(dctl);
goto end_of_routine;
} /* if */
/* Add the final null. */
*dst++ = '\0';
dctl->end_of_name = uncompressed_name + length;
} /* if */
end_of_routine:;
return uncompressed_name;
} /* uncompress_mangled_name */
void decode_identifier(char *id,
char *output_buffer,
sizeof_t output_buffer_size,
a_boolean *err,
a_boolean *buffer_overflow_err,
sizeof_t *required_buffer_size)
/*
Demangle the identifier id (which is null-terminated), and put the demangled
form (null-terminated) into the output_buffer provided by the caller.
output_buffer_size gives the allocated size of output_buffer. If there
is some error in the demangling process, *err will be returned TRUE.
In addition, if the error is that the output buffer is too small,
*buffer_overflow_err will (also) be returned TRUE, and *required_buffer_size
is set to the size of buffer required to do the demangling. Note that
if the mangled name is compressed, and the buffer size is smaller than
the size of the uncompressed mangled name, the size returned will be
enough to uncompress the name but not enough to produce the demangled form.
The caller must be prepared in that case to loop a second time (the
length returned the second time will be correct).
*/
{
char *end_ptr, *p;
a_decode_control_block control_block;
a_decode_control_block_ptr dctl = &control_block;
clear_control_block(dctl);
dctl->end_of_name = strchr(id, '\0');
dctl->output_id = output_buffer;
dctl->output_id_size = output_buffer_size;
if (start_of_id_is("__CPR", id, dctl)) {
/* Uncompress a compressed name. */
id = uncompress_mangled_name(id, dctl);
} /* if */
/* Check for special cases. */
if (dctl->output_overflow_err) {
/* Previous error (not enough room in the buffer to uncompress). */
} else if (dctl->err_in_id) {
/* Invalid compressed input. */
} else if (start_of_id_is("__vtbl__", id, dctl)) {
write_id_str("virtual function table for ", dctl);
/* The overall mangled name is one of
__vtbl__ <class mangling>
__vtbl__ <base class mangling> __ <class mangling>
__vtbl__ <base class mangling> __ <base class mangling>
__ <class mangling>
*/
end_ptr = demangle_vtbl_class_name(id+8, dctl);
while (start_of_id_is("__", end_ptr, dctl)) {
/* Further derived class. */
end_ptr += 2;
write_id_str(" in ", dctl);
end_ptr = demangle_vtbl_class_name(end_ptr, dctl);
} /* while */
} else if (start_of_id_is("__CBI__", id, dctl)) {
write_id_str("can-be-instantiated flag for ", dctl);
end_ptr = demangle_identifier(id+7, dctl);
} else if (start_of_id_is("__DNI__", id, dctl)) {
write_id_str("do-not-instantiate flag for ", dctl);
end_ptr = demangle_identifier(id+7, dctl);
} else if (start_of_id_is("__TIR__", id, dctl)) {
write_id_str("template-instantiation-request flag for ", dctl);
end_ptr = demangle_identifier(id+7, dctl);
} else if (start_of_id_is("__LSG__", id, dctl)) {
write_id_str("initialization guard variable for ", dctl);
end_ptr = demangle_identifier(id+7, dctl);
} else if (start_of_id_is("__TID_", id, dctl)) {
write_id_str("type identifier for ", dctl);
end_ptr = demangle_type(id+6, dctl);
} else if (start_of_id_is("__T_", id, dctl)) {
write_id_str("typeinfo for ", dctl);
end_ptr = demangle_type(id+4, dctl);
} else if (start_of_id_is("__VFE__", id, dctl)) {
write_id_str("surrogate in class ", dctl);
p = demangle_type(id+7, dctl);
if (get_char(p, dctl) != '_' || get_char(p+1, dctl) != '_') {
bad_mangled_name(dctl);
end_ptr = p;
} else {
write_id_str(" for ", dctl);
end_ptr = demangle_identifier(p+2, dctl);
} /* if */
} else if (start_of_id_is("__Q", id, dctl) ||
(start_of_id_is("__", id, dctl) &&
is_mangled_type_name(id+2, dctl))) {
/* Mangled type name. */
end_ptr = demangle_type_name(id+2, dctl);
} else if (start_of_id_is("__STV__", id, dctl)) {
/* Static variable made external by addition of prefix "__STV__" and
suffix of module id. */
end_ptr = demangle_static_variable_name(id, dctl);
} else if (start_of_id_is("__", id, dctl) && isdigit((unsigned char)id[2])) {
/* Local variable mangled by the C-generating back end: __nn_mm_name,
where "nn" and "mm" are decimal integers. */
end_ptr = demangle_local_name(id, dctl);
} else {
/* Normal case: function name, static data member name, or
name of type or variable promoted out of function. */
end_ptr = demangle_identifier(id, dctl);
} /* if */
if (dctl->output_overflow_err) {
dctl->err_in_id = TRUE;
} else {
/* Add a terminating null. */
dctl->output_id[dctl->output_id_len] = 0;
} /* if */
/* Make sure the whole identifier was taken. */
if (!dctl->err_in_id && *end_ptr != '\0') bad_mangled_name(dctl);
*err = dctl->err_in_id;
*buffer_overflow_err = dctl->output_overflow_err;
*required_buffer_size = dctl->output_id_len + 1; /* +1 for final null. */
/* If the name is compressed, we need room for the uncompressed
form, and a null, in the buffer. */
if (dctl->uncompressed_length != 0) {
*required_buffer_size += dctl->uncompressed_length+1;
} /* if */
} /* decode_identifier */
#else /* IA64_ABI */
/*
Start of demangling code for IA-64 ABI.
*/
/*
TRUE if the bugs in the g++ 3.2 implementation of the IA-64 ABI should
be emulated. Can be changed by a command line option.
*/
a_boolean emulate_gnu_abi_bugs = DEFAULT_EMULATE_GNU_ABI_BUGS;
/*
TRUE if the host integer representation is little-endian.
External because it's declared extern in host_envir.h.
*/
a_boolean host_little_endian;
/*
Bits used to represent cv-qualifiers in a bit set.
*/
typedef int a_cv_qualifier_set;
#define CVQ_NONE ((a_cv_qualifier_set)0)
#define CVQ_CONST ((a_cv_qualifier_set)0x1)
#define CVQ_VOLATILE ((a_cv_qualifier_set)0x2)
#define CVQ_RESTRICT ((a_cv_qualifier_set)0x4)
/*
Information about a function that has to be preserved from the
time of scanning of the name (e.g., in a <nested-name>) until later use
in processing the <bare-function-type>.
*/
typedef struct a_func_block {
a_boolean no_return_type;
/* TRUE if the function is one that will not have
a return type encoded in the function type. */
a_cv_qualifier_set
cv_quals;
/* If the function is a cv-qualified member function,
the set of cv-qualifiers. 0 otherwise. */
char ctor_dtor_kind;
/* If the function is a constructor or destructor,
the character from the mangled name identifying its
kind, e.g., '2' for a subobject constructor/
destructor. ' ' if the function is not a
constructor or destructor. */
} a_func_block;
/*
Information about an entity in the mangled name that may be reused
by referring back to it by number as a "substitution".
*/
/* Code for type of syntactic object substituted for: */
typedef enum a_substitution_kind {
subk_unscoped_template_name,
/* An <unscoped-template-name>. */
subk_prefix, /* A <prefix>. */
subk_template_prefix, /* A <template-prefix>. */
subk_type, /* A <type>. */
subk_template_template_param
/* A <template-template-param>. */
} a_substitution_kind;
typedef struct a_substitution {
char *start; /* First character of the encoding of the entity. */
a_substitution_kind
kind; /* Kind of entity. */
unsigned long num_levels;
/* For subk_prefix and subk_template_prefix, the
number of levels of the prefix included. That is,
is the substitution A:: or A::B:: or A::B::C::.
For the subk_template_prefix case, the count
is the number of complete levels (name plus
optional template argument list) that precede
the final name (and no template argument list)
that is part of the substitution. (Therefore,
the count could be zero.) */
} a_substitution;
static a_substitution
*substitutions = NULL;
/* A dynamically allocated array. substitutions[n]
gives the meaning of the substitution numbered
"n". */
static unsigned long
num_substitutions = 0;
/* The number of substitutions currently defined, i.e.,
the number of elements of the array that have
been set. */
static unsigned long
allocated_substitutions = 0;
/* The allocated size of the array, as a number of
elements. */
char *demangle_type_first_part(
char *ptr,
a_cv_qualifier_set cv_quals,
a_boolean under_lhs_declarator,
a_boolean need_trailing_space,
a_boolean parse_template_args,
a_decode_control_block_ptr dctl);
void demangle_type_second_part(
char *ptr,
a_cv_qualifier_set cv_quals,
a_boolean under_lhs_declarator,
a_decode_control_block_ptr dctl);
static char *full_demangle_type(char *ptr,
a_boolean parse_template_args,
a_boolean is_pack_expansion,
a_decode_control_block_ptr dctl);
static char *demangle_simple_id(char *ptr,
a_decode_control_block_ptr dctl);
/*
Macro to invoke full_demangle_type in the usual case where parse_template_args
is TRUE and is_pack_expansion is FALSE.
*/
#define demangle_type(ptr, dctl) \
full_demangle_type(ptr, /*parse_template_args=*/TRUE, \
/*is_pack_expansion=*/FALSE, dctl)
static char *demangle_template_args(char *ptr,
a_decode_control_block_ptr dctl);
/*
Bit mask used to determine which portion(s) of a <name> should
be emitted by demangle_name. For most cases, DNO_ALL is correct, but in
cases where a <name> is scanned more than once, different portions of the
name may be emitted on different passes.
*/
typedef int a_demangle_name_option;
#define DNO_NONE ((a_demangle_name_option)0)
#define DNO_EXTERNALIZATION \
((a_demangle_name_option)0x1)
#define DNO_NAME ((a_demangle_name_option)0x2)
#define DNO_ALL (DNO_EXTERNALIZATION | DNO_NAME)
static char *demangle_name(char *ptr,
a_func_block *func_block,
a_demangle_name_option options,
a_decode_control_block_ptr dctl);
static char *demangle_unresolved_name(char *ptr,
a_decode_control_block_ptr dctl);
static char *demangle_expression(char *ptr,
a_decode_control_block_ptr dctl);
static char *demangle_encoding(char *ptr,
a_boolean include_func_params,
a_decode_control_block_ptr dctl);
static char *demangle_nested_name_components(
char *ptr,
unsigned long num_levels,
a_boolean *is_no_return_name,
a_boolean *has_templ_arg_list,
char *ctor_dtor_kind,
char **last_component_name,
a_decode_control_block_ptr dctl);
static char *demangle_unscoped_name(char *ptr,
a_func_block *func_block,
a_decode_control_block_ptr dctl);
static char *demangle_unqualified_name(
char *ptr,
a_boolean *is_no_return_name,
a_decode_control_block_ptr dctl);
static char *demangle_template_param(char *ptr,
a_decode_control_block_ptr dctl);
static void output_cv_qualifiers(a_cv_qualifier_set cv_quals,
a_boolean trailing_space,
a_decode_control_block_ptr dctl);
static void clear_func_block(a_func_block *func_block)
/*
Clear a function information block to default values.
*/
{
func_block->no_return_type = FALSE;
func_block->cv_quals = 0;
func_block->ctor_dtor_kind = ' ';
} /* clear_func_block */
char *get_number(char *p,
long *num,
a_decode_control_block_ptr dctl)
/*
Accumulate a number starting at position p and return its value in *num.
Return a pointer to the character position following the number.
A negative number is indicated by a leading "n".
*/
{
long n = 0;
a_boolean negative = FALSE;
if (*p == 'n') {
negative = TRUE;
p++;
} /* if */
if (!isdigit((unsigned char)*p)) {
bad_mangled_name(dctl);
} else {
do {
n = n*10 + (*p - '0');
p++;
} while (isdigit((unsigned char)*p));
} /* if */
if (negative) n = -n;
*num = n;
return p;
} /* get_number */
static void record_substitutable_entity(char *start,
a_substitution_kind kind,
unsigned long num_levels,
a_decode_control_block_ptr dctl)
/*
Record the entity whose mangled name starts at "start", and whose
kind (of syntax term) is given by "kind", as a potentially
substitutable entity, one that can be used again by referencing
it in a later substitution. num_levels gives added information
for the subk_prefix and subk_template_prefix cases.
*/
{
/* Do not record anything if we are suppressing recording of substitutions.
One case in which that is true is when an error has been detected. */
if (!dctl->suppress_substitution_recording) {
unsigned long number = num_substitutions++;
a_substitution *subp;
if (num_substitutions > allocated_substitutions) {
/* Need to allocate or extend the substitutions array. */
true_size_t new_size;
allocated_substitutions += 500;
new_size = allocated_substitutions*sizeof(a_substitution);
if (substitutions == NULL) {
substitutions = (a_substitution*)malloc(new_size);
} else {
substitutions = (a_substitution*)realloc(substitutions, new_size);
} /* if */
if (substitutions == NULL) {
bad_mangled_name(dctl);
return;
} /* if */
} /* if */
subp = &substitutions[number];
subp->start = start;
subp->kind = kind;
subp->num_levels = num_levels;
} /* if */
} /* record_substitutable_entity */
static char *demangle_substitution(
char *ptr,
int type_pass_num,
a_cv_qualifier_set cv_quals,
a_boolean under_lhs_declarator,
a_boolean need_trailing_space,
char **last_component_name,
char **substitution,
a_decode_control_block_ptr dctl)
/*
Demangle an IA-64 <substitution> and output the demangled form.
Return a pointer to the character position following what was demangled.
A <substitution> repeats a construct previously encoded in the
mangled name by referring to it by number, as a way to reduce the
size of mangled names. There are also some predefined substitutions,
for entities from the standard library that are likely to come up
often. The syntax is:
<substitution> ::= S <seq-id> _
::= S_
<substitution> ::= St # ::std::
<substitution> ::= Sa # ::std::allocator
<substitution> ::= Sb # ::std::basic_string
<substitution> ::= Ss # ::std::basic_string < char,
::std::char_traits<char>,
::std::allocator<char> >
<substitution> ::= Si # ::std::basic_istream<char, std::char_traits<char> >
<substitution> ::= So # ::std::basic_ostream<char, std::char_traits<char> >
<substitution> ::= Sd # ::std::basic_iostream<char, std::char_traits<char> >
When the substitution is a type, type_pass_num indicates whether to
do the first-part (1) or second-part (2) processing. type_pass_num == 0
means do both parts, i.e., the whole type. cv_quals,
under_lhs_declarator, and need_trailing_space give extra information
to be passed through to the type demangling routines in that case. If
last_component_name is non-NULL, and the substitution decoded is a
prefix of a nested name, a pointer to the encoding for the last
component of the nested name is returned in *last_component_name. It
will not be a substitution. This is needed for generating the names
of constructors and destructors. If substitution is non-NULL, *substitution
is set to the point in the mangled name where the substitution source
occurs (in case the caller needs to examine it -- for example to see what
type the substitution represents).
*/
{
char ch2 = ptr[1];
if (last_component_name != NULL) *last_component_name = NULL;
if (substitution != NULL) *substitution = NULL;
if (islower((unsigned char)ch2)) {
/* Predefined substitution. */
char *str = "";
char *last_name = "";
if (ch2 == 't') {
str = "std";
last_name = "3std";
} else if (ch2 == 'a') {
str = "std::allocator";
last_name = "9allocator";
} else if (ch2 == 'b') {
str = "std::basic_string";
last_name = "12basic_string";
} else if (ch2 == 's') {
str =
"std::basic_string<char, std::char_traits<char>, std::allocator<char>>";
last_name = "12basic_string";
} else if (ch2 == 'i') {
str = "std::basic_istream<char, std::char_traits<char>>";
last_name = "13basic_istream";
} else if (ch2 == 'o') {
str = "std::basic_ostream<char, std::char_traits<char>>";
last_name = "13basic_ostream";
} else if (ch2 == 'd') {
str = "std::basic_iostream<char, std::char_traits<char>>";
last_name = "14basic_iostream";
} /* if */
/* Output nothing if we want only the second-pass output. */
if (type_pass_num != 2) {
output_cv_qualifiers(cv_quals, TRUE, dctl);
write_id_str(str, dctl);
} /* if */
ptr += 2;
if (last_component_name != NULL) *last_component_name = last_name;
} else {
/* Not a predefined substitution. Convert the base-36 sequence number. */
uint32_t number = 0;
a_substitution *subp;
char *p;
ptr++;
if (ch2 != '_') {
do {
static char digits[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
number *= 36;
if (*ptr == '\0') {
bad_mangled_name(dctl);
break;
} /* if */
p = strchr(digits, *ptr);
if (p == NULL) {
bad_mangled_name(dctl);
break;
} /* if */
number += (uint32_t)(p - digits);
ptr++;
} while (*ptr != '_');
number++;
} /* if */
if (number >= num_substitutions) {
bad_mangled_name(dctl);
} else {
a_func_block func_block;
ptr = advance_past_underscore(ptr, dctl);
subp = &substitutions[number];
p = subp->start;
if (substitution != NULL) *substitution = p;
/* Rescan the encoding for the entity, outputting the demangled form
again at the current output position. Don't record substitutions
when rescanning. */
dctl->suppress_substitution_recording++;
if (type_pass_num == 2 && subp->kind != subk_type) {
/* If we're expecting a type, and we want the second-pass
processing, and we get something other than a type, ignore it.
It's a type specifier, and we don't put those out on the
second pass. */
} else {
switch (subp->kind) {
case subk_unscoped_template_name:
if (type_pass_num == 1 || type_pass_num == 0) {
/* Emit any cv-qualifiers that are applicable to this
substitution. */
output_cv_qualifiers(cv_quals, TRUE, dctl);
} /* if */
(void)demangle_unscoped_name(p, &func_block, dctl);
break;
case subk_prefix:
case subk_template_prefix:
{ a_boolean is_no_return_name, has_templ_arg_list;
char ctor_dtor_kind;
output_cv_qualifiers(cv_quals, TRUE, dctl);
/* Take the right number of levels of the name. Note that a
substitution counts as one level even if it represents
several. */
if (subp->num_levels > 0) {
p = demangle_nested_name_components(p,
subp->num_levels,
&is_no_return_name,
&has_templ_arg_list,
&ctor_dtor_kind,
last_component_name,
dctl);
} /* if */
if (subp->kind == subk_template_prefix) {
/* For the template prefix case, take one more
<unqualified-name>. */
if (subp->num_levels > 0) write_id_str("::", dctl);
p = demangle_unqualified_name(p, &is_no_return_name, dctl);
} /* if */
}
break;
case subk_type:
if (type_pass_num == 1 || type_pass_num == 0) {
(void)demangle_type_first_part(p, cv_quals,
under_lhs_declarator,
need_trailing_space,
/*parse_template_args=*/TRUE,
dctl);
} /* if */
if (type_pass_num == 2 || type_pass_num == 0) {
demangle_type_second_part(p, cv_quals,
under_lhs_declarator, dctl);
} /* if */
break;
case subk_template_template_param:
(void)demangle_template_param(p, dctl);
break;
default:
bad_mangled_name(dctl);
} /* switch */
} /* if */
dctl->suppress_substitution_recording--;
} /* if */
} /* if */
return ptr;
} /* demangle_substitution */
/*
Bit mask used to determine which portion(s) of a <bare-function-type> should
be emitted. The <bare-function-type> contains an optional return type
as well as one or more parameter types.
*/
typedef int a_bare_function_type_option;
#define BFT_NONE ((a_bare_function_type_option)0)
#define BFT_RETURN ((a_bare_function_type_option)0x1)
#define BFT_PARAMS ((a_bare_function_type_option)0x2)
static char *demangle_bare_function_type(
char *ptr,
a_boolean no_return_type,
a_bare_function_type_option options,
a_decode_control_block_ptr dctl)
/*
Demangle an IA-64 <bare-function-type> and output selected pieces of the
demangled form. Return a pointer to the character position following what was
demangled. A <bare-function-type> encodes the return and parameter types of a
function type without the surrounding F/E delimiters. It is used in cases
where the only possibility is a function type, e.g., in a top-level encoding
for a function. The syntax is:
<bare-function-type> ::= <signature type>+
# types are possible return type, then parameter types
That is, the <bare-function-type> is one or more type encodings.
no_return_type is TRUE if the return type is not present in the mangled
encoding. The pieces of the <bare-function-type> that are emitted are
controlled by the options bit mask; when BFT_RETURN is specified the return
type (and a space character) is emitted, when BFT_PARAMS is specified the
parameter types (with surrounding "( )") are emitted. In all cases, the
returned value reflects the end position of <bare-function-type> (regardless of
what portion(s) of it were emitted).
*/
{
#define end_of_param_list(p) (*(p) == 'E' || *(p) == '\0')
/* Handle the return type first. */
if ((options & BFT_RETURN) == 0) dctl->suppress_id_output++;
if (!no_return_type) {
/* A return type is present and must be scanned. */
ptr = demangle_type(ptr, dctl);
write_id_ch(' ', dctl);
} /* if */
if ((options & BFT_RETURN) == 0) dctl->suppress_id_output--;
/* The remaining portion is the parameter type(s). */
if ((options & BFT_PARAMS) == 0) dctl->suppress_id_output++;
write_id_ch('(', dctl);
if (end_of_param_list(ptr)) {
/* Error, there are no parameter types (there's supposed to be at
least a "v" for a void parameter list). This is likely caused
by absence of a return type when one is expected. */
bad_mangled_name(dctl);
} else if (*ptr == 'v' && end_of_param_list(ptr+1)) {
/* An empty parameter list is encoded as a single void type.
Put out just "()" for that case. */
ptr++;
} else {
for (;;) {
if (*ptr == 'z') {
/* Encoding for ellipsis. */
write_id_str("...", dctl);
ptr++;
if (!end_of_param_list(ptr)) {
bad_mangled_name(dctl);
break;
} /* if */
} else {
/* Normal type, not an ellipsis. */
ptr = demangle_type(ptr, dctl);
} /* if */
/* Stop on an "E" or at the end of the input. */
if (end_of_param_list(ptr)) break;
/* Stop on an error. */
if (dctl->err_in_id) break;
/* Continuing, so we need a comma between parameter types. */
write_id_str(", ", dctl);
} /* if */
} /* if */
write_id_ch(')', dctl);
if ((options & BFT_PARAMS) == 0) dctl->suppress_id_output--;
return ptr;
#undef end_of_param_list
} /* demangle_bare_function_type */
static char *get_cv_qualifiers(char *ptr,
a_cv_qualifier_set *cv_quals)
/*
Advance over any cv-qualifiers (const/volatile) at the indicated location
and return in *cv_quals a bit set indicating the qualifiers encountered.
Return a pointer to the character position following what was demangled.
Note that the IA-64 ABI defines a general-purpose "vendor extended type
qualifier" that is not implemented (as yet). Certain vendor extended type
qualifiers are however used by the front end to represent C++/CLI declarators;
those are handled in the declarator processing rather than here
(order-insensitive vendor extended type qualifiers should be handled here,
but currently the front end doesn't use any).
*/
{
*cv_quals = 0;
for (;; ptr++) {
if (*ptr == 'K') {
*cv_quals |= CVQ_CONST;
} else if (*ptr == 'V') {
*cv_quals |= CVQ_VOLATILE;
} else if (*ptr == 'r') {
*cv_quals |= CVQ_RESTRICT;
} else {
break;
} /* if */
} /* for */
return ptr;
} /* get_cv_qualifiers */
static a_boolean is_vendor_extended_declarator(char *ptr)
/*
Returns TRUE if the location pointed to by ptr contains an EDG-specific vendor
extended type qualifier and the extension is being used as a declarator.
Note that these vendor extended type qualifiers are treated as order-sensitive.
*/
{
return (start_of_id_is("U8__handle", ptr) ||
start_of_id_is("U8__trkref", ptr) ||
start_of_id_is("U14__interior_ptr", ptr) ||
start_of_id_is("U9__pin_ptr", ptr));
} /* is_vendor_extended_declarator */
static char *demangle_vector_size_qualifier(char *ptr,
a_decode_control_block_ptr dctl)
/*
Demangle the GNU vector_size qualifier if it appears at the indicated
location. Return a pointer to the character position following what was
demangled.
*/
{
if (start_of_id_is("U8__vector", ptr)) {
ptr += 10;
write_id_str("__attribute__((vector_size(?))) ", dctl);
} /* for */
return ptr;
} /* demangle_vector_size_qualifier */
static void output_cv_qualifiers(a_cv_qualifier_set cv_quals,
a_boolean trailing_space,
a_decode_control_block_ptr dctl)
/*
Output any cv-qualifiers (const/volatile) in the bit set cv_quals.
If trailing_space is TRUE, add a space at the end if any qualifiers were
put out.
*/
{
a_boolean any_previous = FALSE;
if (cv_quals & CVQ_CONST ) {
write_id_str("const", dctl);
any_previous = TRUE;
} /* if */
if (cv_quals & CVQ_VOLATILE) {
if (any_previous) write_id_ch(' ', dctl);
write_id_str("volatile", dctl);
any_previous = TRUE;
} /* if */
if (cv_quals & CVQ_RESTRICT) {
if (any_previous) write_id_ch(' ', dctl);
write_id_str("restrict", dctl);
any_previous = TRUE;
} /* if */
if (any_previous && trailing_space) write_id_ch(' ', dctl);
} /* output_cv_qualifiers */
static char *demangle_template_param(char *ptr,
a_decode_control_block_ptr dctl)
/*
Demangle an IA-64 <template-param> and output the demangled form. Return
a pointer to the character position following what was demangled.
A <template-param> encodes a reference to a template parameter.
The syntax is:
<template-param> ::= T_ # first template parameter
::= T <parameter-2 non-negative number> _
*/
{
long num = 1;
char buffer[50];
/* Advance past the "T". */
ptr++;
if (*ptr != '_') {
ptr = get_number(ptr, &num, dctl);
if (num < 0) {
bad_mangled_name(dctl);
num = 0;
} else {
num += 2;
} /* if */
} /* if */
ptr = advance_past_underscore(ptr, dctl);
(void)sprintf(buffer, "T%ld", num);
write_id_str(buffer, dctl);
return ptr;
} /* demangle_template_param */
char *demangle_parameter_reference(char *ptr,
a_decode_control_block_ptr dctl)
/*
Demangle an IA-64 <function-param> and output the demangled form.
Function parameter placeholders are needed for late-specified return types.
Return a pointer to the character position following what was demangled.
A <function-param> encodes a reference to a function parameter.
The syntax is:
<function-param> ::= fpT # "this"
::= fp <top-level CV-qualifiers> _
# L == 0, first parameter
::= fp <top-level CV-qualifiers>
<parameter-2 non-negative number> _
# L == 0, second and later parameters
::= fL <L-1 non-negative number> p
<top-level CV-qualifiers> _
# L > 0, first parameter
::= fL <L-1 non-negative number> p
<top-level CV-qualifiers>
<parameter-2 non-negative number> _
# L > 0, second and later parameters
*/
{
long num = 1, level = -1;
char buffer[50];
a_cv_qualifier_set cv_quals;
/* Advance past the "f". */
ptr++;
if (*ptr == 'L') {
/* Get the optional level information. */
ptr++;
ptr = get_number(ptr, &level, dctl);
if (level < 0) {
bad_mangled_name(dctl);
goto end_of_routine;
} else {
level += 1;
} /* if */
} /* if */
if (*ptr != 'p') {
bad_mangled_name(dctl);
goto end_of_routine;
} /* if */
ptr++;
if (*ptr == 'T') {
/* Implicit "this" in trailing return type. */
ptr++;
write_id_str("this", dctl);
} else {
if (*ptr != '_' && !isdigit((unsigned char)*ptr)) {
/* Optional cv-qualifiers. */
ptr = get_cv_qualifiers(ptr, &cv_quals);
output_cv_qualifiers(cv_quals, /*trailing_space=*/TRUE, dctl);
} /* if */
if (*ptr != '_') {
/* Parameter number. */
ptr = get_number(ptr, &num, dctl);
if (num < 0) {
bad_mangled_name(dctl);
goto end_of_routine;
} else {
num += 2;
} /* if */
} /* if */
ptr = advance_past_underscore(ptr, dctl);
write_id_str("param#", dctl);
if (level == -1) {
(void)sprintf(buffer, "%ld", num);
} else {
(void)sprintf(buffer, "%ld[up %ld level%s]", num, level,
level > 1 ? "s" : "");
} /* if */
write_id_str(buffer, dctl);
} /* if */
end_of_routine:
return ptr;
} /* demangle_parameter_reference */
/* Forward reference. */
static char *demangle_source_name(
char *ptr,
a_boolean is_module_id,
a_decode_control_block_ptr dctl);
/*
Macro to determine if the character string pointed to by "p" is a
<builtin-type>. <builtin-type>s are a single lower-case letter or two
characters starting with the character "D". Exceptions to this rule are
the mangling for decltype (i.e., "DT" and "Dt") as well as the EDG extension
for typeof (i.e., "DY" and "Dy"), __underlying_type (i.e., "Du") and pack
expansions (i.e., "Dp"). The lower case letter "r" is used in <CV-qualifiers>
for "restrict" and is not a <builtin-type>.
*/
#define is_builtin_type(p) \
((islower((unsigned char)*(p)) && \
*(p) != 'r') || \
(*(p) == 'D' && \
!((p)[1] == 'p' || (p)[1] == 'u' || \
(p)[1] == 'T' || (p)[1] == 't' || \
(p)[1] == 'Y' || (p)[1] == 'y')))
/*
Macro to determine if the type pointed to by "p" needs a substitution
recorded for it. <builtin-type>s are not recorded with the exception of
vendor extended types which are recorded.
*/
#define record_substitution_for_type(p) (!(is_builtin_type(p)) || *(p) == 'u')
static char *demangle_type_specifier(
char *ptr,
a_boolean parse_template_args,
a_decode_control_block_ptr dctl)
/*
Demangle the type at ptr and output the specifier part. Return a pointer
to the character position following what was demangled. The syntax is:
<type> ::= <builtin-type>
::= <class-enum-type>
::= <template-param>
::= <template-template-param> <template-args>
::= Dp <type> # pack expansion of (C++11)
::= Dt <expression> E # decltype of an id-expression or class member
# access (C++11)
::= DT <expression> E # decltype of an expression (C++11)
::= Dy <type> E # typeof(type) (EDG extension)
::= DY <expression> E # typeof(expression) (EDG extension)
::= Du <type> E # __underlying_type(type) (EDG extension)
Other parts of <type> are handled in demangle_type_first_part and
demangle_type_second_part. In particular, substitutions are handled
at that level. cv-qualifiers have been handled by the caller.
If parse_template_args is TRUE then any <template-args> in the type should be
parsed as part of the type. parse_template_args is FALSE when parsing the
<type> of a conversion function operator-name (the <template-args> are
demangled as part of the template function instead).
*/
{
char *p = ptr, *s;
/* Builtin type encodings are typically lower-case (with some exceptions).
Names begin with a digit or an upper-case letter. */
if (!is_builtin_type(p)) {
if (*p == 'T') {
/* A template parameter, possibly a template template parameter. */
char *tstart = p;
p = demangle_template_param(p, dctl);
if (*p == 'I' && parse_template_args) {
/* A <template-args> list. */
/* Record the template template parameter as a potential
substitution. */
record_substitutable_entity(tstart, subk_template_template_param, 0L,
dctl);
p = demangle_template_args(p, dctl);
} /* if */
} else if (*p == 'D' && p[1] == 'p') {
/* A pack expansion. */
p = full_demangle_type(p+2, /*parse_template_args=*/TRUE,
/*is_pack_expansion=*/TRUE, dctl);
} else if (*p == 'D' &&
(p[1] == 't' || p[1] == 'T')) {
/* decltype:
Dt <expression> E # decltype of an id-expression or class member
# access
DT <expression> E # decltype of an expression */
write_id_str("decltype(", dctl);
if (p[1] == 't') {
p = demangle_expression(p+2, dctl);
} else {
write_id_ch('(', dctl);
p = demangle_expression(p+2, dctl);
write_id_ch(')', dctl);
} /* if */
write_id_ch(')', dctl);
p = advance_past('E', p, dctl);
} else if (*p == 'D' &&
(p[1] == 'y' || p[1] == 'Y')) {
/* typeof:
This is an EDG extension to the IA-64 ABI spec to handle GNU typeof
(and GNU doesn't provide a mangling that we can follow):
<type> ::= Dy <type> E # typeof(type)
::= DY <expression> E # typeof(expression)
*/
write_id_str("typeof(", dctl);
if (p[1] == 'y') {
p = demangle_type(p+2, dctl);
} else {
p = demangle_expression(p+2, dctl);
} /* if */
write_id_ch(')', dctl);
p = advance_past('E', p, dctl);
} else if (*p == 'D' && p[1] == 'u') {
/* __underlying_type:
This is an EDG extension to the IA-64 ABI spec to handle
__underlying_type (a helper function used to implement the C++11
underlying_type type trait):
<type> ::= Du <type> E # __underlying_type(type)
*/
write_id_str("__underlying_type(", dctl);
p = demangle_type(p+2, dctl);
write_id_ch(')', dctl);
p = advance_past('E', p, dctl);
} else {
/* <class-enum-type>, i.e., <name> */
a_func_block func_block;
p = demangle_name(p, &func_block, /*options=*/DNO_ALL, dctl);
} /* if */
} else {
/* Builtin type. */
switch (*p++) {
case 'v':
s = "void";
break;
case 'w':
s = "wchar_t";
break;
case 'b':
s = "bool";
break;
case 'c':
s = "char";
break;
case 'a':
s = "signed char";
break;
case 'h':
s = "unsigned char";
break;
case 's':
s = "short";
break;
case 't':
s = "unsigned short";
break;
case 'i':
s = "int";
break;
case 'j':
s = "unsigned int";
break;
case 'l':
s = "long";
break;
case 'm':
s = "unsigned long";
break;
case 'x':
s = "long long";
break;
case 'y':
s = "unsigned long long";
break;
case 'n':
s = "__int128";
break;
case 'o':
s = "unsigned __int128";
break;
case 'f':
s = "float";
break;
case 'd':
s = "double";
break;
case 'e':
s = "long double";
break;
case 'u':
/* A vendor extended type is specified as:
<builtin-type> ::= u <source-name> . */
p = demangle_source_name(p, /*is_module_id=*/FALSE, dctl);
s = "";
break;
case 'D':
/* Additional built-in types (too many to assign a single character
to each one). */
switch (*p++) {
case 'a':
s = "auto";
break;
case 'n':
s = "std::nullptr_t";
break;
case 'N':
/* EDG extension for C++/CLI managed __nullptr. */
s = "__nullptr";
break;
case 's':
s = "char16_t";
break;
case 'i':
s = "char32_t";
break;
default:
bad_mangled_name(dctl);
s = "";
} /* switch */
break;
case 'z': /* Ellipsis not handled here;
see demangle_bare_function_type. */
default:
bad_mangled_name(dctl);
s = "";
} /* switch */
write_id_str(s, dctl);
} /* if */
return p;
} /* demangle_type_specifier */
static char *skip_extern_C_indication(char *ptr)
/*
ptr points to the character after the "F" of a function type. Skip over
and ignore an indication of extern "C" following the "F", if one is present.
Return a pointer to the character following the extern "C" indication.
There's no syntax for representing the extern "C" in the function type, so
just ignore it.
*/
{
if (*ptr == 'Y') ptr++;
return ptr;
} /* skip_extern_C_indication */
char *demangle_type_first_part(
char *ptr,
a_cv_qualifier_set cv_quals,
a_boolean under_lhs_declarator,
a_boolean need_trailing_space,
a_boolean parse_template_args,
a_decode_control_block_ptr dctl)
/*
Demangle the type at ptr and output the specifier part and the part of the
declarator that precedes the name. Return a pointer to the character
position following what was demangled. If under_lhs_declarator is TRUE,
this type is directly under a type that uses a left-side declarator,
e.g., a pointer type. (That's used to control use of parentheses around
parts of the declarator.) If need_trailing_space is TRUE, put a space
at the end of the specifiers part (needed if the declarator part is
not empty, because it contains a name or a derived type). cv_quals
indicates any previously-scanned cv-qualifiers that are to be considered
to be on top of the type. If parse_template_args is TRUE then any
<template-args> in the type should be parsed as part of the type.
*/
{
char *p = ptr, *qualp = p, *unqualp;
char kind;
a_cv_qualifier_set local_cv_quals;
a_boolean record_substitution = TRUE;
/* Accumulate cv-qualifiers. */
p = get_cv_qualifiers(p, &local_cv_quals);
cv_quals |= local_cv_quals;
unqualp = p;
kind = *p;
if (kind == 'S' &&
/* "St" for "std::" is the beginning of a name, not a type. */
p[1] != 't') {
/* A substitution. */
p = demangle_substitution(p, 1, cv_quals,
under_lhs_declarator,
need_trailing_space,
(char **)NULL,
(char **)NULL,
dctl);
record_substitution = FALSE;
if (*p == 'I') {
/* A <template-args> list (the substitution must be a template). */
p = demangle_template_args(p, dctl);
record_substitution = TRUE;
} /* if */
} else if (kind == 'P' || kind == 'R' || kind == 'O' || kind == 'C' ||
(kind == 'U' && is_vendor_extended_declarator(p))) {
char *vendor_ext = NULL;
a_boolean need_space = TRUE;
/* Look for type qualifiers:
<type> ::= <CV-qualifiers> <type>
::= P <type> # pointer-to
::= R <type> # reference-to
::= O <type> # rvalue reference-to (C++11)
::= C <type> # complex pair (C 2000)
::= U <source-name> <type> # vendor extended type qualifier
*/
p++;
if (kind == 'U') {
/* This is a vendor extended type qualifier that is being used by the
front end to encode C++/CLI pointer-like types (i.e., handles,
tracking references, interior_ptrs, and pin_ptrs). This avoids adding
EDG-specific manglings for these entities that might be used in
subsequent IA-64 ABI revisions. Note that these extensions are
treated as "order-sensitive" for the purposes of substitutions. */
long num;
if (start_of_id_is("8__handle", p)) {
vendor_ext = "^";
} else if (start_of_id_is("8__trkref", p)) {
vendor_ext = "%";
} else if (start_of_id_is("14__interior_ptr", p)) {
write_id_str("interior_ptr<", dctl);
vendor_ext = ">";
need_space = FALSE;
} else if (start_of_id_is("9__pin_ptr", p)) {
write_id_str("pin_ptr<", dctl);
vendor_ext = ">";
need_space = FALSE;
} else {
bad_mangled_name(dctl);
} /* if */
/* Advance past the vendor string. */
p = get_number(p, &num, dctl);
p += num;
} /* if */
if (kind == 'C') {
write_id_str("_Complex ", dctl);
} /* if */
p = demangle_type_first_part(p, CVQ_NONE, /*under_lhs_declarator=*/TRUE,
need_space, parse_template_args, dctl);
if (kind == 'P') {
write_id_ch('*', dctl);
} else if (kind == 'R') {
write_id_ch('&', dctl);
} else if (kind == 'O') {
write_id_str("&&", dctl);
} else if (vendor_ext != NULL) {
write_id_str(vendor_ext, dctl);
} /* if */
/* Output the cv-qualifiers on the pointer, if any. */
output_cv_qualifiers(cv_quals, /*trailing_space=*/TRUE, dctl);
} else if (kind == 'M') {
/* Pointer-to-member type, M <class type> <member type>. */
char *classp = p+1;
/* Skip over the class name. */
/* Substitutions do get recorded on this scan. */
dctl->suppress_id_output++;
p = demangle_type(classp, dctl);
dctl->suppress_id_output--;
p = demangle_type_first_part(p, CVQ_NONE, /*under_lhs_declarator=*/TRUE,
/*need_trailing_space=*/TRUE,
parse_template_args, dctl);
/* Output Classname::*. */
dctl->suppress_substitution_recording++;
(void)demangle_type(classp, dctl);
dctl->suppress_substitution_recording--;
write_id_str("::*", dctl);
/* Output the cv-qualifiers on the pointer, if any. */
output_cv_qualifiers(cv_quals, /*trailing_space=*/TRUE, dctl);
} else if (kind == 'F') {
/* Function type, F [Y] <bare-function-type> E
where "Y" indicates extern "C" (and is ignored here). */
p = skip_extern_C_indication(p+1);
/* Output the return type. */
p = demangle_type_first_part(p, CVQ_NONE, /*under_lhs_declarator=*/FALSE,
/*need_trailing_space=*/TRUE,
parse_template_args, dctl);
/* Skip over the parameter types without outputting anything. */
/* Substitutions do get recorded on this scan. */
p = demangle_bare_function_type(p, /*no_return_type=*/TRUE, BFT_NONE,
dctl);
p = advance_past('E', p, dctl);
/* This is a right-side declarator, so if it's under a left-side declarator
parentheses are needed. */
if (under_lhs_declarator) write_id_ch('(', dctl);
} else if (kind == 'A') {
/* Array type,
A <positive dimension number> _ <element type>
A [ <dimension expression> ] _ <element type>
*/
p++;
if (!isdigit((unsigned char)*p)) {
if (*p != '_') {
/* Length is specified by an expression based on template
parameters. Ignore the expression. */
/* Substitutions do get recorded on this scan. */
dctl->suppress_id_output++;
p = demangle_expression(p, dctl);
dctl->suppress_id_output--;
} /* if */
} else {
/* Normal constant number of elements. */
/* Skip the array size. */
while (isdigit((unsigned char)*p)) p++;
} /* if */
p = advance_past_underscore(p, dctl);
/* Process the element type. */
p = demangle_type_first_part(p, CVQ_NONE, /*under_lhs_declarator=*/FALSE,
/*need_trailing_space=*/TRUE,
parse_template_args, dctl);
/* This is a right-side declarator, so if it's under a left-side declarator
parentheses are needed. */
if (under_lhs_declarator) write_id_ch('(', dctl);
} else {
/* No declarator part to process. Handle the specifier type. */
output_cv_qualifiers(cv_quals, /*trailing_space=*/TRUE, dctl);
p = demangle_vector_size_qualifier(p, dctl);
p = demangle_type_specifier(p, parse_template_args, dctl);
if (need_trailing_space) write_id_ch(' ', dctl);
if (!record_substitution_for_type(unqualp)) {
/* Do not record a substitution for (most) <builtin-type>s. */
record_substitution = FALSE;
} /* if */
} /* if */
if (record_substitution) {
/* Record the non-cv-qualified version of the type as a potential
substitution. */
record_substitutable_entity(unqualp, subk_type, 0L, dctl);
} /* if */
if (qualp != unqualp) {
/* The type is cv-qualified, so record another potential substitution
for the fully-qualified type. */
record_substitutable_entity(qualp, subk_type, 0L, dctl);
} /* if */
return p;
} /* demangle_type_first_part */
void demangle_type_second_part(
char *ptr,
a_cv_qualifier_set cv_quals,
a_boolean under_lhs_declarator,
a_decode_control_block_ptr dctl)
/*
Demangle the type at ptr and output the part of the declarator that follows the
name. This routine does not return a pointer to the character position
following what was demangled; it is assumed that the caller will save
that from the call of demangle_type_first_part, and it saves a lot of
time if this routine can avoid scanning the specifiers again.
If under_lhs_declarator is TRUE, this type is directly under a type that
uses a left-side declarator, e.g., a pointer type. (That's used to control
use of parentheses around parts of the declarator.) cv_quals
indicates any previously-scanned cv-qualifiers that are to considered
to be on top of the type.
*/
{
char *p = ptr;
char kind;
a_cv_qualifier_set local_cv_quals;
/* Accumulate cv-qualifiers. */
p = get_cv_qualifiers(p, &local_cv_quals);
cv_quals |= local_cv_quals;
kind = *p;
if (kind == 'S' &&
/* "St" for "std::" is the beginning of a name, not a type. */
p[1] != 't') {
/* A substitution. */
p = demangle_substitution(p, 2, cv_quals,
under_lhs_declarator,
/*need_trailing_space=*/FALSE,
(char **)NULL,
(char **)NULL,
dctl);
/* No need to scan the <template-args> list if there is one --
that was done by demangle_type_first_part. */
} else if (kind == 'P' || kind == 'R' || kind == 'O' || kind == 'C' ||
(kind == 'U' && is_vendor_extended_declarator(p))) {
/* Look for type qualifiers:
<type> ::= <CV-qualifiers> <type>
::= P <type> # pointer-to
::= R <type> # reference-to
::= O <type> # rvalue reference-to (C++11)
::= C <type> # complex pair (C 2000)
::= U <source-name> <type> # vendor extended type qualifier
*/
p++;
if (kind == 'U') {
/* This is a vendor extended type qualifier that is being used
by the front end as a declarator; skip over it. */
dctl->suppress_id_output++;
p = demangle_source_name(p, /*is_module_id=*/FALSE, dctl);
dctl->suppress_id_output--;
} /* if */
demangle_type_second_part(p, CVQ_NONE, /*under_lhs_declarator=*/TRUE,
dctl);
} else if (kind == 'M') {
/* Pointer-to-member type, M <class type> <member type>. */
/* Advance over the class name. */
dctl->suppress_id_output++;
dctl->suppress_substitution_recording++;
p = demangle_type(p+1, dctl);
dctl->suppress_substitution_recording--;
dctl->suppress_id_output--;
demangle_type_second_part(p, CVQ_NONE, /*under_lhs_declarator=*/TRUE,
dctl);
} else if (kind == 'F') {
char *returnt;
/* Function type, F [Y] <bare-function-type> E
where "Y" indicates extern "C" (and is ignored here). */
/* This is a right-side declarator, so if it's under a left-side declarator
parentheses are needed. */
if (under_lhs_declarator) write_id_ch(')', dctl);
p = skip_extern_C_indication(p+1);
/* Put out the parameter types (the return type is skipped and not
output). */
returnt = p;
dctl->suppress_substitution_recording++;
p = demangle_bare_function_type(p, /*no_return_type=*/FALSE, BFT_PARAMS,
dctl);
dctl->suppress_substitution_recording--;
p = advance_past('E', p, dctl);
/* Put out any cv-qualifiers (member functions). */
/* Note that such things could come up on nonmember functions in the
presence of typedefs. In such a case what we generate here will not
be valid C, but it's a reasonable representation of the mangled
type, and there's no way of getting the typedef name in there,
so let it be. */
if (cv_quals != 0) {
write_id_ch(' ', dctl);
output_cv_qualifiers(cv_quals, /*trailing_space=*/FALSE, dctl);
} /* if */
/* Output the return type. */
demangle_type_second_part(returnt, CVQ_NONE,
/*under_lhs_declarator=*/FALSE, dctl);
} else if (kind == 'A') {
/* Array type,
A <positive dimension number> _ <element type>
A [ <dimension expression> ] _ <element type>
*/
/* This is a right-side declarator, so if it's under a left-side declarator
parentheses are needed. */
if (under_lhs_declarator) write_id_ch(')', dctl);
write_id_ch('[', dctl);
p++;
if (!isdigit((unsigned char)*p)) {
if (*p != '_') {
/* Length is specified by a constant expression based on template
parameters. */
dctl->suppress_substitution_recording++;
p = demangle_expression(p, dctl);
dctl->suppress_substitution_recording--;
} /* if */
} else {
/* Normal constant number of elements. */
/* Put out the array size. */
while (isdigit((unsigned char)*p)) write_id_ch(*p++, dctl);
} /* if */
p = advance_past_underscore(p, dctl);
write_id_ch(']', dctl);
/* Process the element type. */
demangle_type_second_part(p, CVQ_NONE, /*under_lhs_declarator=*/FALSE,
dctl);
} else {
/* No declarator part to process. No need to scan the specifiers type --
it was done by demangle_type_first_part. */
} /* if */
} /* demangle_type_second_part */
static char *full_demangle_type(char *ptr,
a_boolean parse_template_args,
a_boolean is_pack_expansion,
a_decode_control_block_ptr dctl)
/*
Demangle an IA-64 <type> and output the demangled form. Return a pointer
to the character position following what was demangled. A <type> encodes
a type. The syntax is:
<type> ::= <builtin-type>
::= <function-type>
::= <class-enum-type>
::= <array-type>
::= <pointer-to-member-type>
::= <template-param>
::= <template-template-param> <template-args>
::= <substitution>
::= <CV-qualifiers> <type>
::= P <type> # pointer-to
::= R <type> # reference-to
<function-type> ::= F [Y] <bare-function-type> E
<class-enum-type> ::= <name>
<array-type> ::= A <positive dimension number> _ <element type>
::= A [<dimension expression>] _ <element type>
<pointer-to-member-type> ::= M <class type> <member type>
If parse_template_args is TRUE then any <template-args> in the type should be
parsed as part of the type. When is_pack_expansion is TRUE, emit an
indication that the type is a pack expansion.
*/
{
char *p;
/* Generate the specifier part of the type. */
p = demangle_type_first_part(ptr, CVQ_NONE, /*under_lhs_declarator=*/FALSE,
/*need_trailing_space=*/FALSE,
parse_template_args, dctl);
if (is_pack_expansion) {
/* Emit the pack expansion indication between processing the two type
parts so that function and pointer to member function types are handled
properly. */
write_id_str("...", dctl);
} /* if */
/* Generate the declarator part of the type. */
demangle_type_second_part(ptr, CVQ_NONE, /*under_lhs_declarator=*/FALSE,
dctl);
return p;
} /* full_demangle_type */
static char *get_operator_name(char *ptr,
int *num_operands,
int *length,
char **close_str,
a_decode_control_block_ptr dctl)
/*
Demangle an IA-64 <operator-name> and return the demangled form.
Return NULL if the operator is invalid. An <operator-name> encodes
an operator in an expression or operator function name.
*num_operands is set to the number of operands expected by the operator.
*length is set to the mangled name length (2 except for vendor extended
operators). *close_str is set to a string that closes the operator,
if necessary, e.g., "]" for subscripting; it is set to "" if not needed.
*/
{
char *str = NULL;
*num_operands = 2;
*close_str = "";
*length = 0;
if (*ptr == '\0') {
bad_mangled_name(dctl);
} else {
char ch2 = ptr[1];
switch (*ptr) {
case 'a':
if (ch2 == 'a') {
str = "&&";
} else if (ch2 == 'd') {
str = "&";
*num_operands = 1;
} else if (ch2 == 'n') {
str = "&";
} else if (ch2 == 'N') {
str = "&=";
} else if (ch2 == 'S') {
str = "=";
} else if (ch2 == 't') {
/* alignof(type) -- newer mangling form */
str = "alignof(";
*num_operands = 0;
*close_str = ")";
} else if (ch2 == 'z') {
/* alignof(expression) -- newer mangling form */
str = "alignof(";
*close_str = ")";
*num_operands = 1;
} /* if */
break;
case 'c':
if (ch2 == 'c') {
str = "const_cast";
*num_operands = 1;
} else if (ch2 == 'l') {
str = "()";
*num_operands = 0; /* Call is variable-length. */
} else if (ch2 == 'm') {
str = ",";
} else if (ch2 == 'o') {
str = "~";
*num_operands = 1;
} else if (ch2 == 'v') {
str = "cast";
*num_operands = 1;
} /* if */
break;
case 'd':
if (ch2 == 'a') {
str = "delete[] ";
*num_operands = 1;
} else if (ch2 == 'c') {
str = "dynamic_cast";
*num_operands = 1;
} else if (ch2 == 'e') {
str = "*";
*num_operands = 1;
} else if (ch2 == 'l') {
str = "delete ";
*num_operands = 1;
} else if (ch2 == 's') {
str = ".*";
} else if (ch2 == 'v') {
str = "/";
} else if (ch2 == 'V') {
str = "/=";
} /* if */
break;
case 'e':
if (ch2 == 'o') {
str = "^";
} else if (ch2 == 'O') {
str = "^=";
} else if (ch2 == 'q') {
str = "==";
} /* if */
break;
case 'g':
if (ch2 == 'e') {
str = ">=";
} else if (ch2 == 't') {
str = ">";
} /* if */
break;
case 'i':
if (ch2 == 'x') {
str = "[";
*close_str = "]";
} /* if */
break;
case 'l':
if (ch2 == 'e') {
str = "<=";
} else if (ch2 == 's') {
str = "<<";
} else if (ch2 == 'S') {
str = "<<=";
} else if (ch2 == 't') {
str = "<";
} /* if */
break;
case 'm':
if (ch2 == 'i') {
str = "-";
} else if (ch2 == 'I') {
str = "-=";
} else if (ch2 == 'l') {
str = "*";
} else if (ch2 == 'L') {
str = "*=";
} else if (ch2 == 'm') {
str = "--";
*num_operands = 1;
} /* if */
break;
case 'n':
if (ch2 == 'a') {
str = "new[] ";
} else if (ch2 == 'e') {
str = "!=";
} else if (ch2 == 'g') {
str = "-";
*num_operands = 1;
} else if (ch2 == 't') {
str = "!";
*num_operands = 1;
} else if (ch2 == 'w') {
str = "new ";
} else if (ch2 == 'x') {
str = "noexcept(";
*close_str = ")";
*num_operands = 1;
} /* if */
break;
case 'o':
if (ch2 == 'o') {
str = "||";
} else if (ch2 == 'r') {
str = "|";
} else if (ch2 == 'R') {
str = "|=";
} /* if */
break;
case 'p':
if (ch2 == 'l') {
str = "+";
} else if (ch2 == 'L') {
str = "+=";
} else if (ch2 == 'm') {
str = "->*";
} else if (ch2 == 'p') {
str = "++";
*num_operands = 1;
} else if (ch2 == 's') {
str = "+";
*num_operands = 1;
} else if (ch2 == 't') {
str = "->";
} /* if */
break;
case 'q':
if (ch2 == 'u') {
str = "?";
*num_operands = 3;
} /* if */
break;
case 'r':
if (ch2 == 'c') {
str = "reinterpret_cast";
*num_operands = 1;
} else if (ch2 == 'm') {
str = "%";
} else if (ch2 == 'M') {
str = "%=";
} else if (ch2 == 's') {
str = ">>";
} else if (ch2 == 'S') {
str = ">>=";
} /* if */
break;
case 's':
if (ch2 == 'c') {
str = "static_cast";
*num_operands = 1;
} else if (ch2 == 't') {
/* sizeof(type) */
str = "sizeof(";
*num_operands = 0;
*close_str = ")";
} else if (ch2 == 'z') {
/* sizeof(expression) */
str = "sizeof(";
*close_str = ")";
*num_operands = 1;
} /* if */
break;
case 't':
if (ch2 == 'e') {
/* typeid(expression) -- newer mangling form */
str = "typeid(";
*close_str = ")";
*num_operands = 1;
} else if (ch2 == 'i') {
/* typeid(type) -- newer mangling form */
str = "typeid(";
*close_str = ")";
*num_operands = 0;
} else if (ch2 == 'r') {
/* rethrow (no arguments) */
str = "throw";
*num_operands = 0;
} else if (ch2 == 'w') {
/* throw (expression) */
str = "throw ";
*num_operands = 1;
} /* if */
break;
case 'v':
/* Vendor extended operators. */
if (start_of_id_is("v18alignofe", ptr)) {
/* __alignof__(expr) -- older mangling form */
str = "__alignof__(";
*close_str = ")";
*num_operands = 1;
*length = 11;
} else if (start_of_id_is("v17alignof", ptr)) {
/* __alignof__(type) -- older mangling form */
str = "__alignof__(";
*close_str = ")";
*num_operands = 0;
*length = 10;
} else if (start_of_id_is("v19__uuidofe", ptr)) {
/* __uuidof(expr) */
str = "__uuidof(";
*close_str = ")";
*num_operands = 1;
*length = 12;
} else if (start_of_id_is("v18__uuidof", ptr)) {
/* __uuidof(type) */
str = "__uuidof(";
*close_str = ")";
*num_operands = 0;
*length = 11;
} else if (start_of_id_is("v17typeide", ptr)) {
/* typeid(expr) -- older mangling form */
str = "typeid(";
*close_str = ")";
*num_operands = 1;
*length = 10;
} else if (start_of_id_is("v16typeid", ptr)) {
/* typeid(type) -- older mangling form */
str = "typeid(";
*close_str = ")";
*num_operands = 0;
*length = 9;
} else if (start_of_id_is("v19clitypeid", ptr)) {
/* C++/CLI T::typeid. */
str = "::typeid";
*num_operands = 0;
*length = 12;
} else if (start_of_id_is("v23min", ptr)) {
/* GNU "<?" */
str = "<?";
*length = 6;
*num_operands = 2;
} else if (start_of_id_is("v23max", ptr)) {
/* GNU ">?" */
str = ">?";
*length = 6;
*num_operands = 2;
} else if (start_of_id_is("v18__real__", ptr)) {
/* __real(expr) */
str = "__real(";
*close_str = ")";
*length = 11;
*num_operands = 1;
} else if (start_of_id_is("v18__imag__", ptr)) {
/* __imag(expr) */
str = "__imag(";
*close_str = ")";
*length = 11;
*num_operands = 1;
} else if (start_of_id_is("v19clihandle", ptr)) {
/* C++/CLI handle-to */
str = "%";
*length = 12;
*num_operands = 1;
} else if (start_of_id_is("v112clisafe_cast", ptr)) {
/* C++/CLI safe_cast<T>() */
str = "safe_cast";
*length = 16;
*num_operands = 1;
} else if (start_of_id_is("9builtin", ptr+2)) {
/* Builtin operation. Name is
vN9builtinXX
^^-- Operation number
^------------ Number of operands (<= 9)
*/
static char builtin_name[] = "builtin-operation-XX";
str = builtin_name;
str[18] = ptr[10];
str[19] = ptr[11];
*length = 12;
*num_operands = ptr[1]-'0';
} else if (start_of_id_is("12clisubscript", ptr+2) &&
ptr[1] >= '0' && ptr[1] <= '9') {
/* C++/CLI subscript operation with variable number of operands
(<= 9). The caller handles this as a special case. */
str = "subscript";
*length = 16;
*num_operands = ptr[1]-'0';
} /* if */
break;
default:
break;
} /* switch */
if (*length == 0) *length = 2;
} /* if */
return str;
} /* get_operator_name */
static char *demangle_source_name(
char *ptr,
a_boolean is_module_id,
a_decode_control_block_ptr dctl)
/*
Demangle an IA-64 <source-name> and output the demangled form.
Return a pointer to the character position following what was demangled.
A <source-name> encodes an unqualified name as a length plus the
characters of the name. The syntax is:
<source-name> ::= <positive length number> <identifier>
<identifier> ::= <unqualified source code identifier>
If is_module_id is TRUE, the identifier is a module id string, which
begins with a (second) count that gives the length of the file name
part. Just put out the file name part (continue scanning, but do not
output the rest of the string). This is used for an EDG extension.
*/
{
long num;
a_boolean output_chars = TRUE;
ptr = get_number(ptr, &num, dctl);
if (num <= 0) {
bad_mangled_name(dctl);
} else if (is_module_id) {
/* A module id name (an EDG extension), which has the form
<length> _ <file-name-length> _ <file-name> <rest-of-module-id>
Only the file name part is put out. */
ptr = demangle_module_id(ptr, (unsigned long)num, (char *)NULL, dctl);
} else if (num >= 9 && start_of_id_is("_INTERNAL", ptr)) {
/* An EDG extension to individuate certain entities so they don't
collide with similarly named (or unnamed) entities in other
translation units. */
write_id_str("[local to ", dctl);
ptr = demangle_module_id(ptr+9, (unsigned long)num-9, ptr, dctl);
write_id_str("]", dctl);
} else {
if (num >= 11 && start_of_id_is("_GLOBAL__N_", ptr)) {
/* g++ uses names beginning with "_GLOBAL__N_" to identify unnamed
namespaces, and the EDG C++ Front End does also to be compatible
with that. */
write_id_str("<unnamed>", dctl);
output_chars = FALSE;
} /* if */
for (; num > 0; ptr++, num--) {
if (*ptr == '\0') {
/* The name string ends before enough characters have been
accumulated. */
bad_mangled_name(dctl);
break;
} else if (!isalnum((unsigned char)*ptr) && *ptr != '_' && *ptr != '$') {
/* Invalid character in identifier. */
/* g++ names for unnamed namespaces contain bad characters,
e.g., periods. */
if (output_chars) {
bad_mangled_name(dctl);
break;
} /* if */
} else if (output_chars) {
write_id_ch(*ptr, dctl);
} /* if */
} /* for */
} /* if */
return ptr;
} /* demangle_source_name */
static char *get_instance_number(char *p,
unsigned long *instance,
a_decode_control_block_ptr dctl)
/*
An underscore optionally preceded by a non-negative instance number is
expected at *p. Advance past the underscore. Return the instance number
(non-negative number plus two -- or one if no number is present) in *instance.
*/
{
*instance = 1;
if (isdigit((unsigned char)*p)) {
long num;
p = get_number(p, &num, dctl);
if (num < 0) {
bad_mangled_name(dctl);
} else {
*instance = num+2;
} /* if */
} /* if */
if (*p == '_') {
p += 1;
} else {
bad_mangled_name(dctl);
} /* if */
return p;
} /* get_instance_number */
static char *demangle_unnamed_type(char *ptr,
a_decode_control_block_ptr dctl)
/*
Demangle an IA-64 <unnamed-type-name>. Return a pointer to the character
position following what was demangled.
<unnamed-type-name> ::= Ut [ <nonnegative number> ] _
::= <closure-type-name>
<closure-type-name> ::= Ul <lambda-sig> E [ <nonnegative number> ] _
<lambda-sig> ::= <parameter type>+
# Parameter types or "v" if the lambda has no parameters
*/
{
unsigned long instance;
if (*ptr == 'U' && ptr[1] == 't') {
/* An unnamed type has an optional instance number followed by an
underscore. */
ptr = get_instance_number(ptr+2, &instance, dctl);
if (!dctl->err_in_id) {
write_id_str("[unnamed type (instance ", dctl);
write_id_number(instance, dctl);
write_id_str(")]", dctl);
} /* if */
} else if (*ptr == 'U' && ptr[1] == 'l') {
/* A lambda has the encoding for the operator() bare function type (without
the return type) and an optional instance number followed by an
underscore. */
write_id_str("[lambda", dctl);
ptr = demangle_bare_function_type(ptr+2, /*no_return_type=*/TRUE,
BFT_PARAMS, dctl);
if (*ptr == 'E') {
ptr = get_instance_number(ptr+1, &instance, dctl);
if (!dctl->err_in_id) {
write_id_str(" (instance ", dctl);
write_id_number(instance, dctl);
write_id_str(")", dctl);
} /* if */
} else {
bad_mangled_name(dctl);
} /* if */
write_id_str("]", dctl);
} else {
bad_mangled_name(dctl);
} /* if */
return ptr;
} /* demangle_unnamed_type */
static char *demangle_unqualified_name(
char *ptr,
a_boolean *is_no_return_name,
a_decode_control_block_ptr dctl)
/*
Demangle an IA-64 <unqualified-name> and output the demangled form.
Return a pointer to the character position following what was demangled.
An <unqualified-name> encodes a name that is not qualified, e.g.,
"f" rather than "A::f". The syntax is:
<unqualified-name> ::= <operator-name>
::= <ctor-dtor-name> # Not handled here
::= <source-name>
::= <unnamed-type-name>
Constructor and destructor names do not get here; see
demangle_nested_name_components. *is_no_return_name is returned TRUE
if the name is one that does not get a return type (e.g., a
conversion function). is_no_return_name can be NULL if the
caller does not need the value.
*/
{
if (is_no_return_name != NULL) *is_no_return_name = FALSE;
if (isdigit((unsigned char)*ptr)) {
/* A <source-name>, which has a length followed by the characters
of the identifier, as in "3abc". */
ptr = demangle_source_name(ptr, /*is_module_id=*/FALSE, dctl);
} else if (*ptr == 'U' &&
(ptr[1] == 't' ||
ptr[1] == 'l')) {
/* <unnamed-type-name> */
ptr = demangle_unnamed_type(ptr, dctl);
} else {
/* <operator-name> */
write_id_str("operator ", dctl);
if (*ptr == 'c' && ptr[1] == 'v') {
/* A conversion function. */
if (is_no_return_name != NULL) *is_no_return_name = TRUE;
/* A demangling ambiguity exists in the IA-64 ABI when parsing a
templated conversion operator. We can't differentiate between
these type productions in this case:
<type> ::= <template-param>
::= <template-template-param> <template-args>
For example, when presented with T_I1BIS4_IiEEEEv, should just the T_
be parsed (as a <template-param>) or should the entire T_I1BIS4_IiEEEE
be parsed (as a <template-template-param> <template-args>)?
We can't do a local retry here because the type may parse just
fine both ways and we only find out later that there is a problem when
a substitution number is too large. On the initial attempt, prefer
the <template-param> case (parse_template_args); on a
subsequent attempt (if the demangling fails), we'll try the other
case. */
ptr = full_demangle_type(ptr+2,
dctl->parse_template_args_after_conversion_operator,
/*is_pack_expansion=*/FALSE,
dctl);
dctl->contains_conversion_operator = TRUE;
} else {
/* Other operator function (not conversion function). */
int num_operands, length;
char *op_str, *close_str;
op_str = get_operator_name(ptr, &num_operands, &length, &close_str,
dctl);
if (op_str == NULL) {
bad_mangled_name(dctl);
} else {
write_id_str(op_str, dctl);
write_id_str(close_str, dctl);
ptr += length;
} /* if */
} /* if */
} /* if */
return ptr;
} /* demangle_unqualified_name */
static unsigned char get_hex_digit(char *ptr,
a_decode_control_block_ptr dctl)
/*
Convert a hexadecimal digit at ptr to an integral value, and return the
value.
*/
{
unsigned char value;
unsigned char ch = (unsigned char)ptr[0];
if (isdigit(ch)) {
value = (ch - '0');
} else if (isxdigit(ch) && islower(ch)) {
value = (ch - 'a' + 10);
} else {
bad_mangled_name(dctl);
value = 0;
} /* if */
return value;
} /* get_hex_digit */
static char *demangle_float_number(char *ptr,
a_decode_control_block_ptr dctl)
/*
Demangle a floating point number as specified in an IA-64 float or complex
literal and output the demangled form. The floating point number is
terminated by either an E or underscore, and the return value will point
to the terminating character.
*/
{
sizeof_t i, length;
char *p;
union {
#if USE_LONG_DOUBLE_FOR_HOST_FP_VALUE
long double ld;
#endif /* USE_LONG_DOUBLE_FOR_HOST_FP_VALUE */
double d;
float f;
} x;
/* Zero the bits of x. */
#if USE_LONG_DOUBLE_FOR_HOST_FP_VALUE
x.ld = 0.0;
#else /* !USE_LONG_DOUBLE_FOR_HOST_FP_VALUE */
x.d = 0.0;
#endif /* USE_LONG_DOUBLE_FOR_HOST_FP_VALUE */
/* Determine the number of digits in the value by scanning to the
terminating "E" or "_". */
length = 0;
p = ptr;
while (*p != 'E' && *p != '_' && *p != '\0') {
length++;
p++;
} /* while */
if (length % 2 != 0) {
/* An odd number of bytes is an error. */
bad_mangled_name(dctl);
length -= 1;
} /* if */
/* Convert the length to a byte count. */
length /= 2;
if (length > sizeof(x)) {
/* Too many bytes is an error. */
bad_mangled_name(dctl);
length = sizeof(x);
} /* if */
/* Convert the right number of bytes. */
for (i = 0; i < length; i++, ptr+=2) {
unsigned char byte = get_hex_digit(ptr, dctl);
if (dctl->err_in_id) break;
byte = byte<<4 | get_hex_digit(ptr+1, dctl);
if (dctl->err_in_id) break;
if (host_little_endian) {
((unsigned char *)&x)[length-1-i] = byte;
} else {
((unsigned char *)&x)[i] = byte;
} /* if */
} /* for */
if (!dctl->err_in_id) {
/* Convert the floating-point value in x to a string. */
char str[60];
int ndig;
if (i <= sizeof(float)) {
#ifdef FLT_DIG
ndig = FLT_DIG;
#else /* !defined(FLT_DIG) */
ndig = 6;
#endif /* ifdef FLT_DIG */
(void)sprintf(str, "%.*g", ndig, x.f);
#if USE_LONG_DOUBLE_FOR_HOST_FP_VALUE
} else if (i > sizeof(double)) {
#ifdef LDBL_DIG
ndig = LDBL_DIG;
#else /* !defined(LDBL_DIG) */
ndig = 18;
#endif /* ifdef LDBL_DIG */
(void)sprintf(str, "%.*Lg", ndig, x.ld);
#endif /* USE_LONG_DOUBLE_FOR_HOST_FP_VALUE */
} else {
#ifdef DBL_DIG
ndig = DBL_DIG;
#else /* !defined(DBL_DIG) */
ndig = 15;
#endif /* ifdef DBL_DIG */
(void)sprintf(str, "%.*g", ndig, x.d);
} /* if */
/* Add trailing ".0" if no decimal point or exponent indication was put out
and the last character of the string is a digit (i.e., not
"inf" or "nan"). */
p = str + strlen(str) - 1;
if (strchr(str, '.') == NULL &&
strchr(str, 'e') == NULL &&
isdigit((unsigned char)*p)) {
p++;
*p++ = '.';
*p++ = '0';
*p++ = '\0';
} /* if */
write_id_str(str, dctl);
} /* if */
return ptr;
} /* demangle_float_number */
static char *demangle_float_literal(char *ptr,
a_decode_control_block_ptr dctl)
/*
Demangle an IA-64 float literal and output the demangled form.
Return a pointer to the character position following what was demangled.
The syntax is:
<expr-primary> ::= L <type> <value float> E
<float> is the hexadecimal representation of the floating-point value,
high-order bytes first, using lower-case letters.
*/
{
/* Put parentheses around the type to make a cast. */
write_id_ch('(', dctl);
ptr = demangle_type(ptr+1, dctl);
write_id_ch(')', dctl);
if (!dctl->err_in_id) {
ptr = demangle_float_number(ptr, dctl);
if (!dctl->err_in_id) {
ptr = advance_past('E', ptr, dctl);
} /* if */
} /* if */
return ptr;
} /* demangle_float_literal */
static char *demangle_complex_literal(char *ptr,
a_decode_control_block_ptr dctl)
/*
Demangle an IA-64 complex float literal and output the demangled form.
Return a pointer to the character position following what was demangled.
The syntax is:
<expr-primary> ::= L <type> <real-part float> _ <imag-part float> E
<float> is the hexadecimal representation of the floating-point value,
high-order bytes first, using lower-case letters.
*/
{
/* Put parentheses around the type to make a cast. */
write_id_ch('(', dctl);
ptr = demangle_type(ptr+1, dctl);
write_id_str(")(", dctl);
/* Emit the literal as ( <real> + <imag> i). */
if (!dctl->err_in_id) {
ptr = demangle_float_number(ptr, dctl);
if (!dctl->err_in_id) {
ptr = advance_past('_', ptr, dctl);
if (!dctl->err_in_id) {
write_id_ch('+', dctl);
ptr = demangle_float_number(ptr, dctl);
if (!dctl->err_in_id) {
write_id_str("i)", dctl);
if (!dctl->err_in_id) {
ptr = advance_past('E', ptr, dctl);
} /* if */
} /* if */
} /* if */
} /* if */
} /* if */
return ptr;
} /* demangle_complex_literal */
/*
Macro that returns TRUE if the character represents a floating point type.
*/
#define is_floating_point_type(ch) \
((ch) == 'd' || (ch) == 'e' || (ch) == 'f' || (ch) == 'g')
static char *demangle_expr_primary(char *ptr,
a_decode_control_block_ptr dctl)
/*
Demangle an IA-64 literal or external name and output the demangled form.
Return a pointer to the character position following what was demangled.
The syntax is:
<expr-primary> ::= L <type> <value number> E # integer literal
::= L <type> <value float> E # floating literal
::= L <string type> E # string literal
::= L <nullptr type> E # nullptr literal (i.e., "LDnE")
::= L <type> <real-part float> _ <imag-part float> E
# complex floating point literal (C 2000)
::= L <mangled-name> E # external name
*/
{
char *sub = NULL;
if (ptr[1] == 'S') {
/* Most of the types used in literals are <builtin-type>s, so there are no
substitutions, but complex literals and string literals can have
substitutions, so watch out for these. */
dctl->suppress_id_output++;
(void)demangle_substitution(ptr+1, 0, CVQ_NONE,
/*under_lhs_declarator=*/FALSE,
/*need_trailing_space=*/FALSE,
(char **)NULL,
&sub,
dctl);
dctl->suppress_id_output--;
} /* if */
if (ptr[1] == '_') {
/* External name, L_Z <encoding> E. */
if (ptr[2] != 'Z') {
bad_mangled_name(dctl);
} else {
ptr = demangle_encoding(ptr+3, /*include_func_params=*/FALSE, dctl);
ptr = advance_past('E', ptr, dctl);
} /* if */
} else if (is_floating_point_type(ptr[1])) {
/* Float literal, L <type> <hex> E, where <hex> is the hexadecimal
representation of the value, high-order bytes first, with
lower-case hex letters. */
ptr = demangle_float_literal(ptr, dctl);
} else if ((ptr[1] == 'C' && is_floating_point_type(ptr[2])) ||
(sub != NULL &&
(sub[0] == 'C' && is_floating_point_type(sub[1])))) {
/* Complex floating point literal. */
ptr = demangle_complex_literal(ptr, dctl);
} else if (ptr[1] == 'D' &&
(ptr[2] == 'n' || ptr[2] == 'N') &&
ptr[3] == 'E') {
/* Recognize the literal for nullptr or __nullptr (the mangling is an
EDG extension for the C++/CLI managed __nullptr keyword). */
dctl->suppress_id_output++;
(void)demangle_type(ptr+1, dctl);
dctl->suppress_id_output--;
if (ptr[2] == 'N') {
write_id_str("__nullptr", dctl);
} else {
write_id_str("nullptr", dctl);
} /* if */
ptr += 4;
} else {
/* Integer literal, or string literal. */
/* Put parentheses around the type to make a cast. */
write_id_ch('(', dctl);
ptr = demangle_type(ptr+1, dctl);
write_id_ch(')', dctl);
if (*ptr == 'E') {
/* There's no value -- must have been a string literal. */
write_id_str("\"...\"", dctl);
} else {
/* Copy the literal value. "n" is translated to a "-". */
if (*ptr == 'n') {
write_id_ch('-', dctl);
ptr++;
} /* if */
/* g++ 3.2 puts out L1xE instead of L_Z1xE, which gets demangled
sort of okay in the g++ demangler because the name is treated
as a type and a cast is put out with nothing following it: (x) */
if (!isdigit((unsigned char)*ptr) && !emulate_gnu_abi_bugs) {
bad_mangled_name(dctl);
} else {
while (isdigit((unsigned char)*ptr)) {
write_id_ch(*ptr, dctl);
ptr++;
} /* while */
} /* if */
} /* if */
ptr = advance_past('E', ptr, dctl);
} /* if */
return ptr;
} /* demangle_expr_primary */
static char *demangle_expression_list_full(
char *ptr,
char stop_char,
char open_paren,
char close_paren,
a_decode_control_block_ptr dctl)
/*
Demangle zero or more expressions, terminated by stop_char. The expression
list output is enclosed by open_paren/close_paren and separated by commas.
Returns a pointer to the terminating character (unless an error occurs).
*/
{
a_boolean first_time = TRUE;
write_id_ch(open_paren, dctl);
while (*ptr != stop_char && !dctl->err_in_id) {
if (*ptr == '\0') {
bad_mangled_name(dctl);
break;
} /* if */
if (!first_time) {
write_id_str(", ", dctl);
} else {
first_time = FALSE;
} /* if */
ptr = demangle_expression(ptr, dctl);
} /* while */
write_id_ch(close_paren, dctl);
return ptr;
} /* demangle_expression_list_full */
static char *demangle_expression_list(
char *ptr,
char stop_char,
a_decode_control_block_ptr dctl)
/*
Demangle zero or more expressions, terminated by stop_char. The expression
list output is enclosed in parentheses and separated by commas. Returns a
pointer to the terminating character (unless an error occurs).
*/
{
return demangle_expression_list_full(ptr, stop_char, '(', ')', dctl);
} /* demangle_expression_list */
static char *demangle_initializer(
char *ptr,
a_decode_control_block_ptr dctl)
/*
Demangle an <initializer> (or an 'E') starting at ptr.
<initializer> ::= pi <expression>* E # parenthesized initialization
<initializer> ::= il <expression>* E # braced-init list
*/
{
if (*ptr == 'E') {
ptr++;
} else {
if (*ptr == 'p' && ptr[1] == 'i') {
ptr = demangle_expression_list(ptr+2, 'E', dctl);
ptr = advance_past('E', ptr, dctl);
} else if (*ptr == 'i' && ptr[1] == 'l') {
ptr = demangle_expression_list_full(ptr+2, 'E', '{', '}', dctl);
ptr = advance_past('E', ptr, dctl);
} else {
bad_mangled_name(dctl);
} /* if */
} /* if */
return ptr;
} /* demangle_initializer */
static char *demangle_expression(char *ptr,
a_decode_control_block_ptr dctl)
/*
Demangle an IA-64 <expression> and output the demangled form.
Return a pointer to the character position following what was demangled.
An <expression> encodes an expression (usually for a nontype
template argument value written in terms of template parameters or
trailing return types specified using decltype).
The syntax is:
<expression> ::= <unary operator-name> <expression>
::= <binary operator-name> <expression> <expression>
::= <ternary operator-name> <expression> <expression>
<expression>
::= cl <expression>+ E
# call
::= cp <simple-id> <expression>* E
# call (with ADL suppressed)
::= cv <type> <expression>
# conversion with one argument
::= cv <type> _ <expression>* E
# conversion with a different number of arguments
::= [gs] nw <expression>* _ <type> E
# new (expr-list) type
::= [gs] nw <expression>* _ <type> <initializer>
# new (expr-list) type (init)
::= [gs] na <expression>* _ <type> E
# new[] (expr-list) type
::= [gs] na <expression>* _ <type> <initializer>
# new[] (expr-list) type (init)
::= [gs] dl <expression>
# delete expression
::= [gs] da <expression>
# delete[] expression
::= pp_ <expression>
# prefix ++
::= mm_ <expression>
# prefix --
::= ti <type>
# typeid (type)
::= te <expression>
# typeid (expression)
::= dc <type> <expression>
# dynamic_cast<type> (expression)
::= sc <type> <expression>
# static_cast<type> (expression)
::= cc <type> <expression>
# const_cast<type> (expression)
::= rc <type> <expression>
# reinterpret_cast<type> (expression)
::= st <type>
# sizeof (a type)
::= at <type>
# alignof (a type)
::= <template-param>
::= <function-param>
::= dt <expression> <unresolved-name>
# expr.name
::= pt <expression> <unresolved-name>
# expr->name
::= ds <expression> <expression>
# expr.*expr
::= tw <expression>
# throw expression
::= tr
# throw with no operand (rethrow)
::= <unresolved-name>
# f(p), N::f(p), ::f(p),
# freestanding dependent name (e.g., T::x),
# objectless nonstatic member reference
::= sZ <template-param>
# size of a parameter pack
::= sZ <function-param>
# size of a function parameter pack
::= sp <expression>
# pack expansion
::= il <expression>* E
# initializer list
::= tl <type> <expression>* E
# typed initializer list
::= <expr-primary>
Also, these non-standard expressions (EDG-specific) are demangled:
::= gc _ <type> E
# gcnew type
::= gc _ <type> <initializer>
# gcnew type (init)
::= gc <expression>* _ <type> E
# gcnew array<type>(dims)
::= gc <expression>* _ <type> <initializer>
# gcnew array<type>(dims) {init}
*/
{
int num_operands, length;
char *op_str, *close_str;
if (*ptr == 'L') {
/* A literal or external name. */
ptr = demangle_expr_primary(ptr, dctl);
} else if (*ptr == 'T') {
/* A template parameter. */
ptr = demangle_template_param(ptr, dctl);
} else if (*ptr == 'f' && (ptr[1] == 'p' || ptr[1] == 'L')) {
/* A reference to a function parameter. */
ptr = demangle_parameter_reference(ptr, dctl);
} else if (*ptr == 'c' && ptr[1] == 'l') {
/* Call expression: "cl <expression>+ E" */
ptr += 2;
ptr = demangle_expression(ptr, dctl);
ptr = demangle_expression_list(ptr, 'E', dctl);
ptr = advance_past('E', ptr, dctl);
} else if (*ptr == 'c' && ptr[1] == 'p') {
/* Call expression (w/ADL suppressed): "cp <simple-id> <expression>* E" */
ptr += 2;
write_id_ch('(', dctl);
ptr = demangle_simple_id(ptr, dctl);
write_id_ch(')', dctl);
ptr = demangle_expression_list(ptr, 'E', dctl);
ptr = advance_past('E', ptr, dctl);
} else if (*ptr == 'c' && ptr[1] == 'v') {
/* Cast/conversion (with one type and zero or more arguments). When
exactly one expression is specified, emit "(T)expr", otherwise
emit T(expr). */
char *nptr;
a_boolean one_argument = FALSE;
/* Take a peek (without emitting the type, but recording substitutions)
to see which case we have. */
dctl->suppress_id_output++;
nptr = demangle_type(ptr+2, dctl);
dctl->suppress_id_output--;
if (!dctl->err_in_id && *nptr != '_') {
one_argument = TRUE;
write_id_ch('(', dctl);
} /* if */
/* Re-scan the type, this time emitting it (but not recording
substitutions). */
dctl->suppress_substitution_recording++;
ptr = demangle_type(ptr+2, dctl);
dctl->suppress_substitution_recording--;
if (!dctl->err_in_id) {
if (one_argument) {
/* Exactly one expression. */
write_id_ch(')', dctl);
ptr = demangle_expression(ptr, dctl);
} else {
/* Some number of expressions (other than one). */
if (*ptr != '_') {
bad_mangled_name(dctl);
} else {
ptr = demangle_expression_list(ptr+1, 'E', dctl);
ptr = advance_past('E', ptr, dctl);
} /* if */
} /* if */
} /* if */
} else if (*ptr == 'g' && ptr[1] == 's') {
/* global scope: "::". This prefix precedes new/delete operations as
well as the scope-resolution operator in <unresolved-name>. */
write_id_str("::", dctl);
ptr = demangle_expression(ptr+2, dctl);
} else if (*ptr == 'n' && (ptr[1] == 'w' || ptr[1] == 'a')) {
/* new or new[] */
if (ptr[1] == 'w') {
write_id_str("new ", dctl);
} else {
write_id_str("new[] ", dctl);
} /* if */
ptr+=2;
/* Optional placement expressions. */
if (*ptr != '_') {
ptr = demangle_expression_list(ptr, '_', dctl);
write_id_ch(' ', dctl);
} /* if */
ptr = advance_past('_', ptr, dctl);
if (!dctl->err_in_id) {
ptr = demangle_type(ptr, dctl);
if (!dctl->err_in_id) {
ptr = demangle_initializer(ptr, dctl);
} /* if */
} /* if */
} else if (*ptr == 'g' && ptr[1] == 'c') {
/* C++/CLI gcnew (EDG-specific mangling). */
ptr+=2;
write_id_str("gcnew ", dctl);
/* Optional array dimension expressions. */
if (*ptr != '_') {
char *optr = ptr, *ptr2;
/* We need the type before the dimension list, so suppress the list
to get to the type. */
dctl->suppress_id_output++;
dctl->suppress_substitution_recording++;
ptr2 = demangle_expression_list(ptr, '_', dctl);
dctl->suppress_id_output--;
dctl->suppress_substitution_recording--;
if (!dctl->err_in_id) {
ptr2 = advance_past('_', ptr2, dctl);
ptr = demangle_type(ptr2, dctl);
(void)demangle_expression_list(optr, '_', dctl);
write_id_ch(' ', dctl);
} /* if */
} else {
ptr = advance_past('_', ptr, dctl);
ptr = demangle_type(ptr, dctl);
} /* if */
if (!dctl->err_in_id) {
ptr = demangle_initializer(ptr, dctl);
} /* if */
} else if (*ptr == 'd' && ptr[1] == 't') {
/* expr.name */
write_id_ch('(', dctl);
ptr = demangle_expression(ptr+2, dctl);
if (!dctl->err_in_id) {
write_id_ch('.', dctl);
ptr = demangle_unresolved_name(ptr, dctl);
write_id_ch(')', dctl);
} /* if */
} else if (*ptr == 'p' && ptr[1] == 't') {
/* expr->name */
write_id_ch('(', dctl);
ptr = demangle_expression(ptr+2, dctl);
if (!dctl->err_in_id) {
write_id_str("->", dctl);
ptr = demangle_unresolved_name(ptr, dctl);
write_id_ch(')', dctl);
} /* if */
} else if (*ptr == 's' && ptr[1] == 'Z') {
/* Size of a parameter pack. */
write_id_str("sizeof...(", dctl);
ptr+=2;
if (*ptr == 'T') {
/* sizeof...(<template-param>) */
ptr = demangle_template_param(ptr, dctl);
} else if (*ptr == 'f' ) {
/* sizeof...(<function-param>) */
ptr = demangle_parameter_reference(ptr, dctl);
} else {
bad_mangled_name(dctl);
} /* if */
write_id_ch(')', dctl);
} else if (*ptr == 's' && ptr[1] == 'p') {
/* Pack expansion. */
ptr+=2;
ptr = demangle_expression(ptr, dctl);
write_id_str("...", dctl);
} else if ((*ptr == 't' || *ptr == 'i') && ptr[1] == 'l') {
/* Initializer list. */
if (*ptr == 't') {
/* A type is included. */
ptr = demangle_type(ptr+2, dctl);
} else {
ptr += 2;
} /* if */
if (!dctl->err_in_id) {
ptr = demangle_expression_list_full(ptr, 'E', '{', '}', dctl);
ptr = advance_past('E', ptr, dctl);
} /* if */
} else if ((op_str = get_operator_name(ptr, &num_operands, &length,
&close_str, dctl)) != NULL) {
/* An expression beginning with an operator name. */
/* As a heuristic, to avoid extraneous parentheses in the demangled output,
assume that any operator that has a closing string doesn't need
parentheses around it. */
a_boolean needs_parens = strcmp(close_str, "") == 0;
ptr += length;
if (needs_parens) write_id_ch('(', dctl);
if (strncmp(op_str, "builtin-operation-", 18) == 0) {
/* Builtin operation. Has a variable number of operands. */
int i;
write_id_str(op_str, dctl);
write_id_ch('(', dctl);
for (i = 1; i <= num_operands; i++) {
if (*ptr == 'T' && ptr[1] == 'O') {
/* "TO" indicates a type operand. */
ptr = demangle_type(ptr+2, dctl);
} else {
ptr = demangle_expression(ptr, dctl);
} /* if */
if (i != num_operands) write_id_str(", ", dctl);
} /* for */
write_id_ch(')', dctl);
} else if (strncmp(op_str, "subscript", 9) == 0) {
/* C++/CLI subscript operation. Has a variable number of operands. */
int i;
ptr = demangle_expression(ptr, dctl);
write_id_ch('[', dctl);
for (i = 2; i <= num_operands; i++) {
ptr = demangle_expression(ptr, dctl);
if (i != num_operands) write_id_str(", ", dctl);
} /* for */
write_id_ch(']', dctl);
} else if (num_operands == 1) {
char cast_close = 0;
/* Unary operations (old style cast is handled above). */
if (strcmp(op_str, "++") == 0 ||
strcmp(op_str, "--") == 0) {
if (*ptr == '_') {
/* Prefix version. */
ptr++;
} else {
/* Postfix version. */
close_str = op_str;
op_str = "";
} /* if */
} /* if */
write_id_str(op_str, dctl);
if (strcmp(op_str, "static_cast") == 0 ||
strcmp(op_str, "dynamic_cast") == 0 ||
strcmp(op_str, "const_cast") == 0 ||
strcmp(op_str, "reinterpret_cast") == 0 ||
strcmp(op_str, "safe_cast") == 0) {
/* New style cast. */
write_id_ch('<', dctl);
ptr = demangle_type(ptr, dctl);
write_id_str(">(", dctl);
cast_close = ')';
} /* if */
ptr = demangle_expression(ptr, dctl);
if (cast_close != 0) write_id_ch(cast_close, dctl);
} else if (num_operands == 2) {
/* Binary operations. */
ptr = demangle_expression(ptr, dctl);
write_id_str(op_str, dctl);
ptr = demangle_expression(ptr, dctl);
} else if (num_operands == 3) {
/* Ternary operations ("?"). */
ptr = demangle_expression(ptr, dctl);
write_id_str(op_str, dctl);
ptr = demangle_expression(ptr, dctl);
write_id_str(":", dctl);
ptr = demangle_expression(ptr, dctl);
} else {
/* Special cases: sizeof(type), __alignof__(type),
__uuidof(type), typeid(type), T::typeid, scope resolution "::",
throw (just the rethrow variety). */
if (strcmp(op_str, "sizeof(") == 0) {
/* sizeof(type). */
write_id_str(op_str, dctl);
ptr = demangle_type(ptr, dctl);
} else if (strcmp(op_str, "alignof(") == 0 ||
strcmp(op_str, "__alignof__(") == 0) {
/* __alignof__(type). */
write_id_str(op_str, dctl);
ptr = demangle_type(ptr, dctl);
} else if (strcmp(op_str, "__uuidof(") == 0) {
/* __uuidof(type). */
write_id_str(op_str, dctl);
ptr = demangle_type(ptr, dctl);
} else if (strcmp(op_str, "typeid(") == 0) {
/* typeid(type). */
write_id_str(op_str, dctl);
ptr = demangle_type(ptr, dctl);
} else if (strcmp(op_str, "::typeid") == 0) {
/* C++/CLI T::typeid. */
ptr = demangle_type(ptr, dctl);
write_id_str(op_str, dctl);
} else if (strcmp(op_str, "throw") == 0) {
/* throw. This handles the rethrow variety, throw-expression is
handled separately. */
write_id_str(op_str, dctl);
} else {
bad_mangled_name(dctl);
} /* if */
} /* if */
write_id_str(close_str, dctl);
if (needs_parens) write_id_ch(')', dctl);
} else {
/* Assume it's an <unresolved-name>. */
ptr = demangle_unresolved_name(ptr, dctl);
} /* if */
return ptr;
} /* demangle_expression */
static char *demangle_template_args(char *ptr,
a_decode_control_block_ptr dctl)
/*
Demangle an IA-64 <template-args> and output the demangled form.
Return a pointer to the character position following what was demangled.
A <template-args> encodes a template argument list. The syntax is:
<template-args> ::= I <template-arg>+ E
<template-arg> ::= <type> # type or template
::= X <expression> E # expression
::= <expr-primary> # simple expressions
::= J <template-arg>* E # argument pack
*/
{
/* Advance past the "I". */
ptr++;
write_id_ch('<', dctl);
for (;;) {
if (*ptr == 'X') {
/* An expression, X <expression> E. */
ptr = demangle_expression(ptr+1, dctl);
ptr = advance_past('E', ptr, dctl);
} else if (*ptr == 'L') {
/* Literal or external name. */
ptr = demangle_expr_primary(ptr, dctl);
} else if (*ptr == 'J' ||
(*ptr == 'I' && emulate_gnu_abi_bugs)) {
/* Template argument pack. */
ptr = demangle_template_args(ptr, dctl);
} else if (*ptr == 'E') {
/* No template arguments. */
break;
} else {
/* Type template argument. */
ptr = demangle_type(ptr, dctl);
} /* if */
/* "E" ends the template argument list. */
if (*ptr == 'E') break;
/* Stop on an error. */
if (dctl->err_in_id) break;
/* Continuing, so put out a comma between template arguments. */
write_id_str(", ", dctl);
} /* for */
ptr = advance_past('E', ptr, dctl);
write_id_ch('>', dctl);
return ptr;
} /* demangle_template_args */
static char *demangle_nested_name_components(
char *ptr,
unsigned long num_levels,
a_boolean *is_no_return_name,
a_boolean *has_templ_arg_list,
char *ctor_dtor_kind,
char **last_component_name,
a_decode_control_block_ptr dctl)
/*
Demangle one or more name level components of an IA-64 <nested-name>.
Each level is either an unqualified name or a substitution, optionally
followed by a template argument list. ptr points to the beginning of
the <nested-name>, after the initial "N" and the <CV-qualifiers> if any.
If num_levels is zero, scan all components of the nested name, stopping
on the final "E"; otherwise, scan num_levels levels and then stop.
Note that a substitution counts as one level even if it represents
several. Return a pointer to the character position following what
was demangled. *is_no_return_name is returned TRUE if the final
component scanned is a function name of a kind that does not take a
return type (constructor, destructor, or conversion function).
*has_templ_arg_list is returned TRUE if the final component includes a
template argument list. If the final component is a constructor or
destructor name, *ctor_dtor_kind is set to the character identifying
the kind of constructor or destructor. If last_component_name is non-NULL,
*last_component_name will be set to the start position of the encoding
for the name of the last component. If the last component is a
substitution, the name of the last component in the substitution is used.
*/
{
char *prev_component_name = NULL;
char *first_component_start = ptr;
unsigned long level_num = 0;
*is_no_return_name = FALSE;
*has_templ_arg_list = FALSE;
*ctor_dtor_kind = ' ';
for (;;) {
/* Demangle one level of the nested name. */
a_boolean is_substitution = FALSE;
a_boolean suppress_qualification = FALSE;
level_num++;
*is_no_return_name = FALSE;
*has_templ_arg_list = FALSE;
if (*ptr == 'E' || *ptr == '\0') {
/* Error, unexpected end of nested name. */
bad_mangled_name(dctl);
} else if (*ptr == 'S') {
/* A substitution. */
is_substitution = TRUE;
ptr = demangle_substitution(ptr, 0, CVQ_NONE,
/*under_lhs_declarator=*/FALSE,
/*need_trailing_space=*/FALSE,
&prev_component_name,
(char **)NULL,
dctl);
/* A substitution cannot be the last thing; it must be followed
by another name or a template argument list. */
if (*ptr == 'E') {
bad_mangled_name(dctl);
} /* if */
} else if (*ptr == 'T') {
/* A <template-param>. */
ptr = demangle_template_param(ptr, dctl);
} else if (*ptr == 'D' && (ptr[1] == 't' || ptr[1] == 'T')) {
/* A <decltype>. */
ptr = demangle_type(ptr, dctl);
} else {
/* Not a substitution or template parameter, so an <unqualified-name>. */
if (*ptr != 'C' && *ptr != 'D') {
/* Normal case, not a constructor or destructor name. */
prev_component_name = ptr;
ptr = demangle_unqualified_name(ptr, is_no_return_name, dctl);
} else {
/* A constructor or destructor name (or their C++/CLI counterparts:
a static constructor or finalizer). Put out the class name again
(it's provided by prev_component_name). */
*is_no_return_name = TRUE;
if (*ptr == 'D') {
if (ptr[1] == '7') {
/* A C++/CLI finalizer. */
write_id_ch('!', dctl);
} else {
/* Some type of destructor. */
write_id_ch('~', dctl);
} /* if */
} /* if */
if (prev_component_name == NULL ||
*prev_component_name == 'S') {
/* The constructor or destructor code is the first thing in the
nested name or the previous name is a substitution (we're
supposed to have gotten the name from inside the
substitution). */
bad_mangled_name(dctl);
} else {
a_boolean dummy;
/* Rescan and output the class name (no template argument list). */
(void)demangle_unqualified_name(prev_component_name, &dummy, dctl);
/* Check that the second character of the constructor/destructor
name is a valid digit. */
/* "D7" is the code used by the EDG C++ Front End for C++/CLI
finalizers. It's not part of the ABI spec. */
/* "C8" is the code used by the EDG C++ Front End for C++/CLI
static constructors. It's not part of the ABI spec. */
/* '9' is the code used by the EDG C++ Front End for the
underlying routine called by the various entry points.
It's not part of the ABI spec. */
if (ptr[1] == '1' || ptr[1] == '2' || ptr[1] == '9' ||
(ptr[0] == 'C' ? (ptr[1] == '3' || ptr[1] == '8') :
(ptr[1] == '0' || ptr[1] == '7'))) {
/* Okay. */
*ctor_dtor_kind = ptr[1];
ptr += 2;
} else {
/* The second character of the constructor or destructor name
encoding is bad. */
bad_mangled_name(dctl);
} /* if */
} /* if */
} /* if */
if (*ptr == 'M') {
/* A <data-member-prefix>. No further output is required (the
member's <source-name> has been emitted above). */
ptr++;
} /* if */
} /* if */
if (*ptr == 'I') {
/* A <template-args> list. */
/* Record a potential substitution on the template prefix up to
this point, but not if the entire prefix is a substitution. */
if (!is_substitution) {
record_substitutable_entity(first_component_start,
subk_template_prefix, level_num-1, dctl);
} /* if */
/* Scan the template argument list. */
ptr = demangle_template_args(ptr, dctl);
*has_templ_arg_list = TRUE;
is_substitution = FALSE;
} /* if */
/* "E" marks the end of the list. */
if (*ptr == 'E') break;
if (!is_substitution) {
/* Record a potential substitution on the prefix up to this point,
but not if the entire prefix is a substitution (without
template argument list). */
record_substitutable_entity(first_component_start, subk_prefix,
level_num, dctl);
} /* if */
/* Stop on an error. */
if (dctl->err_in_id) break;
/* Stop if we've done enough levels. */
if (num_levels != 0 && level_num >= num_levels) break;
/* Going around again, so the part put out so far is a qualifier and
needs to be followed by "::". */
if (!suppress_qualification) write_id_str("::", dctl);
} /* for */
if (last_component_name != NULL) *last_component_name = prev_component_name;
return ptr;
} /* demangle_nested_name_components */
static char *demangle_nested_name(char *ptr,
a_func_block *func_block,
a_decode_control_block_ptr dctl)
/*
Demangle an IA-64 <nested-name> and output the demangled form. Return
a pointer to the character position following what was demangled.
A <nested-name> represents a qualified name, e.g., A::B::x.
The syntax is:
<nested-name> ::= N [<CV-qualifiers>] <prefix> <unqualified-name> E
::= N [<CV-qualifiers>] <template-prefix> <template-args> E
<prefix> ::= <prefix> <unqualified-name>
::= <template-prefix> <template-args>
::= <template-param>
::= <decltype>
::= # empty
::= <substitution>
::= <prefix> <data-member-prefix>
<template-prefix> ::= <prefix> <template unqualified-name>
::= <template-param>
::= <substitution>
<data-member-prefix> := <member source-name> M
For function names, additional information is returned in *func_block.
*/
{
a_boolean has_templ_arg_list;
a_boolean is_no_return_name;
clear_func_block(func_block);
/* Skip the initial "N". */
ptr++;
/* Accumulate <CV-qualifiers> if present. */
ptr = get_cv_qualifiers(ptr, &func_block->cv_quals);
/* Get all the components of the nested name. */
ptr = demangle_nested_name_components(ptr,
/*num_levels=*/0,
&is_no_return_name,
&has_templ_arg_list,
&func_block->ctor_dtor_kind,
(char **)NULL,
dctl);
ptr = advance_past('E', ptr, dctl);
/* The function will have no return type if it is not a template. */
if (!has_templ_arg_list) {
func_block->no_return_type = TRUE;
} /* if */
/* The function will have no return type if it is a constructor,
destructor, or conversion function. */
if (is_no_return_name) {
func_block->no_return_type = TRUE;
} /* if */
return ptr;
} /* demangle_nested_name */
char *demangle_local_name(char *ptr,
a_func_block *func_block,
a_decode_control_block_ptr dctl)
/*
Demangle an IA-64 <local-name> and output the demangled form. Return
a pointer to the character position following what was demangled.
A <local-name> represents an entity local to a function, and
includes the mangled name of the enclosing function.
The syntax is:
<local-name> := Z <function encoding> E [d [<trailing-param number>] _]
<entity name> [<discriminator>]
:= Z <function encoding> E s [<discriminator>]
<discriminator> := _ <non-negative number> # when number <= 9
:= __ <non-negative number> _ # when number >= 10
For function names, additional information is returned in *func_block.
*/
{
clear_func_block(func_block);
/* Skip over the "Z". */
ptr++;
/* Demangle the function name. */
ptr = demangle_encoding(ptr, /*include_func_params=*/TRUE, dctl);
ptr = advance_past('E', ptr, dctl);
write_id_str("::", dctl);
if (*ptr == 's') {
/* String literal. */
write_id_str("string", dctl);
ptr++;
} else {
if (*ptr == 'd') {
/* Demangle the optional trailing parameter number. */
long param = -1;
ptr += 1;
if (*ptr != '_') {
ptr = get_number(ptr, ¶m, dctl);
if (param < 0 || *ptr != '_') {
bad_mangled_name(dctl);
} else {
/* Advance past underscore. */
ptr += 1;
} /* if */
} else {
/* Advance past underscore. */
ptr += 1;
} /* if */
if (!dctl->err_in_id) {
write_id_str("[default argument ", dctl);
write_id_signed_number(param+2, dctl);
write_id_str(" (from end)]::", dctl);
} /* if */
} /* if */
/* Demangle the entity name. */
ptr = demangle_name(ptr, func_block, /*options=*/DNO_ALL, dctl);
} /* if */
if (!dctl->err_in_id && *ptr == '_') {
/* Demangle the discriminator. */
long num = -1;
if (isdigit((unsigned char)ptr[1])) {
/* _n (n is single digit) case: */
num = (char)ptr[1] - '0';
ptr += 2;
} else if (ptr[1] == '_' && isdigit((unsigned char)ptr[2])) {
/* __nn_ (nn is at least two digits) case: */
ptr = get_number(ptr+2, &num, dctl);
if (*ptr == '_') {
ptr += 1;
} else {
num = -1;
} /* if */
} /* if */
if (num < 0) {
bad_mangled_name(dctl);
} else {
write_id_str(" (instance ", dctl);
write_id_signed_number(num+2, dctl);
write_id_ch(')', dctl);
} /* if */
} /* if */
return ptr;
} /* demangle_local_name */
static char *demangle_unscoped_name(char *ptr,
a_func_block *func_block,
a_decode_control_block_ptr dctl)
/*
Demangle an IA-64 <unscoped-name> and output the demangled form.
Return a pointer to the character position following what was demangled.
The syntax is:
<unscoped-name> ::= <unqualified-name>
::= St <unqualified-name> # ::std::
For function names, additional information is updated in *func_block.
*/
{
a_boolean is_no_return_name;
if (*ptr == 'S' && ptr[1] == 't') {
/* "St" for "std::". */
write_id_str("std::", dctl);
ptr += 2;
} /* if */
ptr = demangle_unqualified_name(ptr, &is_no_return_name, dctl);
func_block->no_return_type = is_no_return_name;
return ptr;
} /* demangle_unscoped_name */
static char *demangle_name(char *ptr,
a_func_block *func_block,
a_demangle_name_option options,
a_decode_control_block_ptr dctl)
/*
Demangle selected portions of an IA-64 <name> and output the demangled form.
Return a pointer to the character position following what was demangled.
The syntax is:
<name> ::= <nested-name>
::= <unscoped-name>
::= <unscoped-template-name> <template-args>
::= <local-name>
<unscoped-template-name> ::= <unscoped-name>
::= <substitution>
For function names, additional information is returned in *func_block.
options is a bit mask that specifies which portion(s) of the name should
be emitted (the entire name is scanned, i.e., the returned value does not
depend on the options specified).
As an EDG extension, allow
B <source-name>
as a prefix to specify a module id for an externalized name.
*/
{
clear_func_block(func_block);
if (*ptr == 'B') {
/* Module-id prefix for externalized name. */
if ((options & DNO_EXTERNALIZATION) == 0) dctl->suppress_id_output++;
write_id_str("[static from ", dctl);
ptr = demangle_source_name(ptr+1, /*is_module_id=*/TRUE, dctl);
write_id_str("] ", dctl);
if ((options & DNO_EXTERNALIZATION) == 0) dctl->suppress_id_output--;
} /* if */
if ((options & DNO_NAME) == 0) dctl->suppress_id_output++;
if (*ptr == 'N') {
/* Nested name, for something like "A::f". */
ptr = demangle_nested_name(ptr, func_block, dctl);
} else if (*ptr == 'Z') {
/* Local name, identifies function and entity local to the function. */
ptr = demangle_local_name(ptr, func_block, dctl);
} else {
/* <unscoped-name> or <unscoped-template-name> <template-args>. */
if (*ptr == 'S' && ptr[1] != '\0' && ptr[2] == 'I') {
/* <substitution> in <unscoped-template-name>, because it's
followed by the "I" beginning a <template-args>. */
ptr = demangle_substitution(ptr, 0, CVQ_NONE,
/*under_lhs_declarator=*/FALSE,
/*need_trailing_space=*/FALSE,
(char **)NULL,
(char **)NULL,
dctl);
} else {
/* An <unscoped-name>, possibly as the whole of an
<unscoped-template-name>. */
char *start = ptr;
ptr = demangle_unscoped_name(ptr, func_block, dctl);
if (*ptr == 'I') {
/* This is a template because it is followed by a template arguments
list. Record the template as a potential substitution. */
record_substitutable_entity(start, subk_unscoped_template_name, 0L,
dctl);
} /* if */
} /* if */
if (*ptr == 'I') {
/* A <template-args> list. */
ptr = demangle_template_args(ptr, dctl);
} else {
/* Non-template functions do not have return types encoded. */
func_block->no_return_type = TRUE;
} /* if */
} /* if */
if ((options & DNO_NAME) == 0) dctl->suppress_id_output--;
return ptr;
} /* demangle_name */
static char *demangle_simple_id(char *ptr,
a_decode_control_block_ptr dctl)
/*
Demangle a <simple-id>:
<simple-id> ::= <source-name> [ <template-args> ]
*/
{
ptr = demangle_source_name(ptr, /*is_module_id=*/FALSE, dctl);
if (!dctl->err_in_id && *ptr == 'I') {
/* A <template-args> list is present. */
ptr = demangle_template_args(ptr, dctl);
} /* if */
return ptr;
} /* demangle_simple_id */
static char *demangle_base_unresolved_name(char *ptr,
a_decode_control_block_ptr dctl)
/*
Demangle a <base-unresolved-name>:
<base-unresolved-name> ::= <simple-id>
# unresolved name
::= on <operator-name>
# unresolved operator-function-id
::= on <operator-name> <template-args>
# unresolved operator template-id
::= dn <destructor-name>
# destructor or pseudo-destructor;
# e.g. ~X or ~X<N-1>
<destructor-name> ::= <unresolved-type> # e.g., ~T or ~decltype(f())
::= <simple-id> # e.g., ~A<2*N>
*/
{
int num_operands, length;
char *op_str, *close_str;
if (*ptr == 'o' && ptr[1] == 'n') {
/* Operator name. */
ptr += 2;
op_str = get_operator_name(ptr, &num_operands, &length, &close_str,
dctl);
if (op_str == NULL) {
bad_mangled_name(dctl);
} else {
ptr += length;
write_id_str("operator ", dctl);
if (strcmp(op_str, "cast") == 0) {
/* A conversion operator has a type. */
ptr = demangle_type(ptr, dctl);
} else {
write_id_str(op_str, dctl);
} /* if */
if (!dctl->err_in_id && *ptr == 'I') {
/* A <template-args> list is present. */
ptr = demangle_template_args(ptr, dctl);
} /* if */
} /* if */
} else if (*ptr == 'd' && ptr[1] == 'n') {
/* <destructor-name> */
ptr += 2;
write_id_ch('~', dctl);
if (isdigit((unsigned char)*ptr)) {
ptr = demangle_simple_id(ptr, dctl);
} else {
ptr = demangle_type(ptr, dctl);
} /* if */
} else {
/* <simple-id> */
ptr = demangle_simple_id(ptr, dctl);
} /* if */
return ptr;
} /* demangle_base_unresolved_name */
static char *demangle_unresolved_name(char *ptr,
a_decode_control_block_ptr dctl)
/*
Demangle an <unresolved-name>:
<unresolved-name> ::= [gs] <base-unresolved-name>
# x or (with "gs") ::x
::= sr <unresolved-type> <base-unresolved-name>
# T::x / decltype(p)::x
::= srN <unresolved-type> <unresolved-qualifier-level>+ E
<base-unresolved-name>
# T::N::x /decltype(p)::N::x
::= [gs] sr <unresolved-qualifier-level>+ E
<base-unresolved-name>
# A::x, N::y, A<T>::z; "gs" means leading "::"
<unresolved-type> ::= <template-param>
::= <decltype>
::= <substitution>
<unresolved-qualifier-level> ::= <simple-id>
Note that the "gs" may already have been stripped by the caller (since it
can also appear at the <expression> level).
*/
{
a_boolean gpp_qualified_name = FALSE;
if (*ptr == 'g' && ptr[1] == 's') {
/* Global scope: "::". */
write_id_str("::", dctl);
ptr += 2;
} /* if */
if (*ptr == 's' && ptr[1] == 'r') {
/* Scope resolution "::":
::= sr <unresolved-type> <base-unresolved-name>
::= srN <unresolved-type> <unresolved-qualifier-level>+ E
<base-unresolved-name>
::= [gs] sr <unresolved-qualifier-level>+ E <base-unresolved-name>
Differentiate between the first and third cases by looking to see if
the character after the "sr" is numeric (in which case it must be
an <unresolved-qualifier-level>).
*/
ptr += 2;
if (isdigit((unsigned char)*ptr)) {
/* We've got this case:
::= [gs] sr <unresolved-qualifier-level>+ E <base-unresolved-name>
*/
while (!dctl->err_in_id && *ptr != 'E') {
if (*ptr == '\0') {
bad_mangled_name(dctl);
} else {
ptr = demangle_simple_id(ptr, dctl);
write_id_str("::", dctl);
} /* if */
} /* while */
ptr = advance_past('E', ptr, dctl);
} else {
if (emulate_gnu_abi_bugs) {
/* g++ 3.2 sometimes puts out a qualified name as the second
operand. Look ahead to see whether that form is used.
If so, we want to skip over the type but not output it,
because the qualified name repeats that type. */
char *ptr2;
dctl->suppress_id_output++;
dctl->suppress_substitution_recording++;
ptr2 = demangle_type(ptr, dctl);
dctl->suppress_id_output--;
dctl->suppress_substitution_recording--;
if (*ptr2 == 'N') {
gpp_qualified_name = TRUE;
/* Scan the type again to get substitutions recorded. */
dctl->suppress_id_output++;
ptr = demangle_type(ptr, dctl);
dctl->suppress_id_output--;
} /* if */
} /* if */
if (!gpp_qualified_name) {
/* We've got one of these two cases:
::= sr <unresolved-type> <base-unresolved-name>
::= srN <unresolved-type> <unresolved-qualifier-level>+ E
<base-unresolved-name>
*/
if (*ptr == 'N') {
ptr = demangle_type(ptr+1, dctl);
write_id_str("::", dctl);
while (!dctl->err_in_id && *ptr != 'E') {
if (*ptr == '\0') {
bad_mangled_name(dctl);
} else {
ptr = demangle_simple_id(ptr, dctl);
write_id_str("::", dctl);
} /* if */
} /* while */
ptr = advance_past('E', ptr, dctl);
} else {
ptr = demangle_type(ptr, dctl);
write_id_str("::", dctl);
} /* if */
} /* if */
} /* if */
if (!dctl->err_in_id) {
/* The qualifiers have been processed, now only a <base-unresolved-name>
remains. */
ptr = demangle_base_unresolved_name(ptr, dctl);
} /* if */
} else {
/* <base-unresolved-name> */
ptr = demangle_base_unresolved_name(ptr, dctl);
} /* if */
return ptr;
} /* demangle_unresolved_name */
static char *demangle_call_offset(char *ptr,
a_decode_control_block_ptr dctl)
/*
Demangle an IA-64 <call_offset> and output the demangled form. Return
a pointer to the character position following what was demangled.
A <call-offset> is used in the encoded name for a thunk for a
virtual function. The syntax is:
<call-offset> ::= h <nv-offset> _
::= v <v-offset> _
<nv-offset> ::= <offset number> # non-virtual base override
<v-offset> ::= <offset number> _ <virtual offset number>
# virtual base override, with vcall offset
*/
{
long num;
a_boolean v_form = FALSE;
if (*ptr != 'h' && *ptr != 'v') {
bad_mangled_name(dctl);
} else {
v_form = (*ptr == 'v');
write_id_str("(offset ", dctl);
ptr = get_number(ptr+1, &num, dctl);
write_id_signed_number(num, dctl);
if (v_form) {
write_id_str(", virtual offset ", dctl);
ptr = advance_past_underscore(ptr, dctl);
ptr = get_number(ptr, &num, dctl);
write_id_signed_number(num, dctl);
} /* if */
ptr = advance_past_underscore(ptr, dctl);
write_id_str(") ", dctl);
} /* if */
return ptr;
} /* demangle_call_offset */
static char *demangle_special_name(char *ptr,
a_decode_control_block_ptr dctl)
/*
Demangle an IA-64 <special-name> and output the demangled form. Return
a pointer to the character position following what was demangled.
Special names are used for generated things like virtual function tables.
The syntax is:
<special-name> ::= TV <type> # virtual table
::= TT <type> # VTT structure (construction vtable index)
::= TI <type> # typeinfo structure
::= TS <type> # typeinfo name (null-terminated byte string)
::= GV <object name> # Guard variable for one-time init
::= T <call-offset> <base encoding>
# base is the nominal target function of thunk
::= Tc <call-offset> <call-offset> <base encoding>
# base is the nominal target function of thunk
# first call-offset is 'this' adjustment
# second call-offset is result adjustment
*/
{
if (*ptr == 'G') {
if (ptr[1] == 'V') {
/* Guard variable, GV <object name>. */
a_func_block func_block;
write_id_str("Initialization guard variable for ", dctl);
ptr = demangle_name(ptr+2, &func_block, /*options=*/DNO_ALL, dctl);
} else {
bad_mangled_name(dctl);
} /* if */
} else if (*ptr == 'T') {
if (ptr[1] == 'V') {
/* Virtual table, TV <type>. */
write_id_str("Virtual function table for ", dctl);
ptr = demangle_type(ptr+2, dctl);
} else if (ptr[1] == 'T') {
/* Virtual table table, TT <type>. */
write_id_str("Virtual table table for ", dctl);
ptr = demangle_type(ptr+2, dctl);
} else if (ptr[1] == 'I') {
/* Typeinfo, TI <type>. */
write_id_str("Typeinfo for ", dctl);
ptr = demangle_type(ptr+2, dctl);
} else if (ptr[1] == 'S') {
/* Typeinfo name, TS <type>. */
write_id_str("Typeinfo name for ", dctl);
ptr = demangle_type(ptr+2, dctl);
} else if (ptr[1] == 'c') {
/* Covariant thunk, Tc <call-offset> <call-offset> <base encoding>. */
write_id_str("Covariant thunk for ", dctl);
ptr = demangle_call_offset(ptr+2, dctl);
ptr = demangle_call_offset(ptr, dctl);
ptr = demangle_encoding(ptr, /*include_func_params=*/TRUE, dctl);
} else if (ptr[1] == 'h' || ptr[1] == 'v') {
/* Thunk, T <call-offset> <base encoding>. */
write_id_str("Thunk for ", dctl);
ptr = demangle_call_offset(ptr+1, dctl);
ptr = demangle_encoding(ptr, /*include_func_params=*/TRUE, dctl);
} else {
bad_mangled_name(dctl);
} /* if */
} else {
bad_mangled_name(dctl);
} /* if */
return ptr;
} /* demangle_special_name */
static char *demangle_function_or_data_name(
char *ptr,
a_boolean include_func_params,
a_boolean first_scan,
a_decode_control_block_ptr dctl)
/*
Demangle selected pieces of an IA-64 <function name><bare-function-type> or
<data name> and output the demangled form. Return a pointer to the character
position following what was demangled. Do not output function parameters if
include_func_params is FALSE. This demangling occurs in two passes, on the
first scan (when first_scan is TRUE), only the return type of the template
function is emitted; on the second scan (when first_scan is FALSE) the
remainder of the demangling is produced. Only template functions require
two scans, but since it's not known ahead of time if a template function
is being demangled, all names are subject to the two pass method (with only
the optional externalization information being emitted on the first pass for
non-template functions).
*/
{
a_func_block func_block;
a_bare_function_type_option bft_option;
a_demangle_name_option dno_option;
/* This routine is invoked in two passes, and in turn invokes
demangle_name and demangle_bare_function_type to emit various pieces
of the name at various times. For example for this mangled name:
_ZB19_7_x4280_C_a9e5c9ef4sft7IiEiT_
the demangled name along with the pass in which each element is
emitted and the option that controls its output is:
[static from x4280_C] int sft7<int>(T1)
^^^^^---- second pass, BFT_PARAMS
^^^^--------- second pass, DNO_NAME
^^^^------------- first pass, BFT_RETURN
^^^^^^^^^^^^^^^^^^^^^^----------------- first pass, DNO_EXTERNALIZATION
*/
if (first_scan) {
/* The return type of a template function (if present) and
externalization information (if present) is emitted on the first
scan. */
dno_option = DNO_EXTERNALIZATION;
bft_option = BFT_RETURN;
} else {
/* On the second scan, emit the name and any template parameters
(if present). */
dno_option = DNO_NAME;
bft_option = BFT_PARAMS;
/* The first pass recorded all of the substitutions, so suppress
substitution recording on the second pass. */
dctl->suppress_substitution_recording++;
} /* if */
ptr = demangle_name(ptr, &func_block, dno_option, dctl);
/* For the first scan, generally speaking, suppress the remaining output
(except for the call to demangle_bare_function_type below). */
if (first_scan) dctl->suppress_id_output++;
/* If there's more, it's the <bare-function-type>. */
if (*ptr != '\0' && *ptr != 'E') {
/* Q <nested-name> indicates a function that is explicitly
overridden. This is an extension over the IA-64 ABI spec. */
if (*ptr == 'Q') {
a_func_block dummy_func_block;
write_id_str(" [overriding ", dctl);
ptr = demangle_name(ptr+1, &dummy_func_block, dno_option, dctl);
write_id_str("] ", dctl);
} /* if */
if (first_scan) dctl->suppress_id_output--;
if (!include_func_params) dctl->suppress_id_output++;
ptr = demangle_bare_function_type(ptr, func_block.no_return_type,
bft_option, dctl);
if (first_scan) dctl->suppress_id_output++;
if (include_func_params && func_block.cv_quals != 0) {
/* Put out cv-qualifiers for a member function. */
write_id_ch(' ', dctl);
output_cv_qualifiers(func_block.cv_quals,
/*trailing_space=*/FALSE, dctl);
} /* if */
if (!include_func_params) dctl->suppress_id_output--;
} /* if */
if (func_block.ctor_dtor_kind != ' ') {
/* Identify the kind of constructor or destructor if necessary. */
switch (func_block.ctor_dtor_kind) {
case '0':
write_id_str(" [deleting]", dctl);
break;
case '1':
/* Complete constructor or destructor gets no extra label. */
break;
case '2':
write_id_str(" [subobject]", dctl);
break;
case '3':
write_id_str(" [allocating]", dctl);
break;
case '7':
/* An EDG extension for C++/CLI finalizers (no extra label). */
break;
case '8':
/* An EDG extension for C++/CLI static constructors. */
write_id_str(" [static]", dctl);
break;
case '9':
/* The EDG front end uses '9' for the routine called by the
other entry points. */
write_id_str(" [internal]", dctl);
break;
default:
/* Bad character. This shouldn't happen, because the character
was checked earlier. */
bad_mangled_name(dctl);
} /* switch */
} /* if */
if (first_scan) {
dctl->suppress_id_output--;
} else {
dctl->suppress_substitution_recording--;
} /* if */
return ptr;
} /* demangle_function_or_data_name */
static char *demangle_encoding(char *ptr,
a_boolean include_func_params,
a_decode_control_block_ptr dctl)
/*
Demangle an IA-64 <encoding> and output the demangled form. Return
a pointer to the character position following what was demangled.
<encoding> is almost the top-level term in the grammar; it's what
follows the initial "_Z" in a mangled name. The syntax is:
<encoding> ::= <function name> <bare-function-type>
::= <data name>
::= <special-name>
Do not output function parameters if include_func_params is FALSE.
*/
{
/* Special names begin with "T" (e.g., TV for a virtual function table)
or "GV" for a guard variable. */
if (*ptr == 'T' || (*ptr == 'G' && ptr[1] == 'V')) {
ptr = demangle_special_name(ptr, dctl);
} else {
/* Function or data name. */
/* Scan the <function name> or <data name> twice in order to emit a
potential return type for a template function (emitted in the first
scan) before the name of the template function (second scan). */
(void)demangle_function_or_data_name(ptr, include_func_params,
/*first_scan=*/TRUE, dctl);
if (!dctl->err_in_id) {
ptr = demangle_function_or_data_name(ptr, include_func_params,
/*first_scan=*/FALSE, dctl);
} /* if */
} /* if */
return ptr;
} /* demangle_encoding */
static void init_demangle_state(char *output_buffer,
sizeof_t output_buffer_size,
a_decode_control_block_ptr dctl)
/*
Utility to set the state of the demangler to its initial values.
*/
{
clear_control_block(dctl);
dctl->output_id = output_buffer;
dctl->output_id_size = output_buffer_size;
num_substitutions = 0;
} /* init_demangle_state */
/* Make sure that decode_identifier doesn't collide with symbols in user
programs when being compiled as part of lib_src. */
#if COMPILE_DECODE_FOR_LIB_SRC
static
#endif /* COMPILE_DECODE_FOR_LIB_SRC */
void decode_identifier(char *id,
char *output_buffer,
sizeof_t output_buffer_size,
a_boolean *err,
a_boolean *buffer_overflow_err,
sizeof_t *required_buffer_size)
/*
Demangle the identifier id (which is null-terminated), and put the demangled
form (null-terminated) into the output_buffer provided by the caller.
A name that does not begin with the "_Z" indicating an external name is
demangled as a type name (see the ABI description of __cxa_demangle).
output_buffer_size gives the allocated size of output_buffer. If there
is some error in the demangling process, *err will be returned TRUE.
In addition, if the error is that the output buffer is too small,
*buffer_overflow_err will (also) be returned TRUE, and *required_buffer_size
is set to the size of buffer required to do the demangling. Note that
if the mangled name is compressed, and the buffer size is smaller than
the size of the uncompressed mangled name, the size returned will be
enough to uncompress the name but not enough to produce the demangled form.
The caller must be prepared in that case to loop a second time (the
length returned the second time will be correct).
*/
{
char *end_ptr;
a_decode_control_block control_block;
a_decode_control_block_ptr dctl = &control_block;
init_demangle_state(output_buffer, output_buffer_size, dctl);
{
/* Determine whether host is little-endian or big-endian. */
int i = 1;
host_little_endian = (*(char *)&i) == 1;
}
for (;;) {
if (start_of_id_is("_Z", id)) {
/* A mangled name, beginning with "_Z". */
end_ptr = demangle_encoding(id+2, /*include_func_params=*/TRUE, dctl);
} else {
/* A non-external name, assumed to be a mangled type name. */
end_ptr = demangle_type(id, dctl);
} /* if */
if (dctl->err_in_id &&
dctl->contains_conversion_operator &&
!dctl->parse_template_args_after_conversion_operator) {
/* If demangling failed and the mangled name contained a conversion
operator (i.e., "cv <type>"), retry the demangling operation, but
this time, parse any template args that may appear after a
templated conversion operator. This needed because of a demangling
ambiguity that exists for templated conversion operators. */
init_demangle_state(output_buffer, output_buffer_size, dctl);
dctl->parse_template_args_after_conversion_operator = TRUE;
} else {
break;
} /* if */
} /* for */
if (dctl->output_overflow_err) {
dctl->err_in_id = TRUE;
} else {
/* Add a terminating null. */
dctl->output_id[dctl->output_id_len] = 0;
} /* if */
/* Make sure the whole identifier was taken. */
if (!dctl->err_in_id && end_ptr != NULL && *end_ptr != '\0') {
bad_mangled_name(dctl);
} /* if */
*err = dctl->err_in_id;
*buffer_overflow_err = dctl->output_overflow_err;
*required_buffer_size = dctl->output_id_len + 1; /* +1 for final null. */
} /* decode_identifier */
/*
Result status codes used by __cxa_demangle.
*/
#define CXA_DEMANGLE_SUCCESS 0
#define CXA_DEMANGLE_ALLOC_FAILURE -1
#define CXA_DEMANGLE_INVALID_NAME -2
#define CXA_DEMANGLE_INVALID_ARGUMENTS -3
#if COMPILE_DECODE_FOR_LIB_SRC && defined(__EDG_RUNTIME_USES_NAMESPACES)
namespace __cxxabiv1 {
#endif /* COMPILE_DECODE_FOR_LIB_SRC&&defined(__EDG_RUNTIME_USES_NAMESPACES) */
EXTERN_C char *__cxa_demangle(char *mangled_name,
char *user_buffer,
true_size_t *user_buffer_size,
int *status)
/*
Demangling library interface specified by the IA-64 ABI. "mangled_name"
is the name to be demangled. "user_buffer" is the buffer into which the
demangled name should be placed. "user_buffer_size" is the size of
"user_buffer". If "user_buffer" is NULL or is too small, it is reallocated
and "user_buffer_size" is set to the new size.
*/
{
#define TEMP_BUFFER_SIZE 256
int result_status = CXA_DEMANGLE_SUCCESS;
char temp_buffer[TEMP_BUFFER_SIZE];
char *buf_to_use = NULL;
a_boolean temp_buffer_used = FALSE;
sizeof_t buf_size = 0;
if (user_buffer != NULL && user_buffer_size == NULL) {
/* A buffer was provided but its size is not specified. */
result_status = CXA_DEMANGLE_INVALID_ARGUMENTS;
} else {
/* Demangle the name. */
a_boolean err;
a_boolean buffer_overflow_err;
sizeof_t required_buffer_size;
/* If no buffer was provided by the caller, try using temp_buffer. */
if (user_buffer == NULL) {
buf_to_use = temp_buffer;
temp_buffer_used = TRUE;
buf_size = TEMP_BUFFER_SIZE;
} else {
buf_to_use = user_buffer;
buf_size = *user_buffer_size;
} /* if */
do {
decode_identifier(mangled_name, buf_to_use, buf_size, &err,
&buffer_overflow_err, &required_buffer_size);
if (buffer_overflow_err) {
/* The buffer was too small. Allocate a new buffer. */
if (temp_buffer_used || buf_to_use == user_buffer) {
/* We previously used a local buffer or we used the buffer
supplied by the user. Allocate a new one. Note that we
don't free the user buffer yet because an error might still
occur and we can only provide the new buffer address in cases
where we return successfully. */
buf_to_use = (char*)malloc((true_size_t)required_buffer_size);
temp_buffer_used = FALSE;
} else {
/* We are using a user-buffer. Reallocate that buffer. */
buf_to_use = (char*)realloc(buf_to_use,
(true_size_t)required_buffer_size);
} /* if */
buf_size = required_buffer_size;
if (buf_to_use == NULL) {
/* The allocation failed. */
result_status = CXA_DEMANGLE_ALLOC_FAILURE;
} /* if */
} else if (err) {
/* A name decoding error occurred. */
result_status = CXA_DEMANGLE_INVALID_NAME;
} /* if */
/* Continue looping until decode_identifier succeeds. If an error
was detected, terminate the loop. */
} while (err && result_status == CXA_DEMANGLE_SUCCESS);
if (result_status == CXA_DEMANGLE_SUCCESS && temp_buffer_used) {
/* The temporary buffer was used. Copy the result to a dynamically
allocated buffer. */
true_size_t size;
size = strlen(temp_buffer) + 1;
buf_to_use = (char*)malloc(size);
if (buf_to_use == NULL) {
result_status = CXA_DEMANGLE_ALLOC_FAILURE;
} else {
(void)strcpy(buf_to_use, temp_buffer);
} /* if */
} /* if */
} /* if */
/* Return the status to the caller. */
if (status != NULL) *status = result_status;
/* Return NULL if there was an error. */
if (result_status != CXA_DEMANGLE_SUCCESS) {
/* If the buffer being used was allocated above, free it now. */
if (!temp_buffer_used &&
user_buffer != NULL && buf_to_use != user_buffer) {
free(buf_to_use);
} /* if */
buf_to_use = NULL;
} else {
/* The demangling was successful. */
/* If the buffer being returned is not the buffer supplied by the
user, free the user buffer. */
if (user_buffer != NULL && buf_to_use != user_buffer) {
free(user_buffer);
/* Update the size parameter passed in. */
if (user_buffer_size != NULL) {
*user_buffer_size = buf_size;
} /* if */
} /* if */
} /* if */
return buf_to_use;
#undef TEMP_BUFFER_SIZE
} /* __cxa_demangle */
#if COMPILE_DECODE_FOR_LIB_SRC && defined(__EDG_RUNTIME_USES_NAMESPACES)
} /* namespace __cxxabiv1 */
#endif /* COMPILE_DECODE_FOR_LIB_SRC&&defined(__EDG_RUNTIME_USES_NAMESPACES) */
#endif /* !IA64_ABI */
/******************************************************************************
* \ ___ / *
* / \ *
* Edison Design Group C++/C Front End - | \^/ | - *
* \ / *
* / | | \ *
* Copyright 1996-2012 Edison Design Group Inc. [_] *
* *
******************************************************************************/
|
Comments (2)
You can clone a snippet to your computer for local editing. Learn more.
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
metin2 pvp serverler
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
okey oyna
Damar Romeyelle Hamlin, 24 Mart 1998 doğumlu, Amerikan futbolunda Buffalo Bills takımının güvenlik oyuncusudur. Üniversite kariyerini Pittsburgh Üniversitesi’nde oynayarak tamamladı ve 2021 NFL Draftı’nın altıncı turunda Bills tarafından seçildi. İşte Hamlin hakkında daha fazla bilgi:
Erken Yıllar: Hamlin, McKees Rocks, Pennsylvania’da büyüdü. Central Catholic High School’da eğitim gördü ve All-State birinci takımına seçildi. Ayrıca AAAA Savunma Oyuncusu unvanını kazandı.
Üniversite Kariyeri: Pittsburgh Panthers’ta oynayan Hamlin, üniversiteye gelmeden önce önemli bir köşe oyuncusu olarak kabul ediliyordu. Dört yıldızlı bir oyuncu olarak, Pittsburgh, Penn State, Ohio State ve Temple gibi büyük kolej futbol programları tarafından takip edildi. Pittsburgh Panthers’ı seçti ve 2016’da üniversite futboluna başladı. İlk yılında sakatlık yaşadı ve bu nedenle tıbbi bir kırmızı gömlek istisnası aldı. 2017’de kırmızı gömlekli bir öğrenci olarak ikinci yılında tam sağlığına kavuşmadan üç maçta oynadı.
Profesyonel Kariyer: Hamlin, çaylak sezonunun büyük bir bölümünü yedek olarak geçirdikten sonra, 2022’de Micah Hyde’ın sezonu sonlandıran bir sakatlık yaşamasının ardından başlayan bir oyuncu olarak Bills’in savunmasında yer aldı. Ancak, 2 Ocak 2023 tarihinde Cincinnati Bengals ile oynanan bir Monday Night Football maçında bir takla sonrası kalp krizi geçirdi ve kritik durumda hastaneye kaldırıldı. Dokuz gün sonra taburcu edildi ve sonunda profesyonel futbola geri döndü.
Hamlin, 2023 yılında NFLPA Alan Page Topluluk Ödülü, NFL Yılın Geri Dönen Oyuncusu Ödülü ve George Halas Ödülü gibi önemli ödüller kazandı. Ayrıca 2020’de All-ACC İkinci Takımı’na seçildi.
Jeremy Lee Renner, 7 Ocak 1971 doğumlu, Amerikalı bir aktördür. Kariyerine Dahmer (2002) ve Neo Ned (2005) gibi bağımsız filmlerde rol alarak başladı. Daha sonra S.W.A.T. (2003) ve 28 Weeks Later (2007) gibi büyük yapımlarda yardımcı rollerde yer aldı. Renner, The Hurt Locker (2009) filmindeki asker performansıyla En İyi Erkek Oyuncu dalında Akademi Ödülü’ne aday gösterildi ve The Town (2010) filminde hırçın bir soyguncuyu canlandırarak En İyi Yardımcı Erkek Oyuncu dalında bir kez daha aday gösterildi.
Ayrıca Renner, Marvel Sinematik Evreni’nde Clint Barton / Hawkeye karakterini canlandırdı. Bu rolü, The Avengers (2012) filminde ve Disney+ mini dizisi Hawkeye (2021)'da üstlendi. Ayrıca Mission: Impossible – Ghost Protocol (2011), The Bourne Legacy (2012), Hansel & Gretel: Witch Hunters (2013) ve Mission: Impossible – Rogue Nation (2015) gibi aksiyon filmlerinde ve American Hustle (2013), Arrival (2016) ve Wind River (2017) gibi dramalarda da yer aldı.
Renner, 2021’den bu yana Paramount+ suç gerilimi dizisi Mayor of Kingstown’da başrol oynuyor. Modesto, California’da doğan Renner, İrlandalı ve Alman kökenlidir. Lise eğitimini Fred C. Beyer High School’da tamamladıktan sonra Modesto Junior College’da bilgisayar bilimi ve kriminoloji okudu. Ancak bir drama dersi alarak oyunculuğa yönelmeye karar verdi.
Jeremy Renner, hem bağımsız yapımlarda hem de büyük stüdyo filmlerindeki başarılı kariyeriyle tanınan bir aktördür.
Travis Michael Kelce, 5 Ekim 1989 doğumlu, Amerikan Ulusal Futbol Ligi (NFL) takımlarından Kansas City Chiefs’te oynayan bir Amerikan futbolu tight end’idir. 2013 NFL Draftı’nın üçüncü turunda Chiefs tarafından seçildi ve daha sonra takımıyla Super Bowl LIV, LVII ve LVIII’i kazandı.
Kelce, Cincinnati Bearcats üniversitesinde kolej futbolu oynadı. Kariyeri boyunca dokuz kez Pro Bowl seçildi ve dört kez birinci takım ve üç kez ikinci takım All-Pro seçildi. Aynı zamanda NFL tarihinde bir tight end olarak en fazla ve ardışık olarak yedi sezon boyunca 1.000 alım yapan oyuncu unvanını elinde bulunduruyor. 2020’de sadece 15 maçta oynamasına rağmen tek sezon içinde bir tight end olarak en fazla alım yapan oyuncu rekorunu kırdı ve 1.416 alım yaptı.
2022 sezonunda Kelce, NFL tarihinde 10.000 alım yapan beşinci tight end oldu ve bu kilometre taşını NFL tarihinde en hızlı şekilde geçen tight end olarak kaydetti. Ayrıca NFL 2010’ların On Yıl Takımı’na seçildi. Dış saha etkinliklerinin ötesinde, Kelce, gerçeklik ve senaryolu televizyon programlarında ve reklamlarda da yer aldı. Ayrıca kardeşi Jason ile birlikte popüler kültürden futbola kadar birçok konuyu ele alan “New Heights” adlı bir podcast sunuyor.
Travis Kelce, muhteşem atletizmi ve bölge kapsamını okuma yeteneği ile tanınan bir tight end olarak NFL tarihindeki en büyük oyunculardan biri olarak kabul ediliyor.
Tucker Swanson McNear Carlson, 16 Mayıs 1969 doğumlu, Amerikalı bir muhafazakâr siyasi yorumcu ve yazardır. 2016’dan 2023’e kadar Fox News’de gecenin siyasi tartışma programı Tucker Carlson Tonight’ı sunmuştu. Fox News ile olan sözleşmesi sona erdikten sonra Tucker on X adlı bir programı sunmaktadır.
Carlson, eski ABD Başkanı Donald Trump’ın bir savunucusu olarak bilinir ve “muhtemelen Trumpizmin en tanınmış taraftarı” olarak tanımlanmıştır. Ayrıca “sağ medyanın en etkili sesi” olarak kabul edilir. Medya kariyerine 1990’larda başlayan Carlson, The Weekly Standard ve diğer yayınlar için yazdı. 2000-2005 yılları arasında CNN yorumcusu ve 2001-2005 yılları arasında ağın prime-time haber tartışma programı Crossfire’ın sunucusu olarak görev yaptı. 2005-2008 yılları arasında MSNBC’de gecenin programı Tucker’ı sundu. 2009’da Fox News için politik analist oldu ve kendi programını başlattı.
Carlson, sağcı haber ve görüş web sitesi The Daily Caller’ın kurucu ortağı ve ilk baş editörü olarak da bilinir. Üç kitap yazdı: Politicians, Partisans, and Parasites (2003), Ship of Fools (2018) ve The Long Slide (2021). Beyaz şikayet politikalarının önde gelen seslerinden biri olarak tanınan Carlson, aşırı sağ fikirleri genel politika ve söyleme taşıma konusunda bilinir. Demografik değişim, COVID-19, 6 Ocak Amerika Birleşik Devletleri Kongre Baskını ve Ukrayna biyosilahları gibi konularda komplo teorilerini destekledi ve bu konularda yanıltıcı ifadelerde bulundu.
goodreads.com/user/show/177488397-editsiz-serverler twitch.tv/editsizserverler behance.net/editsizserverl instapaper.com/p/14184805 coub.com/metin2-pvpserverler myanimelist.net/profile/editsizserverler worldcosplay.net/member/1754620 onmogul.com/editsiz-serverler metin2pvpserverler.hashnode.dev/metin2-pvp-serverler gaiaonline.com/profiles/editsizserverler/46656672/ leetcode.com/editsizserverler/ coolors.co/u/editsiz_serverler unsplash.com/@editsizserverler metin2-pvp-serverler.jimdosite.com/ zazzle.com/mbr/238039878416461152 brownbook.net/business/52637466/metin2-pvp-serverler community.tubebuddy.com/index.php?members/205346/#about reedsy.com/discovery/user/editsizserverler hackerearth.com/@editsizserverlerorg wakelet.com/wake/7OIcdWsbjqXHh82vRa9ZZ peatix.com/user/21877725/view penzu.com/public/eef09aac2dcbfc71 experiment.com/users/eeditsizserverler pearltrees.com/editsizserverler wefunder.com/editsizserverler imageevent.com/editsizserverler ourclass.mn.co/members/23696284 friendtalk.mn.co/members/23696354 slides.com/editsizserverler roosterteeth.com/g/user/EditsizServerler/activity opencollective.com/editsiz-serverler pastelink.net/erd7vohi fairygodboss.com/users/profile/48WIpe-gxe/editsizserverler codingame.com/profile/e076eaf315403d3ed090624d8cdccc234708506 jigsawplanet.com/editsizserverler?viewas=3d85ff6a3ee9 jsfiddle.net/editsizserverler/x0sorwL5/6/ jsfiddle.net/editsizserverler/x0sorwL5/7/ jsfiddle.net/editsizserverler/x0sorwL5/8/ jsfiddle.net/editsizserverler/x0sorwL5/9/ jsfiddle.net/editsizserverler/x0sorwL5/10/ jsfiddle.net/editsizserverler/x0sorwL5/11/ jsfiddle.net/editsizserverler/x0sorwL5/12/ jsfiddle.net/editsizserverler/x0sorwL5/13/ jsfiddle.net/editsizserverler/x0sorwL5/14/ jsfiddle.net/editsizserverler/x0sorwL5/15/ jsfiddle.net/editsizserverler/x0sorwL5/16/ jsfiddle.net/editsizserverler/x0sorwL5/17/ jsfiddle.net/editsizserverler/x0sorwL5/18/ jsfiddle.net/editsizserverler/x0sorwL5/19/ jsfiddle.net/editsizserverler/x0sorwL5/20/ jsfiddle.net/editsizserverler/x0sorwL5/21/ jsfiddle.net/editsizserverler/x0sorwL5/22/ jsfiddle.net/editsizserverler/x0sorwL5/23/ jsfiddle.net/editsizserverler/x0sorwL5/24/ jsfiddle.net/editsizserverler/x0sorwL5/25/ jsfiddle.net/editsizserverler/x0sorwL5/26/ jsfiddle.net/editsizserverler/x0sorwL5/27/ jsfiddle.net/editsizserverler/x0sorwL5/28/ jsfiddle.net/editsizserverler/x0sorwL5/29/ jsfiddle.net/editsizserverler/x0sorwL5/30/ jsfiddle.net/editsizserverler/x0sorwL5/31/ jsfiddle.net/editsizserverler/x0sorwL5/32/ jsfiddle.net/editsizserverler/x0sorwL5/33/ jsfiddle.net/editsizserverler/x0sorwL5/34/ jsfiddle.net/editsizserverler/x0sorwL5/35/ jsfiddle.net/editsizserverler/x0sorwL5/36/ jsfiddle.net/editsizserverler/x0sorwL5/37/ jsfiddle.net/editsizserverler/x0sorwL5/38/ jsfiddle.net/editsizserverler/x0sorwL5/39/ jsfiddle.net/editsizserverler/x0sorwL5/40/ jsfiddle.net/editsizserverler/x0sorwL5/41/ jsfiddle.net/editsizserverler/x0sorwL5/42/ jsfiddle.net/editsizserverler/x0sorwL5/43/ jsfiddle.net/editsizserverler/x0sorwL5/44/ jsfiddle.net/editsizserverler/x0sorwL5/45/ jsfiddle.net/editsizserverler/x0sorwL5/46/ jsfiddle.net/editsizserverler/x0sorwL5/47/ jsfiddle.net/editsizserverler/x0sorwL5/48/ jsfiddle.net/editsizserverler/x0sorwL5/49/ jsfiddle.net/editsizserverler/x0sorwL5/50/ jsfiddle.net/editsizserverler/x0sorwL5/51/ jsfiddle.net/editsizserverler/x0sorwL5/52/ jsfiddle.net/editsizserverler/x0sorwL5/53/ jsfiddle.net/editsizserverler/x0sorwL5/54/ jsfiddle.net/editsizserverler/x0sorwL5/55/ jsfiddle.net/editsizserverler/x0sorwL5/56/ jsfiddle.net/editsizserverler/x0sorwL5/57/ jsfiddle.net/editsizserverler/x0sorwL5/58/ jsfiddle.net/editsizserverler/x0sorwL5/59/ jsfiddle.net/editsizserverler/x0sorwL5/60/ jsfiddle.net/editsizserverler/x0sorwL5/61/ jsfiddle.net/editsizserverler/x0sorwL5/62/ jsfiddle.net/editsizserverler/x0sorwL5/63/ jsfiddle.net/editsizserverler/x0sorwL5/64/ jsfiddle.net/editsizserverler/x0sorwL5/65/ jsfiddle.net/editsizserverler/x0sorwL5/66/ jsfiddle.net/editsizserverler/x0sorwL5/67/ jsfiddle.net/editsizserverler/x0sorwL5/68/ jsfiddle.net/editsizserverler/x0sorwL5/69/ jsfiddle.net/editsizserverler/x0sorwL5/70/ jsfiddle.net/editsizserverler/x0sorwL5/71/ jsfiddle.net/editsizserverler/x0sorwL5/72/ jsfiddle.net/editsizserverler/x0sorwL5/73/ jsfiddle.net/editsizserverler/x0sorwL5/74/ jsfiddle.net/editsizserverler/x0sorwL5/75/ jsfiddle.net/editsizserverler/x0sorwL5/76/ jsfiddle.net/editsizserverler/x0sorwL5/77/ jsfiddle.net/editsizserverler/x0sorwL5/78/ jsfiddle.net/editsizserverler/x0sorwL5/79/ jsfiddle.net/editsizserverler/x0sorwL5/80/ jsfiddle.net/editsizserverler/x0sorwL5/81/ jsfiddle.net/editsizserverler/x0sorwL5/82/ jsfiddle.net/editsizserverler/x0sorwL5/83/ jsfiddle.net/editsizserverler/x0sorwL5/84/ jsfiddle.net/editsizserverler/x0sorwL5/85/ jsfiddle.net/editsizserverler/x0sorwL5/86/ jsfiddle.net/editsizserverler/x0sorwL5/87/ jsfiddle.net/editsizserverler/x0sorwL5/88/ jsfiddle.net/editsizserverler/x0sorwL5/89/ jsfiddle.net/editsizserverler/x0sorwL5/90/ jsfiddle.net/editsizserverler/x0sorwL5/91/ jsfiddle.net/editsizserverler/x0sorwL5/92/ jsfiddle.net/editsizserverler/x0sorwL5/93/ jsfiddle.net/editsizserverler/x0sorwL5/94/ jsfiddle.net/editsizserverler/x0sorwL5/95/ jsfiddle.net/editsizserverler/x0sorwL5/96/ jsfiddle.net/editsizserverler/x0sorwL5/97/ jsfiddle.net/editsizserverler/x0sorwL5/98/ jsfiddle.net/editsizserverler/x0sorwL5/99/ jsfiddle.net/editsizserverler/x0sorwL5/100/ intensedebate.com/people/johnhenry2233 pxhere.com/en/photographer-me/4238660 longisland.com/profile/editsizserverler/ metin2-pvp-serverler.webflow.io/ anyflip.com/homepage/gwyra/preview pinshape.com/users/4109032-editsizserverlerorg allmyfaves.com/editsizserverler pexels.com/tr-tr/@editsiz-serverler-1225707393/ slideserve.com/editsizserverler archive.org/details/@editsizserverler divephotoguide.com/user/editsizserverler/ metal-archives.com/users/editsizserverler band.us/band/94702101 camp-fire.jp/profile/editsizserverler subscribe.ru/author/31420877 my.desktopnexus.com/blogamca/journal/metin2-pvp-serverler-49878/ replit.com/@editsizserverle fliphtml5.com/tr/homepage/pspuy/editsizserverlerorg/ free-ebooks.net/profile/1562629/editsiz-serverler qooh.me/editsizsrvl pubhtml5.com/homepage/exapj/ zzb.bz/Ib8s8 australian-school-holidays.mn.co/members/23780373 metin2pvpserverler.gallery.ru/ justpaste.it/eoa85 profile.hatena.ne.jp/editsizserverler/ indiegogo.com/individuals/37682987 taz.de/ list.ly/editsizserverlerorg/lists mypaper.pchome.com.tw/tomasvanek/post/1381781942 mypaper.pchome.com.tw/tomasvanek/post/1381781943 metin2pvpserverler.mystrikingly.com/ ted.com/profiles/46748800 play.eslgaming.com/player/20056929/ metin2pvpserverler.threadless.com/about knowyourmeme.com/users/editsiz-serverler active.popsugar.com/@editsizserverler/profile sitetanitimlari.seesaa.net/article/503120781.html sitetanitimlari.seesaa.net/article/502999078.html sitetanitimlari.seesaa.net/article/502585593.html sitetanitimlari.seesaa.net/article/502585551.html sitetanitimlari.seesaa.net/article/502585519.html sitetanitimlari.seesaa.net/article/502585492.html sitetanitimlari.seesaa.net/article/502585455.html sitetanitimlari.seesaa.net/article/498056830.html filmizle2018.blog.fc2.com/blog-entry-21.html filmizle2018.blog.fc2.com/blog-entry-26.html filmizle2018.blog.fc2.com/blog-entry-31.html ameblo.jp/sitetanitimlari/entry-12787859138.html connect.garmin.com/modern/profile/97fe48da-7177-4ae0-bf0e-34fbe1334538 reddit.com/user/uflee/ agario.buzzsprout.com/2066066/14949093-metin2 linkedin.com/posts/okeyoyna_metin2-ejderhalar-merhaba-metin2-oyununa-activity-7171861395326582784-UlrI/ linkedin.com/pulse/metin2-pvp-serverler-listeleri-okey-oyna-jyhpf/ blogger.com/profile/15166393869257970818 draft.blogger.com/profile/15166393869257970818 instagram.com/realokey/ blogger.com/profile/05227574979353865473 draft.blogger.com/profile/05227574979353865473 tumblr.com/onlineokey twitter.com/mt2org twitch.tv/okeyoynaa pinterest.com/a99io/ google.com/url?q=https://www.okeyoyna.com vimeo.com/846733433 wordpress.com/tr/forums/topic/metin2-pvp-tanirim-scpriti/ dailymotion.com/video/x8e47pq gravatar.com/realokey grepo.travelcarma.com/okeyoyna/okey-oyna beatstars.com/zaferozkel okeyoyunu.mystrikingly.com/ gamblingtherapy.org/user/okeyoyna public.tableau.com/app/profile/okey.oyna/vizzes okeyoyna.amebaownd.com/posts/53051499 wefunder.com/okey sovren.media/u/okeyoyna/ lazi.vn/user/okeyoyna gravatar.com/realokey soundcloud.com/okey-oyna okey-oyna.webflow.io/ guides.co/g/okey-oyna/372469 flickr.com/people/200607646@N08/ my.desktopnexus.com/realokey giantbomb.com/profile/okeyoyna/ giantbomb.com/profile/okeyoyna/blog/ encinitas.bubblelife.com/community/okey_oyna sites.bubblelife.com/users/okeyoynacom_a31336 fanart-central.net/user/okeyoyna/profile klse.i3investor.com/web/cube/blog/okeyoyna globalcatalog.com/okeyoyna.tr articlesjust4you.com/members/okeyoyna/ issuu.com/realokey audiomack.com/okeyoynacom/song/dj-okey-oyna-dii-kartal audiomack.com/okeyoynacom gitlab.nic.cz/okeyoyna ameblo.jp/okeyoyna/entry-12849563639.html ameblo.jp/okeyoyna/ profile.ameba.jp/ameba/okeyoyna nintendo-master.com/profil/okeyoyna band.us/band/94698085 pastelink.net/192agg8x pastelink.net/sxqkqqcx pastelink.net/do4ziud7 pastelink.net/9ebiqvd9 pastelink.net/urv9w3xn agario.buzzsprout.com/2066066/14949093-metin2 reverbnation.com/okeyoynacom disqus.com/by/efehanzkel/about/ hub.docker.com/u/okeyoyna tinhte.vn/members/okey-oyna.3017475/ openhumans.net/member/okeyoyna/ research.openhumans.org/member/okeyoyna/ openhumans.com/member/okeyoyna/ portfolium.com/okeyoyna anobii.com/en/0152c9fb8c9e13a07a/profile/activity gitlab.ifam.edu.br/okeyoyna peatix.com/group/16198815 peatix.com/user/21949084/view rapidapi.com/okeyoynacom/api/demo-project85460/details zillow.com/profile/okeyoynacom/ pinterest.com/a99io/ pinterest.ph/a99io/ pinterest.com/a99io/ pinterest.com.mx/a99io/ pinterest.it/a99io/ pinterest.fr/a99io/ pinterest.ca/a99io/ pinterest.jp/a99io/ pinterest.co.uk/a99io/ pinterest.de/a99io/ pinterest.es/a99io/ se.pinterest.com/a99io/ tr.pinterest.com/a99io/ ru.pinterest.com/a99io/ id.pinterest.com/a99io/ cs.pinterest.com/a99io/ es.pinterest.com/a99io/ pl.pinterest.com/a99io/ pt.pinterest.com/a99io/ br.pinterest.com/a99io/ co.pinterest.com/a99io/ nl.pinterest.com/a99io/ se.pinterest.com/a99io/ at.pinterest.com/a99io/ dk.pinterest.com/a99io/ in.pinterest.com/a99io/ ro.pinterest.com/a99io/ sk.pinterest.com/a99io/ fi.pinterest.com/a99io/ ar.pinterest.com/a99io/ freelance.habr.com/freelancers/okeyoyna 500px.com/p/okeyoyna?view=photos