This file is indexed.

/usr/share/ada/adainclude/asis/asis-declarations.ads is in libasis2014-dev 2014-4.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

   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
------------------------------------------------------------------------------
--                                                                          --
--                   ASIS-for-GNAT INTERFACE COMPONENTS                     --
--                                                                          --
--                    A S I S . D E C L A R A T I O N S                     --
--                                                                          --
--                                 S p e c                                  --
--                                                                          --
--            Copyright (C) 2006-2013, Free Software Foundation, Inc.       --
--                                                                          --
-- This   specification  is  adapted   from  the  Ada   Semantic  Interface --
-- Specification Standard (ISO/IEC 15291) for use with GNAT.  In accordance --
-- with the copyright of that document, you can freely copy and modify this --
-- specification, provided that if you redistribute a modified version, any --
-- changes that you have made are clearly indicated.                        --
--                                                                          --
-- This  specification  also  contains  suggestions  and  discussion  items --
-- related to revising the  ASIS Standard according to the changes proposed --
-- for  the  new  revision of the Ada standard. The copyright notice above, --
-- and the license provisions that follow apply solely to these suggestions --
-- and  discussion  items  that  are separated by the corresponding comment --
-- sentinels                                                                --
--                                                                          --
-- ASIS-for-GNAT is free software; you can redistribute it and/or modify it --
-- under terms of the  GNU General Public License  as published by the Free --
-- Software Foundation;  either version 2,  or  (at your option)  any later --
-- version. ASIS-for-GNAT is distributed  in the hope  that it will be use- --
-- ful, but WITHOUT ANY WARRANTY; without even the implied warranty of MER- --
-- CHANTABILITY or  FITNESS FOR A  PARTICULAR PURPOSE.  See the GNU General --
-- Public License for more details.  You should have received a copy of the --
-- GNU  General  Public  License  distributed with  ASIS-for-GNAT; see file --
-- COPYING.  If not,  write  to the  Free Software Foundation,  51 Franklin --
-- Street, Fifth Floor, Boston, MA 02110-1301, USA.                         --
--                                                                          --
--                                                                          --
--                                                                          --
--                                                                          --
--                                                                          --
--                                                                          --
--                                                                          --
--                                                                          --
-- ASIS-for-GNAT was originally developed  by the ASIS-for-GNAT team at the --
-- Software  Engineering  Laboratory  of  the Swiss  Federal  Institute  of --
-- Technology (LGL-EPFL) in Lausanne,  Switzerland, in cooperation with the --
-- Scientific  Research  Computer  Center of  Moscow State University (SRCC --
-- MSU), Russia,  with funding partially provided  by grants from the Swiss --
-- National  Science  Foundation  and  the  Swiss  Academy  of  Engineering --
-- Sciences. ASIS-for-GNAT is now maintained by AdaCore                     --
-- (http://www.adacore.com).                                                --
--                                                                          --
------------------------------------------------------------------------------

pragma Ada_2012;

------------------------------------------------------------------------------
--  15 package Asis.Declarations

--  Suggestions related to changing this specification to accept new Ada
--  features as defined in incoming revision of the Ada Standard (ISO 8652)
--  are marked by following comment sentinels:
--
--  --|A2005 start
--   ... the suggestion goes here ...
--  --|A2005 end
--
--  and the discussion items are marked by the comment sentinels of teh form:
--
--  --|D2005 start
--   ... the discussion item goes here ...
--  --|D2005 end
------------------------------------------------------------------------------
------------------------------------------------------------------------------
package Asis.Declarations is
------------------------------------------------------------------------------
------------------------------------------------------------------------------
--  Asis.Declarations encapsulates a set of queries that operate on
--  A_Defining_Name and A_Declaration elements.
------------------------------------------------------------------------------
------------------------------------------------------------------------------
--  --|ER A_Declaration - 3.1
--  --|CR
--  --|CR Child elements returned by:
--  --|CR    function Names
--  --|CR
------------------------------------------------------------------------------
------------------------------------------------------------------------------
--  15.1  function Names
------------------------------------------------------------------------------

   function Names
     (Declaration : Asis.Declaration)
      return        Asis.Defining_Name_List;

------------------------------------------------------------------------------
--  Declaration - Specifies the element to query
--
--  Returns a list of names defined by the declaration, in their order of
--  appearance.  Declarations that define a single name will return a list of
--  length one.
--
--  Returns Nil_Element_List for A_Declaration Elements representing the
--  (implicit) declarations of universal and root numeric type (that is, if
--  Type_Kind (Type_Declaration_View (Declaration) = A_Root_Type_Definition.
--
--  Examples:
--    type Foo is (Pooh, Baah);
--         -- Returns a list containing one A_Defining_Name: Foo.
--
--    One, Uno : constant Integer := 1;
--         -- Returns a list of two A_Defining_Name elements: One and Uno.
--
--  Function designators that define operators are A_Defining_Operator_Symbol.
--
--  Results of this query may vary across ASIS implementations.  Some
--  implementations may normalize all multi-name declarations into an
--  equivalent series of corresponding single name declarations.  For those
--  implementations, this query will always return a list containing a single
--  name.  See Reference Manual 3.3.1(7).
--
--  Appropriate Element_Kinds:
--        A_Declaration
--
--  Returns Element_Kinds:
--        A_Defining_Name
--
--  --|ER---------------------------------------------------------------------
--  --|ER A_Defining_Name - 3.1
--  --|ER---------------------------------------------------------------------
--  --|ER A_Defining_Identifier      - 3.1 - no child elements
--  --|ER A_Defining_Operator_Symbol - 6.1 - no child elements
--  --|ER
--  --|ER A string image returned by:
--  --|ER    function Defining_Name_Image

------------------------------------------------------------------------------
--  15.2  function Defining_Name_Image
------------------------------------------------------------------------------

   function Defining_Name_Image
     (Defining_Name : Asis.Defining_Name)
      return          Program_Text;

------------------------------------------------------------------------------
--  Defining_Name  - Specifies the element to query
--
--  Returns the program text image of the name.  Embedded quotes (for operator
--  designator strings) are doubled.
--
--  A_Defining_Identifier elements are simple identifier names "Abc"
--  (name Abc).
--
--  A_Defining_Operator_Symbol elements have names with embedded quotes
--  """abs""" (function "abs").
--
--  A_Defining_Character_Literal elements have names with embedded apostrophes
--  "'x'" (literal 'x').
--
--  A_Defining_Enumeration_Literal elements have simple identifier names
--  "Blue" (literal Blue). If A_Defining_Enumeration_Literal element is of type
--  Character or Wide_Character but does not have a graphical presentation,
--  then the result is implementation-dependent.
--
--  A_Defining_Expanded_Name elements are prefix.selector names "A.B.C"
--  (name A.B.C).
--
--  The case of names returned by this query may vary between implementors.
--  Implementors are encouraged, but not required, to return names in the
--  same case as was used in the original compilation text.
--
--  The Defining_Name_Image of a label_statement_identifier does not include
--  the enclosing "<<" and ">>" that form the label syntax.  Similarly, the
--  Defining_Name_Image of an identifier for a loop_statement or
--  block_statement does not include the trailing colon that forms the loop
--  name syntax. Use Asis.Text.Element_Image or Asis.Text.Lines queries to
--  obtain these syntactic constructs and any comments associated with them.
--
--  Appropriate Element_Kinds:
--       A_Defining_Name
--  --|ER---------------------------------------------------------------------
--  --|ER A_Defining_Character_Literal   - 3.5.1 - no child elements
--  --|ER A_Defining_Enumeration_Literal - 3.5.1 - no child elements
--  --|ER
--  --|ER A program text image returned by:
--  --|ER    function Defining_Name_Image
--  --|ER
--  --|ER A program text image of the enumeration literal value returned by:
--  --|ER    function Position_Number_Image
--  --|ER    function Representation_Value_Image
--  --
------------------------------------------------------------------------------
--  15.3  function Position_Number_Image
------------------------------------------------------------------------------

   function Position_Number_Image
     (Defining_Name : Asis.Defining_Name)
      return          Wide_String;

------------------------------------------------------------------------------
--  Expression  - Specifies the literal expression to query
--
--  Returns the program text image of the position number of the value of the
--  enumeration literal.
--
--  The program text returned is the image of the universal_integer value that
--  is returned by the attribute 'Pos if it were applied to the value.
--  For example: Integer'Image(Color'Pos(Blue)).
--
--  Appropriate Defining_Name_Kinds:
--       A_Defining_Character_Literal
--       A_Defining_Enumeration_Literal
--
------------------------------------------------------------------------------
--  15.4  function Representation_Value_Image
------------------------------------------------------------------------------

   function Representation_Value_Image
     (Defining_Name : Asis.Defining_Name)
      return          Wide_String;

------------------------------------------------------------------------------
--  Expression  - Specifies the literal expression to query
--
--  Returns the string image of the internal code for the enumeration literal.
--
--  If a representation_clause is defined for the enumeration type then the
--  string returned is the Integer'Wide_Image of the corresponding value given
--  in the enumeration_aggregate.  Otherwise, the string returned is the same
--  as the Position_Number_Image.
--
--  Appropriate Defining_Name_Kinds:
--       A_Defining_Character_Literal
--       A_Defining_Enumeration_Literal
--
--  --|ER---------------------------------------------------------------------
--  --|ER A_Defining_Expanded_Name - 6.1
--  --|ER
--  --|ER A string image returned by:
--  --|ER    function Defining_Name_Image
--  --|CR
--  --|CR Child elements returned by:
--  --|CR    function Defining_Prefix
--  --|CR    function Defining_Selector

------------------------------------------------------------------------------
--  15.5  function Defining_Prefix
------------------------------------------------------------------------------

   function Defining_Prefix
     (Defining_Name : Asis.Defining_Name)
      return          Asis.Name;

------------------------------------------------------------------------------
--  Defining_Name  - Specifies the element to query
--
--  Returns the element that forms the prefix of the name.  The prefix is the
--  name to the left of the rightmost 'dot' in the expanded name.
--  The Defining_Prefix of A.B is A, and of A.B.C is A.B.
--
--  Appropriate Defining_Name_Kinds:
--       A_Defining_Expanded_Name
--
--  Returns Expression_Kinds:
--       An_Identifier
--       A_Selected_Component
--
------------------------------------------------------------------------------
--  15.6  function Defining_Selector
------------------------------------------------------------------------------

   function Defining_Selector
     (Defining_Name : Asis.Defining_Name)
      return          Asis.Defining_Name;

------------------------------------------------------------------------------
--  Defining_Name  - Specifies the element to query
--
--  Returns the element that forms the selector of the name.  The selector is
--  the name to the right of the rightmost 'dot' in the expanded name.
--  The Defining_Selector of A.B is B, and of A.B.C is C.
--
--  Appropriate Defining_Name_Kinds:
--       A_Defining_Expanded_Name
--
--  Returns Defining_Name_Kinds:
--       A_Defining_Identifier
--
--  --|ER---------------------------------------------------------------------
--  --|ER An_Ordinary_Type_Declaration - 3.2.1
--  --|CR
--  --|CR Child elements returned by:
--  --|CR    function Names
--  --|CR    function Discriminant_Part
--  --|CR    function Type_Declaration_View

------------------------------------------------------------------------------
--  15.7  function Discriminant_Part
------------------------------------------------------------------------------

   function Discriminant_Part
     (Declaration : Asis.Declaration)
      return        Asis.Definition;

------------------------------------------------------------------------------
--  Declaration - Specifies the type declaration to query
--
--  Returns the discriminant_part, if any, from the type_declaration or
--  formal_type_declaration.
--
--  Returns a Nil_Element if the Declaration has no explicit discriminant_part.
--
--  Appropriate Declaration_Kinds:
--       An_Ordinary_Type_Declaration
--       A_Task_Type_Declaration
--       A_Protected_Type_Declaration
--       An_Incomplete_Type_Declaration
--  |A2005 start
--       A_Tagged_Incomplete_Type_Declaration (implemented)
--  |A2005 end
--       A_Private_Type_Declaration
--       A_Private_Extension_Declaration
--       A_Formal_Type_Declaration
--
--  Returns Definition_Kinds:
--       Not_A_Definition
--       An_Unknown_Discriminant_Part
--       A_Known_Discriminant_Part
--
------------------------------------------------------------------------------
--  15.8  function Type_Declaration_View
------------------------------------------------------------------------------

   function Type_Declaration_View
     (Declaration : Asis.Declaration)
      return        Asis.Definition;

------------------------------------------------------------------------------
--  Declaration - Specifies the declaration element to query
--
--  Returns the definition characteristics that form the view of the
--  type_declaration.  The view is the remainder of the declaration following
--  the reserved word "is".
--
--  For a full_type_declaration, returns the type_definition, task_definition,
--  or protected_definition following the reserved word "is" in the
--  declaration.
--
--  Returns a Nil_Element for a task_type_declaration that has no explicit
--  task_definition.
--
--  For a private_type_declaration or private_extension_declaration, returns
--  the definition element representing the private declaration view.
--
--  For a subtype_declaration, returns the subtype_indication.
--
--  For a formal_type_declaration, returns the formal_type_definition.
--
--  Appropriate Declaration_Kinds:
--        An_Ordinary_Type_Declaration
--        A_Task_Type_Declaration
--        A_Protected_Type_Declaration
--        A_Private_Type_Declaration
--        A_Private_Extension_Declaration
--        A_Subtype_Declaration
--        A_Formal_Type_Declaration
--
--  Returns Definition_Kinds:
--        Not_A_Definition
--        A_Type_Definition
--        An_Interface_Type_Definition
--        A_Subtype_Indication
--        A_Private_Type_Definition
--        A_Tagged_Private_Type_Definition
--        A_Private_Extension_Definition
--        A_Task_Definition
--        A_Protected_Definition
--        A_Formal_Type_Definition
--
--  --|ER---------------------------------------------------------------------
--  --|ER A_Subtype_Declaration - 3.2.2
--  --|CR
--  --|CR Child elements returned by:
--  --|CR    function Names
--  --|CR    function Type_Declaration_View
--  --|ER---------------------------------------------------------------------
--  --|ER A_Variable_Declaration          - 3.3.1
--  --|CR
--  --|CR Child elements:
--  --|CR    function Names
--  --|CR    function Object_Declaration_View
--  --|CR    function Initialization_Expression
--
------------------------------------------------------------------------------
--  15.9  function Object_Declaration_View
------------------------------------------------------------------------------

   function Object_Declaration_View
     (Declaration : Asis.Declaration)
      return        Asis.Definition;

------------------------------------------------------------------------------
--  Declaration - Specifies the declaration element to query
--
--  Returns the definition characteristics that form the view of the
--  object_declaration.

--  --|A2005 start

--  The view is the subtype_indication, a full type
--  definition of the object_declaration, a subtype mark or an access
--  definition.  An initial value, if any, is not
--  part of this view.
--  --|A2005 end
--
--  For a single_task_declaration or single_protected_declaration, returns
--  the task_definition or protected_definition following the reserved word
--  "is".
--
--  Returns a Nil_Element for a single_task_declaration that has no explicit
--  task_definition.
--
--  --D2005 start
--  For a declaration containing a colon, returns the definition element
--  representing the part of the declaration following the colon.
--  --|D2005 end
--
--  Appropriate Declaration_Kinds:
--        A_Variable_Declaration
--        A_Constant_Declaration
--        A_Deferred_Constant_Declaration
--        A_Single_Protected_Declaration
--        A_Single_Task_Declaration
--        A_Component_Declaration
--  --|A2005 start
--        A_Discriminant_Specification (implemented)
--        A_Parameter_Specification    (implemented)
--        A_Return_Object_Declaration
--        A_Formal_Object_Declaration
--        An_Object_Renaming_Declaration
--  --|A2005 end
--
--  Returns Definition_Kinds:
--        Not_A_Definition
--        A_Type_Definition
--            Returns Type_Kinds:
--                  A_Constrained_Array_Definition
--        A_Subtype_Indication
--        A_Task_Definition
--        A_Protected_Definition
--        A_Component_Definition
--  --|A2005 start
--        An_Access_Definition
--
--  Returns Expression_Kinds:
--       An_Identifier
--       A_Selected_Component
--       An_Attribute_Reference

--  --D2005 start

--  The wording of the query definition needs some more revising
--
--  Probably we need a kind of an Application Note here that would say that
--  in ASIS this query is the only proper way to get a definition of any
--  object, and that Declaration_Subtype_Mark query should not be used in ASIS
--  applications that are supposed to analyze Ada 2005 code.

--  --|D2005 end
--  --|A2005 end

--  --|A2010 start

   function Aspect_Specifications
     (Declaration : Asis.Element)
      return        Asis.Element_List;
------------------------------------------------------------------------------
--  Returns a list of aspect specifications given for the declaration, in
--  their order of appearance. Returns Nil_Element_List if no aspect
--  specification is given for the declaration or if the given declaration kind
--  cannot have any aspect specification.
--
--  Appropriate Element_Kinds:
--     A_Declaration
--
--  Returns Definition_Kinds:
--        An_Aspect_Specification

--  --|A2010 end

------------------------------------------------------------------------------
--  15.10 function Initialization_Expression
------------------------------------------------------------------------------

   function Initialization_Expression
     (Declaration : Asis.Declaration)
      return        Asis.Expression;

------------------------------------------------------------------------------
--  Declaration - Specifies the object declaration to query
--
--  Returns the initialization expression [:= expression] of the declaration.
--
--  Returns a Nil_Element if the declaration does not include an explicit
--  initialization.
--
--  Appropriate Declaration_Kinds:
--       A_Variable_Declaration
--       A_Constant_Declaration
--       An_Integer_Number_Declaration
--       A_Real_Number_Declaration
--       A_Discriminant_Specification
--       A_Component_Declaration
--       A_Parameter_Specification
--  |A2005 start
--        A_Return_Object_Declaration
--  |A2005 end
--       A_Formal_Object_Declaration
--
--  Returns Element_Kinds:
--       Not_An_Element
--       An_Expression
--
--  --|ER---------------------------------------------------------------------
--  --|ER A_Constant_Declaration          - 3.3.1
--  --|CR
--  --|CR Child elements:
--  --|CR    function Names
--  --|CR    function Object_Declaration_View
--  --|CR    function Initialization_Expression
--  --|CR
--  --|CR Element queries that provide semantically related elements:
--  --|CR    function Corresponding_Constant_Declaration
--
------------------------------------------------------------------------------
--  15.11 function Corresponding_Constant_Declaration
------------------------------------------------------------------------------

   function Corresponding_Constant_Declaration
     (Name : Asis.Defining_Name)
      return Asis.Declaration;

------------------------------------------------------------------------------
--  Name    - Specifies the name of a constant declaration to query
--
--  Returns the corresponding full constant declaration when given the name
--  from a deferred constant declaration.
--
--  Returns the corresponding deferred constant declaration when given the name
--  from a full constant declaration.
--
--  Returns a Nil_Element if the deferred constant declaration is completed
--  by a pragma Import.
--
--  Returns a Nil_Element if the full constant declaration has no corresponding
--  deferred constant declaration.
--
--  Raises ASIS_Inappropriate_Element with a Status of Value_Error if the
--  argument is not the name of a constant or a deferred constant.
--
--  The name of a constant declaration is available from both the Names and the
--  Corresponding_Name_Definition queries.
--
--  Appropriate Element_Kinds:
--       A_Defining_Name
--

--  Returns Declaration_Kinds:
--       Not_A_Declaration
--       A_Constant_Declaration
--       A_Deferred_Constant_Declaration
--
--  --|ER---------------------------------------------------------------------
--  --|ER A_Deferred_Constant_Declaration          - 3.3.1
--  --|CR
--  --|CR Child elements returned by:
--  --|CR    function Names
--  --|CR    function Object_Declaration_View
--  --|ER---------------------------------------------------------------------
--  --|ER An_Integer_Number_Declaration - 3.3.2
--  --|ER A_Real_Number_Declaration     - 3.3.2
--  --|CR
--  --|CR Child elements returned by:
--  --|CR    function Names
--  --|CR    function Initialization_Expression
--  --|ER---------------------------------------------------------------------
--  --|ER An_Enumeration_Literal_Specification - 3.5.1
--  --|CR
--  --|CR Child elements returned by:
--  --|CR    function Names
--  --|ER---------------------------------------------------------------------
--  --|ER A_Discriminant_Specification         - 3.7
--  --|CR
--  --|CR Child elements returned by:
--  --|CR    function Names
--  --|CR    function Declaration_Subtype_Mark
--  --|CR    function Initialization_Expression
--
------------------------------------------------------------------------------
--  15.12 function Declaration_Subtype_Mark
------------------------------------------------------------------------------

   function Declaration_Subtype_Mark
     (Declaration : Asis.Declaration)
      return        Asis.Expression;

------------------------------------------------------------------------------
--  Declaration - Specifies the declaration element to query
--
--  Returns the expression element that names the subtype_mark of the
--  declaration.
--
--  --|A2005 start
--  --|D2005 start

--  In ASIS 2005 this query is an obsolescent feature, it should not be used
--  for analyzing Ada 2005 code. We need a proper warning note in the ASIS
--  Standard. See also Object_Declaration_View

--  --|D2005 end
--  --|A2005 end

--  Appropriate Declaration_Kinds:
--       A_Discriminant_Specification
--       A_Parameter_Specification
--       A_Formal_Object_Declaration
--       An_Object_Renaming_Declaration
--
--  Returns Expression_Kinds:
--       An_Identifier
--       A_Selected_Component
--       An_Attribute_Reference
--
--  --|ER---------------------------------------------------------------------
--  --|ER A_Component_Declaration - 3.8
--  --|CR
--  --|CR Child elements returned by:
--  --|CR    function Names
--  --|CR    function Object_Declaration_View
--  --|CR    function Initialization_Expression
--  --|ER---------------------------------------------------------------------
--  --|ER An_Incomplete_Type_Declaration - 3.10.1
--  --|CR
--  --|CR Child elements returned by:
--  --|CR    function Names
--  --|CR    function Discriminant_Part
--

------------------------------------------------------------------------------
--  15.13 function Corresponding_Type_Declaration
------------------------------------------------------------------------------

   function Corresponding_Type_Declaration
     (Declaration : Asis.Declaration)
      return        Asis.Declaration;

   function Corresponding_Type_Declaration
     (Declaration : Asis.Declaration;
      The_Context : Asis.Context)
       return       Asis.Declaration;
------------------------------------------------------------------------------
--  Declaration - Specifies the type declaration to query
--  The_Context - Specifies the program Context to use for obtaining package
--                body information
--
--  Returns the corresponding full type declaration when given a private or
--  incomplete type declaration.  Returns the corresponding private or
--  incomplete type declaration when given a full type declaration.
--
--  These two function calls will always produce identical results:
--
--    Decl2 := Corresponding_Type_Declaration ( Decl1 );
--    Decl2 := Corresponding_Type_Declaration
--               ( Decl1,
--                 Enclosing_Context ( Enclosing_Compilation_Unit ( Decl1 )));
--
--  Returns a Nil_Element when a full type declaration is given that has no
--  corresponding private or incomplete type declaration, or when a
--  corresponding type declaration does not exist within The_Context.
--
--  The parameter The_Context is used whenever the corresponding full type of
--  an incomplete type is in a corresponding package body. See Reference Manual
--  3.10.1(3). Any non-Nil result will always have the given Context as its
--  Enclosing_Context.
--
--  Appropriate Declaration_Kinds:
--       An_Ordinary_Type_Declaration
--       A_Task_Type_Declaration
--       A_Protected_Type_Declaration
--       An_Incomplete_Type_Declaration
--  |A2005 start
--       A_Tagged_Incomplete_Type_Declaration (implemented)
--  |A2005 end
--       A_Private_Type_Declaration
--       A_Private_Extension_Declaration
--
--  Returns Declaration_Kinds:
--       Not_A_Declaration
--       An_Ordinary_Type_Declaration
--       A_Task_Type_Declaration
--       A_Protected_Type_Declaration
--       An_Incomplete_Type_Declaration
--  |A2005 start
--       A_Tagged_Incomplete_Type_Declaration (implemented)
--  |A2005 end
--       A_Private_Type_Declaration
--       A_Private_Extension_Declaration
--
--  --|AN Application Note:
--  --|AN
--  --|AN This function is an obsolescent feature for Ada/ASIS 2012, because
--  --|AN in Ada 2012 an incomplete type can be completed by a private type
--  --|AN and then the private type is completed by a full type declaration.
--  --|AN In this case when applied to the private type declaration, the query
--  --|AN has no way to know which corresponding type declaration (incomplete
--  --|AN or full) should be returned as the result. In this case the query
--  --|AN raises ASIS_Inappropriate_Element
--  --|AN
--  --|AN If an application is supposed to be able to process Ada 2012,
--  --|AN do not use this query and use two new queries:
--  --|AN
--  --|AN    Corresponding_Type_Completion
--  --|AN and
--  --|AN    Corresponding_Type_Partial_View

--  --|A2010 start

------------------------------------------------------------------------------
--  15.??? function Corresponding_Type_Completion
------------------------------------------------------------------------------

   function Corresponding_Type_Completion
     (Declaration : Asis.Declaration)
      return        Asis.Declaration;

--  Declaration - Specifies the type declaration to query
--
--  Returns the type declaration that is a completion of an argument private or
--  incomplete type declaration. In case when the argument is an incomplete
--  type declaration that is completed by a private type declaration and this
--  private type declaration is in turn completed by a full type declaration,
--  the result is the private type declaration but not the full type
--  declaration.
--
--  Returns a Nil_Element when an incomplete type declaration is given but
--  the corresponding completion does not exist within the enclosing Context.
--
--  Appropriate Declaration_Kinds:
--       An_Incomplete_Type_Declaration
--       A_Tagged_Incomplete_Type_Declaration
--       A_Private_Type_Declaration
--       A_Private_Extension_Declaration
--
--  Returns Declaration_Kinds:
--       Not_A_Declaration
--       An_Ordinary_Type_Declaration
--       A_Task_Type_Declaration
--       A_Protected_Type_Declaration
--       A_Private_Type_Declaration
--       A_Private_Extension_Declaration

------------------------------------------------------------------------------
--  15.??? function Corresponding_Type_Partial_View
------------------------------------------------------------------------------

   function Corresponding_Type_Partial_View
     (Declaration : Asis.Declaration)
      return        Asis.Declaration;

--  Declaration - Specifies the type declaration to query
--
--  Returns the type declaration the argument declaration is a completion for.
--  In case when the argument is a full type declaration that is a completion
--  of a private type (or private extension) declaration that is in turn the
--  completion of an incomplete type declaration, the result is the private
--  type (private extension) declaration but not the incomplete type
--  declaration.
--
--  Returns a Nil_Element when an argument declaration is not a completion of
--  any incomplete/private type declaration.
--
--  Appropriate Declaration_Kinds:
--       An_Ordinary_Type_Declaration
--       A_Task_Type_Declaration
--       A_Protected_Type_Declaration
--       A_Private_Type_Declaration
--       A_Private_Extension_Declaration
--
--  Returns Declaration_Kinds:
--       Not_A_Declaration
--       An_Incomplete_Type_Declaration
--       A_Tagged_Incomplete_Type_Declaration (implemented)
--       A_Private_Type_Declaration
--       A_Private_Extension_Declaration

--  --|A2010 end

------------------------------------------------------------------------------
--  15.14 function Corresponding_First_Subtype
------------------------------------------------------------------------------

   function Corresponding_First_Subtype
     (Declaration : Asis.Declaration)
      return        Asis.Declaration;

------------------------------------------------------------------------------
--  Declaration - Specifies the subtype_declaration to query
--
--  This function recursively unwinds subtyping to return at a type_declaration
--  that defines the first subtype of the argument.
--
--  Returns a declaration that Is_Identical to the argument if the argument is
--  already the first subtype.
--
--  --|D2005 start
--  We need to define the effect of this function in case if the argument
--  represents a subtype declaration of the form:
--
--        subtype St is T'Class;
--  or
--        subtype St_1 is St;
--
--  I would add the following paragraph:
--
--     If the argument is a subtype of a class-wide type, returns the
--     declaration of the specific type that is a root type of the class.
--
--  Probably, we need also to add to the core ASIS the following query:
--
--     function Is_Class_Wide
--       (Declaration : Asis.Declaration)
--        return        Boolean;
--
------------------------------------------------------------------------------
--  Declaration - Specifies the subtype_declaration to query
--
--  This function checks if the argument subtype is a subtype of some
--  class-wide type.
--
--  Returns False for any unexpected Element
--
--  Expected Declaration_Kinds:
--  A_Subtype_Declaration
--
--  |D2005 end
--
--  Appropriate Declaration_Kinds:
--       An_Ordinary_Type_Declaration
--       A_Task_Type_Declaration
--       A_Protected_Type_Declaration
--       A_Private_Type_Declaration
--       A_Private_Extension_Declaration
--       A_Subtype_Declaration
--       A_Formal_Type_Declaration
--
--  Returns Declaration_Kinds:
--       An_Ordinary_Type_Declaration
--       A_Task_Type_Declaration
--       A_Protected_Type_Declaration
--       A_Private_Type_Declaration
--       A_Private_Extension_Declaration
--       A_Formal_Type_Declaration
--
------------------------------------------------------------------------------
--  15.15 function Corresponding_Last_Constraint
------------------------------------------------------------------------------

   function Corresponding_Last_Constraint
     (Declaration : Asis.Declaration)
      return        Asis.Declaration;

------------------------------------------------------------------------------
--  Declaration - Specifies the subtype_declaration or type_declaration to
--                query.
--
--  This function recursively unwinds subtyping to return at a declaration
--  that is either a type_declaration or subtype_declaration that imposes
--  an explicit constraint on the argument.
--
--  Unwinds a minimum of one level of subtyping even if an argument declaration
--  itself has a constraint.
--
--  Returns a declaration that Is_Identical to the argument if the argument is
--  a type_declaration, i.e. the first subtype.
--
--  Appropriate Declaration_Kinds:
--       An_Ordinary_Type_Declaration
--       A_Task_Type_Declaration
--       A_Protected_Type_Declaration
--       A_Private_Type_Declaration
--       A_Private_Extension_Declaration
--       A_Subtype_Declaration
--       A_Formal_Type_Declaration
--
--  Returns Declaration_Kinds:
--       An_Ordinary_Type_Declaration
--       A_Task_Type_Declaration
--       A_Protected_Type_Declaration
--       A_Private_Type_Declaration
--       A_Private_Extension_Declaration
--       A_Subtype_Declaration
--       A_Formal_Type_Declaration
--
------------------------------------------------------------------------------
--  15.16 function Corresponding_Last_Subtype
------------------------------------------------------------------------------

   function Corresponding_Last_Subtype
     (Declaration : Asis.Declaration)
      return        Asis.Declaration;

------------------------------------------------------------------------------
--  Declaration - Specifies the subtype_declaration or type_declaration
--                to query.
--
--  This function unwinds subtyping a single level to arrive at a declaration
--  that is either a type_declaration or subtype_declaration.
--
--  Returns a declaration that Is_Identical to the argument if the argument is
--  a type_declaration (i.e., the first subtype).
--
--  --|D2005 start
--  The existing definition of this query does not work in case if the argument
--  A_Subtype_Declaration Element contains an attribute reference as
--  subtype_mark in subtype_indication part. Consider:
--
--       subtype A is B'Class;
--  or
--       subtype C is D'Base;
--
--  The proper solution here seems to be returning the declaration of B and D
--  respectively. We need a paragraph in the query definition describing this.
--
--  --|D2005 end
--
--  Appropriate Declaration_Kinds:
--       An_Ordinary_Type_Declaration
--       A_Task_Type_Declaration
--       A_Protected_Type_Declaration
--       A_Private_Type_Declaration
--       A_Private_Extension_Declaration
--       A_Subtype_Declaration
--       A_Formal_Type_Declaration
--
--  Returns Declaration_Kinds:
--       An_Ordinary_Type_Declaration
--       A_Task_Type_Declaration
--       A_Protected_Type_Declaration
--       A_Private_Type_Declaration
--       A_Private_Extension_Declaration
--       A_Subtype_Declaration
--       A_Formal_Type_Declaration
--
------------------------------------------------------------------------------
--  15.17 function Corresponding_Representation_Clauses
------------------------------------------------------------------------------

   function Corresponding_Representation_Clauses
     (Declaration : Asis.Declaration)
      return        Asis.Representation_Clause_List;

------------------------------------------------------------------------------
--  Declaration - Specifies the declaration to query
--
--  Returns all representation_clause elements that apply to the declaration.
--
--  Returns a Nil_Element_List if no clauses apply to the declaration.
--
--  The clauses returned may be the clauses applying to a parent type if the
--  type is a derived type with no explicit representation.  These clauses
--  are not Is_Part_Of_Implicit, they are the representation_clause elements
--  specified in conjunction with the declaration of the parent type.
--
--  All Declaration_Kinds are appropriate except Not_A_Declaration.
--
--  Returns Clause_Kinds:
--       A_Representation_Clause
--
--  --|D2005 start
--  This query works on declarations, but representation clauses are applied
--  to entities, but not declarations. The problem here is that one declaration
--  may declare several entities, and each of these entities may have its
--  own collection of representation clauses applied to the entity. It seems
--  that what is of areal interest for an ASIS application is a set of queries
--  applied to a particular entity, but not a union of representation clauses
--  applied to all the entities declared in the given declaration.
--
--  So it would be nice to have Corresponding_Representation_Clauses working on
--  entities (A_Defining_Name Elements), but not  declarations. We can not
--  change the semantic of this query because of upward compatibility reasons,
--  so we can consider adding a new query -
--  Corresponding_Entity_Representation_Clauses, that will work on entities
--  (A_Defining_Name Elements)
--  --|D2005 end
--
--  --|ER---------------------------------------------------------------------
--  --|ER A_Loop_Parameter_Specification         - 5.5
--  --|CR
--  --|CR Child elements returned by:
--  --|CR    function Names
--  --|CR    function Specification_Subtype_Definition
--
------------------------------------------------------------------------------
--  15.18 function Specification_Subtype_Definition
------------------------------------------------------------------------------

   function Specification_Subtype_Definition
     (Specification : Asis.Declaration)
      return          Asis.Discrete_Subtype_Definition;

------------------------------------------------------------------------------
--  Specification - Specifies the loop_parameter_specification or
--                  Entry_Index_Specification to query
--
--  Returns the Discrete_Subtype_Definition of the specification.
--
--  Appropriate Declaration_Kinds:
--       A_Loop_Parameter_Specification
--       An_Entry_Index_Specification
--
--  Returns Definition_Kinds:
--       A_Discrete_Subtype_Definition
--
--  --|A2012 start
--
--  Below is the draft proposal for new iterator syntax in Ada 2012. This
--  proposal has not been discussed with ARG yet, so it has enough chances
--  to be changed
--
--  --|ER---------------------------------------------------------------------
--  --|ER A_Generalized_Iterator_Specification         - 5.5.2
--  --|CR
--  --|CR Child elements returned by:
--  --|CR    function Names
--  --|CR    function Iteration_Scheme_Name
--
--  --|ER---------------------------------------------------------------------
--  --|ER An_Element_Iterator_Specification         - 5.5.2
--  --|CR
--  --|CR Child elements returned by:
--  --|CR    function Names
--  --|CR    function Subtype_Indication
--  --|CR    function Name
--
--  --|A2012 end

   function Iteration_Scheme_Name
     (Iterator_Specification : Asis.Element)
      return                   Asis.Element;

--  Specification - Specifies the iterator specification to query
--
--  Returns the name of the iterator routine or array/iterable name that
--  follows the keywird IN/OF [RESERVE]
--
--  Appropriate Declaration_Kinds:
--       A_Generalized_Iterator_Specification
--       An_Element_Iterator_Specification
--
--  Returns Element_Kind
--       An_Expression
--
   function Subtype_Indication
     (Iterator_Specification : Asis.Element)
      return                   Asis.Element;

--  Specification - Specifies the iterator specification to query
--
--  Returns the subtype indication that is used in the specification of
--  iterator parameter. Returns Nil_Element if there is no subtype indication.
--
--  Appropriate Declaration_Kinds:
--       An_Element_Iterator_Specification
--
--  Returns Definition_Kinds:
--       A_Subtype_Indication
--
--  --|ER---------------------------------------------------------------------
--  --|ER A_Procedure_Declaration           - 6.1
--  --|CR
--  --|CR Child elements returned by:
--  --|CR    function Names
--  --|CR    function Parameter_Profile
--
------------------------------------------------------------------------------
--  15.19 function Parameter_Profile
------------------------------------------------------------------------------

   function Parameter_Profile
     (Declaration : Asis.Declaration)
      return        Asis.Parameter_Specification_List;

------------------------------------------------------------------------------
--  Declaration - Specifies the subprogram or entry declaration to query
--
--  Returns a list of parameter specifications in the formal part of the
--  subprogram or entry declaration, in their order of appearance.
--
--  Returns a Nil_Element_List if the subprogram or entry has no
--  parameters.
--
--  Results of this query may vary across ASIS implementations.  Some
--  implementations normalize all multiple name parameter specifications into
--  an equivalent sequence of corresponding single name parameter
--  specifications.  See Reference Manual 3.3.1(7).
--
--  Appropriate Declaration_Kinds:
--       A_Procedure_Declaration
--       A_Function_Declaration
--       A_Procedure_Body_Declaration
--       A_Function_Body_Declaration
--  |A2005 start
--       A_Null_Procedure_Declaration (implemented)
--  |A2005 end
--       A_Procedure_Renaming_Declaration
--       A_Function_Renaming_Declaration
--       An_Entry_Declaration
--       An_Entry_Body_Declaration
--       A_Procedure_Body_Stub
--       A_Function_Body_Stub
--       A_Generic_Function_Declaration
--       A_Generic_Procedure_Declaration
--       A_Formal_Function_Declaration
--       A_Formal_Procedure_Declaration
--       An_Expression_Function_Declaration
--
--  Returns Declaration_Kinds:
--       A_Parameter_Specification
--
--  --|ER---------------------------------------------------------------------
--  --|ER A_Function_Declaration           - 6.1
--  --|CR
--  --|CR Child elements returned by:
--  --|CR    function Names
--  --|CR    function Parameter_Profile
--  --|CR    function Result_Profile
--
------------------------------------------------------------------------------
--  15.20 function Result_Profile
------------------------------------------------------------------------------

   function Result_Profile
     (Declaration : Asis.Declaration)
--  |A2005 start
      return Asis.Element;
--  |A2005 end

------------------------------------------------------------------------------
--  Declaration - Specifies the function declaration to query
--
--  |A2005 start
--  Returns the definition for the return type for the function. It may
--  be subtype_mark expression or anonymous access_definition
--  |A2005 end
--
--  Appropriate Declaration_Kinds:
--       A_Function_Declaration
--       A_Function_Body_Declaration
--       A_Function_Body_Stub
--       A_Function_Renaming_Declaration
--       A_Generic_Function_Declaration
--       A_Formal_Function_Declaration
--
--  Returns Expression_Kinds:
--       An_Identifier
--       A_Selected_Component
--       An_Attribute_Reference
--
--  |A2005 start
--  Returns Definition_Kinds:
--       An_Access_Definition
--  |A2005 end
--
--  --|ER---------------------------------------------------------------------
--  --|ER A_Parameter_Specification         - 6.1
--  --|CR
--  --|CR Child elements returned by:
--  --|CR    function Names
--  --|CR    function Declaration_Subtype_Mark
--  --|CR    function Initialization_Expression
--  --|ER---------------------------------------------------------------------
--  --|ER A_Procedure_Body_Declaration - 6.3
--  --|CR
--  --|CR Child elements returned by:
--  --|CR    function Names
--  --|CR    function Parameter_Profile
--  --|CR    function Body_Declarative_Items
--  --|CR    function Body_Statements
--  --|CR    function Body_Exception_Handlers
--  --|CR    function Body_Block_Statement    - obsolescent, not recommended
--

--  |A2012 start
------------------------------------------------------------------------------
--  15.#??? function Result_Expression
------------------------------------------------------------------------------

   function Result_Expression
     (Declaration :  Asis.Declaration)
      return        Asis.Expression;

------------------------------------------------------------------------------
--  Declaration specifies the expression function declaration to query.

--  Returns an expression that defines the result of an expression function.
--  The parentheses that syntactically surround the expression are considered
--  as the part of the result.  Thus, the Expression_Kind of the result is
--  always A_Parenthesized_Expression
--
--  Appropriate Declaration_Kinds:
--    An_Expression_Function_Declaration
--
--  Returns Expression_Kinds:
--    A_Parenthesized_Expression
--
--  |A2012 end

--  |A2005 start

------------------------------------------------------------------------------
--  15.#??? function Is_Overriding_Declaration
------------------------------------------------------------------------------

   function Is_Overriding_Declaration
     (Declaration : Asis.Declaration)
      return        Boolean;

------------------------------------------------------------------------------
--  Declaration - Specifies the subprogram declaration to query
--
--  Returns True if the declaration contains the overriding indicator of the
--  form "overriding"
--
--  Returns False for any unexpected Element.
--
--  Expected Declaration_Kinds:
--       A_Procedure_Declaration
--       A_Function_Declaration
--       A_Procedure_Body_Declaration
--       A_Function_Body_Declaration
--       A_Null_Procedure_Declaration
--       A_Procedure_Renaming_Declaration
--       A_Function_Renaming_Declaration
--       An_Entry_Declaration
--       A_Procedure_Body_Stub
--       A_Function_Body_Stub
--       A_Procedure_Instantiation
--       A_Function_Instantiation
--
--

------------------------------------------------------------------------------
--  15.#??? function Is_Not_Overriding_Declaration
------------------------------------------------------------------------------

   function Is_Not_Overriding_Declaration
     (Declaration : Asis.Declaration)
      return        Boolean;

------------------------------------------------------------------------------
--  Declaration - Specifies the subprogram declaration to query
--
--  Returns True if the declaration contains the overriding indicator of the
--  form "not overriding"
--
--  Returns False for any unexpected Element.
--
--  Expected Declaration_Kinds:
--       A_Procedure_Declaration
--       A_Function_Declaration
--       A_Procedure_Body_Declaration
--       A_Function_Body_Declaration
--       A_Null_Procedure_Declaration
--       A_Procedure_Renaming_Declaration
--       A_Function_Renaming_Declaration
--       An_Entry_Declaration
--       A_Procedure_Body_Stub
--       A_Function_Body_Stub
--       A_Procedure_Instantiation
--       A_Function_Instantiation
--
--

--  |A2005 end

------------------------------------------------------------------------------
--  15.21 function Body_Declarative_Items
------------------------------------------------------------------------------

   function Body_Declarative_Items
     (Declaration     : Asis.Declaration;
      Include_Pragmas : Boolean := False)
      return            Asis.Element_List;

------------------------------------------------------------------------------
--  Declaration     - Specifies the body declaration to query
--  Include_Pragmas - Specifies whether pragmas are to be returned
--
--  Returns a list of all basic declarations, representation specifications,
--  use clauses, and pragmas in the declarative part of the body, in their
--  order of appearance.
--
--  Returns a Nil_Element_List if there are no declarative_item or pragma
--  elements.
--
--  Results of this query may vary across ASIS implementations.  Some
--  implementations normalize all multi-name declarations into an
--  equivalent sequence of corresponding single name object declarations.
--  See Reference Manual 3.3.1(7).
--
--  Appropriate Declaration_Kinds:
--       A_Function_Body_Declaration
--       A_Procedure_Body_Declaration
--       A_Package_Body_Declaration
--       A_Task_Body_Declaration
--       An_Entry_Body_Declaration
--
--  Returns Element_Kinds:
--       A_Pragma
--       A_Declaration
--       A_Clause
--
------------------------------------------------------------------------------
--  15.22 function Body_Statements
------------------------------------------------------------------------------

   function Body_Statements
     (Declaration     : Asis.Declaration;
      Include_Pragmas : Boolean := False)
      return            Asis.Statement_List;

------------------------------------------------------------------------------
--  Declaration     - Specifies the body declaration to query
--  Include_Pragmas - Specifies whether pragmas are to be returned
--
--  Returns a list of the statements and pragmas for the body, in
--  their order of appearance.
--
--  --|A2012 start
--  In case if a sequence_of_Statements in the argument Element contains
--  'floating' labels (labels that completes sequence_of_statements and that
--  are not attached to any statement in the source code), the result list
--  contains as its last element an implicit A_Null_Statement element these
--  'floating' labels are attached to. The Enclosing_Element of this implicit
--  A_Null_Statement element is the argument Element.
--  --|A2012 start
--
--  Returns a Nil_Element_List if there are no statements or pragmas.
--

--  Appropriate Declaration_Kinds:
--       A_Function_Body_Declaration
--       A_Procedure_Body_Declaration
--       A_Package_Body_Declaration
--       A_Task_Body_Declaration
--       An_Entry_Body_Declaration
--
--  Returns Element_Kinds:
--       A_Pragma
--       A_Statement
--
------------------------------------------------------------------------------
--  15.23 function Body_Exception_Handlers
------------------------------------------------------------------------------

   function Body_Exception_Handlers
     (Declaration     : Asis.Declaration;
      Include_Pragmas : Boolean := False)
      return            Asis.Exception_Handler_List;

------------------------------------------------------------------------------
--  Declaration - Specifies the body declaration to query
--  Include_Pragmas - Specifies whether pragmas are to be returned
--
--  Returns a list of the exception_handler elements of the body, in their
--  order of appearance.
--
--  The only pragmas returned are those following the reserved word "exception"
--  and preceding the reserved word "when" of first exception handler.
--
--  Returns a Nil_Element_List if there are no exception_handler or pragma
--  elements.
--
--  Appropriate Declaration_Kinds:
--       A_Function_Body_Declaration
--       A_Procedure_Body_Declaration
--       A_Package_Body_Declaration
--       A_Task_Body_Declaration
--       An_Entry_Body_Declaration
--
--  Returns Element_Kinds:
--       An_Exception_Handler
--       A_Pragma
--
--  --|ER---------------------------------------------------------------------
--  --|ER A_Function_Body_Declaration  - 6.3
--  --|CR
--  --|CR Child elements returned by:
--  --|CR    function Names
--  --|CR    function Parameter_Profile
--  --|CR    function Result_Profile
--  --|CR    function Body_Declarative_Items
--  --|CR    function Body_Statements
--  --|CR    function Body_Exception_Handlers
--  --|CR    function Body_Block_Statement    - obsolescent, not recommended
--
------------------------------------------------------------------------------
--  15.24 function Body_Block_Statement
------------------------------------------------------------------------------
--  Function Body_Block_Statement is a new query that supplies the
--  equivalent combined functionality of the replaced queries:
--  Subprogram_Body_Block, Package_Body_Block, and Task_Body_Block.
--  Use of the query Body_Block_Statement is not recommended in new programs.
--  This functionality is redundant with the queries Body_Declarative_Items,
--  Body_Statements, and Body_Exception_Handlers.
-------------------------------------------------------------------------------

   function Body_Block_Statement
     (Declaration : Asis.Declaration)
      return        Asis.Statement;

-------------------------------------------------------------------------------
--  Declaration - Specifies the program unit body to query
--
--  Returns a block statement that is the structural equivalent of the body.
--  The block statement is not Is_Part_Of_Implicit.  The block includes
--  the declarative part, the sequence of statements, and any exception
--  handlers.
--
--  Appropriate Declaration_Kinds:
--       A_Function_Body_Declaration
--       A_Procedure_Body_Declaration
--       A_Package_Body_Declaration
--       A_Task_Body_Declaration
--       An_Entry_Body_Declaration
--
--  Returns Statement_Kinds:
--       A_Block_Statement
--
--  --|AN Application Note:
--  --|AN
--  --|AN This function is an obsolescent feature retained for compatibility
--  --|AN with ASIS 83.  It is never called by Traverse_Element. Use of this
--  --|AN query is not recommended in new programs.
--
------------------------------------------------------------------------------
--  15.25 function Is_Name_Repeated
------------------------------------------------------------------------------

   function Is_Name_Repeated
     (Declaration : Asis.Declaration)
      return        Boolean;

------------------------------------------------------------------------------
--  Declaration - Specifies the declaration to query
--
--  Returns True if the name of the declaration is repeated after the "end"
--  which terminates the declaration.
--
--  Returns False for any unexpected Element.
--
--  Expected Declaration_Kinds:
--       A_Package_Declaration
--       A_Package_Body_Declaration
--       A_Procedure_Body_Declaration
--       A_Function_Body_Declaration
--       A_Generic_Package_Declaration
--       A_Task_Type_Declaration
--       A_Single_Task_Declaration
--       A_Task_Body_Declaration
--       A_Protected_Type_Declaration
--       A_Single_Protected_Declaration
--       A_Protected_Body_Declaration
--       An_Entry_Body_Declaration
--
------------------------------------------------------------------------------
--  15.26 function Corresponding_Declaration
------------------------------------------------------------------------------

   function Corresponding_Declaration
     (Declaration : Asis.Declaration)
      return        Asis.Declaration;

   function Corresponding_Declaration
     (Declaration : Asis.Declaration;
      The_Context : Asis.Context)
      return        Asis.Declaration;

------------------------------------------------------------------------------
--  Declaration     - Specifies the specification to query
--  The_Context     - Specifies a Context to use
--
--  Returns the corresponding specification of a subprogram, package, or task
--  body declaration or an expression function declaration.  Returns the
--  expanded generic specification template for generic instantiations.  The
--  argument can be a Unit_Declaration from a Compilation_Unit, or, it can be
--  any appropriate body declaration from any declarative context.
--
--  These two function calls will always produce identical results:
--
--    Decl2 := Corresponding_Declaration (Decl1);
--    Decl2 := Corresponding_Declaration
--               (Decl1,
--                Enclosing_Context ( Enclosing_Compilation_Unit ( Decl1 )));
--
--  If a specification declaration is given, the same element is returned,
--  unless it is a generic instantiation or an inherited subprogram declaration
--  (see below).
--
--  If a subprogram renaming declaration is given:
--
--     a) in case of renaming-as-declaration, the same element is returned;
--     b) in case of renaming-as-body, the subprogram declaration completed
--        by this subprogram renaming declaration is returned.
--        (Reference Manual, 8.5.4(1))
--
--  Returns a Nil_Element if no explicit specification exists, or the
--  declaration is the proper body of a subunit.
--
--  The parameter The_Context is used to locate the corresponding specification
--  within a particular Context.  The_Context need not be the Enclosing_Context
--  of the Declaration.  Any non-Nil result will always have The_Context
--  as its Enclosing_Context.  This implies that while a non-Nil result may be
--  Is_Equal with the argument, it will only be Is_Identical if the
--  Enclosing_Context of the Declaration is the same as the parameter
--  The_Context.
--
--  If a generic instantiation is given, the expanded generic specification
--  template representing the instance is returned and Is_Part_Of_Instance.
--  For example, an argument that is A_Package_Instantiation, results in a
--  value that is A_Package_Declaration that can be analyzed with all
--  appropriate queries.
--
--  The Enclosing_Element of the expanded specification is the generic
--  instantiation.  The Enclosing_Compilation_Unit of the expanded template is
--  that of the instantiation.
--
--  |A2012 start
--  If an inherited subprogram or entry declaration is given, the specification
--  returned is the one for the user-defined subprogram or entry from which the
--  argument was ultimately inherited. Note that this happens for protected
--  operations of derived protected types and derived task types.
--  |A2012 end
--
--  Appropriate Declaration_Kinds returning a specification:
--       A_Function_Body_Declaration
--  |A2012 start
--       An_Expression_Function_Declaration
--  |A2012 end
--       A_Function_Renaming_Declaration (renaming-as-body)
--       A_Function_Body_Stub
--       A_Function_Instantiation
--       A_Package_Body_Declaration
--       A_Package_Body_Stub
--       A_Package_Instantiation
--       A_Procedure_Body_Declaration
--       A_Procedure_Renaming_Declaration (renaming-as-body)
--       A_Procedure_Body_Stub
--       A_Procedure_Instantiation
--       A_Task_Body_Declaration
--       A_Task_Body_Stub
--       A_Protected_Body_Declaration
--       A_Protected_Body_Stub
--       A_Formal_Package_Declaration
--       A_Formal_Package_Declaration_With_Box
--       A_Generic_Package_Renaming_Declaration
--       A_Generic_Procedure_Renaming_Declaration
--       A_Generic_Function_Renaming_Declaration
--       An_Entry_Body_Declaration
--
--  Appropriate Declaration_Kinds returning the argument Declaration
--  |A2012 start
--  (if not inherited):
--  |A2012 end
--       A_Function_Declaration
--       A_Function_Renaming_Declaration (renaming-as-declaration)
--       A_Generic_Function_Declaration
--       A_Generic_Package_Declaration
--       A_Generic_Procedure_Declaration
--       A_Package_Declaration
--       A_Package_Renaming_Declaration
--       A_Procedure_Declaration
--       A_Null_Procedure_Declaration  --  Ada 2005
--       A_Procedure_Renaming_Declaration (renaming-as-declaration)
--       A_Single_Task_Declaration
--       A_Task_Type_Declaration
--       A_Protected_Type_Declaration
--       A_Single_Protected_Declaration
--       A_Generic_Package_Renaming_Declaration
--       A_Generic_Procedure_Renaming_Declaration
--       A_Generic_Function_Renaming_Declaration
--  |A2012 start
--       An_Entry_Declaration
--  |A2012 end
--
--  Returns Declaration_Kinds:
--       Not_A_Declaration
--       A_Function_Declaration
--       A_Function_Renaming_Declaration
--       A_Generic_Function_Declaration
--       A_Generic_Package_Declaration
--       A_Generic_Procedure_Declaration
--       A_Package_Declaration
--       A_Package_Renaming_Declaration
--       A_Procedure_Declaration
--       A_Procedure_Renaming_Declaration
--       A_Single_Task_Declaration
--       A_Task_Type_Declaration
--       A_Protected_Type_Declaration
--       A_Single_Protected_Declaration
--       An_Entry_Declaration
--
--  --|D2005 start
--
--  This function is defined for A_Formal_Package_Declaration_With_Box, and it
--  is supposed to return "the expanded generic specification template" for it.
--  But this form of a formal package denotes any possible instantiation of
--  some generic package, so we do not know anything about the actual
--  parameters to create an expanded instantiation. Moreover, RM95 12.7(10)
--  says:
--
--     The visible part of a formal package includes the first list of
--     basic_declarative_items of the package_specification. In addition, if
--     the formal_package_actual_part is (<>), it also includes the
--     generic_formal_part of the template for the formal package.
--
--  It seems that it would be more reasonable if this query would return the
--  argument declaration for the for A_Formal_Package_Declaration_With_Box
--  argument.
--
--  And for Ada/ASIS 2005 a similar problem arises for
--  A_Formal_Package_Declaration argument: what should be returned if
--  formal_package_actual_part contains formal_package_associations only for
--  some part of the formal parameters of the generic formal package?
--
--  --|D2005 end

------------------------------------------------------------------------------
--  15.27 function Corresponding_Body
------------------------------------------------------------------------------

   function Corresponding_Body
     (Declaration : Asis.Declaration)
      return        Asis.Declaration;

   function Corresponding_Body
     (Declaration : Asis.Declaration;
      The_Context : Asis.Context)
      return        Asis.Declaration;

------------------------------------------------------------------------------
--  Declaration - Specifies the specification to query
--  The_Context - Specifies a Context to use
--
--  Returns the corresponding body for a given subprogram, package, or task
--  specification declaration. Returns the expanded generic body template for
--  generic instantiations.  The argument can be a Unit_Declaration from a
--  Compilation_Unit, or, it can be any appropriate specification declaration
--  from any declarative context.
--
--  These two function calls will always produce identical results:
--
--    Decl2 := Corresponding_Body (Decl1);
--    Decl2 := Corresponding_Body
--               (Decl1,
--                Enclosing_Context ( Enclosing_Compilation_Unit( Decl1 )));
--
--  If a body declaration is given, the same element is returned.
--
--  Returns a Nil_Element if no body exists in The_Context.
--
--  The parameter The_Context is used to locate the corresponding specification
--  within a particular Context.  The_Context need not be the Enclosing_Context
--  of the Declaration.  Any non-Nil result will always have The_Context
--  as its Enclosing_Context.  This implies that while a non-Nil result may be
--  Is_Equal with the argument, it will only be Is_Identical if the
--  Enclosing_Context of the Declaration is the same as the parameter
--  The_Context.
--
--  Implicit predefined operations (e.g., "+", "=", etc.) will not typically
--  have unit bodies.  (Corresponding_Body returns a Nil_Element.)
--  User-defined overloads of the predefined operations will have
--  Corresponding_Body values once the bodies have inserted into the
--  environment.  The Corresponding_Body of an inherited subprogram is that
--  of the original user-defined subprogram.
--
--  If a generic instantiation is given, the body representing the expanded
--  generic body template is returned.  (i.e., an argument that is
--  A_Package_Instantiation, results in a value that is
--  A_Package_Body_Declaration that can be analyzed with all appropriate ASIS
--  queries).
--
--  Returns a Nil_Element if the body of the generic has not yet been compiled
--  or inserted into the Ada Environment Context.
--
--  The Enclosing_Element of the expanded body is the generic instantiation.
--  The Enclosing_Compilation_Unit of the expanded template is that of the
--  instantiation.
--
--  Returns Nil_Element for an implicit generic child unit specification.
--  Reference Manual 10.1.1(19).
--
--  Returns A_Pragma if the Declaration is completed by pragma Import.
--
--  Appropriate Declaration_Kinds returning a body:
--       A_Function_Declaration
--       A_Function_Instantiation
--       A_Generic_Package_Declaration
--       A_Generic_Procedure_Declaration
--       A_Generic_Function_Declaration
--       A_Package_Declaration
--       A_Package_Instantiation
--       A_Procedure_Declaration
--       A_Procedure_Instantiation
--       A_Single_Task_Declaration
--       A_Task_Type_Declaration
--       A_Protected_Type_Declaration
--       A_Single_Protected_Declaration
--       A_Formal_Package_Declaration
--       A_Formal_Package_Declaration_With_Box
--       An_Entry_Declaration (restricted to protected entry)
--
--  Appropriate Declaration_Kinds returning the argument Declaration:
--       A_Function_Body_Declaration
--       A_Function_Body_Stub
--  |A2012 start
--       An_Expression_Function_Declaration
--  |A2012 end
--       A_Function_Renaming_Declaration
--       A_Package_Body_Declaration
--       A_Package_Body_Stub
--       A_Package_Renaming_Declaration
--       A_Procedure_Body_Declaration
--       A_Procedure_Renaming_Declaration
--       A_Procedure_Body_Stub
--       A_Task_Body_Declaration
--       A_Task_Body_Stub
--       A_Protected_Body_Declaration
--       A_Protected_Body_Stub
--       A_Generic_Package_Renaming_Declaration
--       A_Generic_Procedure_Renaming_Declaration
--       A_Generic_Function_Renaming_Declaration
--       An_Entry_Body_Declaration
--
--  Returns Declaration_Kinds:
--       Not_A_Declaration
--       A_Function_Body_Declaration
--       A_Function_Body_Stub
--       A_Function_Renaming_Declaration
--       A_Package_Body_Declaration
--       A_Package_Body_Stub
--       A_Procedure_Body_Declaration
--       A_Procedure_Renaming_Declaration
--       A_Procedure_Body_Stub
--       A_Task_Body_Declaration
--       A_Task_Body_Stub
--       A_Protected_Body_Declaration
--       A_Protected_Body_Stub
--       An_Entry_Body_Declaration
--
--  Returns Element_Kinds:
--        Not_An_Element
--        A_Declaration
--        A_Pragma
--
------------------------------------------------------------------------------
--  15.28 function Corresponding_Subprogram_Derivation
------------------------------------------------------------------------------

   function Corresponding_Subprogram_Derivation
     (Declaration : Asis.Declaration)
      return        Asis.Declaration;

------------------------------------------------------------------------------
--  Declaration - Specifies an implicit inherited subprogram declaration
--
--  Returns the subprogram declaration from which the given implicit inherited
--  subprogram argument was inherited.  The result can itself be an implicitly
--  inherited subprogram.
--
--  Appropriate Element_Kinds:
--       A_Declaration
--
--  Appropriate Declaration_Kinds:
--       A_Function_Declaration
--       A_Procedure_Declaration
--
--  Returns Element_Kinds:
--       A_Declaration
--
--  Returns Declaration_Kinds:
--       A_Function_Body_Declaration
--       A_Function_Declaration
--       A_Function_Renaming_Declaration
--       A_Procedure_Body_Declaration
--       A_Procedure_Declaration
--       A_Procedure_Renaming_Declaration
--
--  Raises ASIS_Inappropriate_Element for a subprogram declaration that is not
--  Is_Part_Of_Inherited.
--
------------------------------------------------------------------------------
--  15.29 function Corresponding_Type
------------------------------------------------------------------------------

   function Corresponding_Type
     (Declaration : Asis.Declaration)
      return        Asis.Type_Definition;

------------------------------------------------------------------------------
--  Declaration - Specifies the subprogram_declaration to query
--
--  Returns the type definition for which this entity is an implicit
--  declaration.  The result will often be a derived type.  However, this query
--  also works for declarations of predefined operators such as "+" and "=".
--  Raises ASIS_Inappropriate_Element if the argument is not an implicit
--  declaration resulting from the declaration of a type.
--
--  Appropriate Element_Kinds:
--       A_Declaration
--
--  Appropriate Declaration_Kinds:
--       A_Function_Declaration
--       A_Procedure_Declaration
--
--  Returns Definition_Kinds:
--       A_Type_Definition
--
------------------------------------------------------------------------------
--  15.30 function Corresponding_Equality_Operator
------------------------------------------------------------------------------

   function Corresponding_Equality_Operator
     (Declaration : Asis.Declaration)
      return        Asis.Declaration;

------------------------------------------------------------------------------
--  Declaration - Specifies an equality or an inequality operator declaration
--
--  If given an explicit Declaration of "=" whose result type is Boolean:
--
--   - Returns the complimentary implicit "/=" operator declaration.
--
--   - Returns a Nil_Element if the Ada implementation has not defined an
--     implicit "/=" for the "=".  Implementations of this sort will transform
--     a A/=B expression into a NOT(A=B) expression.  The function call
--     representing the NOT operation is Is_Part_Of_Implicit in this case.
--

--  If given an implicit Declaration of "/=" whose result type is Boolean:
--
--   - Returns the complimentary explicit "=" operator declaration.
--
--  Returns a Nil_Element for any other function declaration.
--
--  Appropriate Declaration_Kinds:
--       A_Function_Declaration
--
--  --|D2005 start
--
--  There are two problems with this query:
--
--  First, according to RM95 6.6, this query should also return the implicit
--  "/=" declaration also for the following Declaraion_Kinds
--
--       A_Function_Body_Declaration (in case if it acts as declaration,
--                                    otherwise the result should be
--                                    Nil_Element)
--       A_Function_Renaming_Declaration (in case if it represents
--                                    renaming-as-declaration, for
--                                    renaming-as-body Nil_Element is returned.
--
--  The case of a function instantiation is covered by applying this query to
--  the result of Corresponding_Declaration
--
--  Second, what should be the result of the following queries applied to the
--  Element representing the implicit declaration of "/=":
--      Enclosing_Element
--      Corresponding_Declaration
--      Corresponding_Body?
--
--  For the moment, the following decision is made in the GNAT ASIS
--  implementation. If Decl is an Element representing this implicit
--  declaration of "/=", then:
--
--
--  - Is_Equal
--      (Enclosing_Element (Decl),
--       Enclosing_Element (Corresponding_Equality_Operator (Decl)))
--
--  - Is_Equal (Decl, Corresponding_Declaration (Decl))
--
--  - Is_Nil (Corresponding_Body (Decl)
--
--  --|D2005 end
--
--  Returns Declaration_Kinds:
--       A_Function_Declaration
--
--  --|ER---------------------------------------------------------------------
--  --|ER A_Package_Declaration - 7.1
--  --|CR
--  --|CR Child elements returned by:
--  --|CR    function Names
--  --|CR    function Visible_Part_Declarative_Items
--  --|CR    function Private_Part_Declarative_Items
--
------------------------------------------------------------------------------
--  15.31 function Visible_Part_Declarative_Items
------------------------------------------------------------------------------

   function Visible_Part_Declarative_Items
     (Declaration     : Asis.Declaration;
      Include_Pragmas : Boolean := False)
      return            Asis.Declarative_Item_List;

------------------------------------------------------------------------------
--  Declaration     - Specifies the package to query
--  Include_Pragmas - Specifies whether pragmas are to be returned
--
--  Returns a list of all basic declarations, representation specifications,
--  use clauses, and pragmas in the visible part of a package, in their order
--  of appearance.
--
--  Results of this query may vary across ASIS implementations.  Some
--  implementations normalize all multi-name object declarations into an
--  equivalent sequence of corresponding single name object declarations.
--  See Reference Manual 3.3.1(7).
--
--  Appropriate Declaration_Kinds:
--       A_Generic_Package_Declaration
--       A_Package_Declaration
--
--  Returns Element_Kinds:
--       A_Declaration
--       A_Pragma
--       A_Clause
--
------------------------------------------------------------------------------
--  15.32 function Is_Private_Present
------------------------------------------------------------------------------

   function Is_Private_Present
     (Declaration : Asis.Declaration)
      return        Boolean;

------------------------------------------------------------------------------
--  Declaration - Specifies the declaration to query
--
--  Returns True if the argument is a package specification which has a
--  reserved word "private" which marks the beginning of a (possibly empty)
--  private part.
--
--  Returns False for any package specification without a private part.
--  Returns False for any unexpected Element.
--
--  Expected Element_Kinds:
--       A_Declaration
--
--  Expected Declaration_Kinds:
--       A_Generic_Package_Declaration
--       A_Package_Declaration
--
------------------------------------------------------------------------------
--  15.33 function Private_Part_Declarative_Items
------------------------------------------------------------------------------

   function Private_Part_Declarative_Items
     (Declaration     : Asis.Declaration;
      Include_Pragmas : Boolean := False)
      return            Asis.Declarative_Item_List;

------------------------------------------------------------------------------
--  Declaration     - Specifies the package to query
--  Include_Pragmas - Specifies whether pragmas are to be returned
--
--  Returns a list of all basic declarations, representation specifications,
--  use clauses, and pragmas in the private part of a package in their order of
--  appearance.
--
--  Results of this query may vary across ASIS implementations.  Some
--  implementations normalize all multi-name object declarations into an
--  equivalent sequence of corresponding single name object declarations.
--  See Reference Manual 3.3.1(7).
--
--  Appropriate Declaration_Kinds:
--       A_Generic_Package_Declaration
--       A_Package_Declaration
--
--  Returns Element_Kinds:
--       A_Declaration
--       A_Pragma
--       A_Clause
--
--  --|ER---------------------------------------------------------------------
--  --|ER A_Package_Body_Declaration - 7.2
--  --|CR
--  --|CR Child elements returned by:
--  --|CR    function Names
--  --|CR    function Body_Declarative_Items
--  --|CR    function Body_Statements
--  --|CR    function Body_Exception_Handlers
--  --|CR    function Body_Block_Statement    - obsolescent, not recommended
--  --|ER---------------------------------------------------------------------
--  --|ER A_Private_Type_Declaration      - 7.3
--  --|ER A_Private_Extension_Declaration - 7.3
--  --|CR
--  --|CR Child elements returned by:
--  --|CR    function Names
--  --|CR    function Discriminant_Part
--  --|CR    function Type_Declaration_View

------------------------------------------------------------------------------
--  --|A2005 start (implemented)
--  15.#??? function Declaration_Interface_List
------------------------------------------------------------------------------
   function Declaration_Interface_List
     (Declaration : Asis.Definition)
      return        Asis.Expression_List;

------------------------------------------------------------------------------
--  Declaration - Specifies the declaration to query
--
--  Returns a list of subtype mark names making up the interface_list in the
--  argument declaration, in their order of appearance.
--
--  Appropriate Declaration_Kinds:
--       A_Task_Type_Declaration
--       A_Protected_Type_Declaration
--       A_Single_Task_Declaration
--       A_Single_Protected_Declaration
--
--  Returns Expression_Kinds:
--       An_Identifier
--       A_Selected_Component
--
--  --|D2005 start
--  Note, that this function does NOT return an interface list for
--  A_Private_Extension_Declaration. Instead, an application should get to
--  the corresponding A_Private_Extension_Definition Element and get the
--  interface list by Asis.Definitions.Definition_Interface_List query. This
--  does not correspond to the Ada syntax, but ASIS 95 has already introduced
--  A_Private_Extension_Definition position in the Element classification
--  hierarchy, so we have to use it.
--  --|D2005 end
--
--  --|A2005 end
------------------------------------------------------------------------------

--  --|ER---------------------------------------------------------------------
--  --|ER An_Object_Renaming_Declaration - 8.5.1
--  --|CR
--  --|CR Child elements returned by:
--  --|CR    function Names
--  --|CR    function Declaration_Subtype_Mark
--  --|CR    function Renamed_Entity
--
------------------------------------------------------------------------------
--  15.34 function Renamed_Entity
------------------------------------------------------------------------------

   function Renamed_Entity
     (Declaration : Asis.Declaration)
      return        Asis.Expression;

------------------------------------------------------------------------------
--  Declaration - Specifies the rename declaration to query
--
--  Returns the name expression that follows the reserved word "renames" in the
--  renaming declaration.
--
--  Appropriate Declaration_Kinds:
--       An_Exception_Renaming_Declaration
--       A_Function_Renaming_Declaration
--       An_Object_Renaming_Declaration
--       A_Package_Renaming_Declaration
--       A_Procedure_Renaming_Declaration
--       A_Generic_Package_Renaming_Declaration
--       A_Generic_Procedure_Renaming_Declaration
--       A_Generic_Function_Renaming_Declaration
--
--  Returns Element_Kinds:
--       An_Expression
--
--  --|ER---------------------------------------------------------------------
--  --|ER An_Exception_Renaming_Declaration - 8.5.2
--  --|ER A_Package_Renaming_Declaration    - 8.5.3
--  --|CR
--  --|CR Child elements returned by:
--  --|CR    function Names
--  --|CR    function Renamed_Entity
--  --|ER---------------------------------------------------------------------
--  --|ER A_Procedure_Renaming_Declaration - 8.5.4
--  --|CR
--  --|CR Child elements returned by:
--  --|CR    function Names
--  --|CR    function Parameter_Profile
--  --|CR    function Renamed_Entity
--  --|ER---------------------------------------------------------------------
--  --|ER A_Function_Renaming_Declaration  - 8.5.4
--  --|CR
--  --|CR Child elements returned by:
--  --|CR    function Names
--  --|CR    function Parameter_Profile
--  --|CR    function Result_Profile
--  --|CR    function Renamed_Entity
--  --|ER---------------------------------------------------------------------
--  --|ER A_Generic_Package_Renaming_Declaration   - 8.5.5
--  --|ER A_Generic_Procedure_Renaming_Declaration - 8.5.5
--  --|ER A_Generic_Function_Renaming_Declaration  - 8.5.5
--  --|CR
--  --|CR Child elements returned by:
--  --|CR    function Names
--  --|CR    function Renamed_Entity
--
------------------------------------------------------------------------------
--  15.35 function Corresponding_Base_Entity
------------------------------------------------------------------------------

   function Corresponding_Base_Entity
     (Declaration : Asis.Declaration)
      return        Asis.Expression;

-----------------------------------------------------------------------------
--  Declaration - Specifies the rename declaration to query
--
--  The base entity is defined to be the renamed entity that is not itself
--  defined by another renaming declaration.
--
--  If the name following the reserved word "renames" is itself declared
--  by a previous renaming_declaration, then this query unwinds the renamings
--  by recursively operating on the previous renaming_declaration.
--
--  Otherwise, the name following the reserved word "renames" is returned.
--
--  Appropriate Declaration_Kinds:
--       An_Object_Renaming_Declaration
--       An_Exception_Renaming_Declaration
--       A_Procedure_Renaming_Declaration
--       A_Function_Renaming_Declaration
--       A_Package_Renaming_Declaration
--       A_Generic_Package_Renaming_Declaration
--       A_Generic_Procedure_Renaming_Declaration
--       A_Generic_Function_Renaming_Declaration
--
--  Returns Element_Kinds:
--       An_Expression
--
--  --|ER--------------------------------------------------------------------
--  --|ER A_Task_Type_Declaration - 9.1
--  --|CR
--  --|CR Child elements returned by:
--  --|CR    function Names
--  --|CR    function Discriminant_Part
--  --|CR    function Type_Declaration_View
--  --|ER--------------------------------------------------------------------
--  --|ER A_Single_Task_Declaration - 9.1
--  --|CR
--  --|CR Child elements returned by:
--  --|CR    function Names
--  --|CR    function Object_Declaration_View
--  --|ER--------------------------------------------------------------------
--  --|ER A_Task_Body_Declaration - 9.1
--  --|CR
--  --|CR Child elements returned by:
--  --|CR    function Names
--  --|CR    function Body_Declarative_Items
--  --|CR    function Body_Statements
--  --|CR    function Body_Exception_Handlers
--  --|CR    function Body_Block_Statement    - obsolescent, not recommended
--  --|ER--------------------------------------------------------------------
--  --|ER A_Protected_Type_Declaration - 9.4
--  --|CR
--  --|CR Child elements returned by:
--  --|CR    function Names
--  --|CR    function Discriminant_Part
--  --|CR    function Type_Declaration_View
--  --|ER--------------------------------------------------------------------
--  --|ER A_Single_Protected_Declaration - 9.4
--  --|CR
--  --|CR Child elements returned by:
--  --|CR    function Names
--  --|CR    function Object_Declaration_View
--  --|ER--------------------------------------------------------------------
--  --|ER A_Protected_Body_Declaration - 9.4
--  --|CR
--  --|CR Child elements returned by:
--  --|CR    function Names
--  --|CR    function Protected_Operation_Items
--
------------------------------------------------------------------------------
--  15.36 function Protected_Operation_Items
------------------------------------------------------------------------------

   function Protected_Operation_Items
     (Declaration     : Asis.Declaration;
      Include_Pragmas : Boolean := False)
      return            Asis.Declaration_List;

------------------------------------------------------------------------------
--  Declaration     - Specifies the protected_body declaration to query
--  Include_Pragmas - Specifies whether pragmas are to be returned
--
--  Returns a list of protected_operation_item and pragma elements of the
--  protected_body, in order of appearance.
--
--  Returns a Nil_Element_List if there are no items or pragmas.
--
--  Appropriate Declaration_Kinds:
--       A_Protected_Body_Declaration
--
--  Returns Element_Kinds:
--       A_Pragma
--       A_Declaration
--       A_Clause
--

--  Returns Declaration_Kinds:
--       A_Procedure_Declaration
--       A_Function_Declaration
--       A_Procedure_Body_Declaration
--       A_Function_Body_Declaration
--       An_Entry_Body_Declaration
--
--  Returns Clause_Kinds:
--       A_Representation_Clause
--
--  --|ER---------------------------------------------------------------------
--  --|ER An_Entry_Declaration - 9.5.2
--  --|CR
--  --|CR Child elements returned by:
--  --|CR    function Names
--  --|CR    function Entry_Family_Definition
--  --|CR    function Parameter_Profile
--
------------------------------------------------------------------------------
--  15.37 function Entry_Family_Definition
------------------------------------------------------------------------------

   function Entry_Family_Definition
     (Declaration : Asis.Declaration)
      return        Asis.Discrete_Subtype_Definition;

------------------------------------------------------------------------------
--  Declaration - Specifies the entry declaration to query
--
--  Returns the Discrete_Subtype_Definition element for the entry family of
--  an entry_declaration.
--
--  Returns a Nil_Element if the entry_declaration does not define a family
--  of entries.
--
--  Appropriate Declaration_Kinds:
--       An_Entry_Declaration
--
--  Returns Definition_Kinds:
--       Not_A_Definition
--       A_Discrete_Subtype_Definition
--
--  --|ER---------------------------------------------------------------------
--  --|ER An_Entry_Body_Declaration - 9.5.2
--  --|CR
--  --|CR Child elements returned by:
--  --|CR    function Names
--  --|CR    function Entry_Index_Specification
--  --|CR    function Parameter_Profile
--  --|CR    function Entry_Barrier
--  --|CR    function Body_Declarative_Items
--  --|CR    function Body_Statements
--  --|CR    function Body_Exception_Handlers
--  --|CR    function Body_Block_Statement    - obsolescent, not recommended
--
------------------------------------------------------------------------------
--  15.38 function Entry_Index_Specification
------------------------------------------------------------------------------

   function Entry_Index_Specification
     (Declaration : Asis.Declaration)
      return        Asis.Declaration;

------------------------------------------------------------------------------
--  Declaration - Specifies the entry body declaration to query
--
--  Returns the An_Entry_Index_Specification element of an entry body
--  declaration.
--
--  Returns a Nil_Element if the entry does not declare any
--  An_Entry_Index_Specification element.
--
--  Appropriate Declaration_Kinds:
--       An_Entry_Body_Declaration
--
--  Returns Declaration_Kinds:
--       Not_A_Declaration
--       An_Entry_Index_Specification
--
------------------------------------------------------------------------------
--  15.39 function Entry_Barrier
------------------------------------------------------------------------------

   function Entry_Barrier
     (Declaration : Asis.Declaration)
      return        Asis.Expression;

------------------------------------------------------------------------------
--  Declaration - Specifies the entry body declaration to query
--
--  Returns the expression following the reserved word "when" in an entry body
--  declaration.
--
--  Appropriate Declaration_Kinds:
--       An_Entry_Body_Declaration
--
--  Returns Element_Kinds:
--       An_Expression
--
--  --|ER---------------------------------------------------------------------
--  --|ER A_Procedure_Body_Stub - 10.1.3
--  --|CR
--  --|CR Child elements returned by:
--  --|CR    function Names
--  --|CR    function Parameter_Profile
--  --|ER---------------------------------------------------------------------
--  --|ER A_Function_Body_Stub - 10.1.3
--  --|CR
--  --|CR Child elements returned by:
--  --|CR    function Names
--  --|CR    function Parameter_Profile
--  --|CR    function Result_Profile
--  --|ER---------------------------------------------------------------------
--  --|ER A_Package_Body_Stub   - 10.1.3
--  --|ER A_Task_Body_Stub      - 10.1.3
--  --|ER A_Protected_Body_Stub - 10.1.3
--  --|CR
--  --|CR Child elements returned by:
--  --|CR    function Names
--
------------------------------------------------------------------------------
--  15.40 function Corresponding_Subunit
------------------------------------------------------------------------------

   function Corresponding_Subunit
     (Body_Stub : Asis.Declaration)
      return      Asis.Declaration;

   function Corresponding_Subunit
     (Body_Stub   : Asis.Declaration;
      The_Context : Asis.Context)
      return        Asis.Declaration;

------------------------------------------------------------------------------
--  Body_Stub   - Specifies the stub to query
--  The_Context - Specifies a Context to use to locate the subunit
--
--  Returns the Unit_Declaration of the subunit compilation unit corresponding
--  to the body stub.
--
--  Returns a Nil_Element if the subunit does not exist in The_Context.
--
--  These two function calls will always produce identical results:
--
--    Decl2 := Corresponding_Subunit (Decl1);
--    Decl2 := Corresponding_Subunit
--               (Decl1,
--                Enclosing_Context ( Enclosing_Compilation_Unit( Decl1 )));
--
--  The parameter The_Context is used to locate the corresponding subunit body.
--  Any non-Nil result will always have The_Context as its Enclosing_Context.
--
--  Appropriate Declaration_Kinds:
--       A_Function_Body_Stub
--       A_Package_Body_Stub
--       A_Procedure_Body_Stub
--       A_Task_Body_Stub
--       A_Protected_Body_Stub
--
--  Returns Declaration_Kinds:
--       Not_A_Declaration
--       A_Function_Body_Declaration
--       A_Package_Body_Declaration
--       A_Procedure_Body_Declaration
--       A_Task_Body_Declaration
--       A_Protected_Body_Declaration
--
------------------------------------------------------------------------------
--  15.41 function Is_Subunit
------------------------------------------------------------------------------

   function Is_Subunit (Declaration : Asis.Declaration) return Boolean;

------------------------------------------------------------------------------
--  Declaration - Specifies the declaration to query
--
--  Returns True if the declaration is the proper_body of a subunit.
--
--  Returns False for any unexpected Element.
--
--  --|AN
--  Equivalent to:
--    Declaration = Unit_Declaration(Enclosing_Compilation_Unit (Declaration))
--    and Unit_Kind(Enclosing_Compilation_Unit (Declaration)) in A_Subunit.
--
--  Expected Declaration_Kinds:
--       A_Procedure_Body_Declaration
--       A_Function_Body_Declaration
--       A_Package_Body_Declaration
--       A_Task_Body_Declaration
--       A_Protected_Body_Declaration
--
------------------------------------------------------------------------------
--  15.42 function Corresponding_Body_Stub
------------------------------------------------------------------------------

   function Corresponding_Body_Stub
     (Subunit : Asis.Declaration)
      return    Asis.Declaration;

   function Corresponding_Body_Stub
     (Subunit     : Asis.Declaration;
      The_Context : Asis.Context)
      return        Asis.Declaration;

------------------------------------------------------------------------------
--  Subunit     - Specifies the Is_Subunit declaration to query
--  The_Context - Specifies a Context to use to locate the parent unit
--
--  Returns the body stub declaration located in the subunit's parent unit.
--
--  Returns a Nil_Element if the parent unit does not exist in The_Context.
--
--  These two function calls will always produce identical results:
--
--    Decl2 := Corresponding_Body_Stub (Decl1);
--    Decl2 := Corresponding_Body_Stub
--               (Decl1,
--                Enclosing_Context ( Enclosing_Compilation_Unit( Decl1 )));
--
--  The parameter The_Context is used to locate the corresponding parent body.
--  Any non-Nil result will always have The_Context as its Enclosing_Context.
--
--  Appropriate Declaration Kinds:
--       (Is_Subunit(Declaration) shall also be True)
--       A_Function_Body_Declaration
--       A_Package_Body_Declaration
--       A_Procedure_Body_Declaration
--       A_Task_Body_Declaration
--       A_Protected_Body_Declaration
--
--  Returns Declaration_Kinds:
--       Not_A_Declaration
--       A_Function_Body_Stub
--       A_Package_Body_Stub
--       A_Procedure_Body_Stub
--       A_Task_Body_Stub
--       A_Protected_Body_Stub
--
--  --|ER---------------------------------------------------------------------
--  --|ER An_Exception_Declaration - 11.1
--  --|CR
--  --|CR Child elements returned by:
--  --|CR    function Names
--  --|ER---------------------------------------------------------------------
--  --|ER A_Choice_Parameter_Specification - 11.2
--  --|CR
--  --|CR Child elements returned by:
--  --|CR    function Names
--  --|ER---------------------------------------------------------------------
--  --|ER A_Generic_Procedure_Declaration - 12.1
--  --|CR
--  --|CR Child elements returned by:
--  --|CR    function Generic_Formal_Part
--  --|CR    function Names
--  --|CR    function Parameter_Profile
--
------------------------------------------------------------------------------
--  15.43 function Generic_Formal_Part
------------------------------------------------------------------------------

   function Generic_Formal_Part
     (Declaration     : Asis.Declaration;
      Include_Pragmas : Boolean := False)
      return            Asis.Element_List;

------------------------------------------------------------------------------
--  Declaration     - Specifies the generic declaration to query
--  Include_Pragmas - Specifies whether pragmas are to be returned
--
--  Returns a list of generic formal parameter declarations, use clauses,
--  and pragmas, in their order of appearance.
--
--  Results of this query may vary across ASIS implementations.  Some
--  implementations normalize all multi-name object declarations into an
--  equivalent sequence of corresponding single name object declarations.
--  See Reference Manual 3.3.1(7).
--
--  Appropriate Declaration_Kinds:
--       A_Generic_Package_Declaration
--       A_Generic_Procedure_Declaration
--       A_Generic_Function_Declaration
--
--  Returns Element_Kinds:
--       A_Pragma
--       A_Declaration
--       A_Clause
--
--  Returns Declaration_Kinds:
--       A_Formal_Object_Declaration
--       A_Formal_Type_Declaration
--       A_Formal_Procedure_Declaration
--       A_Formal_Function_Declaration
--       A_Formal_Package_Declaration
--       A_Formal_Package_Declaration_With_Box
--
--  Returns Clause_Kinds:
--       A_Use_Package_Clause
--       A_Use_Type_Clause
--       A_Use_All_Type_Clause  --  Ada 2012
--
--  --|ER---------------------------------------------------------------------
--  --|ER A_Generic_Function_Declaration - 12.1
--  --|CR
--  --|CR Child elements returned by:
--  --|CR    function Generic_Formal_Part
--  --|CR    function Names
--  --|CR    function Parameter_Profile
--  --|CR    function Result_Profile
--  --|ER---------------------------------------------------------------------
--  --|ER A_Generic_Package_Declaration - 12.1
--  --|CR
--  --|CR Child elements returned by:
--  --|CR    function Generic_Formal_Part
--  --|CR    function Names
--  --|CR    function Visible_Part_Declarative_Items
--  --|CR    function Private_Part_Declarative_Items
--  --|ER---------------------------------------------------------------------
--  --|ER A_Package_Instantiation   - 12.3
--  --|ER A_Procedure_Instantiation - 12.3
--  --|ER A_Function_Instantiation  - 12.3
--  --|CR
--  --|CR Child elements returned by:
--  --|CR    function Names
--  --|CR    function Generic_Unit_Name
--  --|CR    function Generic_Actual_Part
------------------------------------------------------------------------------
--
--  Instantiations can always be analyzed in terms of the generic actual
--  parameters supplied with the instantiation.  A generic instance is a copy
--  of the generic unit, and while there is no explicit (textual) specification
--  in the program text, an implicit specification and body, if there is one,
--  with the generic actual parameters is implied.
--
--  To analyze the implicit instance specification or body of a generic
--  instantiation:
--     - Use Corresponding_Declaration to return the implicit expanded
--       specification of an instantiation.
--     - Use Corresponding_Body to return the implicit body of an
--       instantiation.
--     - Then analyze the specification or body with any appropriate
--       queries.
--
--  To analyze the explicit generic specification or body referenced by a
--  generic instantiation:
--     - Use Generic_Unit_Name to obtain the name of the generic unit.
--     - Then use Corresponding_Name_Declaration to get to the generic
--       declaration.
--     - Then use Corresponding_Body to get to the body of the generic
--       declaration.
--
------------------------------------------------------------------------------
--  15.44 function Generic_Unit_Name
------------------------------------------------------------------------------

   function Generic_Unit_Name
     (Declaration : Asis.Declaration)
      return        Asis.Expression;

------------------------------------------------------------------------------
--  Declaration - Specifies the generic instantiation to query
--
--  Returns the name following the reserved word "new" in the generic
--  instantiation. The name denotes the generic package, generic procedure, or
--  generic function that is the template for this generic instance.
--
--  Appropriate Declaration_Kinds:
--       A_Function_Instantiation
--       A_Package_Instantiation
--       A_Procedure_Instantiation
--       A_Formal_Package_Declaration
--       A_Formal_Package_Declaration_With_Box
--

--  Returns Expression_Kinds:
--       An_Identifier
--       An_Operator_Symbol
--       A_Selected_Component
--
------------------------------------------------------------------------------
--  15.45 function Generic_Actual_Part
------------------------------------------------------------------------------

   function Generic_Actual_Part
     (Declaration : Asis.Declaration;
      Normalized  : Boolean := False)
      return        Asis.Association_List;

------------------------------------------------------------------------------
--  Declaration - Specifies the generic_instantiation to query
--  Normalized  - Specifies whether the normalized form is desired
--
--  Returns a list of the generic_association elements of the instantiation.
--
--  Returns a Nil_Element_List if there are no generic_association elements.
--
--  An unnormalized list contains only explicit associations ordered as they
--  appear in the program text.  Each unnormalized association has an optional
--  generic_formal_parameter_selector_name and an
--  explicit_generic_actual_parameter component.
--
--  A normalized list contains artificial associations representing all
--  explicit and default associations.  It has a length equal to the number of
--  generic_formal_parameter_declaration elements of the generic_formal_part
--  of the template. The order of normalized associations matches the order of
--  the generic_formal_parameter_declaration elements.
--
--  Each normalized association represents a one-on-one mapping of a
--  generic_formal_parameter_declaration to the explicit or default expression
--  or name.  A normalized association has:
--    - one A_Defining_Name component that denotes the
--      generic_formal_parameter_declaration, and
--    - one An_Expression component that is either:
--      o  the explicit_generic_actual_parameter,
--      o  a default_expression, or
--      o  a default_name from the generic_formal_parameter_declaration or
--         an implicit naming expression which denotes the actual subprogram
--         selected at the place of instantiation for a formal subprogram
--         having A_Box_Default, or
--  |A2012 start
--      o  an implicit name representing the artificial null procedure used as
--         an actual for a formal procedure having a null default in case if
--         there no explicit actual subprogram is provided for this formal
--         subprogram
--  |A2012 end
--
--  If a formal_package_association contains a box, then the corresponding
--  unnormalized A_Generic_Association element contains an Expression_Element
--  with expression kind A_Box_Expression as its Actual_Parameter part. The
--  normalized A_Generic_Association contains either a default parameter or
--  an Expression_Element with expression kind A_Box_Expression.
--
--  Appropriate Declaration_Kinds:
--       A_Function_Instantiation
--       A_Package_Instantiation
--       A_Procedure_Instantiation
--       A_Formal_Package_Declaration
--  |A2005 start
--       A_Formal_Package_Declaration_With_Box
--  |A2005 end
--
--  Returns Association_Kinds:
--       A_Generic_Association
--
--  --|IR Implementation Requirements:
--  --|IR
--  --|IR Normalized associations are Is_Normalized and Is_Part_Of_Implicit.
--  --|IR Normalized associations provided by default are
--  --|IR Is_Defaulted_Association. Normalized associations are never Is_Equal
--  --|IR to unnormalized associations.
--  --|IR
--  --|IP Implementation Permissions:
--  --|IP
--  --|IP An implementation may choose to always include default parameters in
--  --|IP its internal representation.
--  --|IP
--  --|IP An implementation may also choose to normalize its representation
--  --|IP to use the defining_identifier element rather than the
--  --|IP generic_formal_parameter_selector_name elements.
--  --|IP
--  --|IP In either case, this query will return Is_Normalized associations
--  --|IP even if Normalized is False, and the query
--  --|IP Generic_Actual_Part_Normalized will return True.
--  --|IP
--  --|ER---------------------------------------------------------------------
--  --|ER A_Formal_Object_Declaration - 12.4
--  --|CR
--  --|CR Child elements returned by:
--  --|CR    function Names
--  --|CR    function Declaration_Subtype_Mark
--  --|CR    function Initialization_Expression
--  --|ER---------------------------------------------------------------------
--  --|ER A_Formal_Type_Declaration - 12.5
--  --|CR
--  --|CR Child elements returned by:
--  --|CR    function Names
--  --|CR    function Discriminant_Part
--  --|CR    function Type_Declaration_View
--  --|ER---------------------------------------------------------------------
--  --|ER A_Formal_Procedure_Declaration - 12.6
--  --|CR
--  --|CR Child elements returned by:
--  --|CR    function Names
--  --|CR    function Parameter_Profile
--  --|CR    function Formal_Subprogram_Default
--
------------------------------------------------------------------------------
--  15.46 function Formal_Subprogram_Default
------------------------------------------------------------------------------

   function Formal_Subprogram_Default
     (Declaration : Asis.Generic_Formal_Parameter)
      return        Asis.Expression;

------------------------------------------------------------------------------
--  Declaration - Specifies the generic formal subprogram declaration to query
--
--  Returns the name appearing after the reserved word "is" in the given
--  generic formal subprogram declaration.
--
--  Appropriate Declaration_Kinds:
--       A_Formal_Function_Declaration
--       A_Formal_Procedure_Declaration
--
--  Appropriate Subprogram_Default_Kinds:
--       A_Name_Default
--
--  Returns Element_Kinds:
--       An_Expression
--
--  --|ER---------------------------------------------------------------------
--  --|ER A_Formal_Function_Declaration - 12.6
--  --|CR
--  --|CR Child elements returned by:
--  --|CR    function Names
--  --|CR    function Parameter_Profile
--  --|CR    function Result_Profile
--  --|CR    function Formal_Subprogram_Default
--  --|ER---------------------------------------------------------------------
--  --|ER A_Formal_Package_Declaration - 12.7
--  --|CR
--  --|CR Child elements returned by:
--  --|CR    function Names
--  --|CR    function Generic_Unit_Name
--  --|CR    function Generic_Actual_Part
--  --|ER---------------------------------------------------------------------
--  --|ER A_Formal_Package_Declaration_With_Box - 12.7
--  --|CR
--  --|CR Child elements returned by:
--  --|CR    function Names
--  --|CR    function Generic_Unit_Name
--

------------------------------------------------------------------------------
--  15.47 function Corresponding_Generic_Element
------------------------------------------------------------------------------

   function Corresponding_Generic_Element
     (Reference : Asis.Element)
      return      Asis.Defining_Name;

------------------------------------------------------------------------------
--  Reference   - Specifies an expression that references an entity declared
--                within the implicit specification of a generic instantiation,
--                or, specifies the defining name of such an entity.
--
--  Given a reference to some implicit entity, whose declaration occurs within
--  an implicit generic instance, returns the corresponding entity name
--  definition from the generic template used to create the generic instance.
--  (Reference Manual 12.3 (16))
--
--  Returns the first A_Defining_Name, from the generic template, that
--  corresponds to the entity referenced.
--
--  Returns a Nil_Element if the argument does not refer to an entity declared
--  as a component of a generic package instantiation.  The entity name can
--  refer to an ordinary declaration, an inherited subprogram declaration, or a
--  predefined operator declaration.
--
--  Note added as a part of ASIS revision for Ada 2012:
--  Returns Nil_Element if the argument is a reference that does not have a
--  declaration (such as an attribute designator, an identifier specific to a
--  pragma etc.) if it is an ambiguous reference to more than one entity.
--
--  Appropriate Element_Kinds:
--       A_Defining_Name
--       An_Expression
--
--  Appropriate Expression_Kinds:
--       An_Identifier
--       An_Operator_Symbol
--       A_Character_Literal
--       An_Enumeration_Literal
--
--  Returns Element_Kinds:
--       Not_An_Element
--       A_Defining_Name
--
------------------------------------------------------------------------------
------------------------------------------------------------------------------
--  15.48 function Is_Dispatching_Operation
------------------------------------------------------------------------------

   function Is_Dispatching_Operation
     (Declaration : Asis.Element)
      return        Boolean;

------------------------------------------------------------------------------
--  Declaration   -  Specifies the declaration to query.
--
--  Returns True if the declaration is a primitive subprogram of a tagged type.
--
--  Returns False for any unexpected argument.
--
--  Expected Element_Kinds:
--       A_Procedure_Declaration
--       A_Function_Declaration
--       An_Expression_Function_Declaration
--       A_Procedure_Renaming_Declaration
--       A_Function_Renaming_Declaration
--       A_Null_Procedure_Declaration
--       A_Procedure_Body_Declaration
--       A_Function_Body_Declaration
--       A_Procedure_Body_Stub
--       A_Function_Body_Stub
--
------------------------------------------------------------------------------
--  New ASIS 2012 queries                                                   --
------------------------------------------------------------------------------
end Asis.Declarations;