aboutsummaryrefslogtreecommitdiff
path: root/ChangeLog.modules
blob: 29c0e3e950760005b7ccdd3d53972d8a0e9c8f9e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
5853
5854
5855
5856
5857
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
5883
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
5898
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
5919
5920
5921
5922
5923
5924
5925
5926
5927
5928
5929
5930
5931
5932
5933
5934
5935
5936
5937
5938
5939
5940
5941
5942
5943
5944
5945
5946
5947
5948
5949
5950
5951
5952
5953
5954
5955
5956
5957
5958
5959
5960
5961
5962
5963
5964
5965
5966
5967
5968
5969
5970
5971
5972
5973
5974
5975
5976
5977
5978
5979
5980
5981
5982
5983
5984
5985
5986
5987
5988
5989
5990
5991
5992
5993
5994
5995
5996
5997
5998
5999
6000
6001
6002
6003
6004
6005
6006
6007
6008
6009
6010
6011
6012
6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024
6025
6026
6027
6028
6029
6030
6031
6032
6033
6034
6035
6036
6037
6038
6039
6040
6041
6042
6043
6044
6045
6046
6047
6048
6049
6050
6051
6052
6053
6054
6055
6056
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6073
6074
6075
6076
6077
6078
6079
6080
6081
6082
6083
6084
6085
6086
6087
6088
6089
6090
6091
6092
6093
6094
6095
6096
6097
6098
6099
6100
6101
6102
6103
6104
6105
6106
6107
6108
6109
6110
6111
6112
6113
6114
6115
6116
6117
6118
6119
6120
6121
6122
6123
6124
6125
6126
6127
6128
6129
6130
6131
6132
6133
6134
6135
6136
6137
6138
6139
6140
6141
6142
6143
6144
6145
6146
6147
6148
6149
6150
6151
6152
6153
6154
6155
6156
6157
6158
6159
6160
6161
6162
6163
6164
6165
6166
6167
6168
6169
6170
6171
6172
6173
6174
6175
6176
6177
6178
6179
6180
6181
6182
6183
6184
6185
6186
6187
6188
6189
6190
6191
6192
6193
6194
6195
6196
6197
6198
6199
6200
6201
6202
6203
6204
6205
6206
6207
6208
6209
6210
6211
6212
6213
6214
6215
6216
6217
6218
6219
6220
6221
6222
6223
6224
6225
6226
6227
6228
6229
6230
6231
6232
6233
6234
6235
6236
6237
6238
6239
6240
6241
6242
6243
6244
6245
6246
6247
6248
6249
6250
6251
6252
6253
6254
6255
6256
6257
6258
6259
6260
6261
6262
6263
6264
6265
6266
6267
6268
6269
6270
6271
6272
6273
6274
6275
6276
6277
6278
6279
6280
6281
6282
6283
6284
6285
6286
6287
6288
6289
6290
6291
6292
6293
6294
6295
6296
6297
6298
6299
6300
6301
6302
6303
6304
6305
6306
6307
6308
6309
6310
6311
6312
6313
6314
6315
6316
6317
6318
6319
6320
6321
6322
6323
6324
6325
6326
6327
6328
6329
6330
6331
6332
6333
6334
6335
6336
6337
6338
6339
6340
6341
6342
6343
6344
6345
6346
6347
6348
6349
6350
6351
6352
6353
6354
6355
6356
6357
6358
6359
6360
6361
6362
6363
6364
6365
6366
6367
6368
6369
6370
6371
6372
6373
6374
6375
6376
6377
6378
6379
6380
6381
6382
6383
6384
6385
6386
6387
6388
6389
6390
6391
6392
6393
6394
6395
6396
6397
6398
6399
6400
6401
6402
6403
6404
6405
6406
6407
6408
6409
6410
6411
6412
6413
6414
6415
6416
6417
6418
6419
6420
6421
6422
6423
6424
6425
6426
6427
6428
6429
6430
6431
6432
6433
6434
6435
6436
6437
6438
6439
6440
6441
6442
6443
6444
6445
6446
6447
6448
6449
6450
6451
6452
6453
6454
6455
6456
6457
6458
6459
6460
6461
6462
6463
6464
6465
6466
6467
6468
6469
6470
6471
6472
6473
6474
6475
6476
6477
6478
6479
6480
6481
6482
6483
6484
6485
6486
6487
6488
6489
6490
6491
6492
6493
6494
6495
6496
6497
6498
6499
6500
6501
6502
6503
6504
6505
6506
6507
6508
6509
6510
6511
6512
6513
6514
6515
6516
6517
6518
6519
6520
6521
6522
6523
6524
6525
6526
6527
6528
6529
6530
6531
6532
6533
6534
6535
6536
6537
6538
6539
6540
6541
6542
6543
6544
6545
6546
6547
6548
6549
6550
6551
6552
6553
6554
6555
6556
6557
6558
6559
6560
6561
6562
6563
6564
6565
6566
6567
6568
6569
6570
6571
6572
6573
6574
6575
6576
6577
6578
6579
6580
6581
6582
6583
6584
6585
6586
6587
6588
6589
6590
6591
6592
6593
6594
6595
6596
6597
6598
6599
6600
6601
6602
6603
6604
6605
6606
6607
6608
6609
6610
6611
6612
6613
6614
6615
6616
6617
6618
6619
6620
6621
6622
6623
6624
6625
6626
6627
6628
6629
6630
6631
6632
6633
6634
6635
6636
6637
6638
6639
6640
6641
6642
6643
6644
6645
6646
6647
6648
6649
6650
6651
6652
6653
6654
6655
6656
6657
6658
6659
6660
6661
6662
6663
6664
6665
6666
6667
6668
6669
6670
6671
6672
6673
6674
6675
6676
6677
6678
6679
6680
6681
6682
6683
6684
6685
6686
6687
6688
6689
6690
6691
6692
6693
6694
6695
6696
6697
6698
6699
6700
6701
6702
6703
6704
6705
6706
6707
6708
6709
6710
6711
6712
6713
6714
6715
6716
6717
6718
6719
6720
6721
6722
6723
6724
6725
6726
6727
6728
6729
6730
6731
6732
6733
6734
6735
6736
6737
6738
6739
6740
6741
6742
6743
6744
6745
6746
6747
6748
6749
6750
6751
6752
6753
6754
6755
6756
6757
6758
6759
6760
6761
6762
6763
6764
6765
6766
6767
6768
6769
6770
6771
6772
6773
6774
6775
6776
6777
6778
6779
6780
6781
6782
6783
6784
6785
6786
6787
6788
6789
6790
6791
6792
6793
6794
6795
6796
6797
6798
6799
6800
6801
6802
6803
6804
6805
6806
6807
6808
6809
6810
6811
6812
6813
6814
6815
6816
6817
6818
6819
6820
6821
6822
6823
6824
6825
6826
6827
6828
6829
6830
6831
6832
6833
6834
6835
6836
6837
6838
6839
6840
6841
6842
6843
6844
6845
6846
6847
6848
6849
6850
6851
6852
6853
6854
6855
6856
6857
6858
6859
6860
6861
6862
6863
6864
6865
6866
6867
6868
6869
6870
6871
6872
6873
6874
6875
6876
6877
6878
6879
6880
6881
6882
6883
6884
6885
6886
6887
6888
6889
6890
6891
6892
6893
6894
6895
6896
6897
6898
6899
6900
6901
6902
6903
6904
6905
6906
6907
6908
6909
6910
6911
6912
6913
6914
6915
6916
6917
6918
6919
6920
6921
6922
6923
6924
6925
6926
6927
6928
6929
6930
6931
6932
6933
6934
6935
6936
6937
6938
6939
6940
6941
6942
6943
6944
6945
6946
6947
6948
6949
6950
6951
6952
6953
6954
6955
6956
6957
6958
6959
6960
6961
6962
6963
6964
6965
6966
6967
6968
6969
6970
6971
6972
6973
6974
6975
6976
6977
6978
6979
6980
6981
6982
6983
6984
6985
6986
6987
6988
6989
6990
6991
6992
6993
6994
6995
6996
6997
6998
6999
7000
7001
7002
7003
7004
7005
7006
7007
7008
7009
7010
7011
7012
7013
7014
7015
7016
7017
7018
7019
7020
7021
7022
7023
7024
7025
7026
7027
7028
7029
7030
7031
7032
7033
7034
7035
7036
7037
7038
7039
7040
7041
7042
7043
7044
7045
7046
7047
7048
7049
7050
7051
7052
7053
7054
7055
7056
7057
7058
7059
7060
7061
7062
7063
7064
7065
7066
7067
7068
7069
7070
7071
7072
7073
7074
7075
7076
7077
7078
7079
7080
7081
7082
7083
7084
7085
7086
7087
7088
7089
7090
7091
7092
7093
7094
7095
7096
7097
7098
7099
7100
7101
7102
7103
7104
7105
7106
7107
7108
7109
7110
7111
7112
7113
7114
7115
7116
7117
7118
7119
7120
7121
7122
7123
7124
7125
7126
7127
7128
7129
7130
7131
7132
7133
7134
7135
7136
7137
7138
7139
7140
7141
7142
7143
7144
7145
7146
7147
7148
7149
7150
7151
7152
7153
7154
7155
7156
7157
7158
7159
7160
7161
7162
7163
7164
7165
7166
7167
7168
7169
7170
7171
7172
7173
7174
7175
7176
7177
7178
7179
7180
7181
7182
7183
7184
7185
7186
7187
7188
7189
7190
7191
7192
7193
7194
7195
7196
7197
7198
7199
7200
7201
7202
7203
7204
7205
7206
7207
7208
7209
7210
7211
7212
7213
7214
7215
7216
7217
7218
7219
7220
7221
7222
7223
7224
7225
7226
7227
7228
7229
7230
7231
7232
7233
7234
7235
7236
7237
7238
7239
7240
7241
7242
7243
7244
7245
7246
7247
7248
7249
7250
7251
7252
7253
7254
7255
7256
7257
7258
7259
7260
7261
7262
7263
7264
7265
7266
7267
7268
7269
7270
7271
7272
7273
7274
7275
7276
7277
7278
7279
7280
7281
7282
7283
7284
7285
7286
7287
7288
7289
7290
7291
7292
7293
7294
7295
7296
7297
7298
7299
7300
7301
7302
7303
7304
7305
7306
7307
7308
7309
7310
7311
7312
7313
7314
7315
7316
7317
7318
7319
7320
7321
7322
7323
7324
7325
7326
7327
7328
7329
7330
7331
7332
7333
7334
7335
7336
7337
7338
7339
7340
7341
7342
7343
7344
7345
7346
7347
7348
7349
7350
7351
7352
7353
7354
7355
7356
7357
7358
7359
7360
7361
7362
7363
7364
7365
7366
7367
7368
7369
7370
7371
7372
7373
7374
7375
7376
7377
7378
7379
7380
7381
7382
7383
7384
7385
7386
7387
7388
7389
7390
7391
7392
7393
7394
7395
7396
7397
7398
7399
7400
7401
7402
7403
7404
7405
7406
7407
7408
7409
7410
7411
7412
7413
7414
7415
7416
7417
7418
7419
7420
7421
7422
7423
7424
7425
7426
7427
7428
7429
7430
7431
7432
7433
7434
7435
7436
7437
7438
7439
7440
7441
7442
7443
7444
7445
7446
7447
7448
7449
7450
7451
7452
7453
7454
7455
7456
7457
7458
7459
7460
7461
7462
7463
7464
7465
7466
7467
7468
7469
7470
7471
7472
7473
7474
7475
7476
7477
7478
7479
7480
7481
7482
7483
7484
7485
7486
7487
7488
7489
7490
7491
7492
7493
7494
7495
7496
7497
7498
7499
7500
7501
7502
7503
7504
7505
7506
7507
7508
7509
7510
7511
7512
7513
7514
7515
7516
7517
7518
7519
7520
7521
7522
7523
7524
7525
7526
7527
7528
7529
7530
7531
7532
7533
7534
7535
7536
7537
7538
7539
7540
7541
7542
7543
7544
7545
7546
7547
7548
7549
7550
7551
7552
7553
7554
7555
7556
7557
7558
7559
7560
7561
7562
7563
7564
7565
7566
7567
7568
7569
7570
7571
7572
7573
7574
7575
7576
7577
7578
7579
7580
7581
7582
7583
7584
7585
7586
7587
7588
7589
7590
7591
7592
7593
7594
7595
7596
7597
7598
7599
7600
7601
7602
7603
7604
7605
7606
7607
7608
7609
7610
7611
7612
7613
7614
7615
7616
7617
7618
7619
7620
7621
7622
7623
7624
7625
7626
7627
7628
7629
7630
7631
7632
7633
7634
7635
7636
7637
7638
7639
7640
7641
7642
7643
7644
7645
7646
7647
7648
7649
7650
7651
7652
7653
7654
7655
7656
7657
7658
7659
7660
7661
7662
7663
7664
7665
7666
7667
7668
7669
7670
7671
7672
7673
7674
7675
7676
7677
7678
7679
7680
7681
7682
7683
7684
7685
7686
7687
7688
7689
7690
7691
7692
7693
7694
7695
7696
7697
7698
7699
7700
7701
7702
7703
7704
7705
7706
7707
7708
7709
7710
7711
7712
7713
7714
7715
7716
7717
7718
7719
7720
7721
7722
7723
7724
7725
7726
7727
7728
7729
7730
7731
7732
7733
7734
7735
7736
7737
7738
7739
7740
7741
7742
7743
7744
7745
7746
7747
7748
7749
7750
7751
7752
7753
7754
7755
7756
7757
7758
7759
7760
7761
7762
7763
7764
7765
7766
7767
7768
7769
7770
7771
7772
7773
7774
7775
7776
7777
7778
7779
7780
7781
7782
7783
7784
7785
7786
7787
7788
7789
7790
7791
7792
7793
7794
7795
7796
7797
7798
7799
7800
7801
7802
7803
7804
7805
7806
7807
7808
7809
7810
7811
7812
7813
7814
7815
7816
7817
7818
7819
7820
7821
7822
7823
7824
7825
7826
7827
7828
7829
7830
7831
7832
7833
7834
7835
7836
7837
7838
7839
7840
7841
7842
7843
7844
7845
7846
7847
7848
7849
7850
7851
7852
7853
7854
7855
7856
7857
7858
7859
7860
7861
7862
7863
7864
7865
7866
7867
7868
7869
7870
7871
7872
7873
7874
7875
7876
7877
7878
7879
7880
7881
7882
7883
7884
7885
7886
7887
7888
7889
7890
7891
7892
7893
7894
7895
7896
7897
7898
7899
7900
7901
7902
7903
7904
7905
7906
7907
7908
7909
7910
7911
7912
7913
7914
7915
7916
7917
7918
7919
7920
7921
7922
7923
7924
7925
7926
7927
7928
7929
7930
7931
7932
7933
7934
7935
7936
7937
7938
7939
7940
7941
7942
7943
7944
7945
7946
7947
7948
7949
7950
7951
7952
7953
7954
7955
7956
7957
7958
7959
7960
7961
7962
7963
7964
7965
7966
7967
7968
7969
7970
7971
7972
7973
7974
7975
7976
7977
7978
7979
7980
7981
7982
7983
7984
7985
7986
7987
7988
7989
7990
7991
7992
7993
7994
7995
7996
7997
7998
7999
8000
8001
8002
8003
8004
8005
8006
8007
8008
8009
8010
8011
8012
8013
8014
8015
8016
8017
8018
8019
8020
8021
8022
8023
8024
8025
8026
8027
8028
8029
8030
8031
8032
8033
8034
8035
8036
8037
8038
8039
8040
8041
8042
8043
8044
8045
8046
8047
8048
8049
8050
8051
8052
8053
8054
8055
8056
8057
8058
8059
8060
8061
8062
8063
8064
8065
8066
8067
8068
8069
8070
8071
8072
8073
8074
8075
8076
8077
8078
8079
8080
8081
8082
8083
8084
8085
8086
8087
8088
8089
8090
8091
8092
8093
8094
8095
8096
8097
8098
8099
8100
8101
8102
8103
8104
8105
8106
8107
8108
8109
8110
8111
8112
8113
8114
8115
8116
8117
8118
8119
8120
8121
8122
8123
8124
8125
8126
8127
8128
8129
8130
8131
8132
8133
8134
8135
8136
8137
8138
8139
8140
8141
8142
8143
8144
8145
8146
8147
8148
8149
8150
8151
8152
8153
8154
8155
8156
8157
8158
8159
8160
8161
8162
8163
8164
8165
8166
8167
8168
8169
8170
8171
8172
8173
8174
8175
8176
8177
8178
8179
8180
8181
8182
8183
8184
8185
8186
8187
8188
8189
8190
8191
8192
8193
8194
8195
8196
8197
8198
8199
8200
8201
8202
8203
8204
8205
8206
8207
8208
8209
8210
8211
8212
8213
8214
8215
8216
8217
8218
8219
8220
8221
8222
8223
8224
8225
8226
8227
8228
8229
8230
8231
8232
8233
8234
8235
8236
8237
8238
8239
8240
8241
8242
8243
8244
8245
8246
8247
8248
8249
8250
8251
8252
8253
8254
8255
8256
8257
8258
8259
8260
8261
8262
8263
8264
8265
8266
8267
8268
8269
8270
8271
8272
8273
8274
8275
8276
8277
8278
8279
8280
8281
8282
8283
8284
8285
8286
8287
8288
8289
8290
8291
8292
8293
8294
8295
8296
8297
8298
8299
8300
8301
8302
8303
8304
8305
8306
8307
8308
8309
8310
8311
8312
8313
8314
8315
8316
8317
8318
8319
8320
8321
8322
8323
8324
8325
8326
8327
8328
8329
8330
8331
8332
8333
8334
8335
8336
8337
8338
8339
8340
8341
8342
8343
8344
8345
8346
8347
8348
8349
8350
8351
8352
8353
8354
8355
8356
8357
8358
8359
8360
8361
8362
8363
8364
8365
8366
8367
8368
8369
8370
8371
8372
8373
8374
8375
8376
8377
8378
8379
8380
8381
8382
8383
8384
8385
8386
8387
8388
8389
8390
8391
8392
8393
8394
8395
8396
8397
8398
8399
8400
8401
8402
8403
8404
8405
8406
8407
8408
8409
8410
8411
8412
8413
8414
8415
8416
8417
8418
8419
8420
8421
8422
8423
8424
8425
8426
8427
8428
8429
8430
8431
8432
8433
8434
8435
8436
8437
8438
8439
8440
8441
8442
8443
8444
8445
8446
8447
8448
8449
8450
8451
8452
8453
8454
8455
8456
8457
8458
8459
8460
8461
8462
8463
8464
8465
8466
8467
8468
8469
8470
8471
8472
8473
8474
8475
8476
8477
8478
8479
8480
8481
8482
8483
8484
8485
8486
8487
8488
8489
8490
8491
8492
8493
8494
8495
8496
8497
8498
8499
8500
8501
8502
8503
8504
8505
8506
8507
8508
8509
8510
8511
8512
8513
8514
8515
8516
8517
8518
8519
8520
8521
8522
8523
8524
8525
8526
8527
8528
8529
8530
8531
8532
8533
8534
8535
8536
8537
8538
8539
8540
8541
8542
8543
8544
8545
8546
8547
8548
8549
8550
8551
8552
8553
8554
8555
8556
8557
8558
8559
8560
8561
8562
8563
8564
8565
8566
8567
8568
8569
8570
8571
8572
8573
8574
8575
8576
8577
8578
8579
8580
8581
8582
8583
8584
8585
8586
8587
8588
8589
8590
8591
8592
8593
8594
8595
8596
8597
8598
8599
8600
8601
8602
8603
8604
8605
8606
8607
8608
8609
8610
8611
8612
8613
8614
8615
8616
8617
8618
8619
8620
8621
8622
8623
8624
8625
8626
8627
8628
8629
8630
8631
8632
8633
8634
8635
8636
8637
8638
8639
8640
8641
8642
8643
8644
8645
8646
8647
8648
8649
8650
8651
8652
8653
8654
8655
8656
8657
8658
8659
8660
8661
8662
8663
8664
8665
8666
8667
8668
8669
8670
8671
8672
8673
8674
8675
8676
8677
8678
8679
8680
8681
8682
8683
8684
8685
8686
8687
8688
8689
8690
8691
8692
8693
8694
8695
8696
8697
8698
8699
8700
8701
8702
8703
8704
8705
8706
8707
8708
8709
8710
8711
8712
8713
8714
8715
8716
8717
8718
8719
8720
8721
8722
8723
8724
8725
8726
8727
8728
8729
8730
8731
8732
8733
8734
8735
8736
8737
8738
8739
8740
8741
8742
8743
8744
8745
8746
8747
8748
8749
8750
8751
8752
8753
8754
8755
8756
8757
8758
8759
8760
8761
8762
8763
8764
8765
8766
8767
8768
8769
8770
8771
8772
8773
8774
8775
8776
8777
8778
8779
8780
8781
8782
8783
8784
8785
8786
8787
8788
8789
8790
8791
8792
8793
8794
8795
8796
8797
8798
8799
8800
8801
8802
8803
8804
8805
8806
8807
8808
8809
8810
8811
8812
8813
8814
8815
8816
8817
8818
8819
8820
8821
8822
8823
8824
8825
8826
8827
8828
8829
8830
8831
8832
8833
8834
8835
8836
8837
8838
8839
8840
8841
8842
8843
8844
8845
8846
8847
8848
8849
8850
8851
8852
8853
8854
8855
8856
8857
8858
8859
8860
8861
8862
8863
8864
8865
8866
8867
8868
8869
8870
8871
8872
8873
8874
8875
8876
8877
8878
8879
8880
8881
8882
8883
8884
8885
8886
8887
8888
8889
8890
8891
8892
8893
8894
8895
8896
8897
8898
8899
8900
8901
8902
8903
8904
8905
8906
8907
8908
8909
8910
8911
8912
8913
8914
8915
8916
8917
8918
8919
8920
8921
8922
8923
8924
8925
8926
8927
8928
8929
8930
8931
8932
8933
8934
8935
8936
8937
8938
8939
8940
8941
8942
8943
8944
8945
8946
8947
8948
8949
8950
8951
8952
8953
8954
8955
8956
8957
8958
8959
8960
8961
8962
8963
8964
8965
8966
8967
8968
8969
8970
8971
8972
8973
8974
8975
8976
8977
8978
8979
8980
8981
8982
8983
8984
8985
8986
8987
8988
8989
8990
8991
8992
8993
8994
8995
8996
8997
8998
8999
9000
9001
9002
9003
9004
9005
9006
9007
9008
9009
9010
9011
9012
9013
9014
9015
9016
9017
9018
9019
9020
9021
9022
9023
9024
9025
9026
9027
9028
9029
9030
9031
9032
9033
9034
9035
9036
9037
9038
9039
9040
9041
9042
9043
9044
9045
9046
9047
9048
9049
9050
9051
9052
9053
9054
9055
9056
9057
9058
9059
9060
9061
9062
9063
9064
9065
9066
9067
9068
9069
9070
9071
9072
9073
9074
9075
9076
9077
9078
9079
9080
9081
9082
9083
9084
9085
9086
9087
9088
9089
9090
9091
9092
9093
9094
9095
9096
9097
9098
9099
9100
9101
9102
9103
9104
9105
9106
9107
9108
9109
9110
9111
9112
9113
9114
9115
9116
9117
9118
9119
9120
9121
9122
9123
9124
9125
9126
9127
9128
9129
9130
9131
9132
9133
9134
9135
9136
9137
9138
9139
9140
9141
9142
9143
9144
9145
9146
9147
9148
9149
9150
9151
9152
9153
9154
9155
9156
9157
9158
9159
9160
9161
9162
9163
9164
9165
9166
9167
9168
9169
9170
9171
9172
9173
9174
9175
9176
9177
9178
9179
9180
9181
9182
9183
9184
9185
9186
9187
9188
9189
9190
9191
9192
9193
9194
9195
9196
9197
9198
9199
9200
9201
9202
9203
9204
9205
9206
9207
9208
9209
9210
9211
9212
9213
9214
9215
9216
9217
9218
9219
9220
9221
9222
9223
9224
9225
9226
9227
9228
9229
9230
9231
9232
9233
9234
9235
9236
9237
9238
9239
9240
9241
9242
9243
9244
9245
9246
9247
9248
9249
9250
9251
9252
9253
9254
9255
9256
9257
9258
9259
9260
9261
9262
9263
9264
9265
9266
9267
9268
9269
9270
9271
9272
9273
9274
9275
9276
9277
9278
9279
9280
9281
9282
9283
9284
9285
9286
9287
9288
9289
9290
9291
9292
9293
9294
9295
9296
9297
9298
9299
9300
9301
9302
9303
9304
9305
9306
9307
9308
9309
9310
9311
9312
9313
9314
9315
9316
9317
9318
9319
9320
9321
9322
9323
9324
9325
9326
9327
9328
9329
9330
9331
9332
9333
9334
9335
9336
9337
9338
9339
9340
9341
9342
9343
9344
9345
9346
9347
9348
9349
9350
9351
9352
9353
9354
9355
9356
9357
9358
9359
9360
9361
9362
9363
9364
9365
9366
9367
9368
9369
9370
9371
9372
9373
9374
9375
9376
9377
9378
9379
9380
9381
9382
9383
9384
9385
9386
9387
9388
9389
9390
9391
9392
9393
9394
9395
9396
9397
9398
9399
9400
9401
9402
9403
9404
9405
9406
9407
9408
9409
9410
9411
9412
9413
9414
9415
9416
9417
9418
9419
9420
9421
9422
9423
9424
9425
9426
9427
9428
9429
9430
9431
9432
9433
9434
9435
9436
9437
9438
9439
9440
9441
9442
9443
9444
9445
9446
9447
9448
9449
9450
9451
9452
9453
9454
9455
9456
9457
9458
9459
9460
9461
9462
9463
9464
9465
9466
9467
9468
9469
9470
9471
9472
9473
9474
9475
9476
9477
9478
9479
9480
9481
9482
9483
9484
9485
9486
9487
9488
9489
9490
9491
9492
9493
9494
9495
9496
9497
9498
9499
9500
9501
9502
9503
9504
9505
9506
9507
9508
9509
9510
9511
9512
9513
9514
9515
9516
9517
9518
9519
9520
9521
9522
9523
9524
9525
9526
9527
9528
9529
9530
9531
9532
9533
9534
9535
9536
9537
9538
9539
9540
9541
9542
9543
9544
9545
9546
9547
9548
9549
9550
9551
9552
9553
9554
9555
9556
9557
9558
9559
9560
9561
9562
9563
9564
9565
9566
9567
9568
9569
9570
9571
9572
9573
9574
9575
9576
9577
9578
9579
9580
9581
9582
9583
9584
9585
9586
9587
9588
9589
9590
9591
9592
9593
9594
9595
9596
9597
9598
9599
9600
9601
9602
9603
9604
9605
9606
9607
9608
9609
9610
9611
9612
9613
9614
9615
9616
9617
9618
9619
9620
9621
9622
9623
9624
9625
9626
9627
9628
9629
9630
9631
9632
9633
9634
9635
9636
9637
9638
9639
9640
9641
9642
9643
9644
9645
9646
9647
9648
9649
9650
9651
9652
9653
9654
9655
9656
9657
9658
9659
9660
9661
9662
9663
9664
9665
9666
9667
9668
9669
9670
9671
9672
9673
9674
9675
9676
9677
9678
9679
9680
9681
9682
9683
9684
9685
9686
9687
9688
9689
9690
9691
9692
9693
9694
9695
9696
9697
9698
9699
9700
9701
9702
9703
9704
9705
9706
9707
9708
9709
9710
9711
9712
9713
9714
9715
9716
9717
9718
9719
9720
9721
9722
9723
9724
9725
9726
9727
9728
9729
9730
9731
9732
9733
9734
9735
9736
9737
9738
9739
9740
9741
9742
9743
9744
9745
9746
9747
9748
9749
9750
9751
9752
9753
9754
9755
9756
9757
9758
9759
9760
9761
9762
9763
9764
9765
9766
9767
9768
9769
9770
9771
9772
9773
9774
9775
9776
9777
9778
9779
9780
9781
9782
9783
9784
9785
9786
9787
9788
9789
9790
9791
9792
9793
9794
9795
9796
9797
9798
9799
9800
9801
9802
9803
9804
9805
9806
9807
9808
9809
9810
9811
9812
9813
9814
9815
9816
9817
9818
9819
9820
9821
9822
9823
9824
9825
9826
9827
9828
9829
9830
9831
9832
9833
9834
9835
9836
9837
9838
9839
9840
9841
9842
9843
9844
9845
9846
9847
9848
9849
9850
9851
9852
9853
9854
9855
9856
9857
9858
9859
9860
9861
9862
9863
9864
9865
9866
9867
9868
9869
9870
9871
9872
9873
9874
9875
9876
9877
9878
9879
9880
9881
9882
9883
9884
9885
9886
9887
9888
9889
9890
9891
9892
9893
9894
9895
9896
9897
9898
9899
9900
9901
9902
9903
9904
9905
9906
9907
9908
9909
9910
9911
9912
9913
9914
9915
9916
9917
9918
9919
9920
9921
9922
9923
9924
9925
9926
9927
9928
9929
9930
9931
9932
9933
9934
9935
9936
9937
9938
9939
9940
9941
9942
9943
9944
9945
9946
9947
9948
9949
9950
9951
9952
9953
9954
9955
9956
9957
9958
9959
9960
9961
9962
9963
9964
9965
9966
9967
9968
9969
9970
9971
9972
9973
9974
9975
9976
9977
9978
9979
9980
9981
9982
9983
9984
9985
9986
9987
9988
9989
9990
9991
9992
9993
9994
9995
9996
9997
9998
9999
10000
10001
10002
10003
10004
10005
10006
10007
10008
10009
10010
10011
10012
10013
10014
10015
10016
10017
10018
10019
10020
10021
10022
10023
10024
10025
10026
10027
10028
10029
10030
10031
10032
10033
10034
10035
10036
10037
10038
10039
10040
10041
10042
10043
10044
10045
10046
10047
10048
10049
10050
10051
10052
10053
10054
10055
10056
10057
10058
10059
10060
10061
10062
10063
10064
10065
10066
10067
10068
10069
10070
10071
10072
10073
10074
10075
10076
10077
10078
10079
10080
10081
10082
10083
10084
10085
10086
10087
10088
10089
10090
10091
10092
10093
10094
10095
10096
10097
10098
10099
10100
10101
10102
10103
10104
10105
10106
10107
10108
10109
10110
10111
10112
10113
10114
10115
10116
10117
10118
10119
10120
10121
10122
10123
10124
10125
10126
10127
10128
10129
10130
10131
10132
10133
10134
10135
10136
10137
10138
10139
10140
10141
10142
10143
10144
10145
10146
10147
10148
10149
10150
10151
10152
10153
10154
10155
10156
10157
10158
10159
10160
10161
10162
10163
10164
10165
10166
10167
10168
10169
10170
10171
10172
10173
10174
10175
10176
10177
10178
10179
10180
10181
10182
10183
10184
10185
10186
10187
10188
10189
10190
10191
10192
10193
10194
10195
10196
10197
10198
10199
10200
10201
10202
10203
10204
10205
10206
10207
10208
10209
10210
10211
10212
10213
10214
10215
10216
10217
10218
10219
10220
10221
10222
10223
10224
10225
10226
10227
10228
10229
10230
10231
10232
10233
10234
10235
10236
10237
10238
10239
10240
10241
10242
10243
10244
10245
10246
10247
10248
10249
10250
10251
10252
10253
10254
10255
10256
10257
10258
10259
10260
10261
10262
10263
10264
10265
10266
10267
10268
10269
10270
10271
10272
10273
10274
10275
10276
10277
10278
10279
10280
10281
10282
10283
10284
10285
10286
10287
10288
10289
10290
10291
10292
10293
10294
10295
10296
10297
10298
10299
10300
10301
10302
10303
10304
10305
10306
10307
10308
10309
10310
10311
10312
10313
10314
10315
10316
10317
10318
10319
10320
10321
10322
10323
10324
10325
10326
10327
10328
10329
10330
10331
10332
10333
10334
10335
10336
10337
10338
10339
10340
10341
10342
10343
10344
10345
10346
10347
10348
10349
10350
10351
10352
10353
10354
10355
10356
10357
10358
10359
10360
10361
10362
10363
10364
10365
10366
10367
10368
10369
10370
10371
10372
10373
10374
10375
10376
10377
10378
10379
10380
10381
10382
10383
10384
10385
10386
10387
10388
10389
10390
10391
10392
10393
10394
10395
10396
10397
10398
10399
10400
10401
10402
10403
10404
10405
10406
10407
10408
10409
10410
10411
10412
10413
10414
10415
10416
10417
10418
10419
10420
10421
10422
10423
10424
10425
10426
10427
10428
10429
10430
10431
10432
10433
10434
10435
10436
10437
10438
10439
10440
10441
10442
10443
10444
10445
10446
10447
10448
10449
10450
10451
10452
10453
10454
10455
10456
10457
10458
10459
10460
10461
10462
10463
10464
10465
10466
10467
10468
10469
10470
10471
10472
10473
10474
10475
10476
10477
10478
10479
10480
10481
10482
10483
10484
10485
10486
10487
10488
10489
10490
10491
10492
10493
10494
10495
10496
10497
10498
10499
10500
10501
10502
10503
10504
10505
10506
10507
10508
10509
10510
10511
10512
10513
10514
10515
10516
10517
10518
10519
10520
10521
10522
10523
10524
10525
10526
10527
10528
10529
10530
10531
10532
10533
10534
10535
10536
10537
10538
10539
10540
10541
10542
10543
10544
10545
10546
10547
10548
10549
10550
10551
10552
10553
10554
10555
10556
10557
10558
10559
10560
10561
10562
10563
10564
10565
10566
10567
10568
10569
10570
10571
10572
10573
10574
10575
10576
10577
10578
10579
10580
10581
10582
10583
10584
10585
10586
10587
10588
10589
10590
10591
10592
10593
10594
10595
10596
10597
10598
10599
10600
10601
10602
10603
10604
10605
10606
10607
10608
10609
10610
10611
10612
10613
10614
10615
10616
10617
10618
10619
10620
10621
10622
10623
10624
10625
10626
10627
10628
10629
10630
10631
10632
10633
10634
10635
10636
10637
10638
10639
10640
10641
10642
10643
10644
10645
10646
10647
10648
10649
10650
10651
10652
10653
10654
10655
10656
10657
10658
10659
10660
10661
10662
10663
10664
10665
10666
10667
10668
10669
10670
10671
10672
10673
10674
10675
10676
10677
10678
10679
10680
10681
10682
10683
10684
10685
10686
10687
10688
10689
10690
10691
10692
10693
10694
10695
10696
10697
10698
10699
10700
10701
10702
10703
10704
10705
10706
10707
10708
10709
10710
10711
10712
10713
10714
10715
10716
10717
10718
10719
10720
10721
10722
10723
10724
10725
10726
10727
10728
10729
10730
10731
10732
10733
10734
10735
10736
10737
10738
10739
10740
10741
10742
10743
10744
10745
10746
10747
10748
10749
10750
10751
10752
10753
10754
10755
10756
10757
10758
10759
10760
10761
10762
10763
10764
10765
10766
10767
10768
10769
10770
10771
10772
10773
10774
10775
10776
10777
10778
10779
10780
10781
10782
10783
10784
10785
10786
10787
10788
10789
10790
10791
10792
10793
10794
10795
10796
10797
10798
10799
10800
10801
10802
10803
10804
10805
10806
10807
10808
10809
10810
10811
10812
10813
10814
10815
10816
10817
10818
10819
10820
10821
10822
10823
10824
10825
10826
10827
10828
10829
10830
10831
10832
10833
10834
10835
10836
10837
10838
10839
10840
10841
10842
10843
10844
10845
10846
10847
10848
10849
10850
10851
10852
10853
10854
10855
10856
10857
10858
10859
10860
10861
10862
10863
10864
10865
10866
10867
10868
10869
10870
10871
10872
10873
10874
10875
10876
10877
10878
10879
10880
10881
10882
10883
10884
10885
10886
10887
10888
10889
10890
10891
10892
10893
10894
10895
10896
10897
10898
10899
10900
10901
10902
10903
10904
10905
10906
10907
10908
10909
10910
10911
10912
10913
10914
10915
10916
10917
10918
10919
10920
10921
10922
10923
10924
10925
10926
10927
10928
10929
10930
10931
10932
10933
10934
10935
10936
10937
10938
10939
10940
10941
10942
10943
10944
10945
10946
10947
10948
10949
10950
10951
10952
10953
10954
10955
10956
10957
10958
10959
10960
10961
10962
10963
10964
10965
10966
10967
10968
10969
10970
10971
10972
10973
10974
10975
10976
10977
10978
10979
10980
10981
10982
10983
10984
10985
10986
10987
10988
10989
10990
10991
10992
10993
10994
10995
10996
10997
10998
10999
11000
11001
11002
11003
11004
11005
11006
11007
11008
11009
11010
11011
11012
11013
11014
11015
11016
11017
11018
11019
11020
11021
11022
11023
11024
11025
11026
11027
11028
11029
11030
11031
11032
11033
11034
11035
11036
11037
11038
11039
11040
11041
11042
11043
11044
11045
11046
11047
11048
11049
11050
11051
11052
11053
11054
11055
11056
11057
11058
11059
11060
11061
11062
11063
11064
11065
11066
11067
11068
11069
11070
11071
11072
11073
11074
11075
11076
11077
11078
11079
11080
11081
11082
11083
11084
11085
11086
11087
11088
11089
11090
11091
11092
11093
11094
11095
11096
11097
11098
11099
11100
11101
11102
11103
11104
11105
11106
11107
11108
11109
11110
11111
11112
11113
11114
11115
11116
11117
11118
11119
11120
11121
11122
11123
11124
11125
11126
11127
11128
11129
11130
11131
11132
11133
11134
11135
11136
11137
11138
11139
11140
11141
11142
11143
11144
11145
11146
11147
11148
11149
11150
11151
11152
11153
11154
11155
11156
11157
11158
11159
11160
11161
11162
11163
11164
11165
11166
11167
11168
11169
11170
11171
11172
11173
11174
11175
11176
11177
11178
11179
11180
11181
11182
11183
11184
11185
11186
11187
11188
11189
11190
11191
11192
11193
11194
11195
11196
11197
11198
11199
11200
11201
11202
11203
11204
11205
11206
11207
11208
11209
11210
11211
11212
11213
11214
11215
11216
11217
11218
11219
11220
11221
11222
11223
11224
11225
11226
11227
11228
11229
11230
11231
11232
11233
11234
11235
11236
11237
11238
11239
11240
11241
11242
11243
11244
11245
11246
11247
11248
11249
11250
11251
11252
11253
11254
11255
11256
11257
11258
11259
11260
11261
11262
11263
11264
11265
11266
11267
11268
11269
11270
11271
11272
11273
11274
11275
11276
11277
11278
11279
11280
11281
11282
11283
11284
11285
11286
11287
11288
11289
11290
11291
11292
11293
11294
11295
11296
11297
11298
11299
11300
11301
11302
11303
11304
11305
11306
11307
11308
11309
11310
11311
11312
11313
11314
11315
11316
11317
11318
11319
11320
11321
11322
11323
11324
11325
11326
11327
11328
11329
11330
11331
11332
11333
11334
11335
11336
11337
11338
11339
11340
11341
11342
11343
11344
11345
11346
11347
11348
11349
11350
11351
11352
11353
11354
11355
11356
11357
11358
11359
11360
11361
11362
11363
11364
11365
11366
11367
11368
11369
11370
11371
11372
11373
11374
11375
11376
11377
11378
11379
11380
11381
11382
11383
11384
11385
11386
11387
11388
11389
11390
11391
11392
11393
11394
11395
11396
11397
11398
11399
11400
11401
11402
11403
11404
11405
11406
11407
11408
11409
11410
11411
11412
11413
11414
11415
11416
11417
11418
11419
11420
11421
11422
11423
11424
11425
11426
11427
11428
11429
11430
11431
11432
11433
11434
11435
11436
11437
11438
11439
11440
11441
11442
11443
11444
11445
11446
11447
11448
11449
11450
11451
11452
11453
11454
11455
11456
11457
11458
11459
11460
11461
11462
11463
11464
11465
11466
11467
11468
11469
11470
11471
11472
11473
11474
11475
11476
11477
11478
11479
11480
11481
11482
11483
11484
11485
11486
11487
11488
11489
11490
11491
11492
11493
11494
11495
11496
11497
11498
11499
11500
11501
11502
11503
11504
11505
11506
11507
11508
11509
11510
11511
11512
11513
11514
11515
11516
11517
11518
11519
11520
11521
11522
11523
11524
11525
11526
11527
11528
11529
11530
11531
11532
11533
11534
11535
11536
11537
11538
11539
11540
11541
11542
11543
11544
11545
11546
11547
11548
11549
11550
11551
11552
11553
11554
11555
11556
11557
11558
11559
11560
11561
11562
11563
11564
11565
11566
11567
11568
11569
11570
11571
11572
11573
11574
11575
11576
11577
11578
11579
11580
11581
11582
11583
11584
11585
11586
11587
11588
11589
11590
11591
11592
11593
11594
11595
11596
11597
11598
11599
11600
11601
11602
11603
11604
11605
11606
11607
11608
11609
11610
11611
11612
11613
11614
11615
11616
11617
11618
11619
11620
11621
11622
11623
11624
11625
11626
11627
11628
11629
11630
11631
11632
11633
11634
11635
11636
11637
11638
11639
11640
11641
11642
11643
11644
11645
11646
11647
11648
11649
11650
11651
11652
11653
11654
11655
11656
11657
11658
11659
11660
11661
11662
11663
11664
11665
11666
11667
11668
11669
11670
11671
11672
11673
11674
11675
11676
11677
11678
11679
11680
11681
11682
11683
11684
11685
11686
11687
11688
11689
11690
11691
11692
11693
11694
11695
11696
11697
11698
11699
11700
11701
11702
11703
11704
11705
11706
11707
11708
11709
11710
11711
11712
11713
11714
11715
11716
11717
11718
11719
11720
11721
11722
11723
11724
11725
11726
11727
11728
11729
11730
11731
11732
11733
11734
11735
11736
11737
11738
11739
11740
11741
11742
11743
11744
11745
11746
11747
11748
11749
11750
11751
11752
11753
11754
11755
11756
11757
11758
11759
11760
11761
11762
11763
11764
11765
11766
11767
11768
11769
11770
11771
11772
11773
11774
11775
11776
11777
11778
11779
11780
11781
11782
11783
11784
11785
11786
11787
11788
11789
11790
11791
11792
11793
11794
11795
11796
11797
11798
11799
11800
11801
11802
11803
11804
11805
11806
11807
11808
11809
11810
11811
11812
11813
11814
11815
11816
11817
11818
11819
11820
11821
11822
11823
11824
11825
11826
11827
11828
11829
11830
11831
11832
11833
11834
11835
11836
11837
11838
11839
11840
11841
11842
11843
11844
11845
11846
11847
11848
11849
11850
11851
11852
11853
11854
11855
11856
11857
11858
11859
11860
11861
11862
11863
11864
11865
11866
11867
11868
11869
11870
11871
11872
11873
11874
11875
11876
11877
11878
11879
11880
11881
11882
11883
11884
11885
11886
11887
11888
11889
11890
11891
11892
11893
11894
11895
11896
11897
11898
11899
11900
11901
11902
11903
11904
11905
11906
11907
11908
11909
11910
11911
11912
11913
11914
11915
11916
11917
11918
11919
11920
11921
11922
11923
11924
11925
11926
11927
11928
11929
11930
11931
11932
11933
11934
11935
11936
11937
11938
11939
11940
11941
11942
11943
11944
11945
11946
11947
11948
11949
11950
11951
11952
11953
11954
11955
11956
11957
11958
11959
11960
11961
11962
11963
11964
11965
11966
11967
11968
11969
11970
11971
11972
11973
11974
11975
11976
11977
11978
11979
11980
11981
11982
11983
11984
11985
11986
11987
11988
11989
11990
11991
11992
11993
11994
11995
11996
11997
11998
11999
12000
12001
12002
12003
12004
12005
12006
12007
12008
12009
12010
12011
12012
12013
12014
12015
12016
12017
12018
12019
12020
12021
12022
12023
12024
12025
12026
12027
12028
12029
12030
12031
12032
12033
12034
12035
12036
12037
12038
12039
12040
12041
12042
12043
12044
12045
12046
12047
12048
12049
12050
12051
12052
12053
12054
12055
12056
12057
12058
12059
12060
12061
12062
12063
12064
12065
12066
12067
12068
12069
12070
12071
12072
12073
12074
12075
12076
12077
12078
12079
12080
12081
12082
12083
12084
12085
12086
12087
12088
12089
12090
12091
12092
12093
12094
12095
12096
12097
12098
12099
12100
12101
12102
12103
12104
12105
12106
12107
12108
12109
12110
12111
12112
12113
12114
12115
12116
12117
12118
12119
12120
12121
12122
12123
12124
12125
12126
12127
12128
12129
12130
12131
12132
12133
12134
12135
12136
12137
12138
12139
12140
12141
12142
12143
12144
12145
12146
12147
12148
12149
12150
12151
12152
12153
12154
12155
12156
12157
12158
12159
12160
12161
12162
12163
12164
12165
12166
12167
12168
12169
12170
12171
12172
12173
12174
12175
12176
12177
12178
12179
12180
12181
12182
12183
12184
12185
12186
12187
12188
12189
12190
12191
12192
12193
12194
12195
12196
12197
12198
12199
12200
12201
12202
12203
12204
12205
12206
12207
12208
12209
12210
12211
12212
12213
12214
12215
12216
12217
12218
12219
12220
12221
12222
12223
12224
12225
12226
12227
12228
12229
12230
12231
12232
12233
12234
12235
12236
12237
12238
12239
12240
12241
12242
12243
12244
12245
12246
12247
12248
12249
12250
12251
12252
12253
12254
12255
12256
12257
12258
12259
12260
12261
12262
12263
12264
12265
12266
12267
12268
12269
12270
12271
12272
12273
12274
12275
12276
12277
12278
12279
12280
12281
12282
12283
12284
12285
12286
12287
12288
12289
12290
12291
12292
12293
12294
12295
12296
12297
12298
12299
12300
12301
12302
12303
12304
12305
12306
12307
12308
12309
12310
12311
12312
12313
12314
12315
12316
12317
12318
12319
12320
12321
12322
12323
12324
12325
12326
12327
12328
12329
12330
12331
12332
12333
12334
12335
12336
12337
12338
12339
12340
12341
12342
12343
12344
12345
12346
12347
12348
12349
12350
12351
12352
12353
12354
12355
12356
12357
12358
12359
12360
12361
12362
12363
12364
12365
12366
12367
12368
12369
12370
12371
12372
12373
12374
12375
12376
12377
12378
12379
12380
12381
12382
12383
12384
12385
12386
12387
12388
12389
12390
12391
12392
12393
12394
12395
12396
12397
12398
12399
12400
12401
12402
12403
12404
12405
12406
12407
12408
12409
12410
12411
12412
12413
12414
12415
12416
12417
12418
12419
12420
12421
12422
12423
12424
12425
12426
12427
12428
12429
12430
12431
12432
12433
12434
12435
12436
12437
12438
12439
12440
12441
12442
12443
12444
12445
12446
12447
12448
12449
12450
12451
12452
12453
12454
12455
12456
12457
12458
12459
12460
12461
12462
12463
12464
12465
12466
12467
12468
12469
12470
12471
12472
12473
12474
12475
12476
12477
12478
12479
12480
12481
12482
12483
12484
12485
12486
12487
12488
12489
12490
12491
12492
12493
12494
12495
12496
12497
12498
12499
12500
12501
12502
12503
12504
12505
12506
12507
12508
12509
12510
12511
12512
12513
12514
12515
12516
12517
12518
12519
12520
12521
12522
12523
12524
12525
12526
12527
12528
12529
12530
12531
12532
12533
12534
12535
12536
12537
12538
12539
12540
12541
12542
12543
12544
12545
12546
12547
12548
12549
12550
12551
12552
12553
12554
12555
12556
12557
12558
12559
12560
12561
12562
12563
12564
12565
12566
12567
12568
12569
12570
12571
12572
12573
12574
12575
12576
12577
12578
12579
12580
12581
12582
12583
12584
12585
12586
12587
12588
12589
12590
12591
12592
12593
12594
12595
12596
12597
12598
12599
12600
12601
12602
12603
12604
12605
12606
12607
12608
12609
12610
12611
12612
12613
12614
12615
12616
12617
12618
12619
12620
12621
12622
12623
12624
12625
12626
12627
12628
12629
12630
12631
12632
12633
12634
12635
12636
12637
12638
12639
12640
12641
12642
12643
12644
12645
12646
12647
12648
12649
12650
12651
12652
12653
12654
12655
12656
12657
12658
12659
12660
12661
12662
12663
12664
12665
12666
12667
12668
12669
12670
12671
12672
12673
12674
12675
12676
12677
12678
12679
12680
12681
12682
12683
12684
12685
12686
12687
12688
12689
12690
12691
12692
12693
12694
12695
12696
12697
12698
12699
12700
12701
12702
12703
12704
12705
12706
12707
12708
12709
12710
12711
12712
12713
12714
12715
12716
12717
12718
12719
12720
12721
12722
12723
12724
12725
12726
12727
12728
12729
12730
12731
12732
12733
12734
12735
12736
12737
12738
12739
12740
12741
12742
12743
12744
12745
12746
12747
12748
12749
12750
12751
12752
12753
12754
12755
12756
12757
12758
12759
12760
12761
12762
12763
12764
12765
12766
12767
12768
12769
12770
12771
12772
12773
12774
12775
12776
12777
12778
12779
12780
12781
12782
12783
12784
12785
12786
12787
12788
12789
12790
12791
12792
12793
12794
12795
12796
12797
12798
12799
12800
12801
12802
2019-10-17  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.cc (trees_out::decl_value): Stream thunks too.
	(trees_out::decl_node): Forward all potentially mergeable decls to
	decl_value.
	(trees_out::tree_value): Make sure we don't get any potentially
	mergeable decls.
	(trees_{in,out}::tree_value): Stream template parms
	via tpl_parms.
	(trees_{in,out}::tpl_parms): The vector can be 0 length.
	(trees_out::mark_declaration): Don't mark the template parms.

	gcc/cp/
	* module.cc (trees_{in,out}::tpl_parms): Cope with non-shared
	parms.
	(trees_{in,out}::tpl_parms_fini): Likewise, stream vec type.

	gcc/cp/
	* cp-objcp-common.c (cp_pushdecl): Set DECL_CONTEXT.
	gcc/testsuite/
	* g++.dg/modules/builtin-3_[ab].C: New.

	gcc/cp/
	* module.cc (trees_{in,out}::decl_value): Refactor some ifs.

2019-10-16  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* decl.c (cp_make_fname_decl): Set context to global namespace,
	outside functions.
	(builtin_function_1): Merge into ...
	(cxx_builtin_function): ... here.  Nadger the decl before maybe
	copying it.  Set the context.
	(cxx_builtin_function_ext_scope): Push to top level, then call
	cxx_builtin_function.

	gcc/cp/
	* rtti.c (get_tinfo_desc): Set DECL_CONTEXT.
	gcc/testsuite/
	* g++.dg/modules/tinfo-1.C: New.

	gcc/cp/
	* module.cc (enum tree_tag): Add tt_parm.
	(trees_out::decl_node): Emit tt_parm for parms.
	(trees_in::tree_node): Add tt_parm.
	(trees_out::write_function_def): Simply tag constexpr parms &
	result.
	(trees_in::read_function_def): Clone the originating fn's parms &
	result.
	(module_state::read): Add GC points, when lazy.

2019-10-15  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.cc (trees_out::core_vals): Don't assert template
	arguments visited.
	(trees_{in,out}::tpl_parms): Stream TMPL_DEPTH.
	(trees_{in,out}::tpl_parms_fini): New.
	(trees_{in,out}::decl_value): Don't stream template parms, use
	tpl_parms_fini.

	gcc/cp/
	* module.cc (trees_out::get_container): New, broken out of ...
	(trees_out::key_mergeable): ... here.  Add container parm.
	(trees_in::key_mergeable): Container is already set.
	(trees_{in,out}::decl_value): Stream container here.
	(dpset::hash::find_dependencies): Adjust mergeable walk.
	gcc/testsuite/
	* g++.dg/modules/builtin-1_a.C: Adjust scan.

	Merge trunk r277002.

	Revert TYPE_LAMBDA_P, it's unnecessary churn.
	gcc/cp/
	* cp-tree.h (LAMBDA_TYPE_P): Subsume TYPE_LAMBDA_P.
	(TYPE_LAMBDA_P): Delete.  Update all uses.

	gcc/cp/
	* module.cc (merge_kind): Add MK_local_friend.
	(trees_{in,out}::tpl_parms): New.
	(trees_{in,out}::tpl_header): Adjust parm streaming
	(trees_{in,out}::key_mergeable): Find containing template.

2019-10-11  Nathan Sidwell  <nathan@acm.org>

	Merge trunk r276888.
	Pull in c++20 concepts.

	gcc/cp/
	* module.cc (trees_{in,out}::core_vals): Don't stream function
	parms here.
	(trees_out::decl_value): Stream has_defn.
	(trees_in::decl_value): Stream has_defn, adjust fn_parms_fini.
	(trees_in::tree_value): Likewise.
	(trees_{in,out}::fn_parms_init): Stream entire parms.
	(trees::fn_parms_fini): Do nothing.
	(trees_in::fn_parms_fini): Add has_defn, adjust.

	gcc/cp/
	* module.cc (enum walk_kind): Remove WK_merge.
	(enum trees_out::tags): Remove tag_merging.
	(trees_out::mark_merged): Delete.
	(trees_out::{insert,ref_node}): Adjust.
	(trees_out::decl_value): Insert by value immediately.

	gcc/cp/
	* optimize.c (maybe_clone_body): Allow aliasing with modules.

	gcc/cp/
	* module.cc (enum depset::entity_kind): Remove EK_CLONE.
	(depset::add_clone): Delete.
	(enum merge_kind): Remove MK_clone.
	(depset::entity_kind_name): Adjust.
	(trees_in::decl_value): No merging for clones.
	(trees_out::decl_node): Remove clone dependency.
	(trees_out::get_merge_kind): No clone merging.
	(trees_{in,out}::key_mergeable): Likewise.
	(module_state::write_cluster): Never see a clone.

	Reconstruct clones on stream in
	gcc/cp/
	* module.cc (trees_out::{decl,tree}_value): Write clone info.
	(trees_in::{decl,tree}_value): Reconstruct clone.
	(trees_out::decl_node): Do not depend on clones.
	(module_state::read_cluster): Clone bodies.

2019-10-10  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* cp-tree.h (DECL_NEEDS_VTT_PARM_P): Delete.
	(build_clones): Declare.
	(ctor_omit_inherited_parms): Add exact_name default parm.
	* class.c (build_clone): Add need_vtt & omit_inherited parms, do
	not calculate here.
	(build_clones): New function.  Add need_vtt &
	omit_inherited_parms.  Broken out of ...
	(clone_function_decl): Call build_clones.  Add to method vec here.
	* method.c (ctor_omit_inherited_parms): Add exact_name parm.
	Detect any ctor or specific base ctor as specified.

2019-10-09  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* class.c (maybe_add_class_template_decl_list): Don't check
	template-id-expr friends.
	* module.cc (friend_from_decl_list): Don't stray into primary
	templates.
	(trees_out::{write,mark}_class_def): Adjust local friend
	detection.
	(trees_in::read_class_def): Likewise.

	gcc/cp/
	* cp-tree.h (DECL_UNINSTANTIATED_TEMPLATE_FRIEND_P): New.
	* module.cc (trees_{in,out}::core_vals): Stream local template
	friend's DECL_CHAIN.
	(trees_out::decl_node): Use DECL_UNINSTANITATED_TEMPLATE_FRIEND_P.
	(trees_out::{read,write,mark}_class_def): Adjust local template
	friend streaming.
	* pt.c (push_template_decl_real): Set
	DECL_UNINSTANTIATED_TEMPLATE_FRIEND_P.
	(tsubst_friend_function): Clear D_U_T_F_P.

	gcc/cp/
	* pt.c (push_template_decl_real): Always set DECL_CHAIN for
	non-pushed friends.

2019-10-08  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.cc (trees_out::decl_value): Check streaming before dump.
	(module_name): Protect from not modules.

	gcc/cp/
	* module.cc (enum merge_kind): Rename non->unique.
	(trees_out::key_mergeable): Add decl parm.  Return MK_unique for
	non-dep decls.
	(trees_{out,out}::decl_value): Adjust.

	gcc/cp/
	* module.cc (struct nodel_decl_hash): New.
	(duplicate_hash_map): New.
	(trees_in::duplicates): New.
	(trees_in::mergeables): Delete.
	(trees_in::{,~}trees_in): Adjust.
	(trees_in::{find,register,unmatched}_duplicate): New.
	(trees_in::{reserve,register,unmcted}_mergeable): Delete.
	(enum trees_in::dupness): Delete DUP_unique.
	(trees_in::decl_value): Adjust duplicate registration.
	(trees_in::get_dupness): Adjust.
	(module_state::{read,write}_cluster): Don't stream mergeable count.

	gcc/cp/
	* module.cc (enum walk_kind): Rename body->value,
	mergeable->merge.  Delete clone, merging.
	(trees_in::decl_value): Drop walk_kind parm, read merge kind
	early.
	(trees_in::key_mergeable): Add merge_kind parm, return bool.
	(trees_out::mark_node): Rename to ...
	(trees_out::mark_by_value): ... here.
	(trees_out::get_merge_kind): New, broken out of ...
	(trees_out::key_mergeable): ... here.  Add merge_kind parm.
	(trees_out::decl_value): Replace walk_kind parm with depset.
	Adjust.
	gcc/testsuite/
	* g++.dg/modules/scc-1.C: Adjust scan.
	* g++.dg/modules/builtin-1_a.C: Adjust scan.

2019-10-07  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.cc (enum trees_out::tags): Delete tag_mergeable,
	tag_cloned.
	(trees_out::mark_mergeable): Delete.
	(trees_out::{insert,ref_node}): Adjust.
	(trees_out::decl_node): Look at depset to determine mergeability.
	(trees_out::key_mergeable): Adjust.
	(trees_in::register_mergeable): Always reserve space.
	(module_state::write_cluster): Don't mark mergeable here.

	gcc/cp/
	* module.cc (trees_in::get_odrness): Check if overrun.
	(trees_in::read_class_def): Add overrun protection.
	* name-lookup.c (name_search::search_adl): Tweak.

	gcc/cp/
	* module.cc (trees_{in,out}::core_vals): Stream
	decl_non_common.result for using decls.
	(trees_out::decl_node): USING_DECLS are done by value.
	* name-lookup.c (finish_nonmember_using_decl): Set DECL_CONTEXT.
	gcc/testsuite/
	* g++.dg/modules/using-6_[ab].C: New.

	gcc/cp/
	* module.cc (enum tree_tag): Add tt_decl.
	(trees_{in,out}::decl_value): Broken out of ...
	(trees_{in,out}::tree_value): ... here.  Deal with non mergeble
	cases only.
	(trees_in::tree_node): Add tt_decl.
	(trees_out::decl_node): Call decl_value.

	gcc/cp/
	* module.cc (trees_out::decl_node): Refactor some instantiation
	discovery.

2019-10-04  Nathan Sidwell  <nathan@acm.org>

	Merge trunk r276597.

	gcc/cp/
	* module.c (trees_out:decl_node): More switchification and code
	movement.

	gcc/cp/
	* module.c (trees_out:decl_node): Switchify, and move some checks
	before template detection.

	gcc/cp/
	* module.cc (trees_in::tree_value): Rework merge_kind switching.
	(trees_{in,out}::key_mergeable): Likewise.

	gcc/cp/
	* module.cc (enum merge_kind): Reorder.

2019-10-03  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.cc (trees_out::decl_node): Merge and reorder tinfo
	streaming.
	(trees_in::tree_node): Merge tinfo streaming.

	gcc/cp/
	* module.cc (depset::hash::add_dependency): Separate EK_REDIRECT
	handling from EK_MAYBE_SPEC.
	(get_instantiating_module_decl): Reorder checks, remove fixme.

	gcc/cp/
	* module.cc (trees_out::decl_node): Check DECL_LANG_SPECIFIC.
	(depset::hash::add_dependency): Likewise.
	(get_originating_module_decl): Return global_namespace for null.
	(get_originating_module): Correctly handle lack of
	DECL_LANG_SPECIFIC.
	(set_instantiating_module): Lazily allocate lang specific.
	(set_originating_module): Call set_instantiating_module.
	* pt.c (build_template_decl, tsubst_template_decl): Check
	DECL_LANG_SPECIFIC.
	* rtti.c (tinfo_base_init): Likewise.

	gcc/cp/
	* module.cc (elf_in::{defrost,begin}): Advise random seeking.

	gcc/cp/
	* module.cc (depset::hash::add_dependency): Drop is_import arg,
	update callers.  Calculate it here.

	gcc/cp/
	* cp-tree.h (MODULE_SLOT_*): Move to ...
	* name-lookup.c (MODULE_SLOT_*): ... here.
	* module.cc (depset::hash::add_dependency): More asserts.
	* pt.c (build_template_decl, tsubst_template_decl): Always
	propagate from result.

2019-10-02  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.cc (trees_out::tree_ctx): Delete, forward all callers to
	tree_node.
	(trees_out::tree_namespace): Delete, move into tree_decl.
	(trees_out::tree_decl): Rename to ...
	(trees_out::decl_node): ... this.  Update caller.

	gcc/cp/
	* module.cc (trees_out::tree_type): Rename to ...
	(trees_out::type_node): Drop walk_kind arg, return void.  Update
	callers.

	gcc/cp/
	* module.cc (trees_out::tree_ctx): Drop need_contents parm.
	Update callers.
	(trees_out::tree_{type,decl}: Likewise.

	gcc/cp/
	* module.cc (trees_out::tree_ctx): Drop inner_decl parm.  Update
	callers.
	(trees_out::tree_namespace): Likewise.

	gcc/cp/
	* cp-tree.h (MK_*): Document better.

	gcc/cp/
	* cp-tree.h (MODULE_CURRENT, MODULE_IMPORT_BASE): Delete.
	* module.cc: Replace with zero/one
	* name-lookup.c: Likewise.
	* decl2.c (no_linkage_error): Likewise.
	* ptree.c (cxx_print_decl): Likewise.

	Don't equivocate GMF with module
	gcc/cp/
	* cp-tree.h (MODULE_NONE, MODULE_PURVIEW): Delete.
	(MODULE_CURRENT): New.
	(MODULE_IMPORT_BASE): Reduce.
	(DECL_MODULE_OWNER): Rename to ...
	(DECL_MODULE_ORIGIN): ... this.
	(DECL_MODULE_PURVIEW_P): New.
	(MODULE_BITS): Reduce.
	(lang_decl_base::module_purview_p): New bit.
	(module_may_redeclare): Take decl.
	* module.cc (MODULE_UNKNOWN_PARTITION): New.
	(MODULE_LIMIT): Adjust.
	(slurping::remap_module): Return int.
	(trees_in::assert_definition): Adjust.
	(dumper::impl::nested_name): Adjust.
	(trees_{in,out}::lang_decl_bits): Stream module_purview_p.
	(trees_out::tree_{namespace,decl,value}): Adjust.
	(trees_in::tree_node): Adjust.
	(depset::hash::add_{dependency,binding,specializations}): Adjust.
	(module_state::check_not_purview): Adjust.
	(module_state::read_{imports,partitions}): Adjust.
	(module_state::write_{cluster,namespaces,unnamed}): Adjust.
	(module_state::read_unnamed): Adjust.
	(module_state::{write,read}): Adjust.
	(module_visible_instantiation_path): Adjust.
	(get_originating_module): Return int.
	(get_instantiating_module): Adjust.
	(module_may_redeclare): Reimplement.
	(set_{instantating,originating}_module): Adjust.
	(module_state::{do,direct}_import): Adjust.
	(declare_module, module_preprocess, process_deferred_imports): Adjust.
	({init,finish}_module_processing): Adjust.
	* name-lookup.c (get_fixed_binding_slot): Adjust.
	(name_lookup::{search_namespace_only,adl_namespace_fns,search_adl):
	Adjust.
	(check_module_override, extract_module_binding): Adjust.
	(note_pending_specializations): Adjust.
	(get_imported_namespaxe, finish_nonmember_using_decl)
	(lookup_type_scope_1): Adjust.
	(add_imported_namespace): Take int.
	* name-lookup.h ({add,get}_imported_namespace): Module is int.
	* class.c (build_self_ref): Set instantiating module.
	* decl.c (duplicate_decls): Adjust.
	* decl2.c (no_linkage_error): Adjust.
	* mangle.c (maybe_write_module): Adjust.
	* pt.c (build_template_decl): Propagate purview flag.
	(tsubst_template_decl): Likewise.
	(tsubst_decl): Set instantiating_module as necessary.
	* ptree.c (cxx_print_decl): Adjust, print purview flag.
	* rtti.c (tinfo_base_init): Clear purview flag.
	gcc/testsuite/
	* g++.dg/modules/*: Update lang dump scans.

2019-10-01  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* cp-tree.h (set_originating_module): Add friend_p.
	* decl.c (grokdeclarator): Set it.
	* module.cc (get_originating_module): Always look through template
	info.
	(set_originating_module): Add friend_p.  Assert.
	(set_instantiating_module): Assert.

2019-09-30  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* cp-tree.h (set_module_owner): Delete.
	* decl.c (duplicate_decls): Propagate module owner.  Set module
	export for builtins, no need to set owner.
	* module.cc (set_module_owner): Delete.
	gcc/testsuite/
	* g++.dg/modules/isalnum.H: New.

2019-09-27  Nathan Sidwell  <nathan@acm.org>

	Merge trunk r276201.

	gcc/cp/
	* decl.c (fixup_anonymous_aggr): Partially revert recent change.
	(grokfndecl): Call set_originating_module before determining
	specialization.
	(grokdeclarator): Likewise.

	gcc/cp/
	* cp-tree.h (set_{originating,instantiating}_module): Declare.
	* class.c (layout_class_type): Use set_instantiating_module.
	* pt.c (lookup_template_class_1): Likewise.
	(tsubst_function_decl, instantiate_template_1): Likewise.
	(tsubst_friend): Not here.
	* decl.c (grokfndecl): Use set_originating_module.
	(grokvardecl,grokdeclarator): Likewise.
	* name-lookup.c (do_pushtag): Likewise.
	* friend.c (do_friend): Not here.
	* module.cc (set_implicit_module_origin): Rename to ...
	(set_instantiating_module): ... here.
	(set_originating_module): New.
	gcc/testsuite/
	* g++.dg/modules/friend-3.C: New.
	* g++.dg/modules/friend-4_[ab].C: New.

	gcc/cp/
	* cp-tree.h (get_module_owner): Delete.
	(get_instantiating_module_decl, get_instantiating_module): Declare.
	* module.cc (get_instantiating_module_decl)
	(get_instantiating_module): New.
	(dumper::impl::nested_name, trees_out::tree_node)
	(trees_out::tree_decl, depset::hash::add_specializations)
	(set_module_owner): Use them.
	(get_module_owner): Delete.

	gcc/cp/
	* cp-tree.h (get_declared_module_origin): Delete.
	(get_originating_module, get_originating_module_decl): Declare.
	* module.cc (get_originating_module_decl): New.
	(get_originating_module): New.
	(module_state::write_cluster, module_visible_instantiation_path): Use
	get_originating_module.
	* module.cc (module_state::write_unnamed)
	(lazy_load_specializations): Use get_originating_module_decl.
	* error.c (dump_module_suffix): Use get_originating_module.
	* mangle.c (maybe_write_module): Likewise.
	* name-lookup.c (init_global_partition): Use
	get_originating_module.
	(name_lookup::search_adl): Use get_originating_module_decl.
	* pt.c (lookup_template_class_1): Propagate DECL_MODULE_EXPORT_P.

2019-09-26  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* cp-tree.h (DECL_MODULE_OWNER): Restrict to
	var/fn/type/template/namespace.
	(MAYBE_DECL_MODULE_EXPORT_P): Delete.
	({set,get}_{declared,implicit}_module_origin): Declare.
	(module_name): Delete and adjust.
	* modules.cc: Adjust throughout for loss of
	MAYBE_DECL_MODULE_EXPORT_P.  Use get_module_owner more.
	(fixup_unscoped_enum_owner): Delete.
	* class.c (layout_class_type): Use set_implicit_module_origin.
	* decl.c (duplicate_decls): Use get_module_owner.
	(finish_enum_value_list): Set DECL_MODULE_EXPORT_P directly.
	* decl2.c (no_linkage_error): Use DECL_MODULE_OWNER.
	* error.c (dump_module_suffix): Reimplement.
	* mangle.c (maybe_write_module): Adjust.
	* name-lookup.c (init_global_partition): Adjust.
	(name_lookup::search_adl): Owner always has module.
	(do_pushdecl): Adjust namespace exporting.
	(do_nonmember_using_decl): Adjust exporting check.
	* pt.c (build_template_decl): Only propagate module info when
	needed.
	(lookup_template_class_1): Use set_implicit_module_origin.
	(tsubst_friend_function): Propagate to outer template.
	(tsubst_function_decl): Use set_implicit_module_origin.
	(tsubst_template_decl): Simplify tsubst if cascade.  Propagate
	inner module info.
	(instantiate_template_1): Use set_module_owner.
	* ptree.c (cxx_print_decl): Protect module info display.
	gcc/testsuite/
	* g++.dg/modules/friend-1_a.C: Adjust scans.
	* g++.dg/modules/indirect-[13]_[bc].C: Likewise.
	* g++.dg/modules/indirect-4_b.C: Likewise.
	* g++.dg/modules/late-ret-3_a.H: Likewise.
	* g++.dg/modules/scc-1.C: Likewise.
	* g++.dg/modules/vmort-2_[abc].C: Likewise.

2019-09-25  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* modules.cc (enum merge_kind): Rearrange.
	(merge_kind_name): Adjust.
	gcc/testsuite/
	* g++.dg/modules/inst_-[234]-[ab].C: Adjust scans.
	* g++.dg/modules/indirect-[234]_b.C: Likewise.

2019-09-24  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* modules.cc (trees_out::tree_decl): RESULT and LABEL decls
	written by value.  Assert only expected things remain by name.

	gcc/cp/
	* modules.cc (enum tree_tag): Add tt_data_member.
	(trees_out::tree_decl): Use it for consts and fields.
	(trees_in::tree_node): Read it.
	(set_implicit_module_owner): Delete.
	* name-lookup.c (get_field_ident, lookup_field_ident): New.
	* name-lookup.h (get_field_ident, lookup_field_ident): Declare.
	* cp-tree.h (set_implicit_module_owner): Delete.
	gcc/testsuite/
	* g++.dg/modules/class-3_[bd].C: Adjust scans.
	* g++.dg/modules/indirect-1_c.C: Likewise.

2019-09-23  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.cc (depset): Add DB_BOTH_SPEC_BIT.
	(specialization_add): Accept template aliases for !decl_p.
	(depset::hash::add_specializations): Notice duplicate
	specialization paths.

2019-09-20  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* decl.c (fixup_anonymous_aggr): Clear LAZY flags, no need to
	strip out fns.
	* module.cc (module_state::lazy_load): Distinguish out of order
	from failure to set slot.
	* name-lookup.c (get_binding_or_decl): Fixme :(
	gcc/testsuite/
	* g++.dg/modules/anon-2{,_[ab]}.[hHC]: New.

2019-09-19  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.cc (enum merge_kind): Add MK_{decl,type}_tmpl_spec,
	MK_type_partual_spec.
	(tree_in::tree_value): Process them.
	(trees_{in,out}::key_mergeable): Stream them.
	* pt.c (match_mergeable_specialization): Only store if spec !=
	NULL.
	gcc/testsuite/
	* g++.dg/modules/tpl-tpl-merge-[12]{,_[ab].[hHC]: New.

	gcc/cp/
	* module.cc (slurping::slurping): Init current to mostpos - 1.
	(module_state::read): Increment slurp->current when done.

	gcc/cp/
	* module.cc (trees_in::tree_node): Check overrun more.

2019-09-18  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.cc (trees_in::is_matching_decl): Copy
	DECL_TEMPLATE_INSTANTIATED.
	gcc/testsuite/
	* g++.dg/modules/inst-5_[ab].[CH]: New.

	gcc/cp/
	* module.cc (trees_in::mergeables): Vec of intptr_t.
	(trees_in::register_mergeable): Return index.
	(trees_in::unmatched_mergeable): New.
	(trees_in::get_dupness): Drop last parm.  Return DUP_bad as
	necessary.  Adjust callers.
	(trees_in::tree_value): Call unmatched_mergeable as necessary.

	gcc/cp/
	* module.cc (trees_in): Delete skip_defns & handling.  Add
	any_deduping field.
	(trees_in::register_mergeable): Outline.
	(trees_in::{enum dupness,get_dupness}): New.
	(trees_in::{enum odrness,get_odrness}): New.
	(trees_in::lookup_mergeable): Delete.
	(trees_in::is_existing_mergeable): Delete, use get_dupness.
	(trees_in::is_skippable_defn): Delete, ise get_odrness.
	(trees_in::assert_definition): Adjust.
	(trees_in::read_{function,class,var,enum}_def): Adjust.
	(topmost_decl): Delete.
	gcc/testsuite/
	* g++.dg/modules/part-3_c.C: Adjust scans.
	* g++.dg/modules/tdef-6_b.C: Adjust scans.

2019-09-17  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.cc (trees_in::is_skippable_defns): Defns always complete
	incomplete.
	gcc/testsuite/
	* g++.dg/modules/merge-3_[ab].[CH]: New.

2019-09-16  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.cc (depset::DB_TYPE_SPEC_BIT): New.
	(depset::is_type_spec): New.
	(enum merge_kind): Replace MK_spec with MK_decl_spec, MK_type_spec.
	(merge_kind_name): Update.
	(trees_in::tree_value): Partition MK_spec handling.
	(trees_{in,out}::key_mergeable): Likewise.
	(depset::hash::add_specialization): Set DB_TYPE_SPEC_BIT.
	gcc/testsuite/
	* g++.dg/modules/indirect-[234]_b.C: Update lang dump scans.
	* g++.dg/modules/inst-[234]_[ab].C: Update lang dump scans.

	gcc/cp/
	* module.cc (spec_tuple): Delete type.
	(specialization_add): Adjust data type.
	(depset::hash::add_specializations): Drop PARTITIONS parm. Adjust.
	(module_state::write): Adjust.

	gcc/cp/
	* cp-tree.h (check_mergeable_specialization): Declare.
	(match_mergeable_specialization): Add DECL_P parm, drop INSERT_P parm.
	* module.cc (trees_in::tree_value): Adjust
	match_mergeable_spcialization calls.
	(specialization_add): Use check_mergeable_specializatio.
	* pt.c (check_mergeable_specialization): New.
	(match_mergeable_specialization): Always insert, reorder parms.

	gcc/cp/
	* module.cc (enum merge_kind): Add MK_linkage.
	(merge_kind_name): ... and here.
	(trees_in::tree_value): Add it.
	(trees_{in,out}::key_mergeable): Use it.
	* name-lookup.c (match_mergeable_decl): Don't add anon-enum.
	gcc/testsuite/
	* g++.dg/modules/builtin-1_a.C: Adjust scan.
	* g++.dg/modules/indirect-[234]_b.C: Likewise.
	* g++.dg/modules/inst-[23]_a.C: Likewise.
	* g++.dg/modules/tdef-6_[ab].[HC]: New.

2019-09-15  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.cc (trees_in::chained_decls): No need to deal with clones here.
	(trees_{in::read,out::write}_class_def): Don't chain
	fields until we know we're the definition.

	Merge trunk r275727.

2019-09-13  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* name-lookup.c (get_namespace_binding): Fish out global binding,
	if it's a vector.
	gcc/testsuite/
	* g++.dg/modules/binding-2.H: New.

	gcc/cp/
	* cp-tree.h (MODULE_VECTOR_LAZY_SPEC_P): Use TREE_THIS_VOLATILE.
	gcc/testsuite/
	* g++.dg/modules/binding-1_[abc].[HC]: New.

2019-09-12  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* cp-tree.def (UNBOUND_CLASS_TEMPLATE): Correct docs.
	* cp-tree.h (make_unbound_class_template_raw): Declare.
	* decl.c (make_unbound_class_template_raw): New, break out of ...
	(make_unbound_class_template): ... this, call it.
	* module.cc (trees_out::tree_type): Handle UNBOUND_CLASS_TEMPLATE.
	(trees_in::tree_node): Likewise.
	gcc/testsuite/
	* g++.dg/modules/tpl-tpl-parm-1_[ab].[HC]: New.

	gcc/cp/
	* module.cc (trees_out::core_vals): Never write template_decl's
	type ...
	(trees_in::tree_value): .. resurrect it here instead.

	gcc/cp/
	* module.cc: Sort many switch stmts.

2019-09-11  Nathan Sidwell  <nathan@acm.org>

	Merge trunk r275641.

2019-09-09  Nathan Sidwell  <nathan@acm.org>

	Merge trunk r275518

	gcc/cp/
	* module.cc (enum depset::disc_bits): Delete DB_REACHED_ONCE_BIT.
	(depset::is_reached_once, depset::clear_mergeable): Delete
	(trees_in::tree_value): Set template typedef type.
	(depset::hash::add_dependency): No reached once stuff.
	(sort_mergeables): Just live with tight clusters.
	gcc/testsuite/
	* g++.dg/modules/late-ret-2_a.H: Adjust scans.
	* g++.dg/modules/late-ret-3_[abc].[CH]: New.

2019-09-06  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.cc (enum depset::disc_bits): Add DB_REACHED_ONCE_BIT.
	(depset::is_reached_once, depset::clear_mergeable): New.
	(depset::hash::add_dependency): Set and clear DB_REACHED_ONCE_BIT.
	(sort_mergeables): Deal with internal entities.
	(module_state::read_cluster): A voldemort might have been merged.
	gcc/testsuite/
	* g++.dg/modules/late-ret-2_[abc].[HC]: New.

	Merge trunk r275458.

2019-09-05  Nathan Sidwell  <nathan@acm.org>

	gcc/testsuite/
	* g++.dg/modules/concept-2_[ab].C: New.

	gcc/cp/
	* module.cc (trees_{in,out}::core_vals): Stream constraint_info.
	(trees_{in,out}::tree_value): Stream constrain node.
	{trees_{in,out}::tpl_header): Stream parm(s) constraints.
	* pt.c (set_constraints): Don't do spurious lookup.
	gcc/testsuite/
	* g++.dg/modules/concept-1_[ab].C: New.

	gcc/cp/
	* module.cc (module_state::write_location): Check streaming here.
	Adjust many callers.

	gcc/cp/
	* module.cc (trees_{in,out}::core_vals): Move some node handling
	into the new switch.

	gcc/cp/
	* module.cc (trees_{in,out}::core_vals): Reorder part 7.
	* decl.c (cp_tree_node_structure): Alphabetize.
	gcc/
	* tree.c (tree_node_structure_for_code): Likewise.

	gcc/cp/
	* module.cc (trees_{in,out}::core_vals): Reorder part 6.

	gcc/cp/
	* module.cc (trees_{in,out}::core_vals): Reorder part 5.

	gcc/cp/
	* module.cc (trees_{in,out}::core_vals): Reorder part 4.

	gcc/cp/
	* module.cc (trees_{in,out}::core_vals): Reorder part 3.

	gcc/cp/
	* module.cc (trees_{in,out}::core_vals): Reorder part 2.

	gcc/cp/
	* module.cc (trees_{in,out}::core_vals): Reorder part 1.

	gcc/cp/
	* module.cc (trees_out::tree_type): There are no indescribable types.

	gcc/cp/
	* module.cc (trees_{in,out}::core_vals): Redo enum underlying type
	streaming.

	Merge trunk r275404.

2019-08-30  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.cc (trees_out::tree_type): Stream ptrmemfuncs at the
	appropriate point.

	gcc/cp/
	* module.cc (trees_in::finish{,_type}): Delete. Move into
	trees_in::tree_value, removing type remapping etc,
	(trees_out::start): Check not streaming an unexpected type.
	(trees_{in,out}::core_vals): Pointers are not streamed.
	(trees_in::tree_value): Move remnants of finish{,_type} here &
	simplify handling.

	gcc/cp/
	* module.cc (trees_out::tree_type): Write non-standard integer
	types here.
	(trees_in::tree_node): Read them here.
	(trees_out::tree_value): We never see a naked type.
	gcc/testsuite/
	* g++.dg/modules/bfield-2_[ab].C: New.

	gcc/cp/
	* module.cc (trees_{in,out}::start): Refactor switch.
	(trees_{in,out}::core_vals): Remove first switch.

	gcc/cp/
	* module.cc (enum streamed_extensions): New.
	(module_state::extensions): New.
	(module_state::write_readme): Adjust.
	(trees_{in,out}::start): Note or check openmp extension.
	(module_state::{read,write}_config): Adjust.
	gcc/testsuite/
	* g++.dg/modules/omp-1_c.C: New.
	* g++.dg/modules/omp-2_[ab].C: New.

	gcc/cp/
	* module.cc (trees_{in,out}::start): Deal with OMP_CLAUSE.
	(trees_{in,out}::core_vals): Likewise.
	gcc/testsuite/
	* g++.dg/modules/omp-1_[ab].C: New.

	gcc/cp/
	* module.cc (friend_from_decl_list): Reimplement.
	(trees_out::tree_decl): When streaming a local template friend
	reference, make sure we find one.

	gcc/cp/
	* module.cc (enum tree_tag): Drop tt_mergeable, tt_clone.
	(trees_out::tree_value): Emit tt_node & kind separately.
	(trees_in::tree_node): Read tt_node kind explicitly.

2019-08-29  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.cc (trees_out::tree_decl): VTTs are just vtables.
	gcc/testsuite/
	* g++.dg/modules/vtt-1_[abc].C: New.

	gcc/cp/
	* module.cc (trees_{in,out}::core_vals): We never see
	TS_CP_ARGUMENT_PACK_SELECT nodes.

	Merge trunk r275034.

2019-08-28  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.cc (struct location_map_info): New.
	(module_state::prepare_locations): Rename to ...
	(module_state::prepare_maps): ... here.  Return a
	location_map_info.
	(module_state::{read,write}_locations): Split to ...
	(module_state::{read,write}_{ordinary,macro}_maps): ... here. Adjust.
	(module_state::{read,write}): Split location map streaming.
	gcc/testsuite/
	* g++.dg/modules/macro-7_[abc].C: New.

	Merge trunk r274992.

2019-08-27  Nathan Sidwell  <nathan@acm.org>

	gcc/c-family/
	* c.opt (fnote-include-translate): Renamed from finclude-translate.
	gcc/
	* doc/invok.texi: Update.
	gcc/cp/
	* module.cc (module_translate_include): Tweak.

2019-08-26  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.cc (note_includes): Renamed from inform_includes.
	(module_translate_include): Emit note, not warning.
	(init_module_processing, handle_module_option): Adjust.
	gcc/c-family
	* c.opt (finclude-translate): Renamed from -Winclude-translate.
	gcc/
	* doc/invoke.texi (finclude-translate): Document.

2019-08-25  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.cc (trees_in::finish): Don't clear PENDING_TEMPLATE here.
	Set IDENTIFIER_VIRTUAL_P if t is a vfunc.
	(trees_out::core_bools): Write PENDING_TEMPLATE as false.
	gcc/testsuite/
	* g++.dg/modules/virt-1_[ab].C: New.

	gcc/cp/
	* module.cc (trees_out::tree_decl): Vtables are distinguished by
	DECL_VIRTUAL_P.

2019-08-23  Nathan Sidwell  <nathan@acm.org>

	Merge trunk r274867.

	gcc/cp/
	* module.cc (trees_out::core_bools): Don't propagate asm_written
	for types.
	(trees_{in,out}::lang_type_bools): Don't stream debug_requested.
	(trees_in::read_{enum,class}_def): Register for debug.
	(finish_module_processing): Don't write module when syntax only.
	gcc/testsuite/
	* g++.dg/modules/debug-1_[ab].C: New.

2019-08-22  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.cc (depset::hash::add_dependency): We should never find a
	redirect.
	(depset::hash::add_redirect): Rename to ...
	(depset::hash::add_partial_redirect): ... here. Mark the redirect
	as unreachable.

	gcc/cp/
	* module.cc (MOD_SNAME_PFX): Resurrect initial dot.
	(elf_out::strtab_write): Elide global namespace.

2019-08-21  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.cc (trees_in::assert_definition): Relax already-present
	assert.

	gcc/cp/
	* module.cc (finish_module_processing): Protect against null
	filename.

	gcc/cp/
	* module.cc (elf_in::release): Reset size too.
	(enum ct_bind_flags): Correct cbf_wrapped value.
	(module_state::read_cluster): Usings may be unwrapped.

	gcc/c-family/
	* c.opt (Winclude-translate*): New family of options.
	gcc/cp/
	* module.cc (inform_includes): New var.
	(module_translate_include): Inform of translations.
	(init_module_processing): Canonicalize inform list.
	(handle_module_option): Process inform options.

	gcc/cp/
	* module.cc (set_cmi_repo): NULL means default init.
	(module_mapper::module_mapper): Default init repo.
	(module_mapper::translate_include): Add LEN parm, create STRING.
	(canonicalize_header_name): Correctly prepend './'.
	gcc/testsuite/
	* g++.dg/modules/ben-1.map: Add $root.
	* g++.dg/modules/gc-2.map: Add $root.
	* g++.dg/modules/map-1.map: Add $root.
	* g++.dg/modules/map-1_b.map: Add $root.

2019-08-20  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.cc (module_state::module_state): Header must be
	.-relative if not absolute.
	(get_module): Validate module name more.
	gcc/testsuite/
	* g++.dg/modules/map-2.{C,map}: New.

	Merge trunk r274747.

	Merge trunk r273943 (Jason's TEMPLATE_INFO changes).

	Merge trunk r273906 (Martin's function_decl.decl_type changes).

2019-08-19  Nathan Sidwell  <nathan@acm.org>

	Merge trunk r273771.

2019-08-04  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* name-lookup.c (get_cxx_dialect_name): Make extern.
	* name-lookup.h (get_cxx_dialect_name): Declare.
	* module.cc (module_state_config::get_opts): Just determine C++
	dialect.
	gcc/testsuite/
	* g++.dg/modules/flag-1_[ab].C: Adjust.

2019-08-01  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.cc (module_state::deferred_macro): Emit warning if at end
	of TU.
	(finish_module_processing): Adjust.
	gcc/
	* doc/invoke.texi (fforce-module-macros): Replace documentation
	with ...
	(Winvalid-imported-macros): ... this.
	gcc/c-family/
	* c.opt (fforce-module-macros): Replace with ...
	(Winvalid-imported-macros): ... this.
	gcc/testsuite/
	* g++.dg/modules/macro-4_[abcdeg].C: Update.
	* g++.dg/modules/macro-5_c.C: Update.

2019-07-28  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.cc (node_template_info): Enums may be function-local.
	gcc/testsuite/
	* g++.dg/modules/enum-7.C: New.

2019-07-27  Nathan Sidwell  <nathan@acm.org>

	gcc/
	* doc/invoke.texi (C++ Modules): Update.

2019-07-24  Nathan Sidwell  <nathan@acm.org>

	Default to gcm.cache directory.
	gcc/cp/
	* cxx-mapper.c (flag_root): Change default.
	(module2bmi): Headers have same suffix.
	(client::action): Prefix root dir to look for bmi.
	gcc/
	* doc/invoke.texi (C++ Module Mapper): Update docs.
	gcc/testsuite/
	* g++.dg/modules/dep-1_[ab].C: Update scans.
	* g++.dg/modules/dep-2.C: Update scans.
	* g++.dg/modules/modules.exp (DEFAULT_REPO): New.
	(dg-module-cmi): Adjust.

	Drop import alias detection, via controlling macros.
	gcc/cp/
	* module.cc (bytes_in::no_more): Delete.
	(module_state::{read,write}_config): Drop controlling macro.
	(module_state::write_readme): Likewise.
	(module_state::read): Drop alias return.
	(module_state::slurp): Delete.  Replace all uses with field
	access.
	(module_state::resolve_alias): Delete.
	(module_state::is_alias): Delete.
	(module_state::read_imports): Drop alias detection.
	gcc/testsuite/
	* g++.dg/modules/alias-[12]_b.C: Drop controlling macro scans.
	* g++.dg/modules/macro-2_c.H: Likewise.
	* g++.dg/modules/macro-3_[abc].[CH]: Likewise.
	* g++.dg/modules/stdio-1_a.H: Likewise.
	* g++.dg/modules/alias-3_*: Delete.
	* g++.dg/modules/sys/alias-3_a.H: Delete.

	Merge trunk r273764.

	gcc/testsuite/
	* g++.dg/modules/alias-2_a.H: Add dg-module-header.
	* g++.dg/modules/alias-3_a.H: Likewise.
	* g++.dg/modules/mod-decl-0-2a.C: std=c++2a.
	* g++.dg/modules/mod-decl-0.C: std=c++17.
	* g++.dg/modules/modules.exp: Add dg-module-header, iterate over
	different c++ stds.

	gcc/cp/
	* module.cc (trees_out::tree_decl): Cope with using decls in the
	binding list.
	gcc/testsuite/
	* g++.dg/modules/enum-6_[ab].[HC]: New.

	gcc/cp/
	* module.cc (enum merge_kind): Add MK_enum.
	(trees_out::tree_decl): Deal with anon enums.
	(trees_in::tree_value): Adjust for MK_enum.
	(trees_{in,out}::tree_node): Adjust tt_enum_int streaming.
	(trees_{in,out}::key_mergeable): Add MK_enum key.
	(depset::hash::add_dependency): Enum values are like using decls.
	(depset::hash::add_binding): Likewise.
	(depset_cmp): Reorder for new requirements.
	(enum ct_bind_flags): Add cbf_wrapped.
	(sort_mergeables): Presume sorted by depset_cmp.
	(module_state::{read,write}_cluster): Adjust.
	* name-lookup.c (check_mergeable_decl): Deal with anon-enum
	proxies.
	gcc/testsuite/
	* g++.dg/modules/enum-1_a.C: Adjust scan.

2019-07-23  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.cc (depset): Rename MARKED to SPECIAL, update all users.

2019-07-22  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* parser.c (cp_parser_class_specifier_1): Fixup a template's type
	with a late exception specifier.
	gcc/testsuite/
	* g++.dg/modules/except-1.C: New.

2019-07-22  Boris Kolpackov <boris@codesynthesis.com>

	gcc/cp/
	* Make-lang.in (MODULE_REVISION): Add git rev, if it's git.

2019-07-16  Nathan Sidwell  <nathan@acm.org>r

	gcc/cp/
	* module.cc (module_state::read_{bindings,namespaces}): Use plain
	vec
	(module_state::read): Adjust.
	(module_state::write_macros): Use plain vec.
	(module_state::deferred_macro): Use plain vec.

	gcc/cp/
	* module.cc (depset::hash::add_writables): Use plain vec.
	(typedef spec_tuple): Use plain vec.
	(depset::hash::add_speciailizations): Correctly init vec.
	(module_state::{read,write}_namespaces): Use plain vec.
	(module_state::{read,write}): Adjust.

	Fix it better.
	gcc/cp/
	* mangle.c (mangle_module_substitution): Offset overflow.
	gcc/testsuite/
	* g++.dg/modules/sym-subst-3_[ab].C: Fix
	* g++.dg/modules/sym-subst-[456].C: New.

	Fix module backref subst.
	gcc/cp/
	* cp-tree.h (mangle_substitution): Rename to ...
	(mangle_module_substitution): ... here.  Drop genecity.
	* mangle.c: Likewise.  Fix mangling.
	* module.cc (module_state::mangle): Adjust.
	gcc/testsuite/
	* g++.dg/modules/sym-subst-1.C: Adjust scan.
	* g++.dg/modules/sym-subst-2_[ab].C: Adjust scan.
	* g++.dg/modules/sym-subst-3_[ab].C: New.

2019-07-09  Nathan Sidwell  <nathan@acm.org>

	gcc/c-family/
	* c-opts.c (c_common_handle_option): Remove {user,system}_search.
	* c.opt ({user,system}-search): Delete.
	(fmodule-header): Undeprecate.
	gcc/cp/
	* module.cc (module_state_config::get_opts): Drop
	OPT_fmodule_header_.
	(handle_module_option): Handle fmodule-header=.
	gcc/
	* gcc.c (cpp_unique_options): Drop {user,system}-search.

2019-07-08  Nathan Sidwell  <nathan@acm.org>

	gcc/c-family/
	* c-common.c (try_to_locate_new_include): Use strcmp and ignore
	zero-line maps.
	gcc/cp/
	* module.cc (finish_module_processing): Inhibit module stats if
	not moduling.

2019-07-07  Nathan Sidwell  <nathan@acm.org>

	Merge trunk r273185.

	libcpp/
	* files.c (cpp_find_failed): Replace with ...
	(cpp_found_name): ... this.
	(_cpp_stack_file): Check main_search option.
	* include/cpplib.h (cpp_options): Add main_search.
	* internal.h (cpp_find_failed): Replace with ...
	(cpp_found_name): ... this.
	* init.c (cpp_read_main_file): Examine main_search option.
	gcc/c-family/
	* c-opts.c (c_common_handle_options): Add OPT_{user,system}_search.
	* c.opt (user-search, system-search): New.
	gcc/
	* gcc.c (cpp_unique_options): Add {user,system}-search.

	gcc/
	* module.cc (module_state::write_cluster): Return cluster size.
	(avalable_clusters, loaded_clusters): New static vars.
	(module_state::{read,write}): Adjust.
	(finish_module_processing): Dump more stats.
	gcc/testsuite/
	* g++.dg/module/part-3_c.C: Adjust scan.

	gcc/
	* timevar.def (TV_MODULE_{IMPORT,EXPORT,MAPPER}): Define.
	gcc/cp/
	* module.cc: Include timvar.h.  Sprinkle timevar accounting throughout.

2019-07-05  Nathan Sidwell  <nathan@acm.org>

	Merge trunk r273146.

	Victory!
	gcc/cp/
	* decl2.c (c_parse_final_cleanups): Don't do static init things
	for a header module.
	* module.cc (trees_in::start): Drop unused second parm.
	(module_state::{read,write}_inits): New.
	(trees_out::core_bools): Restrict static->extern hack.
	(module_state::{read,write}_config): Note inits.
	(module_state::{read,write}): Stream inits.
	gcc/testsuite/
	* g++.dg/modules/iostream-1_b.C: Remove ioinit workaround.

	gcc/testsuite/
	* g++.dg/modules/iostream-1_[ab].[HC]: New.

	gcc/cp/
	* module.cc (module_state_config::get_opts): Drop -g* switches.

	gcc/cp/
	* cp-tree.h (get_tinfo_decl_direct): Declare.
	* module.cc (trees_out::tree_decl): Stream more tinfo_var info.
	(trees_in::tree_value): Use get_tinfo_decl_direct for tinfo vars.
	* rtti.c (get_tinfo_decl_direct): Break out of ...
	(get_tinfo_decl): ... here.  Call it.

2019-07-04  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.cc (module_state::read_cluster): finalize_function may
	not GC.

	gcc/cp/
	* module.cc (enum cluster_tag): Add ct_defn.
	(enum ct_decl_flags): Rmove cdf_has_definition.
	(module_state::{read,write}_cluster): Stream definitions after
	declarations..

	gcc/cp/
	* module.cc (trees_{in,out}::key_mergeable): Always stream context.
	gcc/testsuite/
	* g++.dg/modules/merge-1_[ab].[HC]: New.

	gcc/cp/
	* module.cc (trees_out::key_mergeable): Return merge kind.
	(trees_out::tree_value): Note key writing.
	(trees_in::tree_value): Adjust key dump.
	gcc/testsuite/
`	* g++.dg/modules/builtin-1_b.C: Adjust scans.
	* g++.dg/modules/inst-[1234]_b.C: Likewise.
	* g++.dg/modules/part-3_[cd].C: Likewise.

2019-07-03  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.cc (trees_out::tree_type): Add TYPEOF_TYPE, UNDERLYING_TYPE.
	(trees_in::tree_node): Likewise.

	gcc/cp/
	* module.cc (struct unnamed_entity): GTY it.
	(unnamed_map): Not a GTY object.

	gcc/cp/
	* module.cc (trees_{in,out}::fn_parms): Rename to ...
	(trees_{in,out}::fn_arg_types): ... this.
	(trees_{in,out}::fn_parms_{init,fini}): New.
	(trees_{in,out}::tree_value): Call fn_parms_fini.
	(trees_{in,out}::key_mergeable): Call fn_parms_init.
	gcc/testsuite/
	* g++.dg/modules/late-ret-1.H: New.
	* g++.dg/modules/scc-1.C: Adjust scan.

	gcc/cp/
	* module.cc (trees_out::tree_type): Add DECLTYPE_TYPE.
	(trees_in::tree_node): Likewise.

2019-07-02  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.cc (trees_in::core_vals): Protect binfo base reading.
	(module_state::{read,write}_cluster): Insert types for horcrucifexes.
	gcc/testsuite/
	* g++.dg/modules/horcrux-1_[ab].C: New.

	gcc/testsuite/
	Rename bmi->cmi everywhere.

	gcc/cp/
	* cp-tree.h (module_has_cmi_p): Renamed.
	* name-lookup.c (do_nonmember_using_decl): Adjust.
	* module.cc (cmi_*): Renamed.  Adjust all users.

	gcc/cp/
	* module.cc (trees_out::fn_parms): Don't use canonical type any
	more.
	gcc/testsuite/
	* g++.dg/modules/merge-1_[ab].C: New.

	gcc/cp/
	* module.cc (trees_out::tree_decl): Write types for typedefs.
	(trees_in::tree_node): Adjust.
	gcc/testsuite/
	* g++.dg/modules/tdef-5_[ab].C: New.

	gcc/cp/
	* module.cc (trees_out::tree_type): Add pack types.
	(trees_{in,out}::tree_value): Tweak type streaming flags
	(trees_in::tree_node): Add pack types.

	gcc/cp/
	* module.cc (trees_out::tree_type): Detect bound template template
	parm.
	(trees_{in,out}::tree_value): Stream type on any TYPE_DECL that
	its TYPE_STUB_DECL.

	gcc/cp/
	* module.cc (trees_out::tree_type): Add COMPLEX and VECTOR types.
	(trees_in::tree_node): ... and here.

	gcc/cp/
	* module.cc (trees_out::tree_decl): Deal with tinfo vars and
	vtables here ...
	(trees_out::tree_node): ... not here.

	gcc/cp/
	* module.cc (trees_out::tree_decl): Deal with tinfo type_decls
	here.
	(trees_out::tree_type): Dectect tinfo types here ...
	(trees_out::tree_node): ... not here.
	(trees_in::tree_node): Add tinfo type too.

2019-07-01  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.cc (trees_out::tree_decl): Fix dump typo.
	(trees_in::tree_value): Likewise.
	(module_state::read_cluster): Show end.

	gcc/cp/
	* module.cc (module_state::write): Don't stream env.

	gcc/cp/
	* module.cc (trees_in:::read_function_def): Push the template for
	post processing.
	(module_state::read_cluster): Deal with abstract post processing.
	gcc/testsuite/
	* g++.dg/modules/tpl-friend-7_[ab].C: New.

	gcc/cp/
	* module.cc (depset::hash::add_binding): Return added flag.  Deal
	with orphaned using decls.
	(depset::hash::add_writables): Return added flag.
	gcc/testsuite/
	* g++.dg/modules/using-5_[ab].C: New.

	Clones
	gcc/cp/
	* module.cc (enum tree_tag): Add tt_clone_ref.
	(get_clone_target): Replace get_clone_orig.
	(FOR_EVERY_CLONE): New.
	(trees_out::mark_mergeable): Add tag parm.  Adjust.
	(trees_in::chained_decls): Cope with already-linked clones.
	(trees_out::tree_decl): Support clone walking.
	(trees_{in,out}::tree_value): Likewise.
	(trees_in::tree_node): Support tt_clone_ref.
	(trees_{in,out}::key_mergeable): Key clones.
	(trees_out::{mark,write}_definition): No clones here.
	(trees_in::read_definition): Likewise.
	(depset::hash::add_clone): Reimplement.
	(module_state::write_cluster): Deal with clones.
	gcc/testsuite/
	* g++.dg/modules/clone-1_[ab].C: New.
	* g++.dg/modules/friend-1_a.C: Adjust scan.
	* g++.dg/modules/indirect-[1234]_[bc].C: Likewise.
	* g++.dg/modules/inst-3_a.C: Likewise.

2019-06-27  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.cc (depset::entity_kind): Add EK_CLONE.
	(depset::hash::add_clone): New.
	(enum walk_kind): Move to global scope.
	(enum merge_kind): New.
	(trees_{in,out}::tree_value): Use new enums.
	(trees_{in,out}::tree_mergeable): Likewise.
	(get_clone): New.
	(member_owned_by_class): Clones are never owned.
	(trees_out::mark_declaration): Walk clones.
	(trees_in::read_definition): Likewise.
	(trees_out::write_definition): Likewise.
	gcc/testsuite/
	* g++.dg/modules/builtin-1_b.C: Adjust dump scans.
	* g++.dg/modules/inst-1_b.C: Adjust dump scans.
	* g++.dg/modules/part-3_[cd].C: Adjust dump scans.

	gcc/cp/
	* module.cc (trees_{in,out}::core_vals): Stream abstract_origin.

	gcc/cp/
	* class.c (build_clone): Neaten and assert.
	* cp-tree.h (lang_decl_u5.cloned_function): Fix comment.
	* name-lookup.c (get_lookup_ident): Don't fall off end of overload.

	Add -Mno-modules.
	gcc/c-family/
	* c-opts.c (c_common_init_options): Default module deps on.
	(c_common_handle_option): Handle M{no-}modules.
	* c.opt (Mmodules, Mno-modules): New options.
	gcc/
	* doc/cppopts.texi (Mno-modules): Document it.
	* doc/invoke.texi: Likewise.
	* gcc.c (cpp_unique_options): Add it.
	gcc/testsuite/
	* g++.dg/modules/dep-3.C: New.
	libcpp/
	* include/cpplib.h (struct cpp_options): Add dep.modules.
	* include/mkdeps.h: Include cpplib.h
	(deps_write): Take a cpp_reader.
	* init.c (cpp_finish): Adjust deps_write call.
	* mkdeps.c: Include internal.h
	(make_write): Adjust.  Conditionally inhibit module output.
	(deps_write): Adjust.

2019-06-26  Nathan Sidwell  <nathan@acm.org>

	Don't elide primary from partition names.
	gcc/cp/
	* cp-tree.h (module_name): Drop maybe_primary parm.
	* modules (module_state::get_flatname): Just get the flatname.
	(get_primary): New.
	(get_module): Expect fully qualified name.  Drop parent arg.
	Adjust callers.
	(module_stae:set_flatname): Create fully qualified name.
	(module_state::read_{imports,partitions}): Check partitions have
	expected primary.
	(module_state::{read,write}_config): Adjust.
	(module_state::do_import, module_preprocess)
	(finish_module_procesing): Adjust deps_add_module calls.
	* name-lookup.c (make_namespace): Adjust anon namespace name
	creation.
	* ptree.c (cxx_print_decl): Adjust module_name call.
	gcc/testsuite/
	* g++.dg/modules/part-2_d.c: Adjust regexp.
	* g++.dg/modules/part-3_c.c: Adjust scans.
	libcpp/
	* include/mkdeps.h (deps_add_module): Drop primary arg.
	* mkdeps.c (deps_add_module): Drop primary arg.

	Merge trunk r272714.

	gcc/cp/
	* decl.c (duplicate_decls): Non-modules are ok for builtins.
	gcc/testsuite/
	* g++.dg/modules/builtin-2.C: New.

	gcc/cp/
	* module.cc (depset::hash::add_mergeable_horcrux): Add redirect as
	necessary.
	gcc/testsuite/
	* g++.dg/modules/tpl-spec-7.C: New.

	gcc/cp/
	* module.cc (depset::hash::add_redirect): New.
	(depset::hash::add_specialization): Use it.
	(depset::hash::add_mergeable): Use it.
	(depset::hash::add_dependency): Never add a redirect here.

	gcc/cp/
	* module.cc (finish_module_processing): Adjust failed to write error.
	gcc/testsuite/
	* g++.dg/modules/internal-1.C: Adjust.

	gcc/cp/
	* module.cc (depset::entity_kind): Add EK_REDIRECT.
	(tree_out::tree_decl): Cope with redirects.
	(depset::hash::add_dependency): Likewise.
	(depset::hash::add_specialization): Add redirect for partials.
	(depset::hash::add_mergeable): Likewise.
	(module_state::write_cluster): Assert no redirects here.
	(module_state::write): Check redirects here.
	gcc/testsuite/
	* g++.dg/modules/global-3_a.C: Disable.
	* g++.dg/modules/tpl-spec-6_[ab].C: New.

	gcc/cp/
	* module.cc (trees_{in,out}::note_definition): Rename to ...
	 (trees_{in,out}::assert_definition): ... here.  Update callers.

	gcc/cp/
	* cp-tree.h (match_mergeable_specialization): Add insert parm.
	* pt.c (match_mergeable_specialization): Add insert parm.
	* module.cc (depset::entity_kind): Add EK_MAYBE_SPEC.
	(depset::disc_bits): Delete DB_FRIEND_BIT, ADD DB_PSEUDO_SPEC_BIT.
	(depset::is_friend): Delete.
	(depset::is_pseudo_spec): Add.
	(trees_out::tree_decl): Some specializations are findable by name.
	(trees_in::tree_value): Mergeables have an explicit kind.
	(trees_in::tree_node): Protect more.
	(trees_{in,out{::key_mergeable): Explicitly encode key kind.
	(depset::hash::add_dependency): Support EK_MAYBE_SPEC.
	(specialization_add): Add some consistency checking.
	(depset::hash::add_specialization): Specialization might be an
	import.
	(depset::hash::add_mergeable_horcrux): New.
	(sort_mergeables): Add horcrux deps.
	(module_state::write_cluster): Don't mark cdf_is_friend.
	gcc/testsuite/
	* g++.dg/modules/indirect-3_[ab].C: Reenable. Adjust scans.

2019-06-25  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.cc (module_state:note_cmi_name): New.
	(module_state::read_config): Use it.
	(module_state::check_read): Likewise.
	gcc/testsuite/
	* g++.dg/modules/atom-decl-3.C: Adjust diags.
	* g++.dg/modules/atom-preamble-3.C: Likewise.
	* g++.dg/modules/bad-mapper-1.C: Likewise.
	* g++.dg/modules/bad-mapper-3.C: Likewise.
	* g++.dg/modules/circ-1_c.C: Likewise.
	* g++.dg/modules/flag-1_b.C: Likewise.
	* g++.dg/modules/import-2.C: Likewise.
	* g++.dg/modules/mod-stamp-1_d.C: Likewise.
	* g++.dg/modules/p0713-3.C: Likewise.

2019-06-24  Nathan Sidwell  <nathan@acm.org>

	Revert late specialization insertion.
	gcc/cp
	* module.cc (depset): Delete DB_OOT_SPEC_BIT.
	(depset::~depset): Remove deletion.
	(trees_out::key_mergeable): Assert specialization is marked.
	(depset::hash::add_dependency): Assert no late specializations.
	gcc/testsuite
	* g++.dg/modules/modules.exp: Expand dg-module-do capabilities.
	* g++.dg/modules/indirect-3_a.C: Disable.

2019-06-23  Nathan Sidwell  <nathan@acm.org>

	Merge trunk r272583.

2019-06-21  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* modules.cc (depset): Add DB_OOT_SPEC_BIT.
	(depset::~depset): Free the spec entry if we own it.
	(trees_{in,out}::note_definition): Check template result isn't
	there.
	(depset::hash::add_dependency): Correctly insert discovered
	non-member template instantiations.

	gcc/cp/
	* modules.cc (note_defs): New checking hash table.
	(trees_{in,out}::note_definition): New checkers
	(trees_in::read_{function,class,var,enum}_def): Add maybe_template
	arg, use it.  Note definitions.
	(member_owned_by_class): New, extracted from ...
	(trees_out::mark_class_member): ... here.  Call it.
	(trees_out::write_class_def): Only write the owned definitions.
	(trees_out::write_definition): Note definition.
	(trees_in::read_definition): Pass maybe_template to readers.
	(module_state::write): Reset note_defs hash.
	(init_module_processing): Init it.
	(finish_module_processing): Delete it.

	gcc/cp/
	* modules.cc (dumper::operator ()): Print indentation level.
	gcc/testsuite/
	* g++.dg/modules/scc-1.C: Adjust dump scan.

	gcc/cp/
	* modules.cc (node_template_info): Enums are awkwarder.
	gcc/testsuite/
	* g++.dg/modules/enum-4_[ab].C: New.

2019-06-20  Nathan Sidwell  <nathan@acm.org>

	Bitfields.
	gcc/cp/
	* module.cc (tree_out::mark_class_def): Mark bitfield's
	representative field.
	gcc/testsuite/
	* g++.dg/modules/bfield-1_[ab].C: New.

	Thunks.
	gcc/cp/
	* module.cc (enum tree_tag): Add tt_thunk.
	(trees_out::tree_decl): Emit it.
	(trees_out::tree_value): Assert we don't accidentally meet a
	thunk.
	(trees_in::tree_node): Read it.
	(trees_out::{mark,write}_class_def): Emit thunks by value.
	(trees_in::read_class_def): Install thunks.
	gcc/testsuite/
	* g++.dg/modules/thunk-1_[ab].C: New.

	gcc/cp/
	* parser.c (cp_lexer_tokenize): Skip pragmas.
	* lex.c (module_preprocess_token): Likewise.
	gcc/testsuite/
	* g++.dg/modules/pragma-1_[ab].[HC]: New.
	* g++.dg/modules/tname-spec-1_b.C: Move include earlier.

	Deconstruct types.
	gcc/cp/
	* module.cc (enum tree_tag): Add tt_typename_decl,
	tt_derived_type, tt_variant_type.
	(trees_out::tree_decl): Stream typename types.
	(trees_out::tree_type): Emit tt_{derived,variant}_type records.
	(trees_in::tree_node): Add tt_typename_decl, tt_derived_type,
	tt_variant_type handling.
	gcc/testsuite/
	* g++.dg/modules/class-3_b.C: Adjust dump scan.
	* g++.dg/modules/tname-spec-1_[ab].[HC]: New.
	* g++.dg/modules/typename-1_[ab].C: New.

2019-06-19  Nathan Sidwell  <nathan@acm.org>

	Stream mergeables inline.
	gcc/cp/
	* module.cc (depset): Add DB_MERGEABLE_BIT.
	(depset::is_mergeable): New.
	(depset::hash::set_for_mergeable): Delete.
	(trees_{in,out}::tree_mergeable): Delete.
	(tress_{in,out}::key_mergeable): New.
	(trees_out::tags): New enum.
	(trees_out::mark_{mergeable,merged}): New.
	(trees_out::reserve_mergeable,unset_for_mergeable): Delete.
	(trees_out::{insert,ref_node}): Adjust.
	(trees_out::core_vals): Don't stream tpl-tpl-parm contexts.
	(trees_out::tree_decl): tpl-tpl-parms not found by name.
	(trees_{in,out}::tree_value): Stream merging info inline.
	(trees_{in,out}::tpl_header): Take template, not parms.
	(trees_out::mark_declaration): Mark the template parms.
	(depset::hash::find_dependencies): Adjust mergeable walk.
	(depset::hash::add_mergeable): Adjust.
	(module_state::sort_mergeables): Replace with ...
	(sort_mergeables): ... this.
	(enum cluster_tag): Delete ct_mergeable.
	(module_state::write_cluster): Determine mergable ordering
	earlier.  Don't write a mergeable table.
	(module_state::read_cluster): No mergeables to deal with here.
	(module_state::write): Move cluster member dumping to write_cluster.
	* name-lookup.h (match_mergeable_decl): Drop tpl_args parm.
	* name-lookup.c (check_mergeable_decl): Likewise.  Update callers.
	gcc/testsuite/
	* g++.dg/modules/builtin-1_a.C: Adjust dump scans.
	* g++.dg/modules/friend-1_a.C: Likewise.
	* g++.dg/modules/indirect-[234]_[bc].C: Likewise.
	* g++.dg/modules/inst-[23]_[ab].C: Likewise.
	* g++.dg/modules/part-3_[cd].C: Likewise.
	* g++.dg/modules/scc-1.C: Likewise.
	* g++.dg/modules/tpl-friend-[12]_a.C: Likewise.
	* g++.dg/modules/tpl-spec-[12345]_[ab].C: Likewise.
	* g++.dg/modules/vmort-2_b.C: Likewise.

2019-06-18  Nathan Sidwell  <nathan@acm.org>

	Merge trunk r272419.

	gcc/cp/
	* module.cc (specialization_cmp): Deal with more equivalencies.
	(depset_cmp): New, cloned and adjusted from cluster_cmp.
	(depset::hash::connect): Use it.

2019-06-17  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.cc (trees_out::fn_parms): Stream canonical type.
	(depset::hash::add_dependency): Adjust static inline check.
	gcc/testsuite/
	* g++.dg/modules/mutual-friend.ii: New.

2019-06-14  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.cc (depset::hash::add_dependency): Don't register
	internal entities when in a header module.
	(depset::hash::add_binding): Add internal entities in header modules.
	gcc/testsuite/
	* g++.dg/modules/stat-tpl-1_a.H: New.

	gcc/cp/
	* module.cc (depset::hash::add_dependency): Inhibit internal
	linkage setting on functions.
	(cluster_cmp): We can meet matching using decls.

	gcc/cp/
	* module.cc (depset::hash::add_dependency): Unnamed elaborated
	types have no linkage.
	gcc/testsuite/
	* g++.dg/modules/enum-5_[ab].[HC]: New.

	gcc/cp/
	* module.cc (module_state::{read,write}_cluster): Check stat hack
	is for implicit typedefs.

	gcc/cp/
	* module.cc (trees_out::tree_type): Simplify if-tree.

	gcc/cp/
	* module.cc (trees_{in,out}::core_vals): Stream original_type of type of
	typedefs, not their type.
	(trees_out::tree_type): Stream type_name of typedefs.
	(trees_out::tree_value): Insert the type of a typedef.
	(trees_in::tree_value): Reconstruct the type of a typedef.
	gcc/testsuite/
	* g++.dg/modules/tdef-4_[abc].C: New.
	* g++.dg/modules/class-3_b.C: Adjust scan.

	gcc/cp/
	* module.cc (binding_cmp): There can be an implicit and
	non-implicit type_decl.
	* name-lookup.c (check_mergeable_decl): Check implicitness of
	type_decl.

2019-06-13  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.cc (depset::hash::add_specializations): Partial
	instantiations need their template.
	gcc/testsuite/
	* g++.dg/modules/tpl-tpl-mem-1_[ab].C: New.

2019-06-11  Nathan Sidwell  <nathan@acm.org>

	Update Revision number

2019-06-11  Nathan Sidwell  <nathan@acm.org>

	Merge trunk r272149.

2019-06-10  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.cc (module_state::read_location): Don't map
	UNKNOWN_LOCATION to loc.
	(module_state::read_locations): Don't rely on that.
	gcc/testsuite/
	* g++.dg/modules/predef-2{.h,_[ab].C}: New.

	gcc/cp/
	* module.cc (loc_spans::init): Correct macro range ordering.
	(module_state::write_locations): Fix more off-by-ones.
	gcc/testsuite/
	* g++.dg/modules/predef-1.[hC]: New.

2019-06-07  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.cc (module_state::write_env): New.
	(module_state::write): Call it.

	gcc/cp/
	* Make-lang.in (REVISION_c): Don't test it.
	* module.cc (module_state::write_locations): Fix off-by-one thinko.

	gcc/cp/
	* module.cc (loc_spans::init): Add lmaps parm, separate main from
	forced header locs.
	(loc_spans::SPAN_FIRST): New, use it for first span.
	(loc_spans::SPAN_MAIN): Just after the first span.
	gcc/testsuite/
	* g++.dg/modules/macro-5_[abc].[CH]: Adjust.

	gcc/cp/
	* module.cc (dumper::MACRO): New flag.
	(module_state::{write,install}_macros): Use it.
	(module_state::{undef,deferred}_macro): Likewise.
	gcc/
	* doc.invoke (-fdump-lang): Document.
	gcc/testsuite/
	* g++.dg/modules/macro-[35]_[abc].[CH]: Update.

	gcc/cp/
	* module.cc (bytes_out::print_time): New.
	(module_state::write_readme): Dump some environmental data.

2019-06-06  Nathan Sidwell  <nathan@acm.org>

	Update Revision number

2019-06-06  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* Make-lang.in (MODULE_REVISION): Read from Changelog.modules.

2019-06-05  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.cc (dumper::MAPPER): New flag. Use it on mapper things.
	(dumper::push): Only do blank line when starting a new module
	nest.

	gcc/cp/
	* module.cc (trees_out::tree_type): We can meet ttps here.
	(trees_{in,out}::tree_mergeable): Stream skeleton before locating info.
	gcc/testsuite/
	* g++.dg/modules/ttp-3_[ab].C: New.
	* g++.dg/modules/builtin-1_[ab].C: Adjust module scan.
	* g++.dg/modules/indirect-[234]_b.C: Likewise.
	* g++.dg/modules/inst-[1234]_[ab].C: Likewise.

	gcc/cp/
	* module.cc (trees_out::core_vals): Template type parms are their
	own canonical.
	(trees_in::finish_type): Never subst a canonical type parm for the type.
	gcc/testsuite/
	* g++.dg/modules/ttp-2_[ab].C: New.

	gcc/cp/
	* module.cc (global_tree_arys): Add c_global_trees.
	gcc/c-family/
	* c-common.h (enum c_tree_index): Add CTI_MODULE_HWM, move voltale
	entries below it.

	Merge trunk r271953.

	gcc/
	* tree-core.h (enum tree_index): Add TI_MODULE_HWM.
	gcc/cp/
	* cp-tree.h (enum cp_tree_index): Add CPTI_MODULE_HWM, move
	volatile CPTI's below it.
	(CPTI_STD_IDENTIFIER, std_identifier): Delete.
	(DECL_NAMESPACE_STD): Simplify.
	* decl.c (initialize_predefined_identifiers): Drop std_identifier.
	(cxx_init_decl_processing): Adjust std_node creation. Use push/pop
	nested namespace for std.
	(cxx_builtin_function, cxx_builtin_function_ext_scope): Use
	push/pop nested namespace for std.
	* except.c (init_exception_processing): Likewise.
	* rtti (init_rtti_processing): Likewise.
	* module.cc (global_tree_arys): Restrict C & C++ trees.
	* name-lookup.c (push_namespace): Set location if it was a
	builtin.
	gcc/testsuite/
	* g++.dg/modules/std-1_[ab].C: New.

2019-06-04  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* class.c (maybe_add_class_template_decl): Mark (some) local
	templates.
	* module.cc (friend_from_decl_list): Some friends are overloads.
	(trees_{in,out}::core_vals): Stream TREE_VEC CHAIN.
	(trees_out::mark_class_def): Directly mark friend decls.
	gcc/testsuite/
	* g++.dg/modules/tpl-friend-6_[ab].C: New.

	gcc/testsuite/
	* g++.dg/modules/tpl-friend-5_[ab].C: New.

	gcc/cp/
	* name-lookup.c (lookup_type_scope_1): Look in imported slots too.
	gcc/testsuite/
	* g++.dg/modules/class-8_[ab].C: New.

	gcc/cp/
	* name-lookup.c (lookup_type_scope_1): Reimplement, handle local
	and namespace scopes separately.

2019-06-03  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.cc (friend_from_decl_list): New.
	(trees_out::{tree_decl,{write,mark}_class_def}): Use it.
	(trees_in::{tree_node,read_class_def}): Likewise.

	Template friends of templates.
	gcc/testsuite/
	* g++.dg/modules/tpl-tpl-friend-1_[ab].C: New.

	Non-template friends of templates.
	gcc/testsuite/
	* g++.dg/modules/tpl-friend-4_[ab].C: New.

	Non-template friends of templates.
	gcc/cp/
	* module.cc (has_definition): Use DECL_SAVED_TREE.
	(trees_{in,out}::{read,write}_class_def): Stream definitions of
	local friends.
	gcc/testsuite/
	* g++.dg/modules/tpl-friend-3_[ab].C: New.

	Merge trunk r271874.

	Non-template friends of templates.
	gcc/cp/
	* module.cc (depset::disc_bits): Add DB_FRIEND.
	(depset::is_friend): New.
	(enum tree_tag): Add tt_friend_template.
	(trees_out): Add section field, init it.
	(trees_out::tree_decl): Deal with template friends.  Assert lazy
	ordering.
	(trees_in::tree_node): Add tt_friend_template support.
	(trees_{in,out}::{read,write,mark}_class_def):  Deal with friend
	templates.
	(depset::hash::add_dependency): Notice friend templates.
	(depset::hash::add_specializations): Add non-specializations.
	(depset::hash::find_dependencies): Specializations depend on their
	template & args.
	(enum ct_decl_flags): Add cdf_is_friend.
	(module_state::write_cluster): Set it.
	(module_state::write): Add specializations before bindings.
	Expand cluster dump.
	* pt.c (push_template_decl_real): Friend template's DECL_CHAIN
	points at the befriending class.
	gcc/testsuite/
	* g++.dg/modules/tpl-friend-2_[ab].C: New.
	* g++.dg/modules/tpl-friend-1_a.C: Adjust scans.

2019-05-31  Nathan Sidwell  <nathan@acm.org>

	Non-template friends of templates.
	gcc/cp/
	* module.cc (trees_{in,out}::{read,write}_class_def): Stream
	friend lists and decl lists specially.
	(trees_out::mark_class_def): Mark local friend decls.
	(depset::hash::add_specializations): Don't add non-specializations
	that are in the table.
	* pt.c (push_template_decl_real): Mark non-pushed friend templates.
	gcc/testsuite/
	* g++.dg/modules/tpl-friend-1_[ab].C: New.

2019-05-29  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* decl.c (duplicate_decls): Remove duplicate assert.
	* pt.c (build_template_decl): Set RESULT & TYPE of the template
	here ...
	(process_partial_specialization): ... not here ...
	(add_inherited_template_parms): ... nor here ...
	(push_template_decl_Real): ... nor here.  Refactor.
	gcc/
	* doc/invoke.texi (C++ Modules): Document atomicity.
	gcc/fortran/
	* cpp.c (gfc_cpp_add_dep, gfc_cpp_add_target, gfc_cpp_init):
	Rename mrules to mkdeps.

	gcc/cp/
	* module.cc (maybe_add_bmi_prefix): Replace FORCE with LEN_P.
	Set it.
	(create_dirs): Input is guarantueed unique.
	(module_state::check_read): Show full BMI filename in errors.
	(finish_module_processing): Likewise. Rename output atomically.
	gcc/testsuite/
	* g++.dg/modules/atom-decl-3.C: Adjust diagnostics.
	* g++.dg/modules/atom-preamble-3.C: Likewise.
	* g++.dg/modules/bad-mapper-[13].C: Likewise.
	* g++.dg/modules/circ-1_c.C: Likewise.
	* g++.dg/modules/flag-1_b.C: Likewise.
	* g++.dg/modules/import-2.C: Likewise.
	* g++.dg/modules/internal-1.C: Likewise.
	* g++.dg/modules/mod-stamp-1_d.C: Likewise.
	* g++.dg/modules/p0713-3.C: Likewise.

2019-05-28  Nathan Sidwell  <nathan@acm.org>

	* decl.c (duplicate_decls): Assert a template newdecl has no
	specializations.

	Revert inadvertent commits.
	gcc/cp/
	* pt.c (push_template_decl_real): Here.
	* decl.c (duplicate_decls): Here.

	Merge trunk r271702.

2019-05-23  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.cc (loc_spans): Make spans a vec.
	(module_state::{read,write}_locations): Use vec.

	gcc/cp/
	* module.cc (trees_in): Replace auto_vec with vec.

	Template template parms, and a bunch of other stuff
	gcc/cp/
	* cp-tree.h (DECL_TEMPLATE_INFO): Augment docs.
	* module.cc (depset::clear_flag_bit): New.
	(depset::is_unreached): Replace is_implicit_specialization.
	(depset::is_marked): Replace is_first_dep_repurposed.
	(dumper::impl::nested_name): Template args may be NULL.
	(trees_{in,out}::core_vals): Template decl result & args streamed
	with decl.
	(trees_out::tree_decl): TTPs by value.
	(trees_{in,out}::tree_value): Reorder body streaming, stream more
	template bits.
	(trees_out::tree_mergeable): Redo specialization tagging.
	(trees_out::mark_class_def): Only mark decls on decl list.
	(trees_out::mark_declaration): Simplify.
	(depset::hash::add_dependency): Deal with reaching unreached.
	(specialization_add): Grab all instantiations from this TU.
	(depset::hash::add_specialiazations): Determing is_unreached.
	(depset::hash::find_dependencies): Iterate until no more unreached
	reached.
	(module_state::write_unnamed): Adjust.
	* pt.c (tsubst_function_decl): Set DECL_MODULE_OWNER.
	gcc/testsuite/
	* g++.dg/modules/ttp-1_[ab].C: New.
	* g++.dg/modules/indirect-[234]_[bc].C: Adjust scans.
	* g++.dg/modules/inst-[24]_ab.C: Likewise.

	gcc/cp/
	* module.cc (dumper::impl::nested_name): Cope with TTPs.
	(depset:hash::connect): Return the vec.
	(depset::tarjan): Create and return the vec.
	(module_state::write_{bindings,unnamed}): SCCS are in a vec.
	(module_state::write): Likewise.

2019-05-22  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.cc (depset::hash::hash): Create worklist.
	(depset::tarjan::tarjan): Create stack.
	(depset::depset): Create deps.

	Stream binfos properly (again).
	gcc/cp/
	* module.cc (trees_out::mark_node): Binfos may be marked.
	(trees_{in,out}::start): Binfos may be streamed.
	(trees_{in,out}::core_vals): Likewise.
	(trees_{in,out}::tree_node): Reachable binfos may always be
	inserted.
	(trees_{in,out}::{read,write}_binfos): Delete.
	(trees_out::mark_class_def): Mark the binfo heirarchy.
	(trees_{in,out}::{read,write}_class_def): Stream binfos here.

2019-05-21  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.cc (trees_out::mark_declaration): Add do_defn parm, mark
	definition if set.  Adjust callers.
	(trees_out::mark_definition): Merge into mark_declaration.

	Merge trunk r271478.

	Merge trunk r271467.

2019-05-20  Nathan Sidwell  <nathan@acm.org>

	Merge trunk r271420.

2019-05-17  Nathan Sidwell  <nathan@acm.org>

	Merge trunk r271338.

	gcc/cp/
	* module.cc (trees_out::mark_class_member): Add do_defn parm.
	Mark the definition.
	(trees_out::mark_class_def): Adjust.
	(depset::hash::find_dependencies, module_state::write_cluster):
	Use mark_declaration.

	gcc/cp/
	* module.cc (trees_out::mark_node): Drop OUTERMOST parm.  Don't
	consider templateness.
	(trees_out::mark_declaration): New.
	(trees_out::mark_class_member): New.
	(trees_out::mark_class_def): Use mark_class_member.
	(depset::hash::find_dependencies): Adjust.
	(module_state::write_cluster): Likewise.

	gcc/cp/
	* module.cc (trees_{in,out}::tpl_parms): Rename to ...
	(trees_{in,out}::tpl_headr): ... here.  Stream the whole parms.
	(trees_out::tree_type): Assert no surprising
	TEMPLATE_TEMPLATE_PARM.
	(trees_{in,out}::tree_value): Stream template template parms.

2019-05-16  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.cc (dumper::operator ()): Add null check.
	(trees_out::mark_node): Permit fixed nodes.
	(trees_out::tree_decl, trees_in::tree_node): More anon.
	* name-lookup.c (mark_pending_on_decl): Fix field marking thinko.
	(lookup_by_ident): Lookup anon.
	(get_lookup_ident): Likewise.
	gcc/testsuite/
	* g++.dg/modules/anon-1_[abc].C: New.

2019-05-15  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.cc (depset::DB_HIDDEN_BIT): New, add accessors.
	(depset::hash::add_binding): Set hidden binding bit.
	(binding_cmp): Adjust hidden.
	(enum ct_bind_flags): New.
	(module_state::{read,write}_cluster): Reimplement binding flag
	streaming.
	* name-lookup.c (name_lookup::adl_namespace_fns): Skip hidden.
	gcc/testsuite/
	* g++.dg/modules/friend-2_[ab].C: New.

2019-05-14  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.cc (trees_in::tree_value): New, broken out of ...
	(trees_in::tree_node): ... here.  Call it.
	(trees_{in,out}::lang_type_vals): Don't stream befriending classes.
	gcc/testsuite/
	* g++.dg/modules/friend-1_[abc].C: New.

	Cleanup merging, friend streaming.
	gcc/cp/
	* module.cc (trees_{in,out}::tree_mergeable): Reimplement.
	(trees_out::tree_value): Significant adjustment.
	(trees_in::tree_node): Likewise.
	(trees_{in,out}::tree_node_specific): Move into ...
	(trees_{in,out}::tree_node_bools): ... here.
	(trees_out::mark_mergeable): Delete.
	(trees_{in,out}::insert): Adjust.
	(trees_{in,out}::lang_vals): New, broken out of ...
	(trees_node_vals): ... here.  Call them.
	(trees_out::ref_node): Process mergeable cases.
	(trees_{in,out}::tpl_parms): Adjust.
	(trees_{in,out}::{read,write}_class_def): Stream and connect
	friend lists.
	(binding_cmp): Order hidden decls.
	(module_state::write_cluster): Adjust mergeable streaming.
	(module_State::read_cluster): Hide hidden overloads.
	* name-lookup.c (extract_module_binding): Don't skip hidden.
	gcc/testsuite/
	* g++.dg/modules/builtin-1_a.C: Adjust scans.
	* g++.dg/modules/class-3_b.C: Likewise.
	* g++.dg/modules/indirect-[24]_[bc].C: Likewise.
	* g++.dg/modules/inst-[123]_[bcd].C: Likewise.

2019-05-10  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* decl.c (duplicate_decls): Don't check moduleness on friend decl.
	* pt.c (tsubst_friend_function): Set module ownership.

	gcc/cp/
	* module.cc (trees_{in,out}::{read,write}_function_def): Serialize
	FRIEND_CONTEXT.
	(trees_{in,out}::{read,write}_class_def): Reattach befriending classes.

	gcc/cp/
	* decl.c (duplicate_decls): Check and adjust anticipated builtin
	decls.
	* friend.c (do_friend): Set module ownership.
	* module.cc (trees_{in,out}::lang_decl_vals): Conditionally stream
	context and befriending classes.
	* name-lookup.c (init_global_partition): Header unit uses global
	slot.
	* parser.c (cp_parser_template_declaration): Conditionalize export
	warning.

	Partial specializations!
	gcc/cp/
	* module.cc (trees_out::tree_mergeable): Correct finding of
	general template.
	(trees_in::tree_mergeable): Recover a merged partial
	specialization.
	(depset::hash::add_specializations): Deal with partial
	specializations.
	(enum ct_decl_flags): New.
	(module_state::write_cluster): Set specialization flags.
	(module_state::read_cluster): Install specializations.
	(install_specialization): New.
	gcc/testsuite/
	* g++.dg/modules/tpl-spec-5_[ab].C: New.

2019-05-09  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.cc
	gcc/testsuite/
	* g++.dg/modules/indirect-[234]_[bc].C: Adjust module dump scans.
	* g++.dg/modules/inst-[1234]_[ab].C: Likewise.
	* g++.dg/modules/vmort-2_c.C: Likewise.

	Atomically mark template's DECL_TEMPLATE_RESULT, IMPLICIT_TYPEDEF's type
	gcc/cp/
	* module.cc (enum tree_tag): Replace
	tt_{primary,secondary}_type with tt_typedef.
	(trees_out::mark_node): Mark the template_decl.
	(trees_out::maybe_insert_typeof): Delete.
	(trees_out::tree_decl): Stream the template_decl, name implicit
	templates. Always mark result & type.
	(trees_out::tree_type): Simplify implicit_typedef streaming.
	(trees_out::tree_value): Assert correct ordering.
	(trees_in::tree_node): Adjust tt switch.  Insert result & type.
	(module_state::{read,write}_cluster): Always add voldemort's type.
	gcc/testsuite/
	* g++.dg/modules/class-3_[bd].C: Adjust module dump scans.
	* g++.dg/modules/indirect-[234]_[bc].C: Likewise.
	* g++.dg/modules/inst-[234]_[ab].C: Likewise.
	* g++.dg/modules/stdio-1_a.H: Likewise.
	* g++.dg/modules/using-4_a.C: Likewise.

2019-05-07  Nathan Sidwell  <nathan@acm.org>

	gcc/testsuite/
	* g++.dg/template/pr39425.C: Adjust errors.
	* g++.old-deja/g++.pt/spec20.C: Adjust errors.

	Merge trunk r270943.

2019-05-06  Nathan Sidwell  <nathan@acm.org>

	libcpp/
	* include/mkdeps.h: Rename struct mrules to struct mkdeps.
	* mkdeps.c: Likewise.
	* include/cpplib.h (cpp_get_deps): Rename return type..
	* directives.c (cpp_get_deps): Likewise.
	* internal.h (struct cpp_reader): Rename deps field type.
	gcc/cp/
	* cp-tree.h (module_preprocess): Adjust first arg type.
	* module.cc: Rename mrules to mkdeps.
	* lex.c (module_preprocess_token): Rename mrules->mkdeps.
	gcc/c-family/
	* c-opts.c (handle_defered_opts): Rename struct deps to struc mkdeps.

	gcc/cp/
	* module.cc (enum tree_tag): Delete tt_builtin.
	(trees_out::tree_decl): Builtins are merely GMF entities.
	(tree_in::tree_node): Delete tt_builtin handling.
	* name-lookup.c (init_global_partition): New.
	(get_fixed_binding_slot): Populate global & partition slots.
	gcc/testsuite/
	* g++.dg/modules/builtin-1_[ab].C: Adjust scans.
	* g++.dg/modules/by-name-1.C: Likewise.

	gcc/cp/
	* cp-tree.h (global_purview_p): New.
	(module_header_p): Rename to ...
	(header_module_p): ... this.
	(named_module_p): New.  Replace ...
	(module_not_header_p): ... this.
	(module_global_p): ... delete.
	* module.cc (trees_out::tree_mergeable, module_state::write)
	(module_cpp_undef, finish_module_processing): Adjust.
	* name-lookup.c (get_fixed_binding_slot, record_mergeable_decl)
	(check_module_override, make_namespace): Adjust.
	* parser.c (cp_parser_translation_unit, cp_parser_module_name): Adjust.

2019-05-02  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* cp-tree.h (spec_entry): Moved from pt.c.
	(walk_specializations): Declare.
	(get_specializations_for_module): Delete.
	* module.cc (depset):  Add DB_FIRST_BIT.
	(depset::{is,set}_first_dep_repurposed): New.
	(depset::{,tarjan::}connect): Drop for_mergeable parm, use
	is_first_dep_repurposed instead.
	(spec_tuple): New.
	(specialization_add): New.
	(specialization_cmp): Adjust.
	(depset::hash::add_specializations): Reimplement.
	(depset::hash::add_mergable): Set set_first_dep_repurposed.
	(module_state::sort_mergeables): Adjust.
	(module_state::write): Likewise.
	* pt.c (spec_entry): Move to cp-tree.h
	(get_specializations, get_specializations_for_module): Replace
	with ...
	(walk_specializations): ... this.
	gcc/testsuite/
	* g++.dg/modules/inst-1_b.C: Adjust scans.

2019-05-01  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.cc (depset): Add DB_PARTIAL_BIT,
	is_partial_specialization, set_implicit_specialization.
	(depset::hash::add_dependency): Drop is_implicit parm.  Return the
	depset.
	(trees_out::tree_decl): Set the implicit bit myself.
	(depset::hash::add_specializations): Preliminary tweak.

	gcc/cp/
	* pt.c (get_specializations): Adjust type template checking.
	(get_specializations_for_module): Get the type specializations
	too.
	gcc/testsuite/
	* g++.dg/modules/tpl-spec-4_[ab].C: New.

	gcc/cp/
	* module.cc (set_module_owner): Deal with specializations.
	* name-lookup.c (mark_pending_on_decl): Walk class members.
	gcc/testsuite/
	* g++.dg/modules/tpl-spec-3_[ab].C: New.

	gcc/cp/
	* parser.c (cp_parser_explicit_specialization): Correctl unwind state.
	* decl.c (grokfndecl): Set module ownership after specializationness
	is known.

	libcpp/
	* macro.c (_cpp_new_macro): memset before initing.

	gcc/cp/
	* module.cc (module_state::write_bindings): Iterate over sccs
	array, not hash table.
	(module_state::write): Adjust.

	libcpp/
	* macro.c (_cpp_new_macro): Initialize imported field.

	Merge trunk r270765.

2019-04-30  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* cp-tree.h (module_normal_import_p): Declare.
	* module.cc (module_normal_import_p): New.
	* name-lookup.c (note_pending_specializations): Note already
	loaded normal imports.
	gcc/testsuite/
	* g++.dg/modules/tpl-spec-2_d.C: New

	gcc/testsuite/
	* tpl-spec-2_[abc].C: New.

	Namespace-scope function specializations.
	gcc/cp/
	* cp-tree.h (MODULE_VECTOR_LAZY_{PARTITION,GLOBAL}_SPEC_P):
	Delete.
	* module.cc (struct specset): New.
	(module_for_unnamed): New.
	(lazy_load_specializations): New.
	(module_state::{read,write}_unnamed): Register the
	specializations.
	({init,finish}_module_processing): Adjust.
	* name-lookup.c (mark_pending_on_decl, mark_pending_on_binding):
	New.
	(set_module_binding): If pending, mark the new decls.
	(note_pending_specializations, note_loaded_specializations): New
	* name-lookup.h (note_pending_specializations)
	(note_loaded_specializations): Declare.
	gcc/testsuite/
	* g++.dg/modules/tpl-spec-1_[ab].C: New.

2019-04-29  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* cp-tree.h (MODULE_VECTOR_LAZY_SPEC_P)
	(MODULE_VECTOR_LAZY_GLOBAL_SPEC_P)
	(MODULE_VECTOR_LAZY_PARTITION_SPEC_P): New.
	* module.cc (struct unnamed_entity): New.
	(unnamed_ary): Array of unnamed_entity.
	(module_state::write_cluster): Return void.
	(module_state::{read,write}_unnamed): Deal with specializations.
	(module_State::{read,write}_specializations): Delete.
	(module_state::read_cluster): Adjust.
	(module_state_config): Drop specialization count.
	(module_state::{read,write}_config): Adjust.
	(module_state::{read,write}): Drop specialization streaming.

	Merge trunk r270644. (GCC 10)

	gcc/cp/
	* modules.cc (depset::hash::add_depednency): More STRIP_TEMPLATE.

2019-04-25  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* cp-tree.h (get_specializations_for_module): Declare.
	* module.cc (depset): Add DB_IMPLICIT_BIT,
	is_implicit_specialization.
	(depset::hash::add_dependency): Add is_implicit arg.  Allow NULL
	current.  Set is_imolicit_specialization.
	(module_state::write_specializations): Implement.
	(trees_out::tree_decl): Stream specializations.
	(specialization_cmp): New.
	(depset::hash::add_specializations): New.
	(module_state::write_cluster): Count specializations.
	(module_state::write): Add and stream specializations.
	* pt.c (spec_hash_table): New typedef.  Use it.
	(get_specializations): New.
	(get_specializations_for_module): New.

2019-04-24  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* cp-tree.h (DECL_TEMPLATE_LAZY_SPECIALIZATIONS_P): New.
	(lazy_load_specializations): Declare.
	* module.cc (module_state::{read,write}_specializations): New.
	(module_state::write_cluster) Return template count.
	(module_state_config): Add num_specializations.
	(module_state::{read,write}_config): Stream it.
	(module_state::{read,write}): Stream spcializizations.
	(lazy_load_specializations): New.
	* pt.c (lookup_template_class_1, instantiate_template_1): Lazy
	load specializations.

	Merge trunk r270543.

	Instantiations now streamed.
	gcc/cp/
	* module.cc (tree_tag): Delete tt_inst.
	(trees_out::tree_decl): All instantiations are depended.  Never
	tt_inst.
	(trees_in::tree_node): Delete tt_inst handling.
	(trees_in::tree_mergeable): Deal with type specializations.
	* pt.c (lookup_template_class_1): Set instatiation owner to
	current TU.
	(match_mergable): Accept type.
	gcc/testsuite/
	* g++.dg/modules/indirect-[234]_[bc].C: Adjust scans.
	* g++.dg/modules/inst-[34]_[bc].C: New.

2019-04-23  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* cp-tree.h (module_name): New overload.
	* module.cc (dumper::impl::nested_name): Adjust module dump.
	(module_name): New.
	* error.c (dump_module_suffix): Dump for namespace-scope decl.
	(dump_aggr_type): Dump module suffix.
	gcc/testsuite/
	* g++.dg/modules/adhoc-1_b.C: Adjust regexps.
	* g++.dg/modules/err-1_[cd].C: Likewise.
	* g++.dg/modules/macloc-1_[cd].C: Likewise
	* g++.dg/modules/by-name-1.C: Adjust scans.
	* g++.dg/modules/class-3_[bd].C: Likewise.
	* g++.dg/modules/enum-1_a.C: Likewise.
	* g++.dg/modules/global-[23]_a.C: Likewise.
	* g++.dg/modules/indirect-[1234]_[bc].C: Likewise.
	* g++.dg/modules/inst-[12]_[ab].C: Likewise.
	* g++.dg/modules/part-3_c.C: Likewise.
	* g++.dg/modules/scc-1.C: Likewise.
	* g++.dg/modules/stdio-1_a.H: Likewise.
	* g++.dg/modules/using-4_a.C: Likewise.
	* g++.dg/modules/vmort-2_[abc].C: Likewise.

	gcc/cp/
	* module.cc (trees_{in,out}::tree_mergeable): Stream more for
	specializations.

	gcc/cp/
	* module.cc (trees_{in,out}::core_vals): Don't stream template
	instantiations.
	(trees_{in,out}::tree_mergeable): Refactor.
	(module_state::prepare_locations): Fix dumper.

	gcc/cp/
	* Make-lang.in: Wedge revision number into REVISISON_s.

	Function instantiation merging
	gcc/cp/
	* cp-tree.h (get_module_owner): Add tpl_owner parm.
	(match_mergeable_specialization): New.
	* mangle.c (maybe_write_module): Look through template
	instantiations.
	* method.c (implicitly_declare_fn): Do not set owner here.
	* module.cc (trees_out::tree_decl): Namespace-scope function
	instantiations are merged.
	(trees_in::tree_node): Likewise.
	(trees_{in,out}::tree_mergeable): Allow instantiation merging.
	(depset::hash::add_dependency): Specializations are unnameable.
	(module_state::write_cluster): Seed specializations too.
	(module_state::read_define): Fix size_t/unsigned mismatch.
	(module_visible_instantiation_path): Use TYPE_STUB_DECL.
	(get_module_owner): Add inst_owner_p arg.  Look through
	instantiation, or don't.
	* pt.c (instantiate_template_1): Set module owner here.
	(instantiate_decl): ... not here.
	(match_mergeable_decl): New.
	gcc/testsuite/
	* lib/scanlang.exp (scan-lang-dump-times): New. Cut-paste fu!
	* g++.dg/modules/inst-[12]_[ab].C: New.
	* g++.dg/modules/adl-1_c.C: Comment.
	* g++.dg/modules/indirect[234]_[bc].C: Adjust.

2019-04-12  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* Make-lang.in (MODULE_REVISION): New.
	* module.cc (dumper::impl::nested_name): Print module number.
	(module_state::write_readme): Write revision.
	gcc/testsuite/
	* g++.dg/modules/by-name-1.C: Adjust scans.
	* g++.dg/modules/class-3_[bd].C: Likewise.
	* g++.dg/modules/enum-1_a.C: Likewise.
	* g++.dg/modules/global-[23]_a.C: Likewise.
	* g++.dg/modules/indirect-[1234]_[bc].C: Likewise.
	* g++.dg/modules/part-3_c.C: Likewise.
	* g++.dg/modules/scc-1.C: Likewise.
	* g++.dg/modules/stdio-1_a.H: Likewise.
	* g++.dg/modules/using-4_a.C: Likewise.
	* g++.dg/modules/vmort-2_[abc].C: Likewise.

	gcc/cp/
	* module.cc (dumper::impl::nested_name): Remove namespace owner
	fiddling.
	* name-lookup.c (make_namespace): Don't set owner.  Adjust callers.

	Ownership only on namespace-scope.
	gcc/cp/
	* module.cc (dumper::impl::nested_name): Show decl's ownership.
	(trees_out::tree_decl): Remove unnecessary unnameable code.
	(depset::hash::add_dependency): Add is_import parm.
	(module_state::write_clister): Get owner decl of unnamed.
	(get_module_owner): Always look at the namespace-scope entity.
	(set_module_owner): Only set namespace-scope entity.
	(set_implicit_module_owner): Likewise.
	gcc/testsuite/
	* g++.dg/modules/by-name-1.C: Adjust scans.
	* g++.dg/modules/class-3_[bd].C: Likewise.
	* g++.dg/modules/enum-1_a.C: Likewise.
	* g++.dg/modules/global-[23]_a.C: Likewise.
	* g++.dg/modules/indirect-[1234]_[bc].C: Likewise.
	* g++.dg/modules/part-3_c.C: Likewise.
	* g++.dg/modules/scc-1.C: Likewise.
	* g++.dg/modules/stdio-1_a.H: Likewise.
	* g++.dg/modules/using-4_a.C: Likewise.
	* g++.dg/modules/vmort-2_[abc].C: Likewise.

2019-04-11  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* mangle.c (decl_is_template_id): Rename to ...
	(maybe_template_info): ... here.  Simplify API.
	(mangle_return_type, write_encoding, write_name)
	(write_nested_name, write_prefix, write_template_prefix)
	(write_unqualified_name): Update all callers.

	gcc/cp/
	* module.cc (module_for_{ordinary,macro}_loc): New.
	(module_state::{read,write}_location): Deal with imported locations.

	gcc/cp/
	* module.cc (depset::entity_kind_name): Tweak.
	(trees_{in,out}::tree_mergeable): Frob context.
	* name-lookup.h (match_mergeable_decl): Pass context explicitly.
	* name-lookup.c (match_mergeable_decl): Pass context explicitly.
	gcc/testsuite/
	* g++.dg/modules/global-[23]_a.C: Adjust scans.
	* g++.dg/modules/stdio-1_a.H: Likewise.

	gcc/cp/
	* module.cc (loc_kind): New.
	(module_state::{read,write}_location): Use tagging, compress macro
	& adhoc better.

	gcc/cp/
	* module.cc (loc_spans): Main span is all but reserved.
	(slurping): Drop pre_early_ok.
	(loc_spans::init): Don't push command line and forced header
	spans.
	(loc_spans::macro): Fix comparison thinko.
	(module_state::read_location): No such thing as early.
	(module_state::prepare_locations): Drop command line and forced
	header handling.
	(maybe_add_macro): Ignore lazy macros.
	(canonicalize_header_name): Return the buffer.
	gcc/testsuite/
	* g++.dg/modules/macro-5_c.C: Adjust regexp.

2019-04-10  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.cc (module_preprocess): Module partitions always produce
	a BMI.
	gcc/testsuite/
	* g++.dg/modules/dep-2.C: New.

	gcc/cp/
	* module.cc (module_state::write_cluster): Remove unnecessary
	check & FIXME.

	gcc/cp/
	* module.cc (trees_out::depending_p): Delete.
	(trees_out::tree_decl): Refactor asserts.
	(module_state::write_cluster): Refactor initial scan.

	libcpp/
	* mkdeps.c (deps_add_module): Swap primary & module args.  Too
	confusing.
	gcc/cp/
	* module.cc (module_state::do_import, module_preprocess)
	(finish_module_processing): Adjust.

2019-04-09  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.cc (slurping): Move {ordinary,macro}_locs to ..
	(module_state): ... here.
	(module_state::read_location): Adjust.
	(module_state::read_locations): Adjust, recorded locations are for
	current TU.

	gcc/cp/
	* module.cc (get_module): Add parent option, use it.
	(module_state::read_{imports,partitions}): Adjust.
	(finish_module_processing): Show full module name on error.
	gcc/testsuite/
	* g++.dg/modules/ben-1{_[ab].C,.map}: New.
	* g++.dg/modules/alias-1_f.C: Use [srcdir].
	* g++.dg/modules/gc-2_a.C: Likewise.
	* g++.dg/modules/inc-xlate-1_d.C: Likewise.
	* g++.dg/modules/legacy-6_[cdef].C: Likewise.
	* g++.dg/modules/map-1_[ab].C: Likewise.

	gcc/cp/
	* module.cc (depset::is_imported_entity): New.
	(module_for_unnamed): Delete.
	(depset::hash::add_dependency): Note imported dependencies.
	(module_state::{read,write}_cluster): Deal with imported unnamed.
	(module_state::write): Skip imported dependencies.
	gcc/testsuite/
	* g++.dg/modules/vmort-2_[abc].C: New.

	libcpp/
	* mkdeps (munge): Quote ':'.
	(deps_add_module): Correct partion/module order.
	(make_write): Add .c++m suffix to module name.
	gcc/testsuite/
	* g++.dg/modules/dep-1_[ab].C: New.

	libcpp/
	* mkdeps (mkrules::~mkrules): Use free appropriately.

	gcc/
	* doc/invoke.texi (C++ Module Mapper): Fix markup.

	gcc/cp/
	* cp-tree.h (language_function): Remove x_auto_return_pattern.
	(current_function_auto_return_pattern): Delete.
	(FNDECL_USED_AUTO): Correct documentation.
	* decl.c (save_function_data): Delete.
	(fndecl_declared_return_type): Don't look at language_function.
	(start_preparsed_function): Replace
	current_function_auto_return_pattern with
	DECL_SAVED_AUTO_RETURN_TYPE.
	(finish_function): Likewise.
	* mangle.c (write_unqualified_name): Likewise.
	* parser.c (cp_parser_jump_statement): Likewise.
	* typeck.c (check_return_expr): Likewise.

2019-04-08  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.cc (unnamed_ary, unnamed_map_t, unnamed_map): New.
	(struct slurping): Delete unnamed, alloc_unnamed, & deletion of
	same.
	(struct moduls_state): Add unnamed_lwm, unnamed_num.
	(module_for_unnamed): New.
	(dumper::impl::nested_name): More informative unnamedness.
	(module_state::read_cluster): Use the unnamed_ary.
	(module_state::read_unnamed): Populate unnamed_ary.
	({init,finish}_module_processing): Adjust.
	gcc/testsuite/
	* g++.dg/modules/indirect-4_[bc].C: Adjust scans.

	gcc/cp
	* cp-tree.h (struc mc_slot): Move to ...
	* name-lookup.h: ... here.
	* module.c (depset::hash::{add_mergeable,connect}): Use depsets
	not decls.
	(depset::tarjan::connect): Add for_mergeables parm.
	(tree_node::{mark,tree}_mergeable): Likewise.
	(module_state::sort_mergeables): Likewise,
	(module_state::{read,write}_bindings): Return/expect number of
	bindings.
	(module_state::write_macros): Return number of macros.
	(module_state::write_cluster): Adjust.
	(module_state::{read,write}_config): Adjust.
	(module_state::{read,write}): Adjust.

2019-04-03  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.cc (dumper): Add CLUSTER.
	(module_state::write): Dump cluster information.

	gcc/cp/
	* module.cc (node_template_info): Move earlier, protect from
	partial read in.
	(dumper::impl::nested_name): Dump template args.
	gcc/testsuite/
	* g++.dg/modules/indirect-[234]_[abc].C: Adjust scans.

	gcc/cp/
	* module.cc (module_state::write_cluster): Refactor.

	gcc/cp/
	* module.cc (cluster_tag): Remove ct_defn.
	(module_state::{read,write}_cluster): Definitions marked via flag.

	gcc/cp/
	* module.cc (depset::hash): Rename mergeables flag to mergeable_dep.

2019-04-02  Nathan Sidwell  <nathan@acm.org>

	Allow mapper protocol of file descriptors.
	gcc/
	* doc/invoke.texi (C++ Module Mapper): Document <> form.
	gcc/cp/
	* module.cc (module_mapper::module_mapper): Parse <> option.

	Write bmi /after/ deferred instantiations.
	gcc/cp/
	* cp-tree.h (finish_module_processing): Add cpp arg.
	(finish_module_parse): Delete.
	* name-lookup.h (lookup_by_type): Declare.
	* decl2.c (c_parse_final_cleanups): Adjust.
	* module.c (tree_tag): Add tt_builtin.
	(trees_out::tree_decl): Use tt_builtin for builtins.
	(trees_in::tree_node): Likewise.
	(finish_module_parse): Move processing into ...
	(finish_module_processing): ... here.
	* name-lookup.c (lookup_by_type): New.
	gcc/testsuite/
	* g++.dg/modules/builtin-1_[ab].C: New.

	gcc/cp/
	* module.cc (depset): Add EK_UNNAMED. Delete DB_IS_UNNAMED_BIT,
	is_unnamed accessor.
	(depset::hash::add_dependency): Add entity_kind arg, simplify
	logic.  Update callers.
	gcc/testsuite/
	* g++.dg/modules/using-4_a.C: Adjust scan.

2019-04-02  Ben Boeckel  <ben.boeckel@kitware.com>
	    Nathan Sidwell  <nathan@acm.org>

	libcpp/
	* mkdeps.c (mrules): Rename is_legacy to is_header_init, adjust uses.
	(deps_add_module): Correctly duplicate and use strings.

2019-04-02  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.cc (depset::add_dependency): Drop maybe_using arg.
	Adjust callers.
	(dumper::operator()): Overloads have a name.
	(has_definition): Adjust.

2019-04-01  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.cc (depset): Move flags into discriminator field.  Adjust uses.

	gcc/cp/
	* module.cc (depset): Replace key wih entity/discriminator tuple.
	Add entity_kind and disc_bits enums.  Adjust hashing &
	construction routines.

	gcc/cp/
	* module.cc (depset): Entity keying uses unique entity.  Set
	entity kind later.
	(depset::hash): Adjust hashing.
	(depset::hash::add_dependency): Set kind after insertion.
	(depset::hash::add_mergeable): Adjust.
	gcc/
	* doc/invoke.texi: Fix module mapper thinko.

2019-03-29  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* cp-tree.h (saved_scope): Remove this_module field.
	(current_module): Delete.
	(module_import_bitmap): Rename to ...
	(get_import_bitmap): ... here.  Lose arg.
	* module.cc (module_import_bitmap): Rename to ...
	(get_import_bitmap): ... here.  Lose arg.
	* name-lookup.c (name_lookup::search_namespace_only): Adjust.
	(check_module_override, finish_nonmember_using_decl): Likewise.
	(do_push_to_top_level): Drop this_module field init.

2019-03-28  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* pt.c: Comment some structures.

	gcc/
	* doc/invoke.texi (C++ Modules): Update.

	Merge trunk r269975.

2019-03-27  Nathan Sidwell  <nathan@acm.org>

	Header unit compilations retrofit includeness.
	gcc/cp/
	* cxx-mapper.c (module2bmi): Don't use PCH suffix.
	* module.cc (module_header_macro, controlling_node): Delete.
	(module_state::write_macros): Rely on cpp to determine controlling
	macro.
	(module_state::{write,read}): Likewise.
	(module_begin_main_file): Retrofit as a header.
	(finish_module_parse): Delete header_macro stuff.
	libcpp/
	* files.c (_cpp_stack_file): Set main_file.
	(_cpp_find_header_unit): Close the file.
	(cpp_retrofit_as_include): New.
	(cpp_main_controlling_macro): New.
	* include/cpplib.h (cpp_retrofit_as_include): Declare.
	(cpp_main_controlling_macro): Declare.
	* internal.h (struct cpp_buffer): Add main_file flag.
	(cpp_in_primary_file): Use it.
	gcc/testsuite/
	* g++.dg/modules/{,sys/}inext-1.H: New.
	* g++.dg/modules/macro-[23]_[abc].[CH]: Adjust.
	* g++.dg/modules/modules.exp (dg-module-bmi): Adjust.
	* g++.dg/modules/stdio-1_a.H: Asjust.

	Expunge header name quoting in mapper
	gcc/cp/
	* cxx-mapper.cc (IS_HEADER_NAME): New.
	(module2bmi): Adjust.
	* module.cc (module_mapper::imex_query): Drop quotes.
	(module_mapper::translate_include): Likewise.
	gcc/testsuite/
	* g++.dg/modules/modules.exp (dg-module-bmi): Adjust mapping.

	Header unit names lack quotes
	gcc/c-family/
	* c.opt (fmodule-header): Set a var.
	* cp-tree.h (module_map_header): Pass string as ptr/len tuple.
	* lex.c (module_map_header): Move to module.cc.
	(module_process_token): Remove gratuitous representation frobbing.
	* module.cc (module_state::module_state): Assert no quotes.
	(module_header_name): Delete.
	(get_module): Detect header via pathism.
	(module_mapper::imex_query): Add quotes.
	(module_mapper::translate_include): Drop reader parms, don't push
	buffer here.
	(canonicalize_header_name): New, from lex.c.
	(module_map_header): Wrapper for canonicalize_header_name.
	(module_translate_include): Do buffer pushing here.  Canonicalize
	name.
	(set_module_header_name): Delete.
	(module_begin_main_file): Simplify header name setting.
	(handle_module_option): Adjust header name flag setting.
	* parser.c (cp_lexer_tokenize): Adjust header name mapping.
	libcpp/
	* lex.c (cpp_output_token): Add quotes back onto CPP_HEADER_NAME.
	gcc/testsuite/
	* g++.dg/modules/alias-3_[bc].C: Adjust.
	* g++.dg/modules/leg-merge-4_c.C: Adjust.
	* g++.dg/modules/macro-[2456]_[bcde].C: Adjust.
	* g++.dg/modules/stdio-1_b.C: : Adjust.
	* g++.dg/modules/sys: Add.

	Header unit names are strings
	gcc/cp/
	* lex.c (module_map_header): Build string_cst.
	(module_preprocess_token): Adjust.
	* module.cc (module_state::module_state): Header names are
	strings.
	(module_name_hash): New.
	(module_state_hash::{hash,equal}): Adjust.
	(dumper::impl::nested_name): Fix string_cst.
	(get_module): Tweak.
	(module_state::set_flatname): Tweak.
	(module_begin_main_file): Build string.

2019-03-26  Nathan Sidwell  <nathan@acm.org>

	gcc/c-family/
	* c-opts.c (c_common_post_options): Invert sense of
	cpp_read_main_file arg.
	* parser.c (cp_parser_translation_unit): Reject include
	translation in module purview.
	libcpp/
	* files.c (_cpp_stack_file): Take include type parm.  Drop line
	parm. Do line-table adjusting here ...
	(_cpp_stack_include): ... not here.
	* include/cpplib.h (cpp_read_main_file): Invert final parm.
	* init.c (cpp_read_main_file): Adjust.
	* internal.h (include_type): Add more enumerations, and document.
	(_cpp_stack_file): Adjust prototype.
	gcc/testsuite/
	* g++.dg/modules/alias-2_[ab].[CH]: New.
	* g++.dg/modules/exp-xlate-1_[ab].[CH]: New.
	* g++.dg/modules/legacy-3_c.H: Robustify testing.

	Header units disambiguated by originating header path
	libcpp/
	gcc/
	* doc/invoke.texi (-fmodule-header): Adjust.
	* langhooks.h (struct lang_hooks): Adjust preprocess hook.
	gcc/cp/
	* cp-tree.h (module_preprocess_token): Adjust.
	(module_map_header): Declare.
	(module_translate_include): Adjust.
	* cxx-mapper.cc (module2bmi): Header units map to relative path.
	(client::action): Look for header bmi.
	* lex.c (module_map_header): New.
	(module_preprocess_token): Remap header unit names.
	* module.cc (create_dirs): Fix.
	(module_mapper::translate_include): Adjust.
	(module_translate_include): Likewise.
	(finish_module_parse): Fix directory creation.
	(handle_module_option): Remove fmodule-header=FOO handling.
	* parser.c (cp_lexer_tokenize): Remap header unit names.
	gcc/c-family/
	* c-lex.c (c_lex_with_flags): Build a string for header names.
	* c-ppoutput.c (scan_translation_unit): Allow preprocess hook to
	nadger token.
	* c.opt (fmodule-header=): Deprecate.
	libcpp/
	* directives.c (do_include_common): Move include translation to ...
	* files.c (_cpp_file): Add header_unit field.
	(should_stack_file): Break into ...
	(is_known_idempotent_file): ... this, and ...
	(has_unique_contents): ... this.
	(_cpp_stack_file): ... do include translation.
	(cpp_find_header_unit): New.
	* include/cpplib.h (cpp_callbacks): Adjust translate_include hook.
	(cpp_find_header_unit): Declare.
	gcc/testsuite/
	* g++.dg/modules/: Many changes.

2019-03-21  Nathan Sidwell  <nathan@acm.org>

	libcpp/
	* files.c (struct _cpp_file): Make bools bitfields, add
	header_unit flag.
	(_cpp_find_file): Don't write for (; !fake;) to mean if (!fake)
	for (;;).
	(_cpp_stack_file): Refactor.

	Merge trunk r269839.

	gcc/
	* gcc.c (execute): Use . not (.).
	* params.def (PARAM_LAZY_MODULES): Add trailing .
	gcc/testsuite/
	* lib/prune.exp (prune_gcc_output): Adjust collect regexp.

	gcc/
	* gcc.c (execute): Frob argv[0] to show spawning from driver.
	(process_command): Don't check input file exists here.

2019-03-20  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.cc (trees_out::mark_class_def): Skip friends in decl_list.

	gcc/cp/
	* module.cc (module_state::read_namespaces): Module-linkage
	namespaces are visible in the module itself.
	* name-lookup.h (add_imported_namespace): Rename parm.
	* name-lookup.c (add_imported_namespace): Export_p becomes visible_p.
	gcc/testsuite/
	* g++.dg/modules/enum-3_[ab].C: New.

	Enum members of templates part 2.
	gcc/cp/
	* module.cc (trees_out::tree_node): Any enum can be tt_enum_int.
	(trees_out::mark_enum_def): Only mark integer_cst inits.
	gcc/testsuite/
	* g++.dg/modues/enum-2_[ab].C: Add.

	Enum members of templates part 1.
	gcc/cp/
	* class.c (maybe_add_class_template_decl): No need to add
	CONST_DECLs.
	* pt.c (instantiate_class_template_1): CONST_DECLs are not on the
	template decl list no more.
	* module.cc (node_template_info): Cope with enum members of
	templates.
	(trees_in::insert): Allow null when failing.
	(trees_{in,out}::core_vals): Uninstantiated enums have no
	underlying type.
	(trees_out::tree_decl): Enums can be members too.
	(trees_out::write_class_def): Only announce when streaming.
	(trees_out::mark_class_def): Don't mark const_decl fields.
	(trees_out::mark_enum_def): Always mark the enum here.
	gcc/testsuite.
	* g++.dg/modules/enum-2_[ab].C: New.

2019-03-19  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.cc (depset::hash::find_dependencies): It might be a fixed
	tree.
	gcc/testsuite/
	* g++.dg/modules/stdns_[ab].C: New.

	Using decls part 3.
	gcc/cp/
	* cp-tree.h (ovl_iterator::exporting_p): Simplify.
	* name-lookup.c (do_nonmember_using_decl): Upgrade export in place.
	gcc/testsuite/
	* g++.dg/modules/using-4_[ab].C: New.

	gcc/testsuite/
	* g++.dg/modules/using-3.C: New.

	Using decls part 2.
	gcc/cp/
	* cp-tree.h (OVL_EXPORT_P): New.
	(ovl_iterator::exporting_p): New.
	(ovl_insert): Change using_p arg type.
	* tree.c (ovl_insert): USINGNESS parm conveys exporting too.
	* name-lookup.c (do_nonmember_using_decl): Deal with exports.
	* module.cc (binding_cmp): Sort usings too.
	(module_state::{read,write}_cluster): Using decls too.
	gcc/testsuite/
	* g++.dg/modules/using-2_[abc].C: New.

	gcc/cp/
	* name-lookup.c (do_nonmember_using_decl): Cleanups.
	(finish_nonmember_using_decl): Likewise.

2019-03-18  Nathan Sidwell  <nathan@acm.org>

	Using decls part 1.
	gcc/cp/
	* name-lookup.c (do_nonmember_using_decl): Unnest if.
	(finish_nonmember_using_decl): Deal with module vector.
	gcc/testsuite/
	* g++.dg/modules/global-3_[ab].C: New.

	gcc/cp/
	* module.cc (module_state::{read,write}_locations): Cope with
	trailing empty expansions.

	gcc/cp/
	* module.cc (module_state::{read,write}_locations): Macro maps can
	have embedded zeroes.

	gcc/cp/
	* name-lookup.c (do_nonmember_using_decl): Add install & fn_scope
	args.
	(finish_nonmember_using_decl): Adjust, prep for modules.
	gcc/testsuite/
	* g++.dg/lookup/using53.C: Restore & extend DR36 errors.

2019-03-15  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* name-lookup.c (do_nonmember_using_decl): Have lookup passed in.
	(validate_nonmember_using_decl): Delete.  Absorb
	into ...
	(finish_nonmember_using_decl): ... here.  Do lookup once.
	lookup_enum_member): New.  Broken out of ...
	(get_binding_or_decl): ... here.  Call it.
	(finish_nonmember_using_decl): Drop LOOKUP parm. Do lookup here.
	gcc/testsuite/
	* g++.dg/cpp0x/using-enum-2.C: Adjust diagnostics.
	* g++.dg/cpp0x/using-enum-3.C: Likewise.
	* g++.dg/lookup/hidden-class9.C: Likewise.
	* g++.dg/lookup/hidden-temp-class11.C: Likewise.
	libstdc++-v3/
	* testsuite/18_support/byte/global_neg.cc: Adjust diagnostics.
	* testsuite/20_util/headers/type_traits/types_std_c++0x_neg.cc: Likewise.
	* testsuite/26_numerics/headers/cmath/types_std_c++0x_neg.cc: Likewise.
	* testsuite/27_io/headers/cstdio/functions_neg.cc: Likewise.
	* testsuite/29_atomics/headers/atomic/types_std_c++0x_neg.cc: Likewise.
	* testsuite/29_atomics/headers/atomic/types_std_c++20_neg.cc: Likewise.

	gcc/cp/
	* name-lookup.h	(finish_nonmember_using_decl): Drop LOOKUP parm.
	* name-lookup.c (lookup_enum_member): New.  Broken out of ...
	(get_binding_or_decl): ... here.  Call it.
	(finish_nonmember_using_decl): Drop LOOKUP parm. Do lookup here.
	* parser.c (cp_parser_using_declaration): Adjust.
	* pt.c (tsubst_expr): Likewise.
	gcc/testsuite/
	* g++.dg/lookup/hidden-class9.C: Adjust diagnostics.
	* g++.dg/lookup/hidden-temp-class11.C: Likewise.
	libcc1/
	* libcp1plugin.cc (plugin_add_using_decl): Adjust
	finish_nonmember_using_decl call.
	libstdc++-v3/
	* testsuite/18_support/byte/global_neg.cc: Adjust diagnostics.
	* testsuite/20_util/headers/type_traits/types_std_c++0x_neg.cc: Likewise.
	* testsuite/26_numerics/headers/cmath/types_std_c++0x_neg.cc: Likewise.
	* testsuite/27_io/headers/cstdio/functions_neg.cc: Likewise.
	* testsuite/29_atomics/headers/atomic/types_std_c++0x_neg.cc: Likewise.
	* testsuite/29_atomics/headers/atomic/types_std_c++20_neg.cc: Likewise.

	Merge using directive fields & fns.
	gcc/cp/
	* cp-tree.h (lang_decl_ns): Drop usings field.
	(DECL_NAMESPACE_USING): Delete.
	* name-lookup.h (finish_using_directive): Declare.
	(finish_namespace_using_directive)
	(finish_local_using_directive): Delete.
	* name-lookup.c (name_lookup::search_usings)
	(name_lookup::queue_namespace): Adjust.
	(has_using_namespace_std_directive_p): No need to search
	namespaces separately.
	(finish_using_directive): New.  Merged from ...
	(finish_namespace_using_directive, finish_local_using_directive): ...
	here.  Delete.
	(push_namespace): Adjust.
	* parser.c (cp_parser_using_directive): Call finish_using_directive.
	* pt.c (tsubst_expr): Likewise,
	libcc1/
	* libcp1plugin.cc (plugin_add_using_namespace): Call
	finish_using_directive.

2019-03-14  Nathan Sidwell  <nathan@acm.org>

	Merge finish using decl fns
	gcc/cp/
	* name-lookup.c (finish_nonmember_using_decl): New, merged from ...
	(finish_namespace_using_decl, finish_local_using_decl): ... here.
	Delete.
	* name-lookup.h (finish_nonmember_using_decl): Declare
	(finish_namespace_using_decl, finish_local_using_decl): Delete.
	* parser.c (cp_parser_using_declaration): Adjust.
	* pt.c (tsubst_expr): Likewise.
	libcc1/
	* libcp1plugin.cc (plugin_add_using_decl): Likewise.

	Drop cp_binding_level::usings
	gcc/cp/
	* name-lookup.h (cp_binding_level): Remove usings field.
	* name-lookup.c (push_using_decl, push_using_decl_1): Delete.
	(validate_nonmember_using_decl): Make using decl here.

	gcc/cp/
	* name-lookup.c (validate_nonmember_using_decl): Drop DR 36 case.
	gcc/testsuite/
	* g++.dg/lookup/using53.C: Permit DR 36 case.

	Merge trunk r269682.

2019-03-13  Nathan Sidwell  <nathan@acm.org>

	Start doing something with using decls
	gcc/cp/
	* cp-tree.h (ovl_iterator): Add get_using accessor.
	* module.cc (depset::is_using): New.
	(depset::hash::add_dependency): Add maybe_using parm.  Use it.
	(depset::hash::add_binding): Deal with using decls.
	(depset::hash::find_dependencies): Likewise.
	(cluster_cmp): Likewise.
	(module_state::{read,write}_cluster): Likewise.
	gcc/testsuite/
	* g++.dg/modules/using-1_[abc].C: New.

	stdio.h can be a legacy unit!
	gcc/testsuite/
	* g++.dg/modules/stdio-1_[ab].[CH]: New.
	* g++.dg/modules/global-2_[ab].C: New.

	typedef struct {} foo; part 2
	gcc/cp/
	* module.cc (tt_anon_decl): New.
	(trees_out::tree_decl): Deal with anonymous decls.
	(trees_out::tree_type): Use TYPE_STUB_DECL.
	(trees_in::tree_node): Deal with tt_anon_decl.
	* name-lookup.c (get_lookup_ident): Assert not anonymous.
	gcc/testsuite/
	* g++.dg/modules/tdef-3_[ab].C: Extend.
	* g++.dg/modules/tdef-3_c.C: New.

	gcc/cp/
	* module.cc (trees_out::tree_decl): Refactor named decl streaming.
	(trees_in::tree_node): Remove as_base special casing.
	* name-lookup.c (lookup_by_ident, get_lookup_ident): Handle
	as_base here.

2019-03-12  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.cc (trees_out::tree_node): Refactor.
	(module_state::write_cluster): Prefer non-anonymous name.

	typedef struct {} foo; part 1
	gcc/cp/
	* module.cc (trees_out::tree_value): Cope with name-for-linkage.
	(trees_out::write_class_def): Likewise.
	(depset::hash::add_dependency): Likewise.
	gcc/testsuite/
	* g++.dg/modules/tdef-3_[ab].C: New.

	gcc/cp/
	* decl.c (fndecl_declared_return_type): Remove BMI FIXME.
	* module.cc (trees_{in,out}::lang_decl_vals): Stream
	saved_auto_return_type.

	gcc/cp/
	* tree.c (ovl_splice): Delete.

	Kill DECL_SAVED_FUNCTION_DATA part 1
	gcc/cp/
	* cp-tree.h (lang_decl_fn): Replace saved_language_function with
	saved_auto_return type.
	(DECL_SAVED_FUNCTION_DATA): Delete.
	(DECL_SAVED_AUTO_RETURN_TYPE): New.
	* decl.c (duplicate_decls, start_preparsed_function): Adjust.
	(save_function_data): Only save auto return type.
	(finish_function): Drop DECL_SAVED_FUNCTION_DATA member zapping.
	(fndecl_declared_return_type): Adjust.
	* method.c (make_thunk, make_alias_for): Adjust.

	gcc/cp/
	* module.cc (writable_cmp): New.
	(depset::hash::add_writables): Sort the hash before inserting.

	gcc/cp/
	* decl.c (fndecl_declared_return_type): Extend BMI hack.
	* module.cc (tt_anon_id, tt_lambda_id): New.
	(trees_{in,out}::tree_node): Stream them.
	gcc/
	* tree.c (make_anon_name): Drop format #.

2019-03-11  Nathan Sidwell  <nathan@acm.org>

	Anon entities never placed in symbol tables.
	gcc/cp/
	* module.cc (depset::hash::add_binding): Assert not anonymous.
	* name-lookup.c (pop_local_binding): Popping anonymous is a NOP.
	(do_pushdecl): Pushing anonymous doesn't push to symbol table.
	gcc/testsuite/
	* g++.dg/other/pr28114.C: Adjust errors.

	gcc/
	* tree.h (make_anon_name): Drop optional parm.
	* tree.c (make_anon_name): Drop 'extra' parm.
	gcc/cp/
	* cp-tree.h (TYPE_LAMBDA_P): New, require a type.
	(LAMBDA_TYPE_P): Refactor.
	(TYPE_ANON_P): New.
	(TYPE_UNNAMED_P): Use it, reject lambdas.
	* class.c (add_implicitly_declared_members): Replace LAMDBA_TYPE_P
	with TYPE_LAMBDA_P.
	(finalize_literal_type_property, explain_non_literal_class)
	(check_bases_and_members, finish_struct)
	(current_nonlambda_class_type, maybe_note_name_used_in_class): Likewise.
	* constexpr.c (check_constexpr_bind_expr_vars): Likewise.
	* decl.c (cp_finith_decomp, grokdeclarator): Likewise.
	* lambda.c (begin_lambda_type): Don't clear IDENTIFIER_ANON_P.
	(lambda_function): Replace LAMBDA_TYPE_P with TYPE_LAMBDA_P.
	(current_lambda_expr, resolvable_dummy_lambda)
	(nonlambda_method_basetype): Likewise.
	* mangle.c (decl_mandling_context, write_unqualified_name): Likewise.
	(write_local_name): Simplify anon check.
	* method.c (synthesized_method_walk): Replace LAMBDA_TYPE_P with
	TYPE_LAMBDA_P.
	(maybe_explain_explicit_delete): Likewise.
	* parser.c (cp_parser_simple_type_specifier)
	(cp_parser_parameter_declaration_clause)
	(cp_parser_parameter_declaration)
	(synthesize_immplicit_template_parm): Likewise.
	* pt.c (template_class_depth, check_for_bare_parameter_packes)
	(push_templated_decl_real, lookup_template_class_1)
	(instantiate_class_template_1, tsubst_expr)
	(tsubst_copy_and_build): Likewise.
	* semantics.c (finish_this_expr, finish_member_declaration): Likewise.
	* error.c (dump_aggr_type): Check for lambda before anonymous.
	* cp-lang.c (cxx_dwarf_name): Treat all anonymous names anonymously.

2019-03-08  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* name-lookup.h (extract_module_binding): Return binding, not name.
	* name-lookup.c (extract_module_binding): Return binding, not name.
	* module.cc (depset::set_binding_name): New.
	(depset::hash::add_binding): Drop name parm, check anon names
	here.
	(depset::hash::add_writables): Adjust extract_module_binding use.

	gcc/cp/
	* cp-tree.h (ovl_sort): Delete.
	* name-lookup.h (extract_module_binding): Drop type_r parm.
	* module.cc (depset::hash::add_binding): Drop type parm.
	(depset::hash::add_writables): Adjust extract_module_binding API.
	* name-lookup.c (extract_module_binding): Return name, valye by
	reference.  Don't sort.
	* tree.c (ovl_sort): Delete.

	Base lambda names off anonymous names.
	gcc/cp/
	* cp-tree.h (IDENTIFIER_LAMBDA_P): New.
	(LAMBDA_TyPE_P): Key off name.
	(TYPE_UNNAMED_P): Simplify.
	(LAMBDANAME_PREFIX, LAMBDANAME_FORMAT): Delete.
	(make_lambda_name): Delete.
	* lambda.c (begin_lambda_type): Use make_anon_name.
	* name-lookup.c (lambda_cnt, make_lambda_name): Delete.

2019-03-07  Nathan Sidwell  <nathan@acm.org>

	Commonize anonymous name generation.
	gcc/
	* tree.h (IDENTIFIER_ANON_P): New.
	(anon_aggrname_p, anon_aggrname_format): Delete.
	(make_anon_name): Declare.
	* tree.c (anon_aggrname_p, anon_aggrname_format): Delete.
	(make_anon_name): New.
	* lto-streamer-out.c (DFS::DFS_write_tree_body): Use IDENTIFIER_ANON_P.
	(hash_tree): Likewise.
	* tree-streamer-out.c (write_ts_decl_minimal_tree_pointers): Likewise.
	gcc/cp/
	* cp-tree.h (TYPE_UNNAMED_P): Use IDENTIFIER_ANON_P.
	(make_anon_name): Delete.
	* class.c (find_flexarrays): Use IDENTIFIER_ANON_P.
	* cp-lang.c (cxx_dwarf_name): Likewise.
	* decl.c (name_unnamed_type, xref_tag_1): Likewise.
	* error.c (dump_aggr_type): Likewise.
	* name-lookup.c (anon_cnt, make_anon_name): Delete.
	(consider_binding_level): Use IDENTIFIER_ANON_P.
	* pt.c (push_template_decl_real): Likewise.
	gcc/d/
	* types.cc (fixup_anonymous_offset): Use IDENTIFIER_ANON_P.
	(layout_aggregate_members): Use make_anon_name.

2019-03-06  Nathan Sidwell  <nathan@acm.org>

	Refactor all the things!
	gcc/cp/
	* module.cc: Tighten up access.

	Refactor.
	gcc/cp/
	* module.cc (module_state): Reorder member fn definitions.

	Refactor.
	gcc/cp/
	* module.cc (module_state::is_matching_decl): Moved to ...
	(trees_in::is_matching_decl): ... here.
	(trees_{in,out}::{mark,write,read}_*): Move earlier.

	Refactor.
	gcc/cp/
	* module.cc (module_state::read_definition): Moved to ...
	(trees_in::read_definition): ... here.
	(module_state::is_skippable_defn): Move to ...
	(trees_in::is_skippable_defn): ... here.
	(module_state::read_{function,var,class,enum}_def): Move to ...
	(trees_in::read_{function,var,class,enum}_def): ... here.
	(module_state::read_binfos): Move to ...
	(trees_in::read_binfos): ... here.

	Refactor.
	gcc/cp/
	* module.cc (module_state::{write,mark}_definition): Move to ...
	(trees_out::{write,mark}_definition): ... here.
	(module_state::{write,mark}_{function,var,class,enum}_def): Move to ...
	(trees_out::{write,mark}_{function,var,class,enum}_def): ... here.
	(module_state::write_binfos): Move to ...
	(trees_out::write_binfos): ... here.
	(depset::hash::find_dependencies): Drop module_state parm.

	Refactor.
	gcc/cp/
	* module.cc (module_state::{add_writables,find_dependencies}): Move
	to ...
	(depset::hash::{add_writables,find_dependencies}): ... here.
	(depset::hash::get_work): Delete.

	GMF pruning, Part 2
	gcc/cp/
	* module.cc (depset::hash): Rename flags fields.
	(trees_out::tree_decl): Self references by dependency binding.
	(depset::hash::add_dependency): Fix thinko.
	(binding_cmp): New.
	(depset::hash::finalize_dependencies): New.
	(module_state::write): Adjust.
	* name-lookup.c (extract_module_binding): The FIXMEs have become
	irrelevant.
	(get_binding_or_decl): Only imports for namespaces.
	gcc/testsuite/
	* g++.dg/modules/internal-1.C: Prune output.
	* g++.dg/modules/mod-sym-2.C: Check GMF not discarded.

	gcc/cp/
	* module.cc (trees_out::trees_out): Add depset::hash parm.
	(trees_out::depending_p): Invert streaming_p.
	(module_state::write_cluster): Add depset::hash parm, adjust.
	(trees_out::begin): Single ctor for both uses.
	(trees_out::end): Don't clear dep_hash.
	(module_state::find_dependencies): Adjust.
	(module_state::write): Adjust.

	Linkage promotion ban
	GMF pruning, Part 1
	gcc/cp/
	* module.cc (depset::is_internal): New field.
	(depset::hash): Add gmfs, & internals fields.
	(depset::hash::add_dependency): Deal with gmf & internal.
	(depset::hash::add_binding): Ignore GMF & internals here.
	(module_state::write): Errors for referenced internals.
	* name-lookup.c (get_binding_or_decl): Get globals.
	gcc/testsuite/
	* g++.dg/modules/internal-1.C: New.
	* g++.dg/modules/namespace-[34]_[abc].C: Adjust.

2019-03-05  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.cc (depset::hash::add_binding): Ignore internal-linkage
	entities.
	(module_state::add_writables): Don't walk anonymous namespaces.
	gcc/testsuite/
	* g++.dg/modules/unnamed-1_a.C: Adjust scan.
	* g++.dg/modules/unnamed-2.C: Adjust scan.

	gcc/cp/
	* module.cc (depset::add_dependency): Drop kind arg, return void.
	(depset::hash::add_binding): Set current during addition.
	(module_state::add_writables): Tweak.

	gcc/cp/
	* module.cc (depset): Add refs_internal field.  Replace decl_key
	and defn_key with entity_key. Remove is_decl, add is_namespace.
	Replace get_decl with get_entity.

2019-03-04  Nathan Sidwell  <nathan@acm.org>

	Merge trunk r269375.

	GMF content locations
	gcc/cp/
	* parser.h (cp_token): Remove C compatibility macros. Add
	main_source_p field.
	* parser.c (cp_lexer_get_preprocessor_token): Set main_source_p
	field.
	(cp_lexer_before_phase_4): Rename to ...
	(cp_lexer_not_macro): ... here.  Drop main-file check.
	(cp_parser_translation_unit): Emit main-file errors.
	(cp_parser_{module,import}_declaration): Adjust.
	gcc/testsuite/
	* g++.dg/modules/global-1_a.C: Adjust.
	* g++.dg/modules/mod-decl-3.C: Adjust.
	* g++.dg/modules/mod-decl-5_b.C: Adjust.
	* g++.dg/modules/mod-exp-1_b.C: Adjust.
	* g++.dg/modules/mod-sym-2.C: Adjust.
	* g++.dg/modules/namespace-2_a.C: Adjust.
	* g++.dg/modules/static-1_a.C: Adjust.
	* g++.dg/modules/token-1.C: Adjust.
	* g++.dg/modules/token-2_b.C: Adjust.
	* g++.dg/modules/token-3.C: Adjust.
	* g++.dg/modules/token-4.C: Adjust.
	* g++.dg/modules/token-5.C: New.

	New # semantics for popping to "" name.
	libcpp/
	* directives.c (do_linemarker): Popping to "" name means fill in
	the name.
	gcc/testsuite/
	* c-c++-common/cpp/line-1.c: New.

	Cleanups.
	libcpp/
	* include/cpplib.h (struct cpp_hashnode): Drop C compatibility
	macros.  Correct bit calculation.
	* include/line-map.h: Formatting.
	* line-map.c (get_pure_location): Formatting.

	gcc/cp/
	* module.cc (declare_module): Deal with de-GMFing here, get name
	of implicit header module.
	* parser.c (enum module_preamble): New enum.
	(cp_parser_translation_unit):  Use it.
	(cp_parser_{module,import}_declaration): Use it.
	gcc/testsuite/
	* g++.dg/modules/p0713-3.C: Adjust diags.

2019-03-01  Nathan Sidwell  <nathan@acm.org>

	Merge trunk r269321.

	Merge trunk r269078 (metadata update).

	Apply trunk r269078.
	gcc/cp/
	* module.cc (module_state::{read,write}_function_def): Adjust.

	gcc/cp/
	* cp-tree.h (struct constexpr_fundef): Moved from constexpr.c.
	(register_constexpr_fundef): Adjust.
	(find_constexpr_fundef): Replace with ...
	(retrieve_constexpr_fundef): ... this.
	* constexpr.c (struct constexpr_fundef): Moved to cp-tree.h
	(constexpr_fundef_hasher): Constify.
	(retrieve_constexpr_fundef): Make extern.
	(find_constexpr_fundef): Delete.
	(check_constexpr_fundef): Adjust.
	(register_constexpr_fundef): Adjust API.
	* module.cc (module_state::{read,write}_function_def): Adjust.

	Merge trunk r269077.

	gcc/cp/
	* parser.c (cp_lexer_set_source_position_from_token): Revert.

2019-02-28  Nathan Sidwell  <nathan@acm.org>

	module & import-semi lexing rules
	gcc/cp/
	* parser.c (cp_lexer_tokenize): Fix EOF push.
	(cp_lexer_before_phase_4): New.
	(cp_lexer_set_source_position_from_token): Simplify.
	(cp_parser_{module,import}_declaration): Check phase-4 requirements.
	gcc/testsuite/
	* g++.dg/modules/class-2_a.C: Do not #include
	* g++.dg/modules/token-[123]*.C: New.

	Remove eof_token
	gcc/cp/
	* parser.h (cp_token): Add tree_check_p, adjust GTY tagging.
	(cp_lexer): Add saved_type, saved_keyword fields.
	* parser.c (eof_token): Delete.
	(cp_lexer_new_from_tokens): Overwrite EOF here.
	(cp_lexer_destroy): Restore overwritten token here.
	(cp_lexer_token_position, cp_lexer_previous_token_position): Simplify.
	(cp_lexer_tokenize): Likewise.
	(cp_lexer_peek_nth_token, cp_lexer_consume_token): Likewise.
	(cp_lexer_purge_token, cp_lexer_purge_tokens_after): Likewise.
	(cp_parser_nested_name_specifier, cp_parser_decltype)
	(cp_parser_template_id): Set tree_check_p.

2019-02-27  Nathan Sidwell  <nathan@acm.org>

	__import in extern "C"
	gcc/cp/
	* parser.c (cp_lexer_tokenize): Add extern_c_depth arg, tokenize
	through extern "C".
	(cp_parser_translation_unit): Handle top-level extern "C".
	(cp_parser_module_name): Force header unit.
	(cp_parser_{module,import}_declaration): Adjust.
	gcc/testsuite/
	* g++.dg/modules/inc-xlate-1_[cd].C: New.

	gcc/cp/
	* cp-tree.h (import_module): Return bool.
	* module.cc (import_module): Return is_header flag.
	* parser.c (cp_parser_tokenize): Rename to ...
	(cp_lexer_tokenize): ... this.  Reimplement.
	(cp_parser_import_declaration): Return is_header flag.
	(cp_parser_translation_unit): Adjust lexer tokenization interaction.

2019-02-26  Nathan Sidwell  <nathan@acm.org>

	Flag_modules is strictly boolean.
	gcc/c-family/
	* c.opt (fmodules-ts): Allow negation.
	gcc/cp/
	* decl.c (duplicate_decls): Use modules_p.
	* lex.c (module_preprocess_token): Use modules_p.
	* parser.c (cp_parser_diagnose_invalid_type)
	(cp_parser_translation_unit, cp_parser_tokenize): Likewise.
	* module.cc (module_begin_main_file): Likewise.
	(handle_module_option): Adjust.
	gcc/
	* doc/invoke.texi (fmodules-ts): Adjust.

	Preprocess __import.
	gcc/cp/
	* cp-tree.h (import_module): Add extern C flag.
	* lex.c (module_preprocess_token): Allow __import in extern-c
	* module.c (import_module): Add extern C flag.
	* parser.c (cp_parser_import_declaration): Adjust.
	gcc/testsuite/
	* g++.dg/modules/inc-xlate-1{.map,_[ab].H}: New.

	Distinguished __import spelling.
	gcc/c-family/
	* c-common.c (c_common_reswords): Add __import spelling.
	gcc/cp/
	* module.cc (module_mapper::translate_include): Use __import.
	gcc/testsuite/
	* g++.dg/modules/legacy-[3456]*: Adjust.
	* g++.dg/modules/map-2.C: Likewise.

	Fix preprocessor tokenizing rules.
	gcc/cp/
	* lex.c (module_preprocess_token): Detect extern "C" {, tokenize
	trailing attributes before importing header unit.
	gcc/testsuite/
	* g++.dg/modules/cpp-2_[abc].[CH]: Extend testing.

	Fix interface partition export rules.
	gcc/cp/
	* module.cc (module_state::read_imports): Don't check partition
	import/export here ...
	(module_state::direct_import): ... or here ...
	(module_state::write): ... but do it here.
	gcc/testsuite/
	* g++.dg/modules/part-2_[cd].C: Adjust.
	* g++.dg/modules/part-2_e.C: New.

2019-02-22  Nathan Sidwell  <nathan@acm.org>

	gcc/
	* doc/invoke.texi: Update modules documentation.

	libcpp/
	* mkdeps.h (deps_write): Add phony arg.
	(deps_phony_targets): Delete.
	* init.c (cpp_finish): Adjust deps_write call.
	* mkdeps.c (mrules): Add quote_lwm member.
	(munge): Just return static buffer.
	(deps_add_target, deps_add_dep, deps_add_module): Store unmunged.
	(write_name): Rename ...
	(make_write_name): ... here.  Maybe munge here.
	(write_vec, deps_write): Rename to ...
	(make_write_vec, make_write): ... here.  Adjust.
	(deps_write): New wrapper.

	gcc/cp/
	* cp-tree.h (init_module_processing): Add arg.
	* decl.c (cxx_init_decl_processing): Adjust.
	* module.cc (init_module_processing): Check preprocess sanity.

	libcpp/
	* mkdeps.c (deps_add_module): Allow empty bmi name.
	(deps_write): Refactor. Add PHONY.
	gcc/cp/
	* cp-tree.h (module_preprocess): Declare.
	* lex.c (module_preprocess_token): Have a proper state object,
	register imports with dependency machinery.
	* module.cc (module_preprocess_token): New.
	(module_begin_main_file): Cope with just preprocessing.

2019-02-21  Nathan Sidwell  <nathan@acm.org>

	gcc/c-family/
	* c.opt: Rename fmodule-legacy to fmodule-header
	gcc/
	* doc/invoke.texi: Update.
	gcc/cp/
	* cp-tree.h, module.cc, lang-specs.h, name-lookup.c, parser.c:
	Rename.
	gcc/testsuite/
	* g++.dg/modules/: Likewise.

	gcc/
	* langhooks.h (struct lang_hooks): Adjust preprocess_token API.
	gcc/cp/
	* lex.c (module_preprocess_token): Adjust API.
	* cp-tree.h (module_preprocess_token): Adjust API.
	* module.cc (module_state::direct_import): Not fatal if preprocessing.
	gcc/c-family/
	* c-ppoutput.c (scan_translation_unit): Adjust preprocess_token
	hook API.

2019-02-20  Nathan Sidwell  <nathan@acm.org>

	gcc/
	* REVISION: Add [].
	gcc/cp/
	* Make-lang.in (MODULE_VERSION): Replace ...
	(MODULE_STAMP): ... this.  Adjust
	* cxx-mapper.cc: Update.
	* module.cc: Update version behaviour.
	(module_state::do_import): Add dependency.
	libcpp/
	* mkdeps.c (mrules): Add dtor properly.   Add modules.
	(deps_write): Spew module deps.

2019-02-11  Nathan Sidwell  <nathan@acm.org>

	Merge trunk r268782.

	Make dependencies
	libcpp/
	* include/cpplib.h (cpp_get_deps): Change type.
	* include/mkdeps.h (struct deps): Rename to ...
	(struct mrules): ... this.  Adjust accessors.
	(deps_add_module): Declare.
	* internal.h (sttuct cpp_reader): Likewise.
	* mkdeps.c (struct mrules): Rename from deps.  Add module fields.
	(munge): Allow concatenation.
	(deps_add_module): New.
	(write_name, write_vec): New, broken out of ...
	(deps_write): ... this.  Add module pieces.
	gcc/
	* module.cc: #include mkdeps.h.
	(module_state::direct_import): Add module to dependencies.
	(finish_module_parse): Set target dependency info.
	gcc/c-family/
	* c-opts.c (handle_deferred_opts): Adjust dep accessors.
	gcc/fortran/
	* cpp.c (gfc_cpp_add_dep, gfc_cpp_add_target, gfc_cpp_init): Adjust
	dep accessors.

2019-02-08  Nathan Sidwell  <nathan@acm.org>

	libcpp/
	* mkdeps.c (struct deps): Make more C++y.  Update all uses.

2019-02-07  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.cc (module_mapper::module_mapper): Fix local socket creation.

	gcc/cp/
	* c++-mapper.cc (module2bmi): Do not map dir separators.
	gcc/testsuite/
	* g+.dg/modules/modules.exp (decode_mod_spec): Likewise.

	gcc/cp/
	* module.cc (create_dirs): New.
	(maybe_add_bmi_prefix): Add FORCE parm, adjust.
	(finish_module_parse): Try and create intermediate dirs.

2019-02-05  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* name-lookup.c (finish_namespace_using_decl): Add assert + FIXME.

	gcc/cp/
	* cxx-mapper.cc (client::action): Add mapper agent.
	* module.cc (module_mapper::handshake): Add mapper agent slot.
	gcc/
	* doc/invoke.texi (C++ Module Mapper): Update handshake.

	gcc/cp/
	* module.cc (module_state::read_locations): Make warning
	development-only.

	gcc/cp/
	* module.cc (get_module_slot): New broken out of ...
	(get_module): ... here.  Call it.
	(module_mapper::translate_include): Cope with file mapper.
	gcc/testsuite/
	* g++.dg/modules/map-2.{C,map}: New.

2019-02-01  Nathan Sidwell  <nathan@acm.org>

	Merge trunk r268456.

	gcc/cp/
	* decl.c (duplicate_decls): Accomodate anticipated fns.
	* module.cc (set_module_owner): Adjust.
	gcc/testsuite/
	* g++.dg/modules/printf-1_[ab].[HC]: New.

2019-01-31  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.cc (try_increase_lazy): Fix setrlimit call.
	(init_module_processing): Fix getrlimit call.

	gcc/cp/
	* module.cc (init_module_processing): Dump even more config.
	Tweak lazy limit.

	Rework lazy limit handling.
	gcc/cp/
	* module.cc (lazy_limit, lazy_hard_limit, LAZY_HEADROOM): New.
	(lazy_open): Invert sense, make unsigned.  Adjust all uses.
	(try_increase_lazy): New.
	(module_state::freeze_an_elf): Call it first.
	(init_module_processing): Adjust lazy_limit setting.

2019-01-30  Nathan Sidwell  <nathan@acm.org>

	ADL part 2
	gcc/cp/
	* cp-tree.h (LOOKUP_FOUND_P): Allow enumeral type.
	* module.cc (module_visible_instantiation_path): Protect against
	not modules.
	* name-lookup.c (name_lookup::adl_enum): New.
	(name_lookup::adl_type): Use it.
	(name_lookup::adl_namespace): INST_PATH may be null.
	(name_lookup::search_adl): Add partitions of types.
	gcc/testsuite/
	* g++.dg/modules/adl-[23]_[abc].C: New.

	ADL part 1
	gcc/cp/
	* cp-tree.h (module_visible_instantiation_path): Declare.
	* module.cc (module_visible_instantiation_path): Implement.
	* name-lookup.c (name_lookup::add_module_fns): Delete.
	(name_lookup::add_namespace_fns): Add visible bitmaps,
	reimplement.
	(name_lookup::search_adl): Get path of instantiation.
	gcc/testsuite/
	* g++.dg/modules/adl-1_[abc].C: New.

	gcc/cp/
	* name-lookup.c (name_lookup::adl_namespace_only): Delete.
	(name_lookip::adl_{namespace,class}_fns): New.
	(name_lookup::adl_{namespace,class}): Adjust.
	(name_lookup::search_adl): Refactor.

2019-01-30  Iain Sandoe  <iain@sandoe.co.uk>

	gcc/cp/
	* module.cc: Reorder includes.
	* cxx-mapper.cc: Likewise.

	gcc/testsuite/
	* g++.dg/modules/fn-inline-1_{bc}.C: Adjust weak scan.

2019-01-30  Nathan Sidwell  <nathan@acm.org>

	gcc/
	* doc/invoke.texi (C++ Modules): Add submenu.

2019-01-29  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.cc (init_module_processing): Dump more config.

	gcc/cp/
	* module.cc (MAPPED_READING, MAPPED_WRITING): 0 or 1
	(init_module_processing): Dump mapping behaviour.

2019-01-28  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.cc (module_mapper::make): Drop options arg, look at
	CXX_MODULE_MAPPER.
	gcc/
	* doc/invoke.texi (fmodule-mapper): Document env var.
	(C++ Module Mapper): Likewise.

	gcc/cp/
	* module.cc (trees_{in,out}::core_vals): Lambda location.
	* cp-objcp-common.c (cp_common_init_ts): Fix LAMBDA_EXPR marking.
	* cp-tree.h (tree_lambda_expr): Save 8 bytes.

	Merge trunk r268337.

2019-01-23  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.cc (trees_{in,out}::core_vals): Stream expression locii.

	gcc/cp/
	* cp-objcp-common.c (cp_common_init_ts): MARK_TS_EXP for tcc_statement.

	gcc/cp/
	* cp-objcp-common.c (cp_common_init_ts): MARK_TS_EXP for scope_ref
	& noexcept_expr.
	* module.cc (trees_{in,out}::core_vals): Rely on TS_EXP.

	gcc/cp/
	* module.cc (trees_{in,out}::core_vals): Adjust expression streaming.

	Fix TS_CONTAINS_STRUCT for tcc_expression.
	gcc/
	(MARK_TS_EXP): New.
	gcc/c-family/
	* c-common.c (c_common_init_ts): Use MARK_TS_EXP. Mark
	SIZEOF_EXPR.
	gcc/cp/
	* cp-objcp-common.c (cp_common_init_ts): MARK_TS_EXP for
	tcc_expression nodes.  Call c_common_init_ts.

	gcc/cp/
	* module.cc (trees_{in,out}::core_vals): Clean up enumeral type
	handling.
	(trees_out:tree_node, module_state::mark_enum_def): Use
	SCOPED_ENUM_P.

	gcc/cp/
	* module.cc (tree_tag): Add tt_enum_int.
	(trees_out::mark_node): Allow marking non-decls.
	(trees_{in,out}::tree_node): Serialize enum values.
	(module_state::mark_enum_def): Mark enum int_csts.
	gcc/testsuite/
	* g++.dg/modules/enum_1_[ab].C: Test serialization.

	gcc/cp/
	* module.cc (trees_in::finish_type): Don't speciual case
	TYPE_PACKs.
	* pt.c (template_parm_to_arg, coerce_template_parameter_pack)
	(make_argument_pack, tsubst_template_args, tsubst)
	(type_unification_real, unify_pack_expansion): Set
	TYPE_STRUCTURAL_EQUALITY for type packs.

2019-01-22  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* cp-objcp-common.c (cp_common_init_ts): Set TYPE_PACK_EXPANSION
	and TYPE_ARGUMENT_PACK correctly.
	* module.c (trees_in::finish_type): Special case pack types and
	bound parms.
	gcc/testsuite/
	* g++.dg/modules/var-tpl-1_[ab].C: New.

	gcc/cp/
	* module.cc (tree_tag): Add tt_ptrmem_type.
	(trees_{in,out}::core_vals): Don't scrog pointer's ptrmem cache.
	(trees_out::tree_type): Stream pointers to member functions.
	(trees_in::tree_node): Likewise.
	gcc/testsuite/
	* g++.dg/modules/nodes-1_[ab].C: More.

2019-01-18  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.cc (trees_{in,out}::core_vals): Stream tcc_reference,
	baselink, static_assert, trait_expr.
	gcc/testsuite/
	* g++.dg/modules/nodes-1_[ab].C: New.

	gcc/cp/
	* module.cc (trees_{in,out}::core_vals): Fix TYPE_CACHED_VALUES
	handling. Stream ptrmem_cst.  Note userdef_literals unreachable.
	gcc/testsuite/
	* g++.dg/modules/nodes-1_[ab].C: Add prememdata

	gcc/cp/
	* module.cc (module_state::{read,write}_locations): Fix macro
	expansion compression.

2019-01-17  Nathan Sidwell  <nathan@acm.org>

	Enable partition entity merging.
	gcc/cp/
	* module.cc (depset::hash): Add mergeable flag.
	(trees_out::{tpl_parms,tree_mergeable}): Protect from not
	streaming.
	(depset::hash::add_dependency): Deal with mergeablility.
	(depset::hash::add_mergeable): New.
	(depset::hash::connect): Adjust dump.
	(module_state::write_cluster): Sort mergeables.
	(module_state::find_dependencies): Deal with mergeability.
	(module_state::sort_mergeables): New.
	gcc/testsuite/
	* g++.dg/modules/scc-1.C: Adjust scans.
	* g++.dg/modules/part-3_[cd].C: Remove xfails.

	gcc/cp/
	* module.cc (trees_{in,out}::fn_parms): New.
	(trees_{in,out}::tree_mergeable): Call them.
	(cluster_cmp): Move earlier.
	(depset::hash::connect): New, broken out of ...
	(module_state::write): ... here.  Call it.

2019-01-16  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.cc (trees_{in,out}::tree_mergeable): Allow non-implicit
	typedefs.
	gcc/testsuite/
	* g++.dg/modules/leg-merge-9_[abc].[HC]: New.

	Merge partition entities (disabled).
	gcc/cp/
	* module.cc (trees_{in,out}::tree_mergeable): Fold partitions.
	(module_state::{read,write}_cluster): Register module entities.
	gcc/testsuite/
	* g++.dg/modules/part-3_[abcd].C: New.

	gcc/cp/
	* module.cc (dumper::GM): Rename to MERGE.  Update uses.

	gcc/cp/
	* cp-tree.h (module_name): Replace FULL parm with primary pointer.
	* error.c (dump_module_suffix): Adjust.
	* module.cc (module_state::fullname): Rename to flatname.
	(module_state::{get,set}_flatname): New.  Use get_flatname.
	(module_state::attach): Conditionally call set_flatname.
	(get_module): Likewise.
	(module_mapper::imex_query): Adjust.
	(module_mapper::bmi_response): Likewise.
	(module_state::write_readme): Adjust.
	(module_state::{read,write}_config): Adjust name checking.
	* name-lookup.c (make_namespace): Adjust anonymous name creation.
	* ptree.c (cxx_print_decl): Adjust.
	gcc/testsuite/
	* g++.dg/modules/part-2_[cd].C: Adjust regex.

	gcc/cp/
	* cp-tree.h (module_name): Add FULL parm.
	* module.cc (module_name): Check it and strip partitions if not.
	* error.c (dump_module_suffix): Don't want full name.

2019-01-15  Nathan Sidwell  <nathan@acm.org>

	Merge trunk r267946.

	Partition BMI folding, but not entity merging.
	gcc/cp/
	* cp-tree.h (get_module_owner): Mark PURE.
	* module.cc (loc_spans::open): Add location parm.
	(trees_out::{lang_decl_bools,tree_node_specific,tree_decl}): Account
	for remapping.
	(depset::hash::add_binding): Account for partitions.
	(module_state::write_locations): Account for partitions.
	(module_state::read_locations): Add partition spans to primary
	interface.
	(module_state::add_writables): Add partition bitmap arg.  Adjust
	extraction.
	(module_state::write): Generate partition bitmap.
	(module_state::read): Only read partitions on primary.
	* name-lookup.h (extract_module_binding): Adjust parms.
	* name-lookup.c (add_mergeable_decl): Break out from ...
	(record_mergeable_decl): ... here.  Call it.
	(match_mergeable_decl): Likewise.
	(check_mergeable_decl): Tweak.
	(extract_module_binding): Examine partitions and merge.
	* tree.c (ovl_sort): Simplify. 
	gcc/testsuite/
	* g++.dg/modules/part-1_a.C: Adjust.
	* g++.dg/modules/part-1_c.C: New.

2019-01-14  Nathan Sidwell  <nathan@acm.org>

	gcc/
	* tree.h (cache_integer_cst): Add defaulted small parm.
	* tree.c (cache_integer_cst): Add small parm, adjust.
	gcc/cp/
	* module.cc (trees_out::start): FIXED_CST are C only.
	(trees_in::finish): Merge small INTEGER_CSTs.
	(trees_{in,out}::core_bools): Don't write base.public_flag of types.

	gcc/cp/
	* module.cc (trees_out::start): Catch POLY_INT_CST, adjust
	VECTOR_CST.
	(trees_{in,out}::core_vals): Do TS_VECTOR.
	* g++.dg/modules/literals-1_[ab].C: Add vector cst.

2019-01-11  Nathan Sidwell  <nathan@acm.org>

	String literals.
	gcc/cp/
	* module.cc (trees_{in,out}::core_vals): String literals (a NOP).
	gcc/testsuite/
	* g++.dg/modules/literals-1_[ab].C: Add string lit.

	Real & complex literals.
	gcc/cp/
	* module.cc (bytes_{in,out}::buf): Void pointer
	(trees_{in,out}::core_vals): Stream REAL_CST & COMPLEX.
	gcc/testsuite/
	* g++.dg/modules/literals-1_[ab].C: New.

	gcc/cp/
	* module.cc (get_module): Fix partition parsing.
	(module_state::read_imports): Check interface import requirements.
	(module_state::{read,write}_partitions): No need for exported.
	(module_state::write_config): Write is_interface.
	(module_state::direct_import): Check interface import
	requirements.
	(declare_module): Set interface_p, not exported_p.
	* parser.c (cp_parser_module_name): Partitions only in non-legacy
	module purview.
	gcc/testsuite/
	* g++.dg/modules/part-2_[abcd].C: New.

2019-01-10  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* cp-tree.h (module_not_legacy_p): New.
	* module.cc (trees_out::tree_namespace): Rema namespace owner.
	(tree_in::tree_node): Protect bogus tt_namespace.
	* name-lookup.c (record_mergeable_decl): New.
	(check_mergeable_decl): Namespaces are never overloaded.
	(check_module_override): Add to mergeable list.
	(do_pushdecl): Record mergeable.
	(make_namespace_finish): Use check_mergeable_decl.  Never add to level
	(push_namespace): Add to level here.
	gcc/testsuite/
	* g++.dg/modules/indirect-1_b.C: Adjust dump scan.

	gcc/cp/
	* module.cc (finish_module_parse): Better location info on errors.
	* name-lookup.c (name_lookup::search_namespace_only): Skip
	partition slot too.
	(check_module_override): Likewise.
	(check_mergeable_decl): New broken out of ...
	(match_mergeable_decl): ... here.  Call it.
	(reuse_namespace): Iterate over global slot.
	* ptree.c (cxx_print_xnode): More cluster info.

2019-01-09  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.cc (module_state::read_partitions): New.
	(module_state::read_imports): Deal with elided partitions.
	(module_state::write_partitions): Write more.
	(module_state::read): Read partitions.
	(module_state::direct_import): Deal with elided partitions.
	(process_deferred_imports): Don't request known filenames.  Avoid
	double request.
	gcc/testsuite/
	* g++.dg/modules/atom-preamble-2_d.C: Check no duplicate.
	gcc/
	* doc/invoke.texi (C++ Modules): Update.

	gcc/cp/
	* module.cc (module_state::from_partition_p): New field.
	(module_state::maybe_partition_name): New.
	(module_state::{read,write}_imports): Adjust.
	(module_state::write_partitions): New.
	(module_state::remap_partitions): Delete.
	(trees_out::tree_decl): Remap owner.
	(module_state::write_readme): Adjust.
	(module_state_config): Add imports and partitions fields.
	(module_state::{read,write}_config): Adjust.
	(module_state::write): Separate out hidden partitions.  Adjust
	import & partition writing.
	(module_state::read): Adjust import reading.
	gcc/testsuite/
	* g++.dg/modules/import-1_c.C: Adjust scan.
	* g++.dg/modules/mod-imp-1_c.C: Likewise.

2019-01-08  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* cxx-mapper.cc (module2bmi): Update mapping
	* module.cc (module_state::{maybe_defrost,freeze_an_elf}): Quote
	filename..
	gcc/testsuite/
	* g++.dg/modules/modules.exp (decode_mod_spec): Update mapping.
	* g++.dg/modules/freeze-1_d.C: Adjust scan-final.
	* g++.dg/modules/import-2.C: Likewise.
	* g++.dg/modules/mod-stamp-1_d.C: Likewise.

	gcc/cp/
	* module.cc (module_state::{interface_p,is_interface}): New.
	(module_state::resolve_alias): Don't propagate exported_p here.
	(module_state::write_readme): Show exportedness of imports.
	(module_state::read_imports): Use resolve_alias.
	(module_state::read_config): Set interface_p.
	(module_state::read): Reformat.
	(module_state::set_import): Correctly set imports.
	(module_state::direct_import): Not here.
	(declare_module): Set interface_p.
	gcc/testsuite/
	* g++.dg/modules/import-1_e.C: Adjust scan.

	gcc/cp/
	* module.cc (bytes_out::set_crc): Only set if crc_ptr != 0.
	(module_state::write_readme): Update for partitions.
	(module_state::{read,write}_config): Write exported_p for
	partitions.
	(finish_module_parse): Write partitions.
	gcc/testsuite/
	* g++.dg/modules/atom-decl-2.C: Adjust.
	* g++.dg/modules/atom-pragma-3.C: Adjust.
	* g++.dg/modules/mod-decl-1.C: Adjust.
	* g++.dg/modules/mod-decl-3.C: Adjust.

	gcc/cp/
	* module.cc (module_state::direct_import): Add LAZY parm, use it
	rather than legacy_p.  Never expect a has_bmi file.
	(declare_module): Always add to pending imports.
	* parser.c (cp_parser_translation_unit): Expect a deferred import
	for a legacy module.

	gcc/cp/
	* cp-tree.h (module_has_bmi_p): New.
	* module.cc (module_state::{is_interface,interface_p}): Rename to ...
	(module_state::{is_primary,primary_p}): ... here.  Adjust users.
	(module_state::read_cluster): Partitions need deduping too.
	(declare_module): Set primary_p, partition_p.
	(process_pending_imports): Adjust.

	gcc/cp
	* cp-tree.h (module_export_depth, module_purview): Replace with ...
	(module_kind): ... this.
	(MK_MODULE, MK_GLOBAL, MK_INTERFACE, MK_PARTITION, MK_EXPORTING): New.
	(module_purview_p, not_module_p, module_legacy_p)
	(module_interface_p, module_partition_p, module_global_p)
	(module_exporting_p): Adjust.
	(declare_module): Return bool.
	* module.cc (module_export_depth, module_purview): Replace with ...
	(module_kind): ... this.
	(module_maybe_interface_p): Delete.
	(module_state::direct_import, declare_module)
	(module_begin_main_file, process_deferred_imports)
	(finish_module_parse): Adjust.
	* name-lookup.c (make_namespae): Use module_global_p.
	* parser.c (cp_parser_module_declaration): Return bool.  Deal with
	GMF introducer.
	(cp_parser_translation_unit, cp_parser_module_export): Adjust.
	gcc/testsuite/
	* g++.dg/modules/circ-1_d.C: Adjust.
	* g++.dg/modules/mod-decl-1.C: Adjust.
	* g++.dg/modules/mod-decl-5_b.C: Adjust.
	* g++.dg/modules/p0713-3.C: Adjust.

2019-01-07  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* cxx-mapper.cc (module2bmi): Don't map ':'.
	* module.cc: Update design description.
	gcc/testsuite/
	* g++.dg/modules/modules.exp (decode_mod_spec): Don't map ':'

2019-01-03  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* name-lookup.h (match_global_decl): Rename to ...
	(match_mergeable_decl): ... this.  Add global/partition flag.
	* name-lookup.c (match_global_decl): Rename to ...
	(match_mergeable_decl): ... this.  Adjust.
	* module.cc: Rename mme to mergeable.
	(trees_{in,out}::tree_mergeable): Stream global/partition
	indicator. Call match_mergeable_decl.

	gcc/cp/
	* name-lookup.c (module_binding_slot): Break apart to ...
	(search_imported_binding_slot, get_fixed_binding_slot)
	(append_imported_binding_slot): ... these.
	(fixed_module_binding_slot): Delete.
	(do_pushdecl, match_global_decl, import_module_binding)
	(set_module_binding, get_binding_or_decl, get_imported_namespace)
	(reuse_namespace, make_namespace_finish)
	(add_imported_namespace): Update for new API.

2019-01-02  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* name-lookup.c (module_binding_slot): Use FIXED parm.

	gcc/cp/
	* name-lookup.c (module_binding_slot): Add FIXED parm, adjust all
	callers.

	gcc/cp/
	* module.cc: Rename gme -> mme, because partitions.

	gcc/cp/
	* cp-tree.h (DECL_MODULE_PURVIEW_P): Delete.
	(MAYBE_DECL_MODULE_PURVIEW_P): Delete.
	* mangle.c (maybe_write_module): Adjust.

	gcc/testsuite/
	* g++.dg/modules/legacy-8_[abcde].[CH]: New.

	gcc/cp/
	* cxx-mapper.cc (server): Workaround PR c++/88664.

	Merge trunk r267509.
	* module.cc, cxx-mapper.cc: Update copyright years.

2018-12-20  Nathan Sidwell  <nathan@acm.org>

	MODULE_VEC has alloc field too.
	gcc/cp/
	* cp-tree.h (MODULE_VECTOR_ALLOC_CLUSTERS): New.
	(MODULE_VECTOR_NUM_CLUSTERS): Adjust.
	(struct tree_module_vec): Adjust.
	* tree.c (make_module_vec): Adjust.
	* name-lookup.c (module_binding_slot): Extend vector if it fits.
	* ptree.c (cxx_print_xnode): Cope with lazy module-vector slots.

	gcc/cp/
	* module.cc (module_state::check_read): Fix bogus note.
	gcc/testsuite/
	* g++.dg/modules/indirect-1_c.C: Add bogus note test.

	gcc/cp/
	* module.cc (module_state::remap): New member var.
	(module_state::remap_partitions): New.
	(module_state::write_imports): Skip partitions.
	(module_state::write): Remap partitions.

2018-12-19  Nathan Sidwell  <nathan@acm.org>

	Partition parsing.  Don't get excited!
	gcc/cp/
	* module.cc (get_module): Attach current module for null
	partition.
	* parser.c (cp_parser_module_name): Parse partitions
	gcc/testsuite/
	* g++.dg/modules/part-1_[ab].C: New.

2018-12-18  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* cp-tree.h (get_module): Add partition arg.
	* module.cc (module_state): Add partition flag.
	(module_state_hash): Hash & compare partition flag.
	(module_state::mangle, get_module, attach): Add partition awareness.

	gcc/cp/
	* cp-tree.h (get_module): Default NULL parent.
	* lex.c (module_preprocess_token): Adjust get_module call.
	* module.cc (get_module, module_begin_main_file): Likewise.
	* parser.c (cp_parser_module_name): Likewise.

	gcc/cp/
	* module.cc (trees_out::tree_decl): Remove some remaining
	non-atomic template hacks.

	gcc/cp/
	* module.cc (module_state::write): Sort dependency table.

	gcc/cp
	* module.cc (module_cpp_undef): Don't zap undef hook if we don't
	own it.
	gcc/c-family/
	* c-opts.c (c_common_init): Don't unilaterally clobber undef
	callback.
	* c-ppoutput.c (cb_undef): Call lang_hook if non-null.
	gcc/testsuite/
	* g++.dg/modules/dir-only-1.C: New.

	Merge trunk r267229.

2018-12-17  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.cc (trees_out::{write,mark}_template_def): Delete.
	(trees_out::{write,mark}_definition): Adjust.
	(trees_in::read_template_def): Delete.
	(trees_in::read_definition): Adjust.

	Kill old broken global module merge code.
	gcc/cp/
	* module.cc (trees_in::finish): Remove DECL merging.
	* name-lookup.c (merge_global_decl): Delete.
	* name-lookup.h (merge_global_decl): Delete decl.

	Atomic TEMPLATE_DECL + DECL_TEMPLATE_RESULT.
	gcc/cp/
	* module.cc (trees_out::mark_node): Remove temp tpl hack.
	(trees_out::tree_decl): Remove tt_template remarking.
	(trees_out::tree_value): Atomic TEMPLATE_DECL.
	(trees_in::tree_node): Likewise.
	(trees_out::{mark,read,write}_template_def): Move DECL_LIST to ...
	(trees_out::{mark,read,write}_class_def): ... here.
	(trees_{in,out}::tree_gme): Don't mark inner decl.
	gcc/testsuite/
	* leg-merge-8_[abc].[CH]: New.

	Intermediate step to atomic TEMPLATE_DECL + DECL_TEMPLATE_RESULT.
	Breaks leg-merge-7_c.C,
	gcc/cp/
	* module.cc (tree_tag): Add tt_template, tt_implicit_template.
	(node_template_info): Not a member fn.
	(trees_out::{mark_node,mark_gme}): Mark the template.
	(trees_{in,out}::tree_decl): Do implicit_template.

2018-12-14  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.cc (trees_out::node_template_info): New, broken out of
	...
	(trees_out::tree_decl): ... here.  Use it.

	gcc/cp/
	* module.cc (trees_out::tree_decl): Adjust TEMPLATE_INFO access.

2018-12-13  Nathan Sidwell  <nathan@acm.org>

	Function template deduping
	gcc/cp/
	* module.cc (trees_{in,out}::tpl_parms): New.
	(trees_out::mark_gme): Mark template result too.
	(trees_{in,out}::tree_gme): Do templates.
	(module_state::write_cluster): Any decl can be a GME.
	* name-lookup.c (match_global_decl): Do template matching.
	gcc/testsuite/
	* g++.dg/modules/leg-merge-7_[abc].[HC]: New.

2018-12-04  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.cc (slurping::remap): Heap allocate.
	(gt_pch_nx): Delete hacks.

	gcc/cp/
	* module.cc (tree_tag): Replace tt_named_type with
	tt_{primary,secondary}_type.
	(trees_out::tree_type): Not recursive.
	(trees_in::tree_node): Adjust tt_named_type case.

	Class deduping
	gcc/cp/
	* module.cc (trees_in::tree_node): Record defn to skip.
	(trees_in::is_skip{,pable}_defn): Fix int/long ptr const.
	(module_state::read_{function,var,class}_def): Add skip checking.
	gcc/testsuite/
	* g++.dg/modules/leg-merge-6_[abc].[HC]: New.

	TYPE streamed with its implicit typedef.
	gcc/cp/
	* module.cc (trees_in::reserve_gmes): Only 2 per.
	(trees_in::{set,get}_backref_gme): Delete.
	(trees_in::existing_gme): Rename to ...
	(trees_in::is_existing_gme): ... this.  Return bool.
	(trees_out::mark_gme): Adjust assert.
	(trees_in::insert): Add assert.
	(trees_out::tree_type): Always look at typedef.
	(trees_out::tree_value): Stream type with its decl.
	(trees_in::tree_node): Likewise.
	(trees_{in,out}::tree_gme): Adjust.

	gcc/cp/
	* module.c (module_state::{read,write,mark}_enum): Take DECL.
	(module_state::{read,write,mark}_definition): Adjust.

	gcc/cp/
	* class.c (layout_class_type): Base type has same module as owner.
	* module.c (module_state::{read,write,mark}_class): Take DECL.
	(module_state::{read,write,mark}_definition): Adjust.
	(topmost_decl, get_module_owner): Don't look at TYPE_CONTEXT.

	gcc/cp/
	* class.c (build_base_field_1): Refactor.
	(layout_class_type): Give as_base type a name.
	* decl.c (initialize_predefined_identifiers): Make as_base name
	unpronouncable.
	* module.cc (tree_tag): Delete tt_as_base.
	(trees_out::mark_node): Don't expect fake base here.
	(trees_out::tree_decl): Write fake base as pseudo-named.
	(trees_out::tree_type): Don't handle fake base specially here.
	(trees_in::tree_node): Read fake base as pseudo-named.  Delete
	tt_as_base handling.
	(module_state::mark_class_def): Adjust.

	gcc/cp/
	* module.cc (trees_in): Rename bad_decls to skip_defns.
	(trees_in::{record,is}_bad_decl): Delete.
	(trees_in::{record,is,any}_skip_defn): New.
	(module_state::is_ignorable_defn): Rename to ...
	(module_state::is_skippable_defn): Key off namespace-scope decl.
	(topmost_decl): New.
	(module_state::read_function_def): Adjust.

2018-11-30  Nathan Sidwell  <nathan@acm.org>

	Merge trunk r266680.

	gcc/cp/
	* module.cc: Fix enums with trailing commas.
	* name-lookup.c (match_global_decl): Avoid unused arg warning.

	gcc/cp/
	* module.cc (module_state::write_binfos): Binfo was not visited.

	gcc/cp/
	* module.cc (module_state::write_binfos): Always write number of
	vbases.
	(module_state::read_binfos): Don't smash the type here.
	(module_state:{read,write}_class_def): Adjust binfo serializing.

	gcc/cp/
	* class.c (fixup_type_variants): Copy TYPE_SIZE & TYPE_SIZE_UNIT.
	(finish_struct): Use fixup_type_variants for template.
	* module.cc (trees_{in.out}::core_vals): Don't serialize TYPE_SIZE
	and TYPE_SIZE_UNIT for classes.
	(trees_in::finish_type): Don't layout clesses here.
	(module_state::{read,write}_class_def): Do it here.

	gcc/cp/
	* module.cc (trees_in): Add bad_decls and post_decls.
	(trees_in::{record,is}_bad_decl): New.
	(trees_in::post_process): New.
	(module_state::is_{matching_decl,ignorable_defn}): New.
	(trees_in::tree_node): Use former.
	(module_state::read_function_def): Use latter. Register for
	post-processig.
	(module_state::read_cluster): Post process.

2018-11-29  Nathan Sidwell  <nathan@acm.org>

	Merge global module function definitions.
	gcc/cp/
	* modules.cc (module_state::write_function_def): Don't rely on
	decl's form.
	(module_state::read_function_def): Allow multiple decls.
	gcc/testsuite/
	* g++.dg/modules/leg-merge-5_[abc].[CH]: New.

	gcc/cp/
	* modules.cc (module_state::check_read): Adjust, print inform of
	outer location.
	(module_state::write_cluster): defns are decls too.
	(lazy_load_binding): Don't inform here.
	gcc/testsuite/
	* g++.dg/modules/leg-merge-4_c.C: Adjust regexps.

	Fixing GME classes
	gcc/cp
	* module.cc (trees_in::tree_node_vals): Add specific bool arg,
	adjust.
	(trees_in::existing_gme): Return cookie.
	(trees_in::{get,set}_backref_gme): New.
	(trees_out::mark_gme): Mark typedef target.
	(trees_out::tree_type): Don't be fooled by GME TYPE_NAME.
	(trees_out::tree_value): Write GME type code.
	(trees_in::tree_node): Use backref channel for typedefs.
	gcc/testsuite/
	* g++.dg/modules/leg-merge-4_c.C: Adjust.

	Some ODR checking of GMEs
	gcc/cp/
	* module.cc (trees_in::tree_node): Check type of matched GME.
	(lazy_load_binding): Add note if diagnostics emitted.
	* name-lookup.c (name_lookup::search_namespace_only): Forward
	iterate over slots.
	(match_global_decl): Return close matches.
	gcc/testsuite/
	* g++.dg/modules/leg-merge-4_[abc].[CH]: New.

	Global module var declaration merging.
	gcc/cp/
	* module.cc (trees_in::reserve_gmes): Add headroom.
	(trees_{in,out}::tree_gme): Deal with VAR_DECLs.
	(module_state::write_cluster): Likewise.
	* name-lookup.c (match_global_decl): Likewise.
	gcc/testsuite/
	* g++.dg/modules/leg-merge-3_[abcd].[CH]: New.

	Global module class declaration merging.
	gcc/cp/
	* module.cc (trees_in::start): Check code & category.
	(trees_in::tree_node): Allow gme types.  Refactor gme/node
	reading.
	(trees_{in,out}::tree_gme): Allow implicit typedefs.
	(module_state::write_cluster): GME Implicit typedefs too.
	* name-lookup.c (match_global_decl): Match TYPE_DECLs too.
	gcc/testsuite/
	* g++.dg/modules/leg-merge-2_[abc].[CH]: New.

2018-11-28  Nathan Sidwell  <nathan@acm.org>

	Global module function declaration merging.
	gcc/cp
	* module.cc (tree_tag): Add tt_gme.
	(trees_in::gmes): New data member.
	(trees_in::tree_node_specific): Add no-alloc flag.
	(trees_in::{tree_gme,reserve_gmes,existing_gme}): New.
	(trees_out::walk_kind): Add WK_gme.
	(trees_out::{mark,tree}_gme): New.
	(trees_out::{ref_node,insert}): Deal with WK_gme walk.
	(trees_out::tree_{decl,value}): Likewise.
	(trees_in::tree_node): Add tt_gme support.
	(cluster_tag): Add ct_gme.
	(module_state::{read,write}_cluster): Add gme support.
	* name-lookup.h (match_global_decl): Declare.
	(add_module_decl): Declare.
	* name-lookup.c (match_global_decl): New.
	(set_module_binding): Don't dedup here.
	(add_module_decl): New.
	gcc/testsuite/
	* g++.dg/modules/leg-merge-1_[abcd].[CH]: New.

	gcc/cp/
	* modules.cc (trees_{in,out}::tree_node_bools): Break out
	tree_node_specific.
	(trees_out::ref_force_{lwm.hwm}): Delete.
	(trees_out::gme_lwm): New.
	(trees_out::insert): Change force to walk_kind.
	(trees_out::mark_node): Drop walk_kind arg.
	(trees_out::{,un}mark_trees): Adjust.
	(trees_out::{mark_node,insert}): Adjust.
	(trees_out::start): Drop CODE parm.
	(trees_out::{ref_node,tree_ctx}): Adjust.
	(trees_out::tree_value): Adjust.
	(trees_{in,out}::tree_node): Likewise.
	(module_state::write_binfos): Likewise.
	(module_state::mark_{class,enum}_def): Adjust.
	(module_state::{read,write}_cluster): Adjust.
	(module_state::find_dependencies): Adjust.

2018-11-26  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* modules.cc (trees_{in,out}::tree_node_raw): Bifurcate to ...
	(trees_{in,out}::tree_node_{bools,vals}): ... these.
	(trees_out::tree_value): Adjust.
	(trees_in::tree_node): Likewise.

	gcc/cp/
	* modules.cc (trees_out::tree_ref): Rename to ...
	(trees_out::ref_node): ... this.
	(trees_out::tree{value,decl,type,namespace}): Replace FORCE
	paramenter with walk_kind.
	(trees_out::tree_node): Adjust.
	(module_state::mark_{class,enum,template}_def): Adjust.
	(module_state::write_cluster): Adjust.
	(module_state::find_dependencies): Adjust.

	gcc/cp/
	* modules.cc (trees_out::walk_kind): New enum.
	(trees_out::tree_ref): Return it.
	(trees_out::tree_{ctx,decl,node}): Use it.

	gcc/cp/
	* modules.cc (trees_out::ref_force_{lwm.hwm}): New ref values.
	(trees_out::{,un}mark_trees): Use them.
	(trees_out::{mark_node,tree_ref}): Likewise.

2018-11-20  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* modules.cc (dumper): Rename dump flags.  Adjust throughout.

2018-11-19  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.cc (handle_module_option): Handle OPT_fmodule_legacy.
	gcc/testsuite/
	* g++.dg/modules/modules.exp: Insert /./ in legacy names.
	* g++.dg/modules/*.H: Adjust as necessary.

	Merge trunk r266271.

2018-11-15  Nathan Sidwell  <nathan@acm.org>

	Merge trunk r266161.

	gcc/
	* doc/invoke.texi: Rename cookie->ident, people read too much into
	'cookie'.

2018-11-07  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* parser.c (cp_parser_translation_unit): Refactor.

	Implement d0924r1 (to be written).
	gcc/cp/
	* lex.c (init_reswords): Set D_CXX_MODULES mask.
	* module.cc (declare_module): Check purview state.
	* parser.c (cp_parser_translation_unit): Module and import are
	always conditional.
	(cp_parser_tokenize): Likewise.
	gcc/
	* doc/invoke.texi (fno-module-keywords): Delete.
	gcc/c-family/
	* c-common.c (c_common_reswords): Don't mark import, module for CXXWARN.
	* c.opt (fmodule-keywords): Delete.
	gcc/testsuite/
	* g++.dg/modules/atom-decl-1.C: Delete.
	* g++.dg/modules/keyword-1_[ab].C: Adjust.
	g++.dg/modules/mod-decl-[13].C: Adjust.
	g++.dg/modules/p0713-3.C: Adjust.

	gcc/cp/
	* cp-tree.h (module_gmf_p): Adjust.
	(not_module_p): New.
	* module.cc (declare_module): Don't deal with starting GMF.
	* parser.c (cp_parser_translation_unit): Adjust module_purview
	values.

2018-11-04  Nathan Sidwell  <nathan@acm.org>

	Implement Bjarne's suggested solution.
	gcc/cp/
	* parser.cc (cp_parser_translation_unit): No tentative parsing.
	Look for following ::.
	(cp_parser_module_{name,declaration,import}): Adjust.
	(cp_parser_tokenize): Adjust, tokenize more.
	gcc/
	* doc/invoke.texi (C++ Modules): Update.
	gcc/testsuite/
	* g++.dg/modules/cpp-5_b.C: Update.
	* g++.dg/modules/keyword-1_[ab].C: Likewise.

2018-11-02  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* modules.c (module_state::read): Interface can be lazy too.

	gcc/cp/
	* name-lookup.c (STAT_EXPORTS): Rename to ...
	(STAT_VISIBLE): ... this.
	(name_lookup::search_namespace_only, name_lookup::add_module_fns)
	(check_module_override, set_module_binding): Adjust.
	* module.cc (module_state::read_cluster): Likewise.

	gcc/cp/
	* cp-tree.h (module_may_redeclare): Declare.
	* decl.c (duplicate_decls): Check moduleness.
	* module.cc (module_state::read_cluster): Adjust export tail.
	(module_may_redeclare): New.
	* name-lookup.c (name_lookup::search_namespace_only): Check
	STAT_TYPE_VISIBLE_P.
	(update_binding): Allow NULL LEVEL.
	(check_module_override): New.
	(do_pushdecl): Deal with module overrides.
	(set_module_binding): Adjust.  Don't push interface bindings.
	gcc/testsuite/
	* g++.dg/modules/ambig-1_[ab].C: New.
	* g++.dg/modules/macro-4_e.C: Avoid error.
	* g++.dg/modules/namespace-2_b.C: Remove xfail.

	gcc/cp/
	* module.cc (module_state::read_cluster): Preserve export_tail.
	* name-lookup.c (STAT_HACK_TYPE_VISIBILE_P): New.
	(name_lookup::process_module_binding): Reimplement.
	(name_lookp::search_namespace_only): Likewise.
	(set_module_binding): Adjust when STAT_HACK_EXPORTS is set.

	gcc/cp/
	* decl.c (duplicate_decls): Refactor export check.
	gcc/testsuite/
	* g++.dg/modules/export-1.C: New.

	gcc/cp/
	* decl.c (duplicate_decls): Refactor checks.
	* name-lookup.c (name_lookup::process_module_binding): Only pubic
	namespaces are shared.
	gcc/testsuite/
	* g++.dg/lookup/crash6.C: Adjust error
	* g++.dg/parse/crash38.C: Likewise.

2018-11-01  Nathan Sidwell  <nathan@acm.org>

	Merge trunk r265714.
	Move to autoconf 2.69.

	gcc/cp/
	* module.cc (module_state::read): Don't read macros for
	preprocessed innput.
	(module_state::set_import): Adjust legacy test.

2018-10-31  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.cc (module_state::check_not_purview): Check name.
	(mangle_module, module_name): Likewise.
	(declare_module): Set parent, not alias.

	Merge trunk r265692.

	Merge trunk r265679.

	gcc/cp/
	* cp-tree.h (OVL_EXPORT_P): Delete.
	(OVL_DEDUP_P): Move to lang flag 0.
	* module.cc (module_state::read_cluster): Don't set OVL_EXPORT_P.
	* tree.c (ovl_copy): Don't copy OVL_EXPORT_P.

2018-10-30  Nathan Sidwell  <nathan@acm.org>

	Module interface gets own mod number
	gcc/cp/
	* cp-tree.g (ovl_iterator::set_dedup): New.
	* module.cc (module_state::{interface_p,is_interface}): New.
	(module_state::check_not_purview): Adjust.
	(mangle_module, module_name): Likewise.
	(module_state::read_cluster): Adjust.
	(module_state::read): Adjust.
	(module_state::{set_import,direct_import}): Adjust import setting.
	(declare_module): Module interface gets number.
	* name-lookup.h (set_module_binding): Add iface parameter.
	* name-lookup.c (name_lookup::search_namespace): Fix indexing.
	(set_module_binding): Insert interface decls.
	gcc/testsuite/
	* g++.dg/modules/namespace-4_b.C: Remove xfails.
	* g++.dg/modules/static-1_b.C: Remove xfails.

	gcc/cp/
	* cp-tree.h (OVL_HAS_USING_P): Rename to ...
	(OVL_DEDUP_P): ... here.
	* name-lookup.c (name_lookup::add_overload)
	(get_class_binding_direct): Adjust.
	* tree.c (ovl_make, ovl_copy, ovl_insert, lookup_maybe_add): Adjust.

	Less ordered overloads
	gcc/cp/
	* cp-tree.h (ovl_sort): Declare.
	* name-lookup.h (extract_module_binding): Binding is reference.
	* tree.c (ovl_insert): Don't sort non-hidden members.
	(ovl_splice, ovl_sort): New.
	* name-lookup.c (extract_module_binding): Binding is reference.
	Sort the binding.
	* ptree.c (cxx_print_xnode): Print MODULE_VEC name.
	* module.cc (module_state::add_writables): Binding is reference.
	gcc/testsuite/
	* g++.dg/lookup/friend21.C: New.

2018-10-29  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* cp-tree.h (ovl_insert): Drop export_tail parm.
	* name-lookup.c (update_binding): No need to track export_tail.
	* tree.c (ovl_insert): Drop export_tail parm.
	* ptree.c (cxx_print_xnode): Output formatting.

	gcc/cp/
	* module.cc (module_state::read_imports): Do in one pass.

	gcc/cp/
	* module.cc (module_state::direct_import): Drop DEFERRABLE arg.
	({import,declare}_module): Deal with deferring here.
	(process_deferred_imports): Adjust direct_import call.

2018-10-27  Nathan Sidwell  <nathan@acm.org>

	Merge trunk r265554.

2018-10-26  Nathan Sidwell  <nathan@acm.org>

	Anon namespaces
	gcc/cp/
	* module.cc (elf_out::strtab_write): Fallback to assembler name.
	(elf_out::name): Allow 0 name.
	(dumper::impl::nested_name): Fallback to assembler name.
	(module_state::{read,write}_namespaces): Write assembler name for
	anons.
	* name-lookup.h (add_imported_namespace): add anon-name arg.
	* name-lookup.c (get_imported_namespace): Look in current slot
	too.
	(make_namespace): Add anon-name arg, calculate as necessary.
	(add_imported_namespace): add anon-name arg.
	gcc/testsuite/
	* gcc/testsuite/g++.dg/modules/namespace-4_[abc].C: New.

	Statics on bindings
	gcc/cp/
	* module.cc (depset::hash::add_binding): Take overload and type
	values, do pruning here.
	(module_state::write_cluster): Reorder binding emission.
	(module_state::read_cluster): Determine export_tail here.
	(module_state::add_writables): Adjust.
	* cp-tree.h (ovl_iterator::export_tail): Delete.
	* name-lookup.h (extract_module_decls): Rename to ...
	(extract_module_binding): ... here.  Return overload set.
	* name-lookup.c ( (extract_module_decls): Rename to ...
	(extract_module_binding): ... here.  Don't prune here.
	(set_module_binding): Simplify.
	(lookup_by_ident, get_lookup_ident): Simplify.
	gcc/testsuite/
	* g++.dg/modules/static-1_b.C: XFAIL error
	* gcc/testsuite/g++.dg/modules/unnamed-1_[ab].C: Adjust scans.
	* gcc/testsuite/g++.dg/modules/unnamed-2.C: Likewise.

	gcc/cp/
	* cp-tree.h (module_purview): Declare.
	(module_purview_p, module_interface_p, module_gmf_p): Inline
	predicates.
	* module.cc (module_purview): Extern.
	(module_purview_p, module_interface_p): Delete.

	p1103 no implicit namespace export
	gcc/cp/
	* module.cc (trees_out::mark_node): Allow namespace marking.
	(trees_out::tree_ctx): Namespaces may be forced.
	(trees_out::tree_namespace): Reimplement.
	(trees_out::tree_{type,decl}): Adjust tree_ctx calls.
	(module_state::write_cluster): Likewise.
	(module_state::{read,write}_namespace): Adjust.
	(module_state::find_dependencies): Also walk namespaces.
	* name-lookup.c (name_lookup::process_binding): Fixup hidden
	namespaces.
	(implicitly_export_namespace): New.
	(do_pushdecl, push_namespace): Call it.
	(add_imported_namespace): Add export_p arg, adjust.
	* name-lookup.h (add_imported_namespace): Add export_p arg.
	* ptree.c (cxx_print_node): Adjust MODULE_VEC printing.
	gcc/testsuite/
	* g++.dg/modules/indirect-1_b.C: Adjust scans.
	* g++.dg/modules/namespace-[23].C: Split to ...
	* g++.dg/modules/namespace-[23]_[ab].C: ... these.

2018-10-25  Nathan Sidwell  <nathan@acm.org>

	Rationalize bool ok == true
	gcc/cp/
	* module.cc (elf::has_error): Rename to ...
	(elf::get_error): ... this.  Update all callers.
	(elf::end): Return true == ok.  Update (indirect) callers.
	(module_state::check_read): Likewise.  Update callers.
	(module_state::lazy_load): Zap slot on failure.
	* name-lookup.c (get_binding_or_decl): No need to assert here.

	gcc/cp/
	* module.cc (module_state::write_readme): Tidy.
	(module_state::{add_writables,find_dependencies): Dump
	DEPENDENCIES.
	(module_state::direct_import): Always pop dump.
	* ptree.c (cxx_print_decl): Print DECL_MODULE_EXPORT_P.
	gcc/c-family/
	* c-ppoutput.c (scan_translation_unit): Remove unused var.

2018-10-24  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.cc (enum tree_tag): Add tt_namespace.
	(trees_out::tree_namespace): Use it.
	(trees_in::tree_node): Grok it.
	* name-lookup.h (get_imported_namespace): Declare.
	* name-lookup.c (get_imported_namespace): New.
	gcc/testsuite/
	* g++.dg/modules/indirect-1_c.C: Adjust.

	gcc/cp/
	* module.cc (trees_out::{tree_{decl,type}): Drop owner arg.
	(trees_out::tree_namespace): New.
	(trees_out::ctx): Take owning-decl arg, use tree_namespace.
	(trees_out::{core_vals,tree_binfo}): Adjust.
	(trees_out::{read,write}_cluster): Adjust.

2018-10-23  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.cc: Add dumper::TREES to tree streamers.
	gcc/testsuite/
	* g++.dg/modules/: Add -uid to several lang dumps.

	gcc/cp/
	* module.cc (slurping::remap_module): New.
	(depset::hash::add_binding): Don't deal with namespaces here.
	(module_state::write_namespaces): No longer static.  Write
	locations.
	(module_state::read_namespaces): Read locations.
	(module_state::add_writables): Deal with namespaces here.
	(module_state::find_dependencies): Don't walk namespaces.
	* name-lookup.h (get_lookup_ident, find_by_ident): Reorder args,
	update callers.
	(add_imported_namespace): Add location arg.
	* name-lookup.c (module_binding_slot): Fix initial alloc.
	(extract_module_decls): Return namespace.
	(get_binding_or_decl, lookup_by_ident, get_lookup_ident): Reorder
	args.
	(make_namespace): Add loc & module args.
	(push_namespace): Adjust.
	(add_imported_namespace): Adjust.
	* ptree.c (cxx_print_decl): Avoid final linefeed.
	(cxx_print_xnode): Adjust MODULE_VEC
	gcc/
	* doc/invoke.texi: Document -fdump-lang-module options.
	gcc/testsuite/
	* g++.dg/modules/namespace-2.C: Adjust.

2018-10-22  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* cp-tree.h (module_exporting_level): Delete.
	(module_export_depth): Declare.
	(module_exporting_p): New.
	({push,pop}_module_export): Adjust, make inline.
	* module.cc (export_depth): Replace with ...
	(module_exporting_level): ... this.
	({push,pop}_module_export): Delete.
	(set_module_owner, import_module, module_begin_main_file)
	(finish_module_parse): Adjust.
	* parser.cc (cp_parser_module_export): Adjust.

	gcc/cp/
	* lex.c (module_preprocess_token): Fix padding/comment states.
	* parser.c (cp_parser_tokenize): Reduce is_decl states.

2018-10-21  Nathan Sidwell  <nathan@acm.org>

	Merge trunk r265362.

	Add -fno-module-keywords.
	gcc/
	* doc/invoke.text (fmodule-keywords): Document.
	gcc/cp/
	* lex.c (init_reswords): Don't add module keywords if
	fno-module-keywords.
	*module_preprocess_token): Adjust.
	* module.cc (module_State_config:get_opts): Drop fmodule-keywords.
	* parser.c (cp_parser_import_declaration): Allow to be tentative.
	(cp_parser_translation_unit): Allow module & import to not be
	keywords. Tentatively parse import declaration.
	(cp_parser_module_keyword): Commit to tentative parse.
	(cp_parser_tokenize): Allow import to not be a keyword.
	gcc/testsuite/
	* g++.dg/modules/keywords-1_[ab].C: New.

	gcc/cp/
	* lex.c (module_preprocessing_token): Pay attention to braces.
	* parser.c (cp_parser_tokenize): Return ptr to stopping import.
	Pay attention to CPP_HEADER tokenization.
	(cp_parser_translation_unit): Adjust.

	gcc/cp/
	* parser.c (cp_parser_diagnose_invalid_type_name): Use C_RID_CODE
	more.

2018-10-19  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* parser.c (cp_parser_tokenize): Don't stop after nested
	module/import decl.

2018-10-18  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* parser.c (cp_parser_translation_unit): Adjust GMF deferred
	imports.
	(cp_parser_tokenize): Only pay attention to module/export at start
	of decl.

	gcc/cp/
	* parser.c (cp_parser_translation_unit): Process deferred imports
	here ...
	(cp_parser_tokenize): ... not here.
	gcc/testsuite/
	* g++.dg/modules/macloc-1_d.C: Correct regexp.

	Expunge -fmodules-atom as a thing.
	gcc/
	* doc/invoke.texi (fmodules-atom): Delete.
	gcc/cp/
	* cp-tree.h (modules_legacy_p): Adjust.
	* module.cc: Expunge OPT_fmodules-atom.
	gcc/c-family/
	* c.opt (fmodules-ts): Adjust.
	(fmodules-atom): Alias fmodules-ts
	(fmodule-legacy*): Adjust.

	gcc/testuite/
	* g++.dg/modules/modules.exp (mode-list): Delete.
	(main): Don't use mode-list.
	* g++.dg/modules/: Add -fmodules-ts to many tests.

	Remove ATOM as a distinction.
	gcc/c-family/
	* c-cppbuiltin.c (c_cpp_builtins): Remove __cpp_modules_{atom,ts}.
	* c.opt (fmodules-ts): Adjust.
	gcc/cp/
	* cp-tree.h (modules_atom_p): Delete.
	* module.cc (module_state::write_readme): Drop ATOM distinction.
	(module_state::{read,write}_config): Likewise.
	(init_module_processing): Drop atom distinction.
	(handle_module_option): Adjust.
	gcc/testsuite/
	* g++.dg/modules/: Drop -fmodules-atom from all tests.

	Simplify translate-include hook.
	libcpp/
	include/cpplib.h (cpp_translate_include_t): Delete.
	(struct cpp_calbacks): Adjust translate_include decl.
	gcc/
	* langhooks.h (struct lang_hooks): Adjust preprocess_translate_include.
	gcc/c-family
	* c-opts.c (c_common_post_options): Adjust.
	gcc/cp/
	* cp-tree.h (maybe_import_include): Replace by ...
	(module_translate_include): ... this.
	* cp-lang.c (LANG_HOOKS_PREPROCESS_TRANSLATE_INCLUDE): Adjust.
	* module.c (module_state::do_import): Check read on all top level
	imports.
	(do_translate_include): Rename to ...
	(module_translate_include): ... this.  Explicitly turn off.
	(maybe_import_include): Delete.

	Preamble on module
	gcc/cp/
	* parser.c (cp_parser_import_declaration): Always check past_preamble.
	gcc/testsuite/
	* g++.dg/modules/atom-norescan-1.C: Delete.
	* g++.dg/modules/atom-pragma-1.C: Not atom-specific.
	* g++.dg/modules/atom-pragma-3.C: Likewise.
	* g++.dg/modules/atom-preamble-1.C: Likewise.
	* g++.dg/modules/atom-preamble-2_a.C: Likewise.
	* g++.dg/modules/atom-preamble-2_b.C: Likewise.
	* g++.dg/modules/atom-preamble-2_c.C: Likewise.
	* g++.dg/modules/atom-preamble-2_d.C: Likewise.
	* g++.dg/modules/atom-preamble-2_e.C: Likewise.
	* g++.dg/modules/atom-preamble-3.C: Likewise.
	* g++.dg/modules/atom-preamble-4.C: Likewise.
	* g++.dg/modules/mod-indirect-1_b.C: Adjust.

	No export { import x; }
	gcc/cp/
	* parser.c (cp_parser_tokenize): Drop nested arg, adjust.
	(cp_parser_translation_unit): Don't deal with outermost export { block.
	gcc/testsuite/
	* g++.dg/modules/err-1_a.C: Adjust.
	* g++.dg/modules/err-1_c.C: Adjust.
	* g++.dg/modules/import-1_c.C: Adjust.
	* g++.dg/modules/mod-decl-1.C: Adjust.


	No atom preamble in non-module
	gcc/cp/
	* parser.c (cp_parser_translation_unit): Preamble is tristate.
	(cp_parser_module_name): Add FOR_MODULE arg, issue error.
	(cp_parser_module_declaration): Adjust.
	(cp_parser_import_declaration): Adjust twice.
	gcc/testsuite/
	* g++.dg/modules/atom-decl-[23].C: Adjust.
	* g++.dg/modules/legacy-6_f.C: Remove XFAIL.

2018-10-17  Nathan Sidwell  <nathan@acm.org>

	gcc/testsuite/
	* g++.dg/modules/err-2_[ab].*: Move to ...
	* g++.dg/modules/cpp-5_[ab].*: ... here.
	* g++.dg/modules/cpp5_c.C: New.

	Robustify parse errors on module/import decls.
	gcc/cp/
	* parser.c (cp_parser_consume_semicolon_at_end_of_statement):
	Return void.
	(cp_parser_translation_unit): Adjust.
	(cp_parser_{module,import}_declaration): Don't try and resync
	here.
	(cp_parser_tokenize): Deal with unprocessed incoming tokens.
	gcc/testsuite/
	* g++.dg/modules/err-2_[ab].*: New.

2018-10-16  Nathan Sidwell  <nathan@acm.org>

	Remove some atom/ts differences.
	gcc/cp/
	* module.cc (declare_module): Copy always.
	* parser.c (cp_parser_translation_unit): Allo GMF under atom.
	(cp_parser_module_name): Allow legacy name under ts
	(cp_parser_initial_pragma): Fix from trunk.
	gcc/testsuite/
	* g++.dg/modules: Many changes.

	gcc/cp/
	* module.cc (module_purview): New.
	(module_purview_p, module_interface_p): Use it.
	(module_maybe_interface_p): New.
	(module_state::direct_import): Use it.
	(process_deferred_imports): Likewise.
	(declare_module): Set it.
	* parser.c (cp_parser_translation_unit): Inform modules of GMF.

	gcc/testsuite/
	* g++.dg/modules/macloc-1_[abcd].C: No longer atom-specific.

	Locations for everyone!
	gcc/cp/
	* module.cc (loc_spans::{init,open,close}): Dump info.
	(module_state::{read,write}_location): No longer atom-specific.
	(module_state::{read,write}): Locations for everyone.
	(process_deferred_imports): Open and close spans correctly.
	gcc/testsuite/
	* g++.dg/modules/adhoc-1_[ab].C: No longer atom-specific.
	* g++.dg/modules/loc-1_[abc].C: Likewise.
	* g++.dg/modules/loc-2_[abcdef].C: Likewise.

	gcc/
	* dumpfile.c (dump_switch_p_1): Don't let a '-' filename fool the
	option machinery.

	Legacy importing during -E
	gcc/c-family/
	* c-lex.c (init_c_lex): Don't use lang_hooks here.
	* c-opts.c (c_common_init): Set them here.
	gcc/cp/
	* lex.c (module_preprocess_token): Enable legacy importing.
	* module.cc (module_state::read): Skip items when preprocessing
	only.
	(module_cpp_undef): Adjust unsetting.
	gcc/testsuite/
	* g++.dg/modules/cpp-2_c.C: Adjust.

	Remove token peeking & preamble related infrastructure.
	libcpp/
	* include/cpplib.h (cpp_relocate_peeked_tokens): Delete.
	(cpp_peek_token_with_location): Delete.
	(cpp_in_macro_expansion_p): Delete.
	* directives-only.c (_cpp_preprocess_dir_only): Adjust
	_cpp_handle_directive call.
	* directives.c (struct if_stack): Drop hash_loc.
	(PEEK_INVISIBLE): Delete.
	(linemarker_dir): Adjust.
	(_cpp_handle_directive): Drop hash_loc arg.  dont set it.
	(push_conditional): Drop hash_loc.
	* init.c (read_original_filename): Adjust _cpp_handle_directive
	call.
	* internal.h (struct cpp_reader): Delete peeked_directive field.
	(_cpp_handl_directive): Drop hash_loc arg.
	* lex.c (cpp_relocate_peeked_tokens): Delete.
	(cpp_peek_token): Swallow ...
	(cpp_peek_token_with_location): ... this.  Delete.
	(_cpp_lex_token): Adjust _cpp_handle_directive call.
	* macro.c (cpp_in_macro_expansion_p): Rename to ...
	(cpp_in_macro_expansion): ... this.  Make static.
	* traditional.c (_cpp_scan_out_logical_line): Adjust
	_cpp_handle_directive call.

	gcc/testsuite/
	* g++.dg/modules/*.H: Drop unnecessary -fmodules-atom option.

	Reimplement preamble peeking
	gcc/
	* doc/invoke.texi (fmodule-preamble): Delete.
	* langhooks-def.h (LANG_HOOKS_PREPROCESS_PREAMBLE): Replace with ...
	(LANG_HOOKS_PREPROCESS_TOKEN): ... this.
	* langhooks.h (struct lang_hooks): Replace preprocess_preamble
	with preprocess_token.
	c-family/
	* c-ppoutput.c (scan_translation_unit): Adjust preprocess lang
	hook.
	* c.opt (fmodule-preamble, fmodule-preamble=): Delete.
	gcc/cp/
	* cp-lang.c (module_preamble_fsm): Delete.
	(LANG_HOOKS_PREPROCESS_PREAMBLE): Delete.
	(LANG_HOOKS_PREPROCESS_TOKEN): Override.
	* cp-tree.h (enum module_preamble_state): Delete.
	(module_preamble_prefix_{peek,next}): Delete.
	(module_preprocess_token): Declare.
	* lex.c (module_preamble_prefix_{peek,next}): Delete.
	(module_preprocess_token): New.
	* module.c (init_module_processing, handle_module_option): Drop
	preamble option handling.
	gcc/testsuite/
	* g++.dg/modules/*: Many changes.

	Remove preamble repeating.
	gcc/cp/
	* cp-tree.h (maybe_repeat_preamble): Delete.
	* module.c (maybe_repeat_preamble): Delete.
	* parser.c (cp_parser_initial_pragma): Revert to trunk.
	* lex.c (modle_preamble_prefix_peek): Don't repeat preamble.
	gcc/testsuite/
	* g++.dg/modules/cpp-preamble-1.C: Adjust.
	* g++.dg/modules/atom-preamble-1.C: Is now well formed.

	Remove preamble peeking
	gcc/cp/
	* cp-tree.h ({import,declare}_module): return void.
	(process_deferred_imports): Return void.
	(module_state::direct_import): Return void, deferrable is
	tristate.  Push onto pending_import vector if permitted.
	({import,declare}_module): Don't return adjustment, use
	direct_import always.
	(process_deferred_imports): Don't return adjustment.
	* parser.c (cp_parser_module_declaration): Return void, drop first
	arg.
	(cp_parser_import_declaration): Return void.
	(cp_parser_module_export): Don't deal with module declaration
	here.
	(cp_parser_get_module_preamble_tokens)
	(cp_parser_parse_module_preamble): Delete.
	(cp_parser_tokenize): Delete #ifdef'd adjustment code.
	(c_parse_file): Don't peek preamble.
	libcpp/
	* line-map.c (linemap_module_restore): Don't calculate adjustment.
	* include/line-map.h (linemap_module_restore): Return void.

	Common tokenizer for atom & ts
	gcc/cp/
	* module.cc ({import,declare}_module): Don't defer legacy modules.
	* parser.c (cp_parser_translation_unit): Deal with atom preamble.
	(cp_parser_module_declaration): No need to check if first.
	(cp_parser_tokenize): Enable filename token as needed.
	(c_parse_file): Disable preamble scan.
	gcc/testsuite/
	* g++.dg/modules/alias-1_b.C: Adjust.
	* g++.dg/modules/atom-pragma-1.C: Adjust
	* g++.dg/modules/atom-pragma-2.C: Delete.
	* g++.dg/modules/atom-preamble-2_e.C: Copy from 2_f.C
	* g++.dg/modules/atom-preamble-2_f.C: Delete.
	* g++.dg/modules/atom-preamble-[34].C: Adjust.
	* g++.dg/modules/atom-rescan-1.C: Delete.
	* g++.dg/modules/ice-1.C: Adjust
	* g++.dg/modules/macro-2_c.H: Adjust
	* g++.dg/modules/macro-3_b.H: Adjust
	* g++.dg/modules/macro-3_c.C: Adjust
	* g++.dg/modules/macro-6_b.C: Adjust

	gcc/cp/
	* cp-tree.h (process_deferred_imports): Drop location arg.
	* modules.cc ({import,declare}_module): Disable eager imports.
	(process_deferred_imports): Drop location arg, take it from the
	deferred imports.
	* parser.c (cp_parser_translation_unit): Process deferred imports.
	(cp_parser_tokenize): Correct close-brace handling.  Process
	deferred imports.
	(c_parse_file): Adjust prcess_deferred_imports call.
	gcc/testsuite/
	* g++.dg/modules/atom-preamble-1.C: More workarounds

	gcc/cp/
	* parser.c (cp_parser_translation_unit): Detect GMF here ...
	(cp_parser_module_declaration): ... not here.

2018-10-15  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* cp-tree.h ({import,declare}_module): Return adjustment.
	* module.c (module_state::direct_import): Preserve line table,
	return adjustment.
	* parser.c (cp_parser_fill_main): Delete.
	(cp_parser_tokenize): Take cp_token pointer, reorder check & push.
	(cp_parser_translation_unit): Take cp_token pointer, call
	cp_parser_tokenize.
	(c_parse_file): Don't tokenize here.

	gcc/cp/
	* lang-specs.h: Fix .s elision with legacy modules.

	gcc/
	* langhooks.h (struct lang_hooks): Adjust preprocess_main_file
	signature.
	gcc/c-family/
	* c-opts.c (push_command_line_include): Adjust
	preprocess_main_file hook call.
	(cb_file_change): Likewise.
	gcc/cp/
	* cp-lang.c (LANG_HOOKS_PREPROCESS_MAIN_FILE): Adjust.
	* cp-tree.h (module_note_main_file): Rename to ...
	(module_begin_main_file): ... here.
	(maybe_begin_legacy_module): Delete.
	* module.cc (declare_module): Remove legacy handling here.
	(module_note_main_file): Rename to ...
	(module_begin_main_file): ... here.  Swallow ...
	(maybe_begin_legacy_module): ... this.
	(process_deferred_imports): We're already exporting for legacy
	headers.
	* parser.c (c_parse_file): Don't call maybe_begin_legacy_module.

	gcc/cp/
	* cp-tree.h (process_deferred_imports): New.
	(module_preamble_load): Delete.
	* module.cc (module_state::direct_import): Fatal error here.
	(module_state::preamble_load): Delete, move into ...
	(process_deferred_imports): ... here.  Subsume ...
	(module_preamble_load): ... this.
	* parser.c (c_parse_file): Adjust.
	gcc/testsuite/
	* g++.dg/modules/atom-inc-1.C: Delete.
	* g++.dg/modules/atom-inc-1_[abc].*: New.
	* g++.dg/modules/import-2.C: Adjust.

	gcc/cp/
	* module.cc (module_state::direct_import): New.
	({import,declare}_module): Call it.
	(module_state::preamble_load): Likewise.

2018-10-12  Nathan Sidwell  <nathan@acm.org>

	libcpp/
	* lex.c (cpp_peek_token_with_location): Fix pragma rewinding.
	gcc/cp/
	* parser.c (cp_parser_initial_pragma): Peek at first token.

	Merge trunk r265127.

	gcc/cp/
	* parser.c (cp_parser_{module,import}_declaration): Remove temp hacks.
	(cp_parser_translation_unit, cp_parser_parse_module_preamble): Adjust.
	gcc/testsuite/
	* g++.dg/modules/atom-decl-1.C: Adjust errors.
	* g++.dg/modules/atom-preamble-1.C: Likewise. XFAIL.
	* g++.dg/modules/mod-decl-1.C: Likewise,
	* g++.dg/modules/p0713-[23].C: Likewise.

	gcc/cp/
	* parser.c (cp_parser_translation_unit): Deal with one level of
	export block here.
	(check_module_outermost): Delete.
	(cp_parser_{module,import}_declaration): Don't call it.
	(cp_parser_declaration): Don't deal with module or import decls.
	gcc/testsuite/
	* g++.dg/modules/mod-decl-[13].C: Adjust errors.

	gcc/cp/
	* parser.c (cp_parser_translation_unit): Detect module and import
	declarations here.

	Start breaking out toplevel parsing.
	gcc/c-family/
	* c.opt (Wlegacy-header): Delete.
	gcc/
	* doc/invoke.texi (Wlegacy-header): Delete.
	gcc/cp/
	* cp-lang.c (module_preamble_fsm): Don't call atom_preamble_end.
	* cp-tree.h (atom_preamble_end): Delete.
	* lex.c (module_preamble_prefix_peek): Drop Wlegacy_header check.
	* module.cc (module_preamble_end_loc): Delete.
	(do_translate_include): Always translate.
	(maybe_import_include): Drop Wlegacy_header check.
	(atom_preamble_end): Delete.
	* parser.h (cp_parser): Drop implicit_extern_c.
	* parser.c (cp_parser_tokenize): New.
	(cp_debug_parser): Drop implicit_extern_c.
	(cp_parser_new): Likewise.
	(cp_parser_translation_unit): Move global module detectin here.
	(module_preamble_end_loc): Delete declaration.
	(in_preamble): Temp hack.
	(cp_parser_{import,module}_declaration): A couple of temp hacks.
	(cp_parser_parse_module_preamble): Manipulate in_preamble.
	(cp_parser_toplevel_declaration): New, broken out of ...
	(cp_parser_declaration_seq_opt): ... here, call it. Drop top_level arg.
	(c_parse_file): Adjust.
	gcc/testsuite/
	* g++.dg/modules/atom-decl-[23].C: Adjust diags.
	* g++.dg/modules/atom-preamble-[13].C: Likewise.
	* g++.dg/modules/legacy-6_[df].C: Likewise.

2018-10-11  Nathan Sidwell  <nathan@acm.org>

	Merge trunk r265055.

	Kill proclaiming decls
	gcc/cp/
	* cp-tree.h (push_module_export): Drop proclaiming arg.
	* module.c (proclaimer): Delete.
	({push,pop}_module_export): Adjust.
	(maybe_begin_legacy_module, module_preamble_load): Adjust.
	* parser.c (cp_parser_module_export): Adjust error.
	(cp_parser_module_proclamation): Delete.
	(cp_parser_declaration): Don't call it.
	gcc/testsuite/
	* g++.dg/modules/proclaim-1.C: Delete.

	Macro locations! (ATOM only)
	libcpp/
	* internal.h (linemap_enter_macro): Move declaration to ...
	* include/cpplib.h (linemap_enter_macro): ... here.
	(linemap_lookup_macro_index): Declare.
	* line-map.c (linemap_lookup_macro_index): Break out of ...
	(linemap_macro_map_lookup): ... this.  Use it.
	gcc/cp/
	* module.cc (loc_spans): Record macro spans.
	(module_state::write_readme): Record controlling macro.
	(module_state::{read,write}_location{s,}): Stream macro locations.
	(module_state::write_readme): Move later.
	gcc/testsuite/
	* g++.dg/modules/macloc-1_[abcd].C: New.

	Merge trunk r265037.

2018-10-10  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.cc (loc_spans::close): Close the current last map.
	(module_state::prepare_locations): Adjust.
	(module_state::preamble_load): Adjust span closing.
	(finish_module_parse): Likewise.

	gcc/cp/
	* module.cc (pending_imports): New.
	({import,declare}_module): Use it.
	(module_from_cmp): Delete.
	(module_state::preamble_load): Use pending_imports array.

	gcc/
	* doc/invoke.texi (fmodule-legacy): Augment syntax.
	gcc/cp/
	* module.cc (module_controlling_macro): Replace with ...
	(module_legacy_macro): ... this.
	(module_state::{read,write}_config): Controlling macros only for
	legacy mode.
	(set_module_legacy_name): New.
	(maybe_begin_legacy_module, handle_module_option): Use it.
	(init_module_processing, finish_module_parse): Adjust.
	gcc/c-family/
	* c.opt (fmodule-macro): Delete.
	gcc/testsuite/
	* g++.dg/modules/alias-1_a.H: Fix.
	* g++.dg/modules/legacy=0[ab].H: Adjust.
	* g++.dg/modules/alias-2_*: New.

	gcc/cp/
	* module.cc (module_state::controlling_macro): Delete.
	(module_state_config): New struct.
	(module_state::{read,write}_config): Wrap args in a struct.
	(get_option_string): Move into module_state_config.
	(module_state::write_macros): Adjust.
	(module_state::{read,write}): Adjust.

	gcc/cp/
	* module.cc (module_state::{read,write}_defines): Rename to ...
	(module_state::{read,write}_macros): ... here.
	(module_state::{read,write}): Cope with legacy aliases.
	(finish_module_parse): Install initialized controlling macro.
	gcc/testsuite/
	* g++.dg/modules/alias-1_[cdef].C: New.

2018-10-09  Nathan Sidwell  <nathan@acm.org>

	Lazy macro table loading
	gcc/cp/
	* module.cc (struct slurping): Add macro_tbl, rename macros to
	macros_def.
	(slurping::~slurping): Release macro_tbl.
	(module_state::{read,write}_config): Replace macro count with
	boolean.
	(module_state::{import,install}_defines): New.
	(module_state::read_defines): Map in the table, don't read it.
	(module_state::{check_read,freeze_an_elf}): Adjust.
	(import_module, module_state::preamble_load): Use install_defines.
	gcc/testsuite/
	* g++.dg/modules/macro-6_[abc].*: New.

	Controlling macros & alias detection
	gcc/cp/
	* module.cc (cpp_node, identifier): Conversions between
	cpp_hashnode and IDENTIFIER. Use them.
	(data_in::no_more): Seek end.
	(module_state::{resolve,is}_alias): New.
	(module_state::read): Return alias.
	(module_state::read_config): Initialize controlling macro,
	determine alias.
	(module_state::{read,write}_define): Allow unlocated macros.
	(module_controlling_macro): New switch.
	(module_state::{read_imports,do_import}): Deal with aliases.
	(module_state::write_config): Write controlling macro.
	(module_state::write_defines): Deal with controlling macro.
	(module_state::preamble_load): Deal with aliases.
	(finish_module_parse): Process explicit controlling macro.
	gcc/testsuite/
	* g++.dg/modules/alias-1*: New.
	* g++.dg/modules/macro-[234]*: Adjust.
	* g++.dg/modules/only-[23].C: Adjust.
	libcpp/
	* include/cpplib.h (HT_NODE,NODE_LEN,NODE_NAME): Adjust.
	(cpp_set_deferred_macro): Add defaulted forced arg.

2018-10-05  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.cc (module_state::deferred_macro): Print macro
	definition.
	gcc/testsuite/
	* g++.dg/modules/macro-2_d.C: Adjust regexps.
	* g++.dg/modules/macro-4_[de].C: Likewise.
	* g++.dg/modules/macro-5_c.C: Likewise.
	libcpp/
	* include/cpplib.h (cpp_macro_definition): Add overload.
	(cpp_macro_definition_location): Make inline, adjust.
	* macro.c (get_deferred_or_lazy_macro): New, broken out of ...
	(_cpp_notify_macro_use): ... here.  Call it.
	(warn_of_redefinition): Call it.
	(cpp_macro_definition): Split into two overloads. Deal with
	deferred macros.
	(cpp_macro_definition_location): Delete.

	gcc/cp/
	* module.cc (module_state): Add controlling_macro, unionize slurp
	with alias.  Add accessors.  Use them.
	(module_state::{read,do_import,read_config}): Drop check_crc arg.
	(module_state::read_imports): Zap direct_p before importing.

	Use 'include translation' terminology.
	gcc/c-family/
	* c-opts.c (c_common_post_options): Adjust.
	gcc/cp/
	* cp-lang.c (LANG_HOOKS_PREPROCESS_TRANSLATE_INCLUDE): Override.
	* cp-tree.h (maybe_import_include): Adjust return type.
	* module.cc (module_mapper::translate_include): Replace ...
	(module_mapper::divert_include): ... this.
	(do_translate_include): Replace ...
	(do_divert_include): ... this.
	(maybe_import_include, atom_preamble_end): Adjust.
	gcc/
	* langhooks-def.h (LANG_HOOKS_PREPROCESS_DIVERT_INCLUDE): Replace
	with ...
	(LANG_HOOKS_PREPROCESS_TRANSLATE_INCLUDE): ... this.
	* langhooks.h (struct lang_hooks): Replace
	preprocess_divert_include with preprocess_translate_include.
	libcpp/
	* directives.c (do_include_common): Adjust.
	* include/cpplib.h (cpp_divert_include_t): Rename to ...
	(cpp_translate_include_t): ... this.
	(struct cpp_callbacks): Replace divert_include with translate_include.

	Mainfile loc has no line number.
	libcpp/
	* internal.h (_cpp_stack_file): Add line_one_p arg.
	* files.c (_cpp_stack_file): Likewise.  Use it.
	* include/cpplib.h (cpp_read_main_file): Add line_one_p arg.
	* init.c (cpp_read_main_file): Likewise, use it.
	gcc/c-family/
	* c-opts.c (c_common_post_options): Start main file on line zero.
	(push_command_line_include): Call preprocess_main_file hook here ...
	(cb_file_change): ... except when reading preprocessed source.
	* c.opt: Add full stops.
	gcc/cp/
	* module.cc (module_note_main_file): Remove fixmes fixed yesterday.
	gcc/testsuite/
	* g++.dg/modules/macro-4_[de].C: Adjust regexp.
	* g++.dg/modules/macro-5_c.C: Likewise.
	* lib/options.exp (check_for_options): Fix comment typos.

2018-10-04  Nathan Sidwell  <nathan@acm.org>

	Dump command line macros, better command line locs
	libcpp/
	* include/cpplib.h (cpp_force_token_locations): Take location, not
	pointer.
	* internal.h (cpp_reader): Replace forced_token_location_p with
	forced_token_location.
	* init.c (cpp_create_reader): Adjust.
	* lex.c (_cpp_lex_direct, cpp_force_token_locations): Adjust.
	(cpp_stop_forcing_token_locations): Adjust.
	gcc/c-family/
	* c-opts.c (c_finish_options): Force command line locations.
	gcc/cp/
	* module.cc (loc_spans::init): Add fixed and cmd line locs.
	(loc_spans::SPAN_*): New.
	(loc_spans::cmd_line): New.
	(module_state::read_location): Adjust, return module loc for
	UNKNOWN.
	(module_state::{prepare,read,write}_locations): Adjust.
	(maybe_add_macro): Write cmd_line macros.
	(load_macros): Location is main source file.
	gcc/fortran/
	* cpp.c (gfc_cpp_init): Adjust token forcing.
	gcc/testsuite/
	* g++.dg/modules/macro-4_[de].C: Adjust regexp.
	* g++.dg/modules/macro-5_*: New.

2018-10-01  Nathan Sidwell  <nathan@acm.org>

	Merge trunk r264769.
	Slip in module.c -> module.cc rename

	Merge trunk r264765.

	gcc/cp/
	* lang-specs.h: Error out on -fcoroutines.

	From c++-coroutines branch:
	2018-10-01  Iain Sandoe  <iain@sandoe.co.uk>
	gcc/c-family/
	* c-common.h (RID_CO_AWAIT, RID_CO_YIELD, RID_CO_RETURN,
	D_CXX_COROUTINES, D_CXX_COROUTINES_FLAGS): New.
	* c-common.c (c_common_reswords): co_await, co_yield,
	co_return New keywords.
	gcc/cp/
	* lex.c (init_reswords): Handle flag_coroutines.
	gcc/c-family/
	* c.opt (fcoroutines, fcoroutines-ts): New.

	Avoid UB type punning union shenanigans
	gcc/cp/
	* module.c (macro_import::slot): Explicitly code bit
	manipulation.  Update all users.
	gcc/testsuite/
	* g++.dg/modules/adhoc-1_b.C: Adjust regexp for wierd dejagnu/TCL bug.

	AdHoc locations
	gcc/cp/
	* modules.c (dumper): Add LOCATIONS, flags.
	(dumper::operator()): Add default arg.
	(dumper::push): Set flags.
	(module_state::{read,write}_location): Serialize adhoc locs.
	(module_state::deferred_macro): Optimize current TU undef case.
	gcc/testsuite/
	* g++.dg/modules/adhoc-1_[ab].C: New.

2018-09-28  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.c (module_state::deferred_macro): Fix undef hiding logic.
	gcc/testsuite/
	* g++.dg/modules/macro-4*: New.

2018-09-27  Nathan Sidwell  <nathan@acm.org>

	No speculative undefs.
	gcc/cp/
	* module.c (maybe_add_macro): Simplify.
	(module_state::undef_macro): Only add undef for a deferred macro.

	Add -fforce-module-macros
	libcpp/
	* include/cpplib.h (get_deferred_macro): Declare.
	* macro.c (undefer_macro): Rename to ...
	(get_deferred_macro): ... here.  Adjust callers.
	gcc/
	* doc/invoke.texi (fforce-module-macros): Document.
	gcc/c-family/
	* c.opt (fforce-module-macros): New.
	gcc/cp/
	* module.c (get_option_string): Prune more options.
	(load_macros): New.
	(finish_module_parse): Walk identifiers, if forcing macros.

2018-09-26  Nathan Sidwell  <nathan@acm.org>

	Add deferred cpp_hashnode field. Replace macro_imports hash table
	with vector and refactor.
	libcpp/
	* include/cpplib.h (NODE_DEFERRED_MACRO): Delete.
	(cpp_hashnode): Reduce flags width.  Add deferred field.
	(cpp_deferred_macro_p): Delete.
	(cpp_set_deferred_macro): Don't set flag.
	* directives.c (do_undef): Adjust deferred check.
	* macro.c (undefer_macro): Adjust.
	gcc/cp/
	* module.c (macro_export): Drop node field.  Add ctor.
	(macro_import): Rename one to struct slot.  Add ctors, type
	erase.  Delete struct traits.
	(macro_imports): Change to vec type.
	(macro_import::{append,exported}): Adjust.
	(get_macro_{imports,exports}): Allocate node deferred index,
	adjust.
	(maybe_add_macro): Add to macros vector, check unexported undefs
	here.
	(macro_loc_cmp): Reimplement.
	(module_state::{read,write}_macros): Adjust.
	(module_state::{undef,deferred}_macro): Likewise.
	(finish_module_parse): Adjust deallocation.

	Macro import and export (corrected).
	libcpp/
	* include/cpplib.h (cpp_callbacks): Add user_deferred_macro.
	(NODE_DEFERRED_MACRO): New.
	(cpp_hashnode): Increase flags size.
	(cpp_deferred_macro_p, cpp_set_deferred_macro): New.
	(cpp_compare_macros): Take two macros.
	* internal.h (_cpp_notify_macro_use): Take source location, return bool.
	(_cpp_maybe_notify_macro_use): Likewise.
	* directives.c (do_undef): Don't warn about unresolved deferred
	macros.
	(do_ifdef, do_ifndef): Cope with deferred macros evaporating.
	* expr.c (parse_defined): Likewise.
	* macro.c (undefer_macro): New.
	(enter_macro_context): Adjust notify call.
	(cpp_get_token_1): Deal with deferred nodes.
	(warn_of_redefinition):  Node extraction of compare, call ...
	(cpp_compare_macros): ... this to compare two macros.
	(cpp_create_definition): Adjust compare call.
	(_cpp_notify_macro_use): Deal with deferred macros.
	gcc/
	* langhooks-def.h (LANG_HOOKS_PREPROCESS_DEFERRED_MACRO): New.
	* langhooks.h (struct langhooks): Add preprocess_deferred_macro.
	gcc/c-family/
	* c-lex.c (init_c_lex): Register deferred_macro hook.
	gcc/cp/
	* cp-tree.h (module_cpp_deferred_macro): Declare.
	* cp-lang.c (LANG_HOOKS_PREPROCESS_DEFERRED_MACRO): Override.
	* module.c (bytes_in::random_access): New.
	(elf_in::{preserve,release}): New.
	(slurping::{legacies,macros}): New fields.
	(slurping::close): New.
	(module_state::legacies): Remove field.
	(module_state::slurper): Delete.
	(module_state::{read,write}_config): Add number of macros.
	(module_state::{read,write}_define{,s}): Reimplement.
	(module_state::{undef,deferred}_macro): New.
	(cpp_undefs): Delete.
	(struct macro_export, struct macro_import): New.
	(get_macro_{export,import}): New.
	(maybe_add_macro,macro_loc_cmp): Adjust.
	(module_state::{read,write}): Adjust.
	(module_state::check_read): Adjust.
	(module_state::set_import): Adjust.
	(module_state::freeze_an_elf): Preserve macros.
	(import_module): Update legacies bitmap.
	(module_cpp_undef): Call module_state::undef_macro.
	(module_cpp_deferred_macro): New.
	(finish_module_parse): Free macro state.
	gcc/testsuite/
	* g++.dg/modules/macro-2_*: Adjust tests.
	* g++.dg/modules/macro-3_*: Likewise.

2018-09-23  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* modules (module_state): Add legacies bitmap.
	(module_state::write): Write README later.
	(module_state::read): Set legacies bit.
	(module_state::set_import): Update legacies.
	gcc/testsuite/
	* g++.dg/modules/unnamed-1_b.C: Update.

2018-09-16  Nathan Sidwell  <nathan@acm.org>

	gcc/
	* doc/invoke.texi (C++ Modules): Update mapper protocol.
	* cxx-mapper.c (client): Remove bewait, forget members.
	(client::action): Remove BYIMPORT, BEWAIT & RESET.

	Remove BYIMPORT, BEWAIT.
	gcc/cp/
	* module.c (module_mapper::uncork): Send blank command.
	(module_mapper::imex_query): Take exported_p bool.
	(module_mapper::bewait_{cmd,response}): Delete.
	(module_mapper::send_command): Don't shortcut blank format.
	(module_state::preamble_load): Avoid async commands.

2018-09-14  Nathan Sidwell  <nathan@acm.org>

	gcc/
	* langhooks.h (preprocess_main_file): Drop index arg.
	gcc/c-family/
	* c-opts.c (cb_file_change): Adjust preprocess_main_file hook.
	gcc/cp/
	* cp-tree.h (module_node_main_file): Drop index parm.
	* module.c (loc_spans::init_p, ): New.
	(loc_spans::init_once): Rename to ...
	(loc_spans::init): ... here.
	(loc_spans::main_start): New.
	(prefix_line_maps_hwm, prefix_locations_hwm): Delete.
	(maybe_add_macro, declare_module, do_divert_include)
	(module_note_main_file, maybe_begin_legacy_module): Adjust.

	A grand renaming
	gcc/cp/
	* cp-tree.h (atom_preamble_state, atom_preamble_prefix_peek)
	(atom_preamble_prefix_next): Rename to ...
	(atom_preamble_state, atom_preamble_prefix_peek)
	(atom_preamble_prefix_next): ... here.
	(atom_cpp_undef, atom_module_preamble, atom_main_file)
	(atom_divert_include, maybe_atom_legacy_module): Rename to ...
	(module_cpp_undef, module_preamble_load, module_note_main_file)
	(maybe_import_include, maybe_begin_legacy_module): ... here.
	* cp-lang.c (LANG_HOOKS_PREPROCESS_MAIN_FILE)
	(LANG_HOOKS_PREPROCESS_DIVERT_INCLUDE)
	(LANG_HOOKS_PREPROCESS_UNDEF, LANG_HOOKS_PREPROCESS_PREAMBLE): Adjust.
	(module_preamble_fsm): Adjust.
	* lex.c (atom_preamble_prefix_peek, atom_preamble_prefix_next):
	Rename to ...
	(atom_preamble_prefix_peek, atom_preamble_prefix_next): ... here.
	Adjust.
	* module.c (atom_cpp_undef, atom_module_preamble, atom_main_file)
	(atom_divert_include, maybe_atom_legacy_module): Rename to ...
	(module_cpp_undef, module_preamble_load, module_note_main_file)
	(maybe_import_include, maybe_begin_legacy_module): Here ... Adust.
	* parser.c (cp_parser_get_module_preamble_tokens, c_parse_file):
	Adjust.

	Expunge the spewer
	gcc/cp/
	* module.c (struct slurping): No need to tag.
	(struct spewing): Delete.
	(declare_module, module_state::atom_preamble)
	(finish_module_parse): Don't deal with it.

	Expunge old location scheme
	gcc/cp/
	* module.c (struct slurper): Remove early_locs, late_locs,
	loc_offset, filenames.
	(module_state::{prepare,read,write}_locations): Delete
	(module_state::{read,write}): Adjust.

	New locations working
	gcc/cp/
	* module.c (module_state::prepare_locations): New, broken out of ...
	(module_state::write_locations): Adjust.
	(module_state::read_locations): Fix.

2018-09-13  Nathan Sidwell  <nathan@acm.org>

	Read & write new locations (buggy, disabled).
	gcc/cp/
	* module.c (module_state::{read,write}_location): Add new-loc
	scheme.
	(module_state::{read,write}_locations): Adjust.
	(module_state::read): Select location scheme.
	gcc/testsuite/
	* g++.dg/modules/loc-1_c.C: Use regexp for note loc.

	Reading location spans (but not using them).
	gcc/cp/
	* module.c (loc_range_t): Global typedef.
	(loc_spans::release): Delete.
	(slurping): Add new range locs.
	(module_state::write_locations): Adjust.
	(module_state::read_locations): New.
	(module_state::read): Call it.

	Stop passing line_map around.  There is only one.
	gcc/cp/
	* cp-tree.h (import_module, declare_module, atom_module_preamble)
	(finish_module_parse, maybe_atom_legacy_module): Drop line_map
	arg.
	* decl2.c (c_parse_final_cleanups): Adjust.
	* parser.c (cp_parser_module_declaration)
	(cp_parser_import_declaration, c_parse_file): Adjust.
	* module.c (loc_spans): Drop lmaps member & adjust.
	(module_state): Drop line_maps from some but not all members.

	Refactor location spans
	gcc/cp/
	* module.c (class loc_spans): New.  Absorb ...
	({open,close,ordinary,macro}_interval): ... these.  Update all uses.

2018-09-12  Nathan Sidwell  <nathan@acm.org>

	Adding location spans
	gcc/cp/
	* module.c (loc_range_t): New range.
	(struct lmap_interval): New.
	(lmap_spans): New.
	(open_interval, close_interval, ordinary_interval)
	(macro_interval): New.
	(module_state::write_locations): Write spans.
	(module_state::write): Write spans.
	(module_state::atom_preamble): Update spans.
	(atom_main_file): Initialize spans.
	(finish_module_parse): Close out span.

	gcc/cp/
	* parser.c (cp_parser_get_module_preamble_tokens): Don't read past
	EOF.
	gcc/testsuite/
	* g++.dg/modules/ice-1.C: New.
	* g++.dg/modules/modules.exp: Remove old pruning.

	Implement p1103r0 19.3/2 not-a-keyword.
	gcc/cp/
	* module (module_state::write_define): Don't export keywords.
	gcc/testsuite/
	* g++.dg/modules/legacy-7_{a.H,b.C}: New.

2018-09-10  Nathan Sidwell  <nathan@acm.org>

	gcc/
	* diagnostic.c (diagnostic_report_current_module): Do not line
	break after module name.
	gcc/testsuite/
	* lib/prune.exp (prune_gcc_output): Adjust module loc regexp.
	* g++.dg/modules/loc-2_[def].C: Adjust dg-regexp.
	* g++.dg/modules/macro-2_d.C: Likewise.

2018-09-06  Nathan Sidwell  <nathan@acm.org>

	gcc/c-family/
	* c.opt (fmodule-only): Set flag.
	gcc/cp/
	* decl2.c (c_parse_final_cleanups): Always call finish_module_parse.
	* module.c (finish_module_parse): Warn on incorrect -fmodule-only.
	gcc/testsuite/
	* g++.dg/modules/only-[123].C: New.

	Add -fmodule-only, rename -fmodules-legacy
	gcc/c-family/
	* c.opt (fmodules-legacy*): Rename to ...
	(fmodule-legacy*): ... here.
	(fmodule-only): New.
	gcc/cp/
	* lang-specs.h: Incorporate -fmodule-only.
	* module.c (get_option_string, handle_module_option): Adjust.
	gcc/
	* doc.invoke.texi: Update module options.
	gcc/testsuite/
	* g++.dg/modules/modules.exp: Adjust.
	* g++.dg/modules/*: Adjust options.

2018-08-31  Nathan Sidwell  <nathan@acm.org>

	libiberty/
	* configure.ac (checkfuncs, AC_CHECK_FUNCS): Add pipe2.
	* configure, config.in: Regenerated.
	* pex-unix.c (pex_unix_execute): Use pipe to transfer child failure.

2018-08-30  Nathan Sidwell  <nathan@acm.org>

	AIXify tests
	fcc/testsuite/
	* fn-inline-1_[abc].C: Adjust regexps.
	* sym-subst-2_a.C: Don't add -fat-lto option, use scan-assembler instead.

	Fix AIX
	gcc/cp/
	* cxx-mapper.cc (buffer::get_request): Reinit pos.

	Fix --enable-checking=release.
	gcc/cp/
	* name-lookup.c (set_module_binding): Add static cast.

	Fix more GC
	gcc/cp/
	* module.c (module_state): Tag for_user.
	(module_state_hash): Defive from ggc_ptr_hash.
	(init_module_processing): GGC alloc hash table.  get mapper when
	not lazy, add ggc_collect.
	(finish_module_parse): Don't zap hash table here ...
	(finish_module_processing): ... do it here instead.
	gcc/testsuite/
	* g++.dg/modules/gc-2_a.C: New.
	* g++.dg/modules/gc-2.map: New.

	AIX build
	gcc/
	* configure.ac: Check sighandler_t, memrchr.
	* config.in, configure: Rebuilt.
	gcc/cp/
	* Make-lang.in (MODULE_STAMP): Protect against non--r capable
	date.
	(cxx-mapper): Add LIBINTL, not LIBBACKTRACE.
	* module.c (memrchr, sighandler_t): Provide fallback.
	* cxx-mapper.cc (memrchr, sighandler_t): Provide fallback.

	* Merge trunk r263974.

2018-08-29  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.c (atom_cpp_undef): location_t arg is unused.

	gcc/cp/
	* module.c (module_state::{read,write}_define): Add NUL
	terminators to CPP_TOKEN_FLD_STR elements.

	libcpp/
	* lex.c (cpp_alloc_token_string): Don't clobber ending NUL.

2018-08-28  Nathan Sidwell  <nathan@acm.org>

	Undefs
	gcc/cp/
	* cp-lang.c (LANG_HOOKS_PREPROCESS_UNDEF): Override.
	* cp-tree.h (atom_cpp_undef): Declare.
	* module.c: Include langhooks.h.
	(cpp_undefs): New global.
	(module_state::{read,write}_defines): Stream undefs.
	(atom_cpp_undef): Define.
	gcc/
	* langhooks-def.h (LANG_HOOKS_PREPROCESS_UNDEF): Default.
	(LANG_HOOKS_INITIALIZER): Add it.
	* langhooks.h (struct lang_hooks): Add preprocess_undef hook.
	gcc/c-family/
	* c-lex.c: Include langhooks.h
	(init_c_lex, cb_undef): Look at lang hook.
	gcc/testsuite/
	* g++.dg/modules/macro-3_[ab].H: New.
	* g++.dg/modules/macro-3_c.C: New.

	Sorted macros
	gcc/cp/
	* module.c (module_state::{read,write}_define): New, single-macro
	streamers.
	(module_state::write_define_cb): Delete.
	(maybe_add_macro, macro_loc_cmp): New.
	(module_state::write_defines): Write in source order.
	(module_state::read_defines): Adjust.

	Macro define locations
	libcpp/
	* include/cpplib.h (cpp_macro): Add imported field.
	gcc/cp/
	* module.c (module_state::write_define_cb): Ignore imported, write
	location.
	(module_state::read_defines): Read location.
	gcc/testsuite/
	* g++.dg/modules/macro-2_[abc].H: New.
	* g++.dg/modules/macro-2_d.C New.

	Reading macros.
	gcc/cp/
	* module.c (bytes_{in,out}::cpp_node): New.
	(bytes_out::buf): New.
	(bytes_{in,out}::str): Treat zero-length strings specially.
	(module_state::write_define_cb): Concatenate strings.
	(module_state::write_defines): Write padding byte.
	(module_state::read_defines): New.
	(module_state::read): Call it.
	libcpp/
	* include/cpplib.h (cpp_alloc_token_string): New.
	(cpp_compare_macros): Declare.
	* lex.c (cpp_alloc_token_string): New, broken out of ...
	(create_literal): ... here.  Call it.
	* macro.c (warn_of_redefinition): Rename to ...
	(cpp_compare_macros): ... this, and make it extern.
	(_cpp_create_definition): Adjust.
	gcc/testsuite/
	* g++.dg/modules/macro-1_a.H: Adjust.
	* g++.dg/modules/macro-1_b.C: New.

	Writing macros.
	gcc/cp/
	* cp-tree.h (import_module, declare_module, atom_module_preamble,
	finish_module_parse, maybe_atom_legacy_module): Add cpp_reader
	arg.
	* decl2.c (c_parse_final_cleanups): Adjust finish_module_parse.
	* module.c (bytes_out::str): Overload for cpp_hashnode.
	(module_state::read_imports,write_imports,do_import): Add
	cpp_reader arg.
	(module_state::atom_preamble): Likwise.
	(import_module, declare_module, atom_module_preamble)
	(finish_module_parse, maybe_atom_legacy_module): Likewise.
	(module_state::write_{define_cb,defines}): New.
	(module_state::write): Write defines when in legacy mode.
	* parser.c (cp_parser_module_declaration)
	(cp_parser_import_declaration, c_parse_file): Pass parse_in.
	gcc/testsuite/
	* g++.dg/modules/macro-1_a.H: New.

2018-08-27  Nathan Sidwell  <nathan@acm.org>

	Merge trunk r263897.

	gcc/cp/
	* module.c (module_state): Remove depth.
	(module_state::maybe_create_loc): Replace ...
	(module_state::set_loc): ... this.
	(module_state::read_imports): Check CRC of indirect imports too.
	(module_state::attach): Simplify logic.
	libcpp/
	* include/linemaph (linemap_module_loc): Drop CURRENT parm.
	* line-map.c (linemap_module_loc): Drop reseating capability.

	gcc/cp/
	* module.c (module_state::check_not_purview): New.
	(module_state::read_imports,import_module): Use it.

	Remove %M formatter, it is not worth complexity.
	gcc/c-family/
	* c-format.c (local_module_ptr_node): Remove
	(gcc_cxxdiag_char_table): Remove 'M'
	(init_dynamic_diag_info): Remove module_state lookup
	* c-format.h (T89_M): Remove
	gcc/cp/
	* cp-tree.h (class module_state): Move to module.c section.
	(pp_module_name): Delete.
	* error.c (cp_printer): Remove %M.
	* module.c: Remove %M error printing.
	(pp_module_name): Delete.
	* ptree.c (cxx_print_decl): Print module number too.

2018-08-27  Nathan Sidwell  <nathan@acm.org>

	Mangling substitutions!
	gcc/cp/
	* cp-tree.h (module_vec_name): Delete.
	* mangle.c (mangle_substitution): Fix name typo.
	* module.c (class module_state): Drop vec_name field.  Make mod
	short.  Add subst field.
	(module_state::mangle): New.
	(mangle_module): Deal with substitutions.
	(mangle_module_fini): Undeal with substitutions.
	(module_vec_name): Delete.
	(module_state::attach): Don't set vec_name.
	gcc/testsuite/
	* g++.dg/modules/sym-subst-1.C: New.
	* g++.dg/modules/sym-subst-2_[ab].C: New.

	Fix module-state lifetime issue.
	gcc/cp/
	* cp-tree.h (finish_module): Break into ...
	(finish_modle_{parse,procesing}): ... these two.
	* decl2.c (c_parse_final_cleanups): Adjust modules finalization.
	* modules.c (finish_modules): Break into ...
	(finish_module_{parse,procesing}): ... these two.
	(module_state::release): Break out ...
	(module_state::slurped): ... this.
	(module_state::{init,fini}): Fold into callers.

	Refactor mangling interface.
	gcc/cp/
	* cp-tree.h (mangle_module, mangle_module_fini): Declare.
	(mangle_substitution, mangle_identifer): Declare.
	* mangle.c (mangle_substitution, mangle_identifer): Define.
	(struct globals): Add mod field.
	(maybe_write_module): Call mangle_module.
	(finish_mangling_internal): Call mangle_module_fini.
	* module.c (mangle_module, mangle_module_fini): Define.

2018-08-23  Nathan Sidwell  <nathan@acm.org>

	Module state gains parent.
	gcc/cp/
	* cp-tree.h (get_module): Add parent argument.
	(module_name): Return string.
	* error.c (dump_module_suffix): Adjust module_name use.
	* module.c (module_state_hash): Adjust for having a parent.
	(module_state: Add parent & fullname fields.
	(module_state::set_name): Delete.
	(get_module): Add parent.
	(get_module): Split string.
	(module_mapper::{export_done,imex_query}): Adjust module name access.
	(module_state::write_readme): Adjust.
	(module_state::{read,write}_{imports,config}): Adjust.
	(module_state::set_loc): Use fullename.
	(module_state::attach): Create fullname.
	* parser.c (cp_parser_module_name): Generate parental name.
	* ptree.c (cxx_print_decl): Adjust.
	gcc/testsuite/
	* g++.dg/modules/mod-decl-1.C: Adjust diags.

	Kill N: prefix notation
	gcc/cp/
	* module.c (enum module_kind): Delete.
	(module_state): Replace kind with legacy, adjust is_legacy.
	(module_state::set_name): Adjust.
	(module_state_hash): Adjust hasher & comparator.
	(module_legacy_system_p): Delete.
	(make_flat_name): Move into ...
	(get_module): ... here.  Adjust.
	(get_module): Add string variant.
	(module_mapper::module_mapper): Adjust.
	(module_mapper::{module_name_kind,response_name}): Delete.
	(module_mapper::{imex_query,bewait_response,divert_include}): Adjust.
	(module_state::{read_imports,attach}): Adjust.
	(pp_module_name): Adjust.
	(maybe_atom_legacy_module, init_module_processing)
	(handle_module_option): Adjust.
	* cxx-mapper.cc (module2bmi): Remove encoding.
	(encode_module_name): Remove encoding.
	gcc/c-family/
	* c-lex.c (c_lex_with_flags): CPP_HEADER include quoting.
	gcc/
	* doc/invoke.texi (C++ Modules): Adjust protocol doc.
	gcc/testsuite/
	* g++.dg/modules/modules.exp: Adjust BMI mapping.
	* g++.dg/modules/legacy-0[ab].H: New.
	* g++.dg/modules/legacy-*: Adjust.

2018-08-22  Nathan Sidwell  <nathan@acm.org>

	%M formatter
	gcc/c-family/
	* c-format.c (local_module_ptr_node): New.
	(gcc_cxxdiag_char_table): Add 'M'.
	(argument_parser::handle_conversions): Allow wanted type to be
	NULL.
	(init_dynamic_diag_info): Simplify lookup, add module_state.
	* c-format.h (T89_M): New.
	gcc/cp/
	* cp-tree.h (class module_state): Declare before diagnostics.
	* error.c (cp_printer): Add %M.
	* module.c: Use %M error printing.

	Use modules as handles themselves.
	gcc/cp/
	* cp-tree.h (class module_state): Forward declare.
	(get_module, pp_module_name): Declare.
	(import_module, declare_module, push_module_export): Take
	module_state.
	* module.c (proclaimer): A module.
	(get_module, pp_module_name): Define.
	(push_module_export, import_module, declare_module): Adjust.
	* parser.c (cp_parser_module_name): Return module_state.
	(cp_parser_module_declaration, cp_parser_import_declaration)
	(cp_parser_module_proclamation): Adjust.

	Fix GTY
	gcc/cp/
	* cp-tree.h (struct mc_index): Don't mark.
	(struct mc_slot): Converted from union.  Adjust.
	(struct module_cluster): Skip mc_index.
	* module.c (struct slurping,spewing): Skip range_t members.
	(class module_state): Remove static data members.
	(global_tree_arys, fixed_trees, global_crc, our_opts, lazy_lru)
	(lazy_open, modules, modules_hash): New static vars.  Adjust uses.
	(finish_module): Add gc point.
	gcc/testsuite/
	* g++.dg/modules/gc-1_[abcd].C: New.

2018-08-21  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* cp-tree.h (declare_module, import_module): Separate name from
	location.
	* module.c (module_state::attach): Drop maybe_vec_name arg.
	(module_state::get_module): Flatten here.
	(declare_module, import_module): Separate name and from loc.
	(maybe_atom_legacy_module): Adjust.
	* parser.c (cp_parser_module_name): Return tree only.
	(cp_parser_module_declaration, cp_parser_import_declaration): Adjust.
	gcc/testsuite/
	* g++.dg/modules/legacy-4.H: Adjust error.

	gcc/cp/
	* module.c (module_mapper::divert_include): Don't append export attrib.
	(import_module): Don't scan attribs.
	(maybe_atom_legacy_module): Push exporting.
	gcc/testsuite/
	* g++.dg/modules/legacy-3_[bc].H: Adjust.
	* g++.dg/modules/legacy-5_b.C: Adjust.
	* g++.dg/modules/legacy-6_[cd].C: Adjust.

	gcc/cp/
	* module.c (module_state::get_module): Lose dflt & insert args.
	(module_state::insert_mapping): Move directly into ...
	(module_mapper::module_mapper): ... here.
	(module_mapper::bewait_response, module_state::read_imports): Adjust.
	(import_module, declare_module): Adjust.

	gcc/cp/
	* module.c (module_state::is_mapping): Rename to ...
	(module_state::is_detached): ... here.  Use from_loc.
	(module_state::attach): New broken out of ...
	(module_state::find_module): ... here.  Delete, fold into ...
	(module_state::read_imports, import_module, declare_module): ...
	these callers.
	(module_state::read): Adjust module index setting.

	libiberty/
	* pex-unix.c (IS_FAKE_VFORK): Rename to VFORK_IS_FORK.
	(pex_unix_exec_child): Avoid spuros clobber warning, use stdio
	when forking.

2018-08-20  Nathan Sidwell  <nathan@acm.org>

	Merge trunk r263679.

	Merge trunk r263673.

	Revert r263619  2018-08-17  Nathan Sidwell  <nathan@acm.org>
	Revert r263597  2018-08-16  Nathan Sidwell  <nathan@acm.org>
	They break GTY strangely.

2018-08-17  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.c (module_state::is_detached): New.
	(module_state::attach): New, broken out of ...
	(module_state::find_module): ... here.  Call it.
	(declare_modules): Do module-specific attaching here.

2018-08-16  Nathan Sidwell  <nathan@acm.org>

	gcc/testsuite/
	* g++.dg/modules/modules.exp (dg-module-pre-prune): Delete
	(g++-dg-prune): Don't override.
	* g++.dg/modules/legacy-4.H: Use dg-regexp.
	* g++.dg/modules/loc-2_[def].C: Likewise.

	gcc/cp/
	* cp-tree.h (class module_state): Forward declare.
	(get_module, pp_module_name): Declare.
	(push_module_export, declare_module, import_module): Take
	module_state.
	* error.c (cp_printer): Accept %M.
	* module.c (module_state::find_module): Take module_state.
	(module_state::get_module): Drop default & insert args.
	(module_state::insert_mapping): Delete.
	(module_mapper::{module_mapper,bewait_response): Adjust.
	(module_mapper::divert_include): Drop indentation.
	(module_state::read_imports): Adjust.
	(proclaimer): Is a module_state pointer.
	(push_module_state, declare_module, import_module): Adjust.
	(pp_module_name): New.
	(get_module): New.
	(maybe_atom_legacy_module): Adjust.
	* parser.c (cp_parser_module_name): Return module_state, adjust.
	(cp_parser_module_declaration, cp_parser_import_declaration):
	Adjust.
	gcc/testsuite/
	* g++.dg/modules/legacy-4.H: Adjust regexp.

2018-08-08  Nathan Sidwell  <nathan@acm.org>

	Merge trunk r263429.

2018-08-02  Nathan Sidwell  <nathan@acm.org>

	Merge trunk r263272.

2018-07-12  Nathan Sidwell  <nathan@acm.org>

	libcpp/
	* include/cpplib.h (cpp_clear_if_stack): Renamed from
	cpp_pop_directives.
	* directives.c (cpp_clear_if_stack): Likewise, drop all arg.
	gcc/c-family/
	* c-ppoutput.c (scan_translation_unit): Fixup.

	gcc/c-family/
	* c.opt (fmodule-preamble): Alias fmodule-preamble=
	(fmodule-preamble): Fix type.
	* module.c: Add i18n markers.
	(init_module_processing): Detect unsupported option combos.
	(handle_module_option): Don't zap explicit modules-ts.
	gcc/
	* diagnostic.c (diagnostic_report_current_module): Add i18n
	markers.
	gcc/testsuite/
	* g++.dg/modules/cpp-preamble-9.C: New.
	* g++.dg/modules/modules.exp (mode_list): Preamble is atom.
	libcpp/
	* directives.c (cpp_pop_directives): Buffer could be NULL.le

	gcc/cp/
	* lex.c (atom_preamble_prefix_peek): Use cpp_macro_p.

	Hide NT_MACRO
	libcpp/
	* include/cpplib.h (cpp_macro_p): New.
	* macro.c (cpp_fun_like_macro_p): Use it.
	gcc/c-family/
	* c-ada-spec.c (count_ada_macro, store_ada_macro): Use
	cpp_macro_p.
	* c-ppoutput.c (dump_macro): Likewise.
	* c-spellcheck.cc (should_suggest_as_macro_p): Likewise.
	gcc/
	* config/rs6000/rs6000-c.c (rs6000_macro_to_expand): Use cpp_macro_p.
	* config/powerpcspe/powerpcspe-c.c (rs6000_macro_to_expand): Likewise.
	gcc/fortran/
	* cpp.c (dump_macro): Use cpp_macro_p.

2018-07-06  Nathan Sidwell  <nathan@acm.org>

	gcc/testsuite/
	* g++.dg/modules/modules.exp: Restore g++-dg-prune after test.
	* g++.dg/modules/legacy-5_c.C: Fix scan-lang-dump.

2018-07-05  Nathan Sidwell  <nathan@acm.org>

	No ALIASes for IMPORTS
	gcc/cp/
	* cxx-mapper.cc (module2bmi): No aliases here.
	(client::imex_response): Adjust.
	gcc/
	* doc/invoke.texi (C++ Modules): Remove ALIAS from IMPORT response
	set.

	Legacy header warning
	gcc/
	* invoke.texi (Wlegacy-header): New warning.
	gcc/c-family/
	* c.opt (Wlegacy-header): New.
	gcc/cp/
	* cp-tree.h (atom_preamble_end): Declare.
	* cp-lang.c (atom_preamble_fsm): Use it.
	* lex.c (atom_preamble_prefix_peek): Check OPT_Wlegacy_header.
	* module.c (do_divert_include): Likewise.
	(atom_divert_include): Default -Wlegacy-header.
	(atom_preamble_end): New.
	* parser.c (c_parse_file): Use it.
	gcc/testsuite/
	* g++.dg/modules/legacy-6*: New.

	Legacy header aliasing
	gcc/
	* doc/invoke.texi (C++ Modules): Update protocol docs
	gcc/cp/
	* cxx-module.cc (module2bmi): Deal with aliasing.
	(encode_module_name): New.
	(read_mapping_file): Use it.  Deal with aliasing.
	(client::imex_response): Likewise.
	(client::action): Likewise,
	* module.c (module_mapper::module_name_kind): New.
	(module_mapper::response_name): Use it.
	(module_mapper::divert_include): Allow aliasing.
	gcc/testsuite/
	* g++.dg/modules/legacy-5*: New.

2018-07-03  Nathan Sidwell  <nathan@acm.org>

	Merge legacy header options to -fmodules-
	gcc/
	* doc/invoke.texi (C++ Modules): Adjust.
	gcc/c-family/
	c.opt (fmodules_legacy, fmodules_legacy=): New.
	(fmodule-{user,system}-header{,=}): Delete.
	gcc/cp/
	* cp-tree.h (modules_legacy_p): Renamed from modules_header_p.
	* lang-specs.h (@c++-header): Update.
	* lex.c (atom_preamble_prefix_peek): Adjust.
	* module.c (module_legacy_name): Do not force to empty string.
	(module_state::get_option_string): Adjust.
	(declare_module, maybe_atom_legacy_module, init_module_processing)
	(handle_module_option): Likewise.
	gcc/testsuite/
	* g++.dg/modules/legacy-[1234]*: update.
	* g++.dg/modules/atom-inc-1.C: Update.

	Explicit user/system legacy headers
	gcc/c-family/
	* c-lex.c (c_lex_with_flags): Encode header names in tree lists.
	* c.opt (fmodule-{user,system}-header): New.
	gcc/cp/
	* cxx-mapper.cc (module2bmi): Adjust.
	(read_mapping_file): Encode legacy header names.
	* lang-specs.h (@c++-header): Update.
	* module.c (module_state_hash::hash): Update hashers.
	(enum module_kind): New.
	(module_state::set_name): Adjust.
	(module_state_hash::equal): Adjust.
	(module_header_is_system): New.
	(make_legacy_name): Delete.
	(module_state::get_module): Adjust.
	(module_mapper::response_name): New.
	(module_mapper::imex_query): Adjust.
	(module_mapper::bewait_response): Adjust.
	(module_mapper::divert_include): Adjust.
	(declare_module, maybe_atom_legacy_module): Likewise.
	(handle_module_option): Check new options.
	gcc/testsuite/
	* g++.dg/modules/modules.exp: update BMI encodings.
	* g++.dg/modules/legacy-[1234]*: update.
	* g++.dg/modules/atom-inc-1.C: Update.
	gcc/
	* doc/invoke.texi (C++ Modules): Document new options.

2018-06-29  Nathan Sidwell  <nathan@acm.org>

	Diverted header column preservation
	libcpp/
	* directives.c (do_include_common): Adjust divert callback.
	* include/cpplib.h (cpp_divert_include_t): Likewise.
	gcc/cp/
	* module.c (module_mapper::divert_include): Add line_maps.
	Preserve column number.
	(import_module): Look at attribs.
	(do_divert_include): Adjust.
	* parser.c (cp_parser_module_declaration): Return loc of name.
	(cp_parser_import_declaration): Likewise.
	(cp_parser_parse_module_preamble): Adjust.
	gcc/
	* langhooks.h (lang_hooks): Adjust preprocess_divert_include.
	gcc/testsuite/
	* g++.dg/modules/legacy-3_b.H: Adjust.
	* g++.dg/modules/legacy-3_c.H: Adjust.
	* g++.dg/modules/legacy-4.H: Adjust.

	Diverted include line numbering
	libcpp/
	* directives.c (do_include_common): Fixup diversion line
	numbering.
	(_cpp_pop_buffer): Free to_free even if not a file.
	gcc/c-family/
	* c-ppoutput.c (print_line_1): More C++y.
	gcc/cp/
	* module.c (module_mapper::divert_include): Two \n's.
	gcc/testsuite/
	* g++.dg/modules/legacy-4: New.
	* g++.dg/modules/legacy-3_b.H

	gcc/testsuite/
	* g++.dg/modules/modules.exp (dg-module-pre-prunes): Renamed.

	libcpp/
	* directives.c (do_include_common): Include diverter will push
	buffer.
	* include/cpplib.h (cpp_divert_include_t): Adjust signature.
	gcc/
	* langhooks.h (lang_hooks): Adjust preprocess_divert_include
	signature.
	gcc/cp/
	* module.c (module_mapper::divert_include): Push buffer here.
	(do_divert_include): Adjust.

2018-06-28  Nathan Sidwell  <nathan@acm.org>

	gcc/testsuite/
	* g++.dg/modules/legacy-3*: New.

	gcc/testsuite/
	* g++.dg/modules/modules.exp: Fix execution tests. Add dg-module-literal
	* g++.dg/modules/legacy-2_d.C: Fix expected line number.
	* g++.dg/modules/loc-2_[def].C: Use dg-module-literal.

	(Beginnings of) Include diversion.
	gcc/c-family/
	* c-opts.c (c_common_post_options): Set divert_include hook.
	(cb_file_change): Fixup precedence.
	gcc/cp/
	* cp-lang.c (LANG_HOOKS_PREPROCESS_DIVERT_INCLUDE): Override.
	* cp-tree.h (modules_header_p): New.
	(atom_divert_include): Declare.
	* cxx-mapper.cc (flag_fallback): New flag.
	(module2bmi): Deal with NULL names.
	(buffer::get_request): Fix off-by-one error.
	(read_mapping_file): Can be multiply called.  Target file name can
	be null.
	(client::action): Deal with INCLUDE.
	(main): There can be may files after connection.  Fixup networking
	errors.
	* lex.c (atom_preamble_prefix_peek): Don't rescan legacy header
	module.
	* module.c (module_preamble_end_loc): Declare here.
	(module_mapper::module_mapper): Prepend path for anything looking
	defaulty.
	(module_mapper::divert_include): New.
	(do_divert_include): New.
	(atom_divert_include): New.
	(init_module_processing): Set header mode here.
	* parser.c (module_preamble_end_loc): Extern.
	gcc/
	* doc/invoke.text (C++ Modules): Document -fmodule-header.
	* langhooks-def.h (LANG_HOOKS_PREPROCESS_DIVERT_INCLUDE): Provide
	default.
	* langhooks.h (lang_hooks): Add preprocess_divert_include.
	libcpp/
	* directives.c (do_include_common): Add diversion smarts.
	* include/cpplib.h (cpp_divert_include_t): New.
	(struct cpp_callbacks): Add divert_include.
	* line-map.c (linemap_module_loc): Missed commit.
	gcc/testsuite/
	* g++.dg/modules/legacy-2.*: New.
	* g++.dg/modules/modules.exp: Fixup header compilation.

2018-06-27  Nathan Sidwell  <nathan@acm.org>

	(Beginnings of) Legacy importing
	gcc/cp/
	* cxx-mapper.cc (module2bmi): Map legacy header names.
	* module.c (module_state::legacy): New field.
	(module_state::{is_legacy,set_name}): New.
	(make_legacy_name): New.
	(module_state::get_module): Canonicalize legacy name.
	(module_state::get_option_string): Strip -fmodule-header.
	(declare_module): Check correct kind.
	(maybe_atom_legacy_module): Use make_legacy_name.
	* parser.c (cp_parser_module_name): Parse legacy names.
	(cp_parser_import_declaration): Don't special case legacy names
	here.
	gcc/testsuite/
	* g++.dg/modules/atom-inc-1.C: Add expected errors.
	* g++.dg/modules/legacy-1_[abc].[CH]: New.
	* g++.dg/modules/modules.exp: Support legacy header compilation.

	(Beginnings of) Legacy header modules
	libcpp/
	* line-map.c (linemap_module_loc): Expect ordinary loc.
	gcc/
	* langhooks-def.h (LANG_HOOKS_PREPROCESS_MAIN_FILE): Provide
	default.
	* langhooks.h (lang_hooks): Add preprocess_main_file hook.
	gcc/c-family/
	* c-opts.c (cb_file_change): Call new hook.
	gcc/cp/
	* cp-tree.h (enum atom_preamble_state): Define.
	(atom_preamble_prefix_{peek,next}): Use enum.
	(atom_main_file, maybe_atom_legacy_module): Declare.
	* cxx-mapper.cc (module2bmi): Munge legacy module chars.
	* lang-specs.h (@c++-header): Fix -fmodule-header use.
	* lex.c (atom_preamble_prefix_{peek,next}): Adjust for enum.
	* module.c (prefix_line_maps_hwm, prefix_locations_hwm): New.
	(module_state::{read,write,prepare}_locations): Adjust prefix checking.
	(ordinary_loc_of): New.
	(import_module): Use it.
	(declare_module): Set preamble prefix if needed.
	(atom_main_file, maybe_atom_legacy_module): New.
	(init_module_processing): Don't default module_header_name here.
	(atom_module_preamble, finish_module): Push & pop exporting state in
	legacy mode.
	* parser.c (cp_parser_get_module_preamble_tokens): Adjust for
	preamble state.  Return indicator of preamble contents.
	(c_parse_file): Maybe inject legacy module decl.
	* cp-lang.c (LANG_HOOKS_PREPROCESS_MAIN_FILE): Override hook.
	(atom_preamble_fsm): Adjust for state enum.

2018-06-26  Nathan Sidwell  <nathan@acm.org>

	Merge trunk r262148.

	gcc/
	* configure.ac: Fix AF_INET6 & accept4 tests.
	* configure, config.in: Rebuilt.
	gcc/cp/
	* module.c: Update some comments.
	(module_mapper::module_mapper): Fix up conditional code.
	(module_state::read_imports): Replace local class with std::pair,
	because C++98.
	* cxx-mapper.cc (accept_from): Fixup conditional code.

2018-06-25  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* cxx-mapper.cc (kill_signal): New.
	(server): Fixup inet_ntop use.

	gcc/
	* configure.ac: Check for inet_ntop.
	* configure, config.in: Rebuilt.
	gcc/cp/
	* cxx-mapper.cc (server): Use inet_ntop when available.

2018-06-24  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* cxx-mapper.cc: BMI->GCC
	* module.c: Likewise.
	gcc/
	* doc/invoke.texi: Likewise.

2018-06-23  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* cxx-mapper.cc (struct netmask): New.
	(server): Validate connection addresses.
	(accept_from): New.
	(process_args): Add -a arg.

	Simplify protocol.
	gcc/cp/
	* cxx-mapper.c (buffer::empty): New.
	(buffer::send_response): Fixup buffer management.
	(client::imex_response): New.
	(client::action): Reimplement.
	* module.c (module_mapper): Update.
	gcc/
	* doc/invoke.texi (C++ Modules): Update protocol.
	gcc/testsuite/
	* g++.dg/modules/indirect-1_c.C: Tweak scan.

	A proper server
	gcc/cp/
	* cxx-module-mapper.sh: Delete.
	* cxx-mapper.cc: New.
	* Make-lang.in: Adjust.
	* module.c (module_mapper:get_response): Fixup errors.
	(module_mapper::import_query): Drop filename.

2018-06-22  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.c (module_mapper::send_command): Fix off-by-one.
	(module_mapper::get_response): Cleanup batch splitting.
	(module_mapper::handshake): Adjust.
	* cxx-module-mapper.sh (cmd): Adjust HELLO.
	gcc/
	* doc/invoke.texi (C++ Modules): Tweak mapper protocol.

	gcc/
	* configure.ac: Check select, accept4.
	* config.in, configure: Rebuilt.

2018-06-21  Nathan Sidwell  <nathan@acm.org>

	gcc/c-family/
	* c.opt: Add -fmodule-header.
	gcc/cp/
	* lang-specs.h: Add legacy import options.
	* module.c (module_header_name): New.
	(init_module_processing): Default it.
	(handle_module_option): Set it.

	Use getaddrinfo, not gethostbyname2
	gcc/
	* configure.ac (HAVE_AF_INET6): Test for getaddrinfo.
	* configure: Rebuilt.
	* doc/invoke.text (C++ Modules): Default is loopback.
	gcc/cp/
	* module.c (module_mapper::module_mapper): Reorganize network startup.
	gcc/testsuite/
	* g++.dg/modules/bad-mapper-[23].C: Adjust diagnostics.

2018-06-19  Nathan Sidwell  <nathan@acm.org>

	Early & late location maps.
	gcc/cp/
	* modules.c (slurping, spewing): Rearrange.
	(module_state::{prepare,read,write}_locations): Reimplement.
	(module_state::{read,write}): Adjust.
	(module_state::atom_preamble): Adjust.

2018-06-18  Nathan Sidwell  <nathan@acm.org>

	gcc/testsuite/
	* g++.dg/modules/loc-2_[a-f].C: New.

2018-06-17  Nathan Sidwell  <nathan@acm.org>

	gcc/
	* configure.ac: Detect epoll & pselect.
	* configure, config.in: Rebuilt.

	gcc/cp/
	* module.c (module_mapper::module_mapper): Fixup length errors.

	gcc/cp/
	* cxx-module-mapper.sh: Remove recompilation capability.
	gcc/testsuite/
	* g++.dg/modules/import-2.C: Adjust messages.
	* g++.dg/modules/main-aux.cc: Delete.
	* g++.dg/modules/main_1.C: Delete.

2018-06-15  Nathan Sidwell  <nathan@acm.org>

	gcc/
	* diagnostic.c (diagnostic_report_current_module): Starting
	location could be a module.
	gcc/cp/
	* module.c (trees_{in,out}::loc): Move to ...
	(module_state::{read,write}_location}): ... here.
	(trees_{in,out}::core_vals): Adjust.
	(module_state::{read,write}_imports): Serialize import location.
	(module_state::set_loc): Add floc parm, adjust.
	gcc/testsuite/
	* lib/prune.exp (prune_gcc_output): Adjust regexp.

	gcc/cp/
	* cp-tree.h (make_module_loc): Delete.
	* lex.c (make_module_loc): Delete.
	* module.c (module_state): Add depth field.
	(module_state::set_loc): Deal with reseating.  Add line_maps parm.
	(module_state::read_imports): Do two passes.
	(module_state::write_imports): Write length.
	gcc/testsuite/
	* g++.dg/modules/import-1_e.C Adjust lang dump scan.
	* g++.dg/modules/mod-imp-1_d.C: Likewise.
	libcpp/
	* include/line-map.h (linemap_module_loc): Add incomping loc parm.
	* line-map.c (linemap_module_loc): Do reseating.

	Location! Location! Location!
	gcc/cp/
	* module.c (module_state::slurper): New.
	(trees_{in,out}::loc): Implement.
	(trees_in::core_vals): Set locus.
	(spewing::linemaps): Fixup offset calculation.
	(module_state::read_locations): Set ord_locs.
	gcc/testsuite/
	* g++.dg/module/loc-1_[abc].C: New.

	libcpp/
	* include/line-map.h (IS_ORDINARY_LOC, IS_MACRO_LOC): New.
	(IS_ADHOC_LOC): Simplify.
	(MAP_ORDINARY_P): Use IS_ORDINARY_LOC.
	* line-map.c (linemap_module_restore): Fixup included_at.

	gcc/
	* diagnostic.c (diagnostic_report_current_module): Fixup include
	stack messages.
	gcc/testsuite/
	* lib/prune.exp (prune_gcc_output): Adjust include stack regexps.

	gcc/cp/
	* module.c (spewer::linemaps): Return mask.
	(module_state::{find,write}_locations): Use mask.
	(module_state::read_locations): Implement.

	Line_maps args everywhere!
	gcc/cp/
	* cp-tree.h (declare_module, import_module, atom_module_preamble):
	Add line_maps arg.
	* module.c (module_state::{read_imports,do_import}): Add line_maps.
	(module_state::set_loc): New.
	(module_state::atom_preamble): Deal with restoring line_maps.
	(module_state::read): Add line_maps.  Call read_locations.
	* parser.c (cp_parser_module_declaration)
	(cp_parser_import_declaration): Adjust.
	(c_parse_file): Line_maps restoration is moved.
	libcpp/
	* include/line-map.h (linemap_save_pre_module): Delete.
	(linemap_restore_pre_module): Rename to ...
	(linemap_module_restore): ... here.
	* line-map.c (linemap_save_pre_module): Delete.
	(linemap_restore_pre_module): Rename to ...
	(linemap_module_restore): ... here.

	gcc/cp/
	* module.c (bytes_{in,out}::align): New.
	(bytes_{in,out}::buf): Use it.

	libcpp/
	* line-map.c (linemap_init): Set default allocator here.
	(line_map_new_raw): Break out of ...
	(new_linemap): ... here.  Call it.
	* include/line-map.h (line_map_new_raw): Declare

2018-06-14  Nathan Sidwell  <nathan@acm.org>

	Break out import section.
	gcc/cp/
	* module.c (module_state::{read,write}_imports): New.
	(module_state::{read,write}_config): Don't do imports here ...
	(module_state::{read,write}): ... do them here.

	Fix section alignment.
	gcc/cp/
	* module.c (elf_out::grow): Fix padding calc.
	(elf_out::add): Assert aligned.

	Write out line maps.
	gcc/cp/
	* cp-tree.g (atom_module_preamble, finish_module): Add line_maps.
	* decl2.c (c_parse_final_cleanups): Pass line_table.
	* parser.c (c_parse_file): Adjst.
	* module.c (struct spewing): New.
	(struct slurping): Add GTY tagging.
	(module_state::spewer): New.
	(module_state::{write,atom_preamble}): Add linemaps.
	(module_state::{find,write,read}_locations): New.

	gcc/cp/
	* module.c (struct slurping): New, broken out of ...
	(struct module_state): ... here.  Move loading data there and
	adjust all users.

2018-06-13  Nathan Sidwell  <nathan@acm.org>

	Reorg line_map data structures.
	libcpp/
	* include/line-map.h (LINE_MAP_MAX_LOCATION): Define here.
	(struct line_map): Move reason field to line_map_ordinary.  Adjust
	GTY tagging.
	(struct line_map_ordinary): Reorder fields for less padding.
	(struct line_map_macro): Likewise.
	(MAP_ORDINARY_P): New.
	(linemap_check_ordinary, linemap_check_macro): Adjust.
	(MAP_MODULE_P): Adjust.
	* line-map.c (LINE_MAP_MAX_SOURCE_LOCATION): Delete.
	(new_linemap): Take start_location, not reason.  Adjust.
	(linemap_add, linemap_enter_macro): Adjust.
	(linemap_line_start): Likewise.
	(linemap_macro_expansion_map_p): Use MAP_ORDINARY_P.
	(linemap_macro_loc_to_spelling_point): Likewise.
	(linemap_macro_loc_to_def_point): Likewise.
	(linemap_dump): Likewise.

2018-06-12  Nathan Sidwell  <nathan@acm.org>

	Better socket handling.  Kill mapping from fd
	gcc/cp/
	* module.c (class module_mapper): Add from & to fds.
	(module_mapper::{module_mapper,kill}): Adjust.
	(module_mapper::{send_command,get_response}): Likewise.
	(module_from_cmp): New.
	(module_state::atom_preamble): Reimplement.
	gcc/
	* doc/invoke.texi (C++ Modules): Remove fd mapper options.
	gcc/testsuite/
	* g++.dg/modules/import-2.C: Adjust messages.
	* g++.dg/modules/flag-1_b.C: Likewise.
	* g++.dg/modules/mod-stamp-1_d.C: Likewise.

	gcc/
	* configure.ac: Rename HOST_HAS_AF_$FOO to HAVE_AF_$FOO.
	* configure, config.in: Rebuilt.
	gcc/cp/
	* module.c: Adjust.

2018-06-11  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.c
	(elf_out::grow): Always define, always align.
	(elf_out::write): Streaming buffers must be using our
	allocator.  No need to align here.

	MMAP writing
	gcc/
	* configure.ac: Check for posix_fallocate.
	* configure, config.in: Rebuilt.
	gcc/cp/
	* module.c (MAPPED_WRITING): New.
	(data::allocator::{grow,shrink}): New overloads.
	(data::use): Check available.
	(data::allocator::grow): Deal with allocator failure.
	(bytes_in::read): Set overflow on fail.
	(bytes_{in,out}::{u32,c,i,u,wi,buf}): Adjust.
	(bytes_out::printf): Likewise.
	(bytes_out::bytes_out): Allocator is non-optional.
	(elf_out): Derive from data::allocator.
	(elf_out::{grow,shrink}): New overriders.
	(elf_out::elf_out): Find page size.
	(elf_out::{create,remove}_mapping): New.
	(elf_out::write): New overload.
	(elf_out::add): Take bytes_out.  Adjust users.
	(elf_out::{begin,end}): Add mapping support.
	(trees_out::trees_out): Add allocator parm.
	(trees_{in::out}::fixed_refs): Delete, adjust uses.
	(module_state::write_{readme,config,namespaces,bindings}): Adjust.
	(module_state::write_{unnamed,cluster}): Adjust.

	Prep for MMAP exporting.
	gcc/cp/
	* module.c (MODULE_MMAP_IO): Rename to ...
	(MAPPED_READING): This.
	(data): Add allocator class with default instance.
	(data::{write,printf}): Move to bytes_out.
	(data::read): Move to bytes_in.
	(data::{extend,release}): Delete. Adjust uses.
	(bytes_out): Add allocator pointer, alter ctor.
	(bytes_out::begin): Add need_crc parm.
	(elf::section_vec): Delete.
	(elf): Add sectab, strtab data members.
	(get_num_sections): Delete.
	(elf_{in,out}::strings): Delete here.
	(elf_in::{grow,shrink}): New.
	(elf_in::{get_section{,_limit}): New, adjust uses.
	(elf_in::{keep_sections,forget_section}): Delete.

2018-06-09  Nathan Sidwell  <nathan@acm.org>

	MMAP importing!
	gcc/cp/
	* module.c (MODULE_MMAP_IO): New define.
	(bytes::{begin,end}): Delete.
	(elf_in::{freeze,defrost}): Adjust.
	(elf_in::{begin,end}): Adjust.
	(elf_in::{keep,forget}_section): Adjust.
	(elf_in::read): Adjust.
	(module_state::our_opts): New static member.  Adjust uses.
	gcc/
	* doc/invoke.texi (C++ Modules): Document lazy limit change.

2018-06-08  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.c (elf): Replace FILE *stream with int fd.  Update uses.

	gcc/cp/
	* module.c (bytes::begin): Add CRC parm.
	(elf_in): Read buffers, adjust.

	gcc/cp/
	* module.c (elf_out): Track file position directly.
	(elf_out::pad): Remove, fold into ...
	(elf_out::write): ... here.  Take a buffer.
	(elf_out::{add,begin,end}): Adjust.

	gcc/cp/
	* module.c (elf): Add hdr member.
	(elf_in::begin): Adjust.
	(elf_out::{begin,end}): Adjust.

	gcc/cp/
	* module.c (data::printf): Moved from ...
	(bytes_out::printf): ... here.
	(elf): Replace sections pointer with section_vec local class.
	Adjust all uses.
	(elf_out): Remove strtab member class.
	(elf_out::end): Adjust.

2018-06-07  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.c (bytes::calc_crc): Take length parm.  Adjust callers.
	(elf_out::strtab): Reimplement.
	(elf_out::add): Use buffer pos for length.

	gcc/cp/
	* module.c (struct data): Resurrect.  Move buffer extension here.
	Update users.
	(class bytes): Derive from data.

	gcc/cp/
	* module.c (struct data): Delete.  Move into ...
	(struct bytes): ... here.  Update uses.

	gcc/cp/
	* module.c (struct data): Make buffer a pointer.  Redo interface.

	Change integer on-disk format.
	gcc/cp/
	* module.c (bytes_{in,out}::{i,u,wi}): Reimplement.
	(make_bmi_path): Don't prefix absolute paths.

	BMI repo directory
	libiberty/
	* pex-unix.c: Fixup optimization issues.
	gcc/cp/
	* cxx-module-mapper.sh: Add repo to HELLO.
	* module.c (bmi_repo, bmi_repo_length, bmi_path, bmi_path_alloc): New.
	(set_bmi_repo, make_bmi_path, drop_bmi_prefix): New.
	(module_mapper::{handshake,module_mapper}): Repo location from file.
	(relativize_import): Delete.
	(module_state::{write_readme,maybe_defrost,do_import,finish_module):
	Adjust.
	gcc/
	* doc/invoke.texi (C++ Modules): Document bmi repo.

2018-06-06  Nathan Sidwell  <nathan@acm.org>

	Better pex-unix.
	libiberty/
	* pex-unix.c (VFORK_STRING): Replace with ...
	(IS_FAKE_VFORK): ... this.
	(pex_child_error): Delete, fold into ...
	(pex_unix_exec_child): ... here.  Inform parent, when really vforking.
	gcc/cp/
	* module.c (module_mapper::module_mapper): Merge error message.
	gcc/testsuite/
	* g++.dg/modules/bad-mapper-1.C: Adjust.
	* g++.dg/modules/bad-mapper-{2,3}.C: New.

	gcc/cp/
	* module.c (module_mapper::module_mapper): Ignore sigpipe.
	(module_mapper::kill): Restore sigpipe.
	(module_mapper::{response_unexpected,get_response}): Cope with EOF.
	gcc/testsuite/
	* g++.dg/modules/bad-mapper-1.C: New.

2018-06-05  Nathan Sidwell  <nathan@acm.org>

	gcc/
	* doc/invoke.texi (C++ Modules): Clarify and extend.

2018-06-04  Nathan Sidwell  <nathan@acm.org>

	Self relative direct import pathnames.
	gcc/cp/
	* module.c (relativize_import): New.
	(module_state::write_readme): Call it.
	(module_state::read_imports): Make import relative to importer,
	query mapper if needed.

	Cookies for mapping files
	gcc/cp/
	* module.c (module_mapper::response_eol): Add ignore arg.
	(module_mapper::module_mapper): Cookie on file mapper.
	gcc/
	* invoke.texi (C++ Modules): Document file mapper cookie.
	gcc/testsuite/
	* g++.dg/modules/map-1_b.C: Use specific mapper.
	* g++.dg/modules/map-1_b.map: New.

2018-06-03  Nathan Sidwell  <nathan@acm.org>

	gcc/
	* diagnostic.c (diagnostic_report_current_module): Don't claim
	module was imported.
	* doc/invoke.texi (C++ Modules): Update module-mapper docs.
	gcc/cp/
	* module.c (module_mapper::module_mapper): Change syntax for
	option.
	(module_mapper::response_token): Add all parm.
	(module_mapper::bmi_response): Use it.
	(module_state::check_read): Fix error reporting.
	(finish_module): Warn if not exporting due to errors.
	gcc/testsuite/
	* lib/prune.exp (prune_gcc_output): Adjust module import regexp/
	* g++.dg/modules/map-1_[ab].C: Adjust module-mapper arg.
	* g++.dg/modules/atom-decl-2.C: Add expected warning
	* g++.dg/modules/mod-decl-1.C: Likewise.
	* g++.dg/modules/mod-decl-3.C: Likewise.
	* g++.dg/modules/proclaim-1.C: Likewise.

2018-06-01  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.c (module_mapper): Robustify.

	gcc/fortran/
	* cpp.c (cb_file_change): Adjust for line map inclusion changes.

	Module mapping file is back
	gcc/
	* doc/invoke.text (C++ Modules): Document mapping file.
	gcc/cp/
	* cxx-module-mapper.sh: Strip -fmodule-preamble=.
	* module.c (elf::get_error): Detect no file name.
	(module_state): Add imported field.
	(module_state::is_{imported,mapping}): New.
	(module_mapper::module_mapper): Read mapping file.
	(module_mapper::get_response): Distingish empty from end.
	(module_state::get_module): Copy a mapping.
	(module_state::insert_mapping): New.
	(module_state::read_imports): Adjust.
	(module_state::do_import): Set imported.
	(import_module, declare_module): Adjust.
	(module_state::atom_preamble): Adjust.
	gcc/testsuite/
	* g++.dg/modules/map-1{_a.C,_b.C,.map}: New.

2018-05-31  Nathan Sidwell  <nathan@acm.org>

	gcc/
	* doc/invoke.texi (C++ Modules): Show mapper cookie.
	gcc/cp/
	* module.c (module_mapper::fini): Assert.
	(module_mapper::module_mapper): Remove dup2.
	(module_mapper::reset): Delete.

	gcc/
	* doc/invoke.texi (C++ Modules): Rename -fmodule-server to
	-fmodule-mapper.
	gcc/c-family/
	* c.opt (fmodule-mapper): Renamed from fmodule-server.
	gcc/cp/
	* cxx-module-mapper.sh: Renamed from cxx-module-server.sh.
	* Make-lang.in: Update.
	* module.c (struct module_mapper): Renamed from module_server.

	Merge trunk r261033.

	gcc/cp/
	* module.c (bytes_in::begin): Add location_t arg.
	(elf_in::begin): Add location args.
	(trees_in::{tree_node,finish}): Use error_at.
	(module_server::module_server): Likewise.
	(module_state::read*): Adjust.
	(module_state::{do_import,lazy_load}): Don't set input_location.
	(finish_module): Likewise.

	ASYNC loading & server cookie.
	gcc/cp/
	* cp-tree.h (reseat_module_loc, module_from_loc): Delete.
	(atom_module_preamble): Declare.
	* cxx-module-server.sh (cmd): Fix ASYNC response.
	* lex.c (reseat_module_loc, module_from_loc): Delete.
	* module.c (module_state::from_loc): Is a field.
	(module_server): Require locations throughout.  Redesign
	interface.  Add cookie.
	(module_state::read_config): Use from_loc.
	(module_state::read): Don't set module_purview here ...
	(module_state::find_module): ... do it here.
	(module_state::do_import): Add check_crc flag.  Don't query server
	here.
	(import_module, declare_module): Query server here (ts).
	(module_state::atom_preamble): New.
	(atom_module_preamble): Call it.
	(finish_module): Adjust.
	* parser.c (cp_parser_peek_module_name): Fold into ...
	(cp_parser_module_name): ... here.
	(cp_parser_module_declaration): No injected atom end marker.
	(cp_parser_module_preamble): Rename to ...
	(cp_parser_get_module_preamble_tokens): ... this.  Don't append
	end marker.  Return end loc.
	(cp_parser_parse_module_preamble): New.
	(cp_parser_declaration_seq_opt): Adjust.
	(cp_parser_fill_main): Skip preamble.
	(c_parse_file): Do preamble tokenization and parsing here.
	gcc/
	* doc/invoke.texi (C++ Modules): Document server cookie.
	libcpp/
	* include/cpplib.h (cpp_relocate_peeked_tokens): Declare.
	* include/line-map.h (linemap_save_pre_module)
	(linemap_restore_pre_module): Declare.
	(LINEMAP_MODULE_SET_FROM): Delete.
	* lex.c (cpp_relocate_peeked_tokens): New.
	* line-map.c (linemap_module_loc): Set from direcly.
	(linemap_save_pre_module, linemap_restore_pre_module): New.
	gcc/testsuite/
	* g++.dg/modules/flag-1_b.C
	* g++.dg/modules/freeze-1_d.C
	* g++.dg/modules/import-2.C
	* g++.dg/modules/indirect-1_c.C
	* g++.dg/modules/mod-stamp-1_d.C

2018-05-30  Nathan Sidwell  <nathan@acm.org>

	Module location
	libcpp/
	* include/cpplib.h (cpp_module_file): Delete.
	* include/line-map.h (MAP_MODULE_P, LINEMAP_MODULE_SET_FROM): New.
	(linemap_module_loc): Declare.
	* files.c (cpp_module_file): Delete.
	* line-map.c (linemap_module_loc): New.
	gcc/cp/
	* cp-tree.h (module_file_nest): Delete.
	(make_module_loc, reseat_module_loc, module_from_loc): Declare.
	* lex.c (module_file_nest): Delete.
	(make_module_loc, reseat_module_loc, module_from_loc): New.
	* module.c (struct module_state): Replace imp_loc and self_loc
	with plain loc.
	(module_state::{push,pop}_location): Delete.
	(module_state::from_loc): New.
	(module_state::find_module): Set module loc here.
	(module_state::do_import): Adjust loc setting.
	(module_state::lazy_load): Likewise.
	(finish_module): Likewise.
	gcc/
	* diagnostic.c (diagnostic_report_current_module): Show module imports.
	gcc/testsuite/
	* lib/prune.exp: Prune 'module imported at'.
	* g++.dg/modules/atom-check-1_b.C: Adjust.
	* g++.dg/modules/circ-1_c.C: Adjust.
	* g++.dg/modules/flag-1_b.C: Adjust.
	* g++.dg/modules/import-2.C: Adjust.
	* g++.dg/modules/mod-decl-1.C: Adjust.
	* g++.dg/modules/mod-decl-2_b.C: Adjust.
	* g++.dg/modules/mod-stamp-1_d.C: Adjust.

	gcc/cp/
	* module.c (struct module_state): Replace loc with imp_loc &
	self_loc.  Rename imported to direct.
	(module_state::occupied): Delete.
	(module_state::read{_,config}): Replace crc_ptr with bool flag.
	(module_state::do_import): ... here.  Break out ...
	(module_state::find_module): ... this part.  Absorb ...
	(module_state::occupy): ... this.  Delete.
	(module_state::get_module): Change default insert.  Check vec_name
	for occupation.
	(module_state::write_imports): Adjust.
	(import_module, declare_module): Adjust.

2018-05-29  Nathan Sidwell  <nathan@acm.org>

	Included from index becomes included_at location
	libcpp/
	* include/line-map.h (line_map_ordinary): Replace included_from
	index with included_at source_location.
	(ORDINARY_MAP_INCLUDER_FILE_INDEX, LAST_SOURCE_LINE_LOCATION)
	(LAST_SOURCE_LINE, LAST_SOURCE_COLUMN): Delete.
	(INCUDED_FROM): Delete.
	(INCLUDED_AT, linemap_included_at): New.
	(MAIN_FILE_P): Adjust.
	* directives.c (do_linemarker): Use linemap_included_at.
	* line-map.c (include_at_map): New.
	(line_check_files_exited): Use it.
	(LAST_SOURCE_LINE_LOCATION): New (moved from header).
	(linemap_add, linemap_dump, linemap_dump_location): Adjust.
	gcc/
	* diagnostic.c (diagnostic_report_current_module): Use
	linemap_included_at.  Adjust line & col discovery.
	gcc/c-family/
	* c-common.c (try_to_locate_new_include_insertion_point): Use
	linemap_included_at.
	* c-lex.c (fe_file_change): Use INCLUDED_AT.
	* c-ppoutput.c (pp_file_change): Likewise.

	libcpp/
	* include/line-map.h (enum lc_reason): Add LC_HWM, LC_CXX_MODULE.
	* line-map.c (linemap_dump): Adjust.
	gcc/
	* diagnostic.c (diagnostic_report_current_module): Reroll loop.

	gcc/cp/
	* cxx-module-server.sh: Add batching and ASYNC support.
	gcc/
	* doc/invoke.texi (C++ Modules): More protocol explanation

2018-05-25  Nathan Sidwell  <nathan@acm.org>

	Server protocol batching
	gcc/
	* doc/invoke.texi (C++ Modules): Document protocol batching.
	gcc/cp/
	* cp-tree.h (maybe_peek_import): Delete.
	* lex.c (atom_preamble_prefix_peek): Drop import peeking.
	* parser.c (cp_parser_module_preamble): Likewise.
	* module.c (module_server::{send_command,get_response}): Deal with
	batching.
	(module_state::peek_import_query, maybe_peek_import): Delete.
	(module_state::next_line): New.
	gcc/tesutsuite/
	* g++.dg/modules/atom-peek-1_[abc].C: Delete.

	Merge trunk r260753.

	Direct import lambda returns!
	gcc/cp/
	* module.c (depset::decl_key): Remove assert.
	(trees_{in,out}::core_vals): Serialize type context, lambda expr and
	decl size & value.
	(trees_out::tree_decl): Spot voldemort returns. Ident by index.
	(trees_in::tree_node): Ident by index.
	(trees_in::finish_type): Don't set type context here.
	(depset::hash::add_dependency): Namespaces are also ok.
	* decl.c (fndecl_declared_return_type): Default to auto.
	* decl2.c (no_linkage_error): Ignore imported decls.
	* name-lookup.h (lookup_by_ident): Ident is index.
	(get_lookup_ident): Declare.
	* name-lookup.c (get_binding_or_decl): New.
	(lookup_by_ident): Use it.  Ident is index.
	(get_lookup_ident): New.
	gcc/testsuite/
	* g++.dg/modules/vmort-1_[ab].C: New.
	* g++.dg/modules/lambda-1_[ab].C: New.

2018-05-24  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* name-lookup.c (extract_module_decls): Don't strip template of
	result.
	gcc/
	* doc/invoke.texi (C++ Modules): Consider batching.

	gcc/
	* doc/invoke.texi (C++ ModuleS): Update server docs.
	gcc/cp/
	* cxx-module-server.sh: Add INCLUDE.
	* semantics.c (deferred_access): Move GTY.
	* module.c (module_state::global_vec): Move GTY.
	(module_state::modules): Likewise.
	* parser.c (cp_parser_peek_module_name): Remove incomplete
	partition work.

	DECL_DISCRIMINATOR for local classes, merge local var disc.
	gcc/cp/
	* cp-tree.h (language_function): Remove x_local_names.
	(DECL_DISCRIMINATOR_P): Allow IMPLICIT_TyPEDEF too.
	(DECL_DISCRIMINATOR_SET_P): Delete.
	(local_classes): Delete declaration.
	(determine_local_discriminator): Declare.
	* class.c (local_classes): Delete.
	(init_class_processing): Don't init it.
	* decl.c (local_names): Delete.
	(local_entities): New.
	(push_local_name): Replace with ...
	(determine_local_discriminator): ... this.
	(cp_finish_decl): Adjust.
	(save_function_data, finish_function): Remove local_name handling.
	* decl2.c (finish_anon_union): Set discriminator.
	* mangle.c (write_unnamed_type_name): Use discriminator_for_local_entity.
	(local_class_index): Delete.
	(discriminator_for_local_entity): Use DECL_DISCRIMINATOR for both
	cases.
	(write_local_name): Adjust.
	* name-lookup.c (do_pushtag): Use determine_local_discriminator.
	gcc/testsuite/
	* g++.dg/abi/anon5.C: New.

2018-05-23  Nathan Sidwell  <nathan@acm.org>

	gcc/
	* diagnostic-code.h (fullname): Delete.
	* diagnostic.c (fullname): Delete.
	* toplev.c (general_init): Don't set it.
	gcc/cp/
	* module.c: Include opts.h.
	(module_state::get_option_string): New.
	(module_state::write_{readme,config}): Write option string.
	(module_state::read_config): Check it.
	(module_state::write): Adjust.
	(module_server::module_server): Adjust.
	gcc/testsuite/
	* g++.dg/modules/flag-1_[ab].C: New.

	Now with a Sneakoscope!
	gcc/cp/
	* module.c (depset::hash): Add a sneakoscope.
	(module_state::find_dependencies): Turn it on.
	(trees_out::tree_decl): Check it.
	gcc/testsuite/
	* g++.dg/modules/local-1_[ab}.C: New.

	gcc/cp/
	* cxx-module-server.sh: Remove --no-default.
	* module.c (module_server::send_command): New.
	(module_server::{reset,handshake,import_export_query,export_done}):
	Use it.
	gcc/testsuite/
	* g++.dg/modules/atom-peek-1_[bc].C: Adjust scans.
	* g++.dg/modules/indirect-1_c.C: Likewise.

2018-05-22  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* cxx-module-server.sh: Add --no-compile, --no-default and
	--mapping options.

	gcc/cp/
	* module.c (depset::defn_key): Add is_def parm.
	(depset::hash::add_definition): Delete.
	(depset::hash::add_dependency): Add either decl or defn.
	(depset::hash::add_binding): Use add_dependency.
	(cluster_cmp): Swap defns and decls.
	(cluster_tag): Delete ct_voldemort, ct_no_decl.
	(module_state::{read,write}_cluster): Voldemorts are implicit.
	(module_state::write): Adjust.
	gcc/testsuite/
	* g++.dg/modules/unnamed-1_b.C: Adjust module scan.

	Revert lazy definition patches.  Once one gets into template land
	it's all very brittle.  We end up with an unmaintained difference
	betweek 'we need the definition right now', and 'we need the
	definition at some point'.  I end up not being able to maintin the
	SCC dependency graph, and my head melted, looking a the rat hole
	that was appearing.  Until proved otherwise, there are other
	things to get on with.
	gcc/cp/
	* cp-tree.h (DECL_MODULE_LAZY_DEFN, HAS_DECL_MODULE_LAZY_DEFN_P)
	(MAYBE_DECL_MODULE_LAZY_DEFN): Delete.
	(struct lang_decl_min): Remove lazy_module_defn field.
	(lazy_load_defn): Delete decl.
	* constexpr.c (cxx_eval_call_expression): Remove lazy loading.
	* decl2.c (decl_defined_p, mark_used): Likewise.
	* module.c (depset::hash::add_definition): Remove DEFERRED parm.
	(trees_in::{pre,}seed): Delete.
	(trees_out::seeding{,_p}): Delete.
	(trees_out::unmark_trees): Seeding not needed.
	(trees_out::{begin,end}): Delete seeding variants.
	(trees_out::seed): Remove.
	(trees_out::insert): Return val, remove seeding.
	(trees_{in,out}::lang_decl_vals): Remove seeding.
	(has_definition): Return bool.
	(ct_seed_decl, ct_self_used): Delete.

	(module_state::{read,write}_cluster): Remove lazy handling.
	(module_state::{find_dependencies,write}): Adjust.
	(module_state::check_read): Adjust.
	(module_state::lazy_load, lazy_load_defn): Delete.
	* ptree.c (cxx_print_decl): Remove lazy defn index.

	Almost lazy function definitions.
	gcc/cp/
	* constexpr.c (cxx_eval_call_expression): Maybe lazy load.
	* decl2.c (decl_defined_p): Lazy definitions are ok.
	(mark_used): Try and lazy load.
	* module.c (module_state::lazy_load): Lazy load a definition.
	(trees_out::seed): Mark template result.
	(trees_in::tree_node): Adjust mark_used.
	(module_state::write_cluster): Adjust.
	(module_state::read_cluster): Accept ct_self_used.
	(lazy_load_defn): New.

	gcc/cp/
	* module.c (trees_out::seed): Reimplement mechanim.
	(trees_out::{begin,end}): Don't turn seeding on/off here.
	(trees_out::unmark_trees): Add logging.
	(trees_in::preseed): Fix addition calculation.
	(module_state::write_cluster): Adjust lazy defn seeding.
	(module_state::read_cluster): Add lazy defn seeding.
	(module_State::find_dependencies): Adjust.

2018-05-21  Nathan Sidwell  <nathan@acm.org>

	libcpp/
	* directives.c (struct if_stack): Add hash_loc field.
	(PEEKED): Replace with ...
	(PEEK_INVISIBLE): ... this.  Inverted sense.
	(DIRECTIVE_TABLE): Update.
	(linemarker_dir): Add PEEK_INVISIBLE.
	(_cpp_handle_directive): Correctly handle if nests.

	gcc/testsuite/
	* g++.dg/modules/atom-preamble-2_[def].C: New.

	gcc/cp/
	* cp-tree.h (HAS_DECL_MODULE_LAZY_DEFN_P): New.
	(MAYBE_DECL_MODULE_LAZY_DEFN): Use it.
	* module.c (trees_in::{pre,}seed): Adjust.
	(trees_out::{begin,end}): New overloads.
	(trees_out::unmark_trees): Adjust.
	(trees_out::{preseed,insert}): Correct force marking.
	(trees_in::tree_node): Robustify.
	(module_state::write_cluster): Fix name, better messages,
	(module_state::read_cluster): Use ct_no_decl.
	(module_state::write): Use HAS_DECL_MODULE_LAZY_DEFN_P.
	(module_state::check_read): Use decl if it makes sense.

	Write lazy decls (no reading yet)
	gcc/cp/
	* module.c (elf_out::strtab::named_decl): Add IS_DEFN parm.
	(elf_out::named_decl): Likewise.
	(elf_out::strtab::write): Adjust.
	(FIXED_LIMIT): New.
	(trees_out::set_seed): Delete.
	(trees_out::{pre,un,}seed): New.
	(trees_out::insert): Adjust for seeding.
	(trees_out::tree_ref): Likewise.
	(cluster_tag): Add ct_lazy.
	(module_state::write_cluster): Preseed decls of lazy defns.
	(module_state::find_dependencies): Adjust seeding changes.
	(module_state::write): Determine lazy defn section numbers.

2018-05-20  Nathan Sidwell  <nathan@acm.org>

	libcpp/
	* internal.h (_cpp_handle_directive): Add HASH_LOC arg.
	* directives.c (_cpp_handle_directive): Add HASH_LOC arg, store it.
	* init.c (read_original_filename): Adjust _cpp_handle_directive call.
	* lex.c (_cpp_lex_token): Likewise.
	* traditional.c (_cpp_scan_out_logical_line): Likewise.
	* directives-only.c (_cpp_preprocess_dir_only): Likewise.

	Import peeking
	gcc/c-family/
	* c-lex.c (c_lex_with_flags) <case CPP_STRING>: Check
	C_LEX_STRING_IS_HEADER.
	* c-pragma.h (C_LEX_STRING_IS_HEADER): New flag.
	gcc/cp/
	* cp-tree.h (HEADER_STRING_LITERAL_P): Delete.
	(maybe_peek_import): Declare.
	* cxx-module-server.sh: Adjust.
	* lex.c (atom_preamble_prefix_peek): Add peeking state.
	* module.c (module_server::peek_import_query): New.
	(make_flat_name): New.  Broken out of ...
	(module_state::do_import): ... here.  Call it.
	(maybe_peek_import): New.
	* parser.c (cp_parser_peek_module_name): New.
	(cp_parser_module_name): Use it.
	(cp_parser_import_declaration): Adjust.
	(cp_parser_module_preamble): Do peeking.
	gcc/
	* doc/invoke.texi (C++ Modules): Tweak server protocol
	gcc/testsuite/
	* g++.dg/modules/atom-peek-1_[abc].C: New.
	* g++.dg/modules/mod-decl-1.C: Adjust diags.
	* g++.dg/modules/p0713-2.C: Likewise.
	* g++.dg/modules/proclaim-1.C: Likewise.

	Diagnose pragmas ending preamble.
	libcpp/
	* lex.c (cpp_peek_token_with_location): Set peeked_location to
	incoming location.  Fix pragma unwind.
	gcc/cp/
	* cxx-module-server.sh: Add new commands.
	* lex.c (atom_preamble_prefix_peek): Note trailing pragma.
	gcc/
	* doc/invoke.text (C++ Modules): More server commands.
	gcc/testsuite/
	* g++.dg/modules/atom-pragma-[123].C: New.

2018-05-19  Nathan Sidwell  <nathan@acm.org>

	Parse after tokenizing
	libcpp/
	* lex.c (cpp_peek_token_with_location): Adjust for compiler warning.
	gcc/cp/
	* parser.c (module_preamble_end_loc): Rename to ...
	(module_marker_loc): ... here.
	(cp_parser_module_declaration): Reimplement.
	(cp_parser_import_declaration): Adjust.
	(cp_parser_module_preamble): Don't parse here.  Add artificial end
	marker.
	(cp_parser_declaration_seq_opt): Adjust for atom.
	(cp_parser_fill_main): Whole buffer is to be parsed.
	(c_parse_file): Don't set end_loc here.
	gcc/testsuite/
	* g++.dg/modules/atom-decl-1.C: Adjust diagnostics.
	* g++.dg/modules/atom-preamble-1.C: Likewise.
	* g++.dg/modules/mod-decl-1.C: Likewise.
	* g++.dg/modules/p0713-[23].C: Likewise.

2018-05-18  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.c (trees_out::maybe_insert_typeof): New.
	(trees_out::{force_,maybe_,}insert): Merge, adjust callers.
	(trees_out::tree_decl): Use maybe_insert_typeof.
	(module_state::write_cluster): Likewise.
	gcc/testsuite/
	* g++.dg/modules/indirect-3_c.C: Adjust scans.

	gcc/cp/
	* module.c (module_state::write_cluster): Break apart unnamed
	numbering from marking.
	(module_state::write): Break apart cluster sizing from section
	numbering.

	gcc/cp/
	* module.c (trees_out::mark_node): Lose walk_into parm.  Adjust
	all callers.
	(module_state::write_cluster): Assert binding already marked.

	gcc/cp/
	* module.c (module_state::mark_definition): Remove include_decl
	parm.
	(module_state::mark_{template,function,var,class,enum}_def): Likewise.

	gcc/cp/
	* module.c (trees_in::{preseed,seed}): New.
	(trees_out::seeding): New member.
	(trees_out::seeding_p): New predicate.
	(trees_out::unmark_trees): Add trees_in parm to preseed.
	(trees_out::end): Add trees_in parm.
	(trees_out::set_seed): New.
	(trees_out::tree_decl): Check seeding_p.
	(module_state::find_dependencies): Preseed the decl of a defn.
	gcc/testsuite/
	* g++.dg/modules/defer-1.C :New.

	gcc/cp/
	* module.c (depset::hash::add_definition): Add DEFERRABLE parm.
	(has_definition): Return tristate.
	(depset::hash::add_{dependency,binding}): Adjust.
	(module_state::find_dependencies): Refactor.

	Add lazy_module_defn cookie.
	* cp-tree.h (DECL_MODULE_LAXY_DEGN, MAYBE_DECL_MODULE_LAZY_DEFN): New.
	(struct lang_decl_min): Add lazy_module_defn field.
	* module.c (trees_{in,out}::lang_decl_vals): Serialize it.
	* ptree.c (cxx_print_decl): Print it.

	gcc/cp/
	* cp-tree.h (ovl_op_flags, ovl_op_code): Reindent.
	* lex.c (atom_preamble_prefix_peek): FIXME.
	* parser.c (cp_parser_module_preamble): FIXME.
	* module.c (bytes_out::streaming_p (): New.
	(trees_out::streaming_p): Delete.
	(tt_backref): Delete.  Update uses to know -ve == backref
	(module_state::write_cluster): Some refactoring.

2018-05-16  Nathan Sidwell  <nathan@acm.org>

	Preamble rescanning!
	gcc/
	* configure.ac: Look for execv.
	* config.in, configure: Rebuilt.
	* toplev.h (original_argc, original_argv): Declare.
	* toplev.c (original_argc, original_argv): Declare.
	(toplev::main): Set them.
	doc/invoke.texi (EE) Rename to ...
	(fmodule-preamble): ... this.
	(C++ Modules): Document RESET message.  Document N,N.
	gcc/c-family/
	* c.opt (EE): Rename to ...
	(fmodule-preamble) ... here.
	(fmodule-preamble=): New hidden option.
	* c-ppoutput.c (scan_translation_unit): Use cpp_pop_directives.
	gcc/cp/
	* cp-tree.h (atom_preamble_prefix_peek): Add from-parser parm.
	(maybe_repeat_preamble): Declare.
	* cp-lang.c (atom_preamble_fsm): Adjust.
	* cxx-module-server.sh (RESET): New command.
	* lang-specs.h (@c++): Adjust EE->fmodule-preamble.
	* lex.c (atom_preamble_prefix_peek): Add from-parser parm.  Check
	flag_module_preamble.  Call maybe_repeat_preamble.
	* module.c: #include "toplev.h"
	(module_server_name): Is const.
	(module_server::module_server): Copy command.  Support N,N for two
	pipes.
	(module_server::make): Adjust.
	(module_server::reset): New.
	(module_server::fini): Add reset arg.  Reset.
	(maybe_repeat_preamble): New.
	(handle_module_option): Adjust.
	* parser.c (cp_parser_module_preamble): Adjust.
	gcc/testsuite/
	* g++.dg/modules/cpp-preamble-[1-8].C: Adjust options.
	* g++.dg/modules/atom-rescan-1.C: New.
	* g++.dg/modules/atom-no-rescan-1.C: New.

2018-05-15  Nathan Sidwell  <nathan@acm.org>

	Detect cpp directives at end of preamble
	libcpp/
	* include/cpplib.h (cpp_peek_token_with_location): Declare.
	(cpp_pop_directives): Declare.
	* internal.h (struct cpp_reader): Add peeked_directive field.
	* directives.c (PEEKED): New.
	(DIRECTIVE_TABLE): Add it.
	(_cpp_handle_directive): Set peeked_directive.
	(cpp_pop_directives): New.
	* lex.c (cpp_peek_token): Wrapper around ...
	(cpp_peek_token_with_location): ... this.
	gcc/cp/
	* cp-lang.c (atom_preamble_fsm): Update for new state transitions.
	* lex.c (atom_preamble_prefix_peek): Check peeked directives.
	* parser.c (cp_parser_module_preamble): Update.
	gcc/testsuite/
	* g++.dg/modules/cpp-preamble-1.C: Add diag
	* g++.dg/modules/cpp-preamble-[678].C: New.

	libcpp/
	* include/cpplib.h (cpp_in_macro_expansion_p): Declare.
	* macro.c (in_macro_expansion_p): Rename to ...
	(cpp_in_macro_expansion_p): ... here.  Externalize.
	(cpp_get_token_1): Adjust.
	* internal.h: Update docs.
	gcc/
	* langhooks.h (struct lang_hooks): Adjust preprocess_preamble.
	gcc/c-family/
	* c-ppoutput.c (scan_translation_unit): Pass token location to
	preamble hook.
	gcc/cp/
	* cp-lang.c (atom_preamble_fsm): Pass token loc through.
	* cp-tree.h (atom_preamble_prefix_next): Take token loc.
	* lex.c (atom_preamble_prefix_next): Take token loc.  Warn if
	ending inside macro.
	* parser.c (cp_parser_module_preamble): Adjust.
	gcc/testsuite/
	* g++.dg/modules/cpp-preamble-5.C: New.

	gcc/
	* langhooks.h (struct lang_hooks): Adjust preprocess_preamble.
	gcc/cp/
	* cp-tree.h (atom_preamble_prefix_{peek,next}): Declare.
	* cp-lang.c (atom_preambls_fsm): Adjust args.  Use
	atom_preamble_prefix_{peek,next}.
	* lex.c (atom_preamble_prefix_len): Turn into ...
	(atom_preamble_prefix_peek): ... this.
	(atom_preamble_prefx_next): New.
	* parser.c (cp_parser_module_preamble): Adjust.
	gcc/c-family/
	* c-ppoutput.c (scan_translation_unit): Adjust
	gcc/testsuite/
	* g++.dg/modules/atom-preamble-2_c.C: New.
	* g++.dg/modules/cpp-preamble-4.C: New.

	gcc/cp/
	* Make-lang.in: Dont sed server version
	* module.c: Use fixed server version.
	* cxx-module-server.sh: Likewise.

	gcc/cp/
	* module.c (trees_out::dep_walk_p): Replace with ...
	(trees_out::{streaming,depending}_p): ... these.  Update callers.

2018-05-14  Nathan Sidwell  <nathan@acm.org>

	Objectify module server.
	gcc/cp/
	* module.c (class module_server): New.
	(server_read, server_write, server_pex, server_size)
	(server_buffer, server_pos, server_end)
	(server_response, server_token, server_word, server_unexpected)
	(server_error, server_init, server_fini): Move into module_server class.
	(server_module_filename): Delete.
	(module_state::do_import): Use module_server::import_query.
	(finish_module): Use module_server::export_{query,done}.
	gcc/testsuite/
	* g++.dg/modules/indirect-1_c.C: Tweak.

	gcc/
	* doc/invoke.texi (C++ Modules): Clarify server docs.
	gcc/cp/
	* cxx-module-server.sh: Robustify.
	* module.c (server_module_filename): Send from location.
	gcc/testsuite/
	* g++.dg/modules/import-2.C: Tweak.

2018-05-13  Nathan Sidwell  <nathan@acm.org>

	Redo the server protocol.
	gcc/cp/
	*cxx-module-server.sh: Update protocol.
	* module.c (elf_out::end): Protect from NULL stream.
	(server_size, server_buffer, server_pos, server_end): New.
	(server_response, server_token, server_word): New.
	(server_end_p): New.
	(server_malformed): Delete.
	(server_init, server_module_filename, server_done): Adjust.
	(module_state::do_import): Adjust.
	gcc/
	* doc/invoke (C++ Modules): Update server protocol.

2018-05-12  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.c (module_server): Make pointer to non-const.
	(server_fini, handle_module_option): Add const_cast.
	(server_init): Write into module_server.  strdup if it came from
	environment.

	Rename oracle->server, thanks Richard Smith
	gcc/
	* doc/invoke.texi (fmodule-oracle): Rename.
	gcc/c-family/
	* c.opt (fmodule-oracle): Rename.
	gcc/cp/
	* Make-lang.in (cxx-module-oracle): Rename.
	* cxx-module-oracle.sh: Rename.
	* module.c (ORACLE_VERSION, module_oracle, oracle_read)
	(oracle_write, oracle_pex): Rename.
	(oracle_fini, oracle_init, oracle_response, oracle_unexpected)
	(oracle_malformed, oracle_module_filename, oracle_done): Rename.

	Direct import filenames are stored.
	gcc/cp/
	* module.c (bytes_out::str): Add overload.
	(bytes_in::str): Robustify.
	(module_state::{read,write}_imports): New.
	(noisy_p): New.
	(module_state::announce, oracle_init): Use noisy_p.
	(oracle_module_file): Rename to ...
	(oracle_module_filename): ... here.  Adjust parms, return
	filename.
	(module_state::write_readme): Write import filename.
	(module_state::{read,write}_config): Use {read,write}_imports.
	(module_state::do_import): Add FILENAME arg, adjust.
	(finish_module): Adjust.
	gcc/testsuite/
	* g++.dg/modules/import-1_e.C: Adjust scan.
	* g++.dg/modules/indirect-1_c.C: Verify no query on indirect import.

2018-05-11  Nathan Sidwell  <nathan@acm.org>

	Remove remaining knowledge of module file names.
	gcc/cp/
	* module.c (MOD_FNAME_SFX, MOD_FNAME_DOT): Delete.
	(module_state): Remove srcname.
	(module_state::print_map): Delete.
	(oracle_query_module, oracle_stream, find_module_file): Merge to ...
	(oracle_module_file): ... this.
	(make_module_file, find_file): Delete.
	(module_state::do_import): Adjust.
	(finish_module): Likewise.

	(Kill -fmodule-output -- use the oracle.
	gcc/c-family/
	* c.opt (fmodule-output): Delete.
	gcc/
	* doc/invoke.texi (C++ Dialect Options): Delete -fmodule-output.
	(C++ Modules): Likewise.
	gcc/cp
	* module.c (module_output): Delete.
	(module_state::do_import): Don't check it.
	(finish_module): Likewise.
	(handle_module_options): Likewise.
	gcc/testsuite/
	* g++.dg/modules/fmod-out-1_[ab].C: Delete.

	Kill -fmodule-file -- use the oracle.
	gcc/c-family/
	* c.opt (fmodule-map-dump): Delete.
	(fmodule-file): Delete.
	gcc/cp/
	* module.c (module_file_args, module_map_dump): Delete.
	(parse_module_mapping): Delete.
	(add_module_mapping): Delete.
	(init_module_processing): Delete module map init.
	(handle_module_option): Delete module map options.
	gcc/
	* doc/invoke.texi (C++ Dialect Options): Delete -fmodule-file.
	(C++ Modules): Likewise.
	gcc/testsuite/
	* g++.dg/modules/fmod-file-1_[ab].C: Delete.
	* g++.dg/modules/fmod-out-1_[ab].C: Adjust.

	Kill -fmodule-path and CXX_MODULE_PATH -- use the oracle.
	gcc/
	* doc/invoke.texi (C++ Dialect Options): Remove -fmodule-path.
	(C++ Modules): Likewise.
	* incpath.h (INC_CXX_MPATH): Delete.
	(clean_cxx_module_path): Delete.
	* incpath.c (clean_cxx_module_path): Delete.
	gcc/c-family/
	* c-opts.c (c_common_post_options): Don't clean_cxx_module_path.
	* c.opt (fmodule-path): Delete.
	gcc/cp/
	* module.c (module_path, module_path_max): Drop.
	(find_file): Adjust.
	(init_module_processing): Drop module path init.
	(handle_module_option): Drop module_path.

	gcc/cp/
	* Make-lang.in (cxx-module-oracle): Sed version.
	(cxx_module-wrapper): Delete.
	* cxx-module-oracle: Allow dev versions.
	* cxx_module-wrapper: Delete.
	* module.c (ORACLE_VERSION): New.
	(oracle_init): Use MODULE_STAMP if available.

	A more conventional protocol
	gcc/
	* doc/invoke.texi (C++ Modules): Update oracle protocol.
	gcc/cp/
	* cxx-module-oracle.sh: Update protocol.
	* module.c (oracle_response): Parse response.
	(oracle_unexpected, oracle_malformed): New.
	(oracle_init): Check version.
	(oracle_query_module): Update.

	Kill module wrapper -- you should use the oracle.
	gcc/
	* doc/invoke.texi (C++ Dialect Options): Remove -fmodule-wrapper.
	* gcc.h (driver::maybe_putenv_CXX_MODULE_WRAPPER): Delete decl.
	* gcc.c (maybe_putenv_CXX_MODULE_WRAPPER): Delete.
	(driver::main): Don't call it.
	gcc/cp/
	* module.c (module_wrapper): Delete.
	(find_module_file): Drop wrapper spawning.
	(init_module_processing): Drop wrapper initialization.
	(handle_module_option): Drop wrapper option.
	gcc/c-family/
	* c.opt (fmodule-wrapper=): Delete.
	gcc/testsuite/
	* g++.dg/modules/modules.exp (DEFAULT_MODFLAGS): Drop -fmodule-wrapper.
	* g++.dg/modules/main-[123]-aux.cc: Delete.
	* g++.dg/modules/main-[123]-map: Delete.
	* g++.dg/modules/main-[123]_a.C: Delete.

	gcc/c
	* config.in: Rebuilt too.

	gcc/
	* diagnostic-core.h (fullname): Declare.
	* diagnostic.c (fullname): Define.
	* toplev.c (general_init): Set it.
	gcc/cp/
	* cxx-module-oracle.sh: More messages.
	* module.c (oracle_init): When defaulting, expect to be next to
	cc1plus.
	(oracle_stream): Always try and init the oracle.
	gcc/testsuite/
	* g++.dg/modules/main_a.C: Adjust for oracle use.

	gcc/
	* configure.ac: Check for AF_UNIX and AF_INET6.
	* configure: Rebuilt.
	* doc/invoke.texi (C++ Modules): Update oracle.
	gcc/cp/
	* module.c: Check HOST_HAS_AF_{UNIX,INET6}.

2018-05-10  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.c: Include socket headers.
	(oracle_init): Create and connect local or ipv6 socket.
	gcc/
	* doc/invoke.texi (C++ Modules): Document oracle socket options.

	gcc/cp/
	* module.c (module_prefix): Delete.
	(make_module_filename): Don't handle it.
	(handle_module_option): Nor here.
	gcc/c-family/
	* c.opt (fmodule-prefix): Delete.
	gcc/
	* doc/invoke.texi (C++ Dialect Options): Remove -fmodule-prefix.
	(C++ Modules): Remove -fmodule-prefix

	Oracle!
	gcc/cp/
	* Make-lang.in (cxx-module-oracle): New rule.
	* cxx-module-oracle.sh: New.
	* module.c (module_oracle): New flag.
	(oracle_read, oracle_write, oracle_pex): New vars.
	(oracle_init, oracle_fini, oracle_response, oracle_query_module)
	(oracle_done, oracle_stream): New.
	(find_module_file, finish_module): Use oracle.
	(handle_module_option): Store oracle option.
	gcc/
	* doc/invoke.texi (C++ Dialect Options): Add -fmodule-oracle.
	(C++ Modules): Document oracle.
	gcc/c-family/
	* c.opt (fmodule-oracle=): New.

2018-05-09  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.c (module_state::get_module): Add insert arg.
	(module_state::{read,write}_config): Stream direct imports first.
	gcc/testsuite/
	* g++.dg/modules/import-1_[ce].C: Adjust.
	* g++.dg/modules/mod-imp-1_[cd].C: Adjust.

	Add -EE
	gcc/cp/
	* cp-lang.c (atom_preamble_fsm): New.
	(LANG_HOOKS_PREPROCESS_PREAMBLE): Override.
	* cp-tree.h (atom_preamble_prefix_len): Declare.
	* lang-specs.h (@c++): Pass -EE when preprocessing.
	* lex.c (atom_preamble_prefix): New.  Broken out of ...
	* parser.c (cp_parser_module_preamble): ... here.  Use it.
	* module.c (handle_module_option): EE implies atom.
	gcc/c-family/
	* c-ppoutput.c: Include langhook.h.
	(scan_translation_unit): Use lang_hooks.preprocess_preamble.
	* c.opt (EE): New.
	gcc/
	* langhooks-def.h (LANG_HOOKS_PREPROCESS_PREAMBLE): Define.
	(LANG_HOOKS_INITIALIZER): Add it.
	* langhooks.h (struct lang_hooks): Add preprocess_preamble.
	* doc/cppopts.texi (EE): Document.
	* doc/invoke.texi (Preprocessor Options): Add -EE.
	(C++ Modules): Document -EE.
	gcc/testsuite/
	* g++.dg/modules/cpp-preamble-[123].C: New.

	gcc/cp/
	* cp/parser.c (module_preamble_end_loc): New var.
	(cp_parser_module_declaration): Check it.
	(cp_parser_import_declaration): Likewise.
	(cp_parser_module_preamble): Deal with FILENAME enabling.
	(cp_parser_declaration_seq_op): Set it.
	(cp_parser_declaration): Parse out-of-preamble module & import
	decls.
	(cp_parser_initial_pragma): Don't check modules here.
	(c_parse_file): Set module_preamble_end_loc.
	gcc/c-family/
	* c-lex.c (c_lex_with_flags): Remove C_LEX_FILENAME handling.
	* c-pragma.h (C_LEX_FILENAME): Delete.
	gcc/testsuite/
	* g++.dg/modules/atom-decl-[123].C: Adjust.
	* g++.dg/modules/atom-preamble-3.C
	* g++.dg/modules/atom-preamble-4.C: New.
	* g++.dg/modules/mod-decl-1.C: Adjust.
	* g++.dg/modules/p0713-[23].C: Adjust.

2018-05-08  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* parser.c (cp_parser_module_preamble): Check for macros
	gcc/testsuite/
	* g++.dg/modules/atom-preamble-3.C: New.

	gcc/cp/
	* parser.c (cp_parser_module_preamble): New.
	(cp_parser_fill_main): Remove atom parsing here.
	(c_parse_file): Adjust.
	gcc/testsuite/
	* g++.dg/modules/atom-preamble-1.C: New.
	* g++.dg/modules/atom-preamble-2_[ab].C: New.

2018-05-07  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.c (depset): Add is_unnamed and refs_unnamed flags.
	(depset::hash::add_dependency): Set them here.
	(cluster_cmp): Change order again.
	(module_state::write_cluster): Check refs_unnamed here.
	gcc/testsuite.
	* g++.dg/modules/scc-1.C: Readjust.

	gcc/cp/
	* module.c (depset::tarjan::connect): Use section==0 for done, not
	top bit of cluster.
	gcc/testsuite/
	* g++.dg/modules/unnamed-1_b.C: Fix scan.

2018-05-06  Nathan Sidwell  <nathan@acm.org>

	Horcruxes!
	gcc/cp/
	* module.c (FIXED_LIMIT): Remove.
	(trees_out::{,maybe_}insert): Make public.
	(trees_out::maybe_mark_unnamed): Delete.
	(trees_out::tree_ref): Remove voldemort handling.
	(trees_in::tree_node): Likewise.
	(tree_tag): Remove tt_voldemort.
	(trees_out::maybe_tag_decl_type): Move back into ..
	(trees_out::tree_decl): ... here.
	(cluster_tag): Add voldemort & horcruxes.
	(module_state::{read,write}_cluster): Deal with horcruxes.
	gcc/testsuite/
	* g++.dg/modules/unnamed-1_[ab].C: Adjust scans.

2018-05-04  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.c (trees_out::maybe_tag_decl_type): New, broken out of ...
	(trees_out::tree_decl): ... here. Call it.
	(trees_out::tree_ref): Use it.
	gcc/testsuite/
	* g++.dg/modules/unnamed-1_[ab].C: New.

	gcc/cp/
	* ptree.c (cxx_print_decl): Show module.
	* module.c (tree_tags): Add tt_voldemort.
	(FIXED_LIMIT): New.
	(trees_out::maybe_mark_unnamed): New.
	(module_state::unnamed): New field.
	(module_state::{read,write}_unnamed): New.
	(module_state::{read,write}_config): Serialize unnamed count.
	(module_state::{read,write}_cluster): Determine unnamedness.
	(trees_out::tree_ref): Check for unnamed.
	(trees_in::tree_node): Add tt_voldemort.
	(depset::hash::add_dependency): Don't add decl to its binding.
	(cluster_cmp): Reorder, again.
	(cluster_tag): Add ct_unnamed.
	(module_state::{read,write}): Adjust.
	gcc/testsuite/
	* g++.dg/modules/namespace-2.C: Adjust scan.
	* g++.dg/modules/unnamed-[12].C: New.
	* g++.dg/modules/scc-1.C: Unadjust.

	gcc/cp/
	* module.c (module_state::mark_definition): Add include_decl arg.
	(module_state::mark_{template,function,var,class,enum}_def): Likewise.
	(cluster_cmp): Reorder decl < defn < bind.
	(enum cluster_tag): New.
	(module_state::{read,write}_cluster): Use it.
	gcc/testsuite/
	* g++.dg/modules/scc-1.C: Adjust.

2018-05-03  Nathan Sidwell  <nathan@acm.org>

	gcc/c-family
	* c-cppbuiltin.c (c_cpp_builtins): Update __cpp_modules value,
	define __cpp_modules_{ts,atom} as selected.
	gcc/testsuite/
	* g++.dg/modules/atom-check-1_a.C: Check for __cpp_modules_atom.
	* g++.dg/modules/atom-check-1_b.C: Check for __cpp_modules_ts.

	gcc/cp/
	* module.c (cluster_size): Delete.
	(module_state::write_{cluster,namespaces,bindings}): Adjust.
	(module_state::write): Precalculate section numbers.

2018-05-02  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* cxx-module-wrapper.sh: Require bash.

	Fragment depsets more.
	gcc/cp/
	* module.c (depset): Replace container & decls with key.  Adjust
	hashing etc.
	(depset::{binding,decl,defn}_key): New.
	(depset::is_{binding,decl,defn}): New.
	(depset::hash::{maybe_insert,find}): Take a key.
	(depset::hash::add_definition): Reimplement.
	(depset::hash::add_dependency): Reimplement.
	(depset::hash::add_binding): Reimplement.
	(cluster_cmp): Extend.
	(module_state::write_{cluster,namespaces,bindings}): Adjust.
	(module_state::{add_writables,find_dependencies}): Adjust.

	gcc/cp/
	* module.c (depset::tarjan): Replace binds, spaces & defs fields
	with plain result field.
	(depset::tarjan::connect): Don't categorize SCCs here.
	(cluster_size): New.
	(module_state::write_cluster): Take SIZE arg.
	(module_state::write): Use cluster_size, split out namespaces here.

2018-05-01  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.c (trees_out::tree_{type,decl,ctx}): Separate need_body
	and owner args.
	(trees_{in,out}::core_vals): Don't stream TYPE_CONTEXT.
	(trees_in::finish_type, module_state::read_class_def): Reconstruct
	it here.
	(trees_out::tree_binfo): Use tree_ctx.

	gcc/cp/
	* module.c (trees_out::tree_decl): Write innermost args.
	gcc/testsuite/
	* g++.dg/modules/indirect-4_[abc].C: New.

	gcc/cp/
	* module.c (module_state::occupy): Do not set filename here.
	(search_module_path): Rename to ...
	(find_file): ... here.  Search for bmis too.
	(find_module_file): Use find_file.
	(add_module_mapping, finish_module): Adjust.
	gcc/
	* doc/invoke.texi (C++ Modules): Document search path and prefix.

	gcc/cp/
	* Make-lang.in (c++.install-common): Install wrapper into
	libexecsubdir.

	Merge trunk r184995.

2018-04-30  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.c (trees_out::tree_decl): Adjust for member templates.
	(trees_out::tree_node): Don't deal with templates here.
	(trees_in::tree_node): Adjust template instantiations here.
	(module_state::mark_template_def): Adjust.
	gcc/testsuite/
	* g++.dg/modules/indirect-2_b.C: Adjust module scan.
	* g++.dg/modules/indirect-3_[abc].C: New.

2018-04-27  Nathan Sidwell  <nathan@acm.org>

	Merge trunk r259710.

2018-04-26  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* cp-tree.h (DECL_TEMPLATE_INFO): Correct comment.
	* module.c: Update description, general format cleanups.
	(elf_out::SECTION_ALIGN): New.
	(elf_out::pad): Use it.
	* pt.c (build_template_decl): Make static.

2018-04-25  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.c (maybe_get_template): Delete.
	(trees_out::tree_decl): Move dependency building into named-decl
	handling.  Don't walk into namespaces.

	gcc/cp/
	* module.c (trees_out::tree_node): Reorder.

2018-04-24  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.c (trees_out::tree_decl): Deal with templated types.
	(tree_in::tree_node): Likewise.
	gcc/testsuite/
	* g++.dg/modules/indirect-2_[abc].C: Add template class.

	gcc/cp/
	* module.c (enum tree_tag): Add tt_template.
	(trees_out::tree_decl): Emit tt_template as needed.
	(trees_in::tree_node): Read tt_template.
	gcc/testsuite/
	* g++.dg/modules/class-3_b.C: Adjust.
	* g++.dg/modules/indirect-1_b.C: Adjust.
	* g++.dg/modules/indirect-2_[abc].C: New.

	gcc/cp/
	* module.c (trees_out::core_vals): Check module of type context.
	(trees_out::tree_decl): Assert we can find the named decl.
	(module_state:read_config): Move defrosting to ...
	(module_state::read): ... here.

2018-04-23  Nathan Sidwell  <nathan@acm.org>

	gcc/testsuite/
	* g++.dg/modules/indirect-1_[abc].C: Add exported constant.

	gcc/cp/
	* name-lookup.c (lookup_by_ident): Look in enumerals.
	gcc/testsuite/
	* g++.dg/modules/indirect-1_[abc].C: Add enum.

	gcc/cp/
	* module.c (trees_{in,out}::core_vals): More FUNCTION_DECL fields.
	gcc/testsuite/
	* g++.dg/modules/indirect-1_[abc].C: Add virtual class.

	gcc/cp/
	* module.c (dumper::pop): Don't print trailing line.

	gcc/cp/
	* module.c (trees_{in,out}::core_vals): Allow NULL-context VAR_DECLS.
	gcc/testsuite/
	* g++.dg/modules/indirect-1_[abc].C: Add class.

	gcc/cp/
	* module.c (enum tree_tag): Remove tt_namespace.
	(trees_out::tree_{value,decl,type,ref,ctx}): New.  Broken out of ...
	(trees_out::tree_node): ... here.  Use them.
	(trees_out::core_vals): Use tree_ctx.
	(module_state::write_cluster): Use tree_ctx.
	* name-lookup.h (find_imported_namespace): Delete.
	* name-lookup.c (find_imported_namespace): Delete.
	gcc/testsuite/
	* g++.dg/modules/class-3_d.C: Adjust scans.
	* g++.dg/modules/indirect-1_[abc].C: New.

	gcc/cp/
	* module.c (module_state::importing): New.
	(module_state::init): Lazy_open is not just for laziness.
	(module_state::read_config): Call maybe_defrost.
	(module_state::maybe_defrost): New, broken out of ...
	(module_state::load_section): ... here.  Call it.
	(module_state::freeze_an_elf): Look in importing stack too.
	gcc/testsuite/
	* g++.dg/modules/nest-1_[abc].C: New.

2018-04-11  Nathan Sidwell  <nathan@acm.org>

	gcc/c-family/
	* c-lex.c (c_lex_with_flags): Check C_LEX_FILENAME.  Deal with
	CPP_HEADER_NAME.
	* c-pragma.h (C_LEX_FILENAME): New.
	gcc/cp/
	* parser.c (cp_parser_fill_main): Ask for C_LEX_FILENAME.
	(cp_parser_import_declaration): Parse legacy import names.
	* cp-tree.h (HEADER_STRING_LITERAL_P): New.
	libcpp/
	* include/cpplib.h (cpp_enable_filename_token): Declare.
	* macro.c (cpp_enable_filename_token): Define.
	pfile->state.angled_headers.
	gcc/testsuite/
	* g++.dg/modules/atom-inc-1.C: New.

	gcc/cp/
	* module.c (module_state::lazy_depth): Remove.
	(module_state::lazy_open): Make countdown value.
	(module_state::init): Use getrlimit to default PARAM_LAZY_MODULES.
	gcc/
	* doc/invoke.texi (C++ Modules): Document lazy loading.
	* params.def (PARAM_LAZY_MODULE_FILES): Rename to ...
	(PARAM_LAZY_MODULES): ... here.
	gcc/testsuite/
	* g++.dg/modules/freeze-1_d.C: Fix.

2018-04-10  Nathan Sidwell  <nathan@acm.org>

	Protect against too-many lazy loadings.
	gcc/
	* params.def (PARAM_LAZY_MODULE_FILES): Define.
	gcc/cp/
	* module.c: Include params.h
	(elf::has_error): Return the error code.
	(elf_in): Add device, inode & size fields.
	(elf_in::{is_frozen,freeze,defrost}): New.
	(module_state): Add lru, lazy_lru, lazy_open fields.
	(module_state::{load_section,freeze_an_elf}): New.
	(module_state::{read,lazy_load}): Adjust.
	(module_state::check_read): Check for EMFILE.
	(module_state::do_import): Adjust.
	gcc/testsuite/
	* g++.dg/modules/freeze-1_[a-d].C: New.

	gcc/cp/
	* parser.c (cp_parser_declaration_seq_opt): Remove ATOM handling here.

	Incremental tokenization of ATOM preamble.
	gcc/c-family/
	* c-pragma.h (C_LEX_STRING_FILENAME): New.
	gcc/cp/
	* cp-tree.h (module_file_nest): Declare.
	* lex.c (module_file_nest): Define.
	* module.c (module_state::{push,pop}_location): Use it.
	* parser.c (cp_lexer_fill_main): Rename to ...
	(cp_parser_file_main): ... this.  Take parser not lexer.  Read &
	parse one atom declaration at a time.
	(cp_parser_declaration_seq_opt): Disable atom preamble here.
	(c_parse_file): Adjust.
	libcpp/
	* files.c (cpp_module_file): New.
	* include/cpplib.h (cpp_module_file): Declare.

2018-04-09  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* parser.c (cp_lexer_new_main): Replace with ...
	(cp_lexer_fill_main): ... this.  Move initial pragma processing to
	...
	(c_parse_file): ... here.
	(cp_parser_new): Adjust.

	gcc/cp/
	* parser.c (cp_lexer_get_preprocessor_token): Take cpp-flags
	directly.
	(cp_lexer_new_main, cp_parser_initial_pragma): Adjust.

	gcc/cp/
	* cp-tree.h (modules_p, modules_atom_p): New predicates.
	* decl.c (cxx_init_decl_processing): Use modules_p.
	* decl2.c (c_parse_final_cleanups): Likewise.
	* lex.c (init_reswords):
	* module.c (module_state::write_readme): Use modules_atom_p.
	(module_state::{read,write}_config): Likewise.
	(handle_module_option): Don't handle OPT_fmodules_atom here,
	* name-lookup,c (reuse_namespace, make_namespace_finish): Use
	modules_p.
	* optimize.c (maybe_clone_body): Likewise.
	* semantics.c (expand_or_defer_fn_1): Likewise.
	* parser.c (cp_parser_diagnose_invalid_type_name)
	(cp_parser_declaration_seq_opt, cp_parser_declaration): Use
	modules predicates.
	(cp_parser_initial_pragma): Reject pragma with modules.
	(c_parse_file): Adjust error message.
	gcc/c-family/
	* c.opt (fmodules-ts, fmodules-atom): Adust.
	(fno-modules): New.
	gcc/
	* doc/invoke.texi (fno-modules): Document.

	gcc/cp/
	* module.c (init_module_processing): Disallow PCH.
	gcc/c-family/
	* c-pch.c (c_common_valid_pch): Never valid with modules.

	gcc/cp/
	* module.c (module_state::{read,write}_config): Check ATOM/TS
	matches.
	gcc/testsuite/
	* g++.dg/modules/atom-check-1_[ab].C: New.

	gcc/cp/
	* module.c (module_state::write_readme): New.  Broken out of ...
	(module_state::write_context): ... here.  Absorb remainder into ...
	(module_state::write_config): ... here.
	(module_state::read_context): Merge into ...
	(module_state::read_config): ... here.
	(module_state::{read,write}): Adjust.

	gcc/cp/
	* module.c (module_state::release): Simplify.
	(module_state::check_read): Release if done.
	gcc/testsuite/
	* g++.dg/modules/import-2.C: Expect no bmi.
	* g++.dg/modules/modules.exp (dg-module-bmi): Always delete the bmi.

	gcc/cp/
	* module.c (module_state::read): Allocate elf_in here.
	(module_state::do_import): Adjust.
	gcc/testsuite/
	* g++.dg/modules/import-2.C: New.

	gcc/cp/
	* module.c (trees_out::tree_node): Avoid uninitialized false
	positive.

2018-04-06  Nathan Sidwell  <nathan@acm.org>

	Merge trunk r259189.

	Lazy loading!
	gcc/cp/
	* cp-tree.h (union mc_slot): New.
	(struct module_cluster): Use it.
	(lazy_load_binding): Take an mc_slot.
	* module.c (module_state::release): End the elf source.
	(module_state::read_function_def): Save and restore
	current_function_decl.
	(module_state::read): Enable lazy loading.
	(module_state::lazy_load): Take an mc_slot, adjust.
	(lazy_load_binding): Likewise.
	* name-lookup.c (module_binding_slot): Return an mc_slot pointer.
	(fixed_module_binding_slot): New.
	(name_lookup::search_namespace_only): Lazily load.
	(do_pushdecl): Use fixed_module_binding_slot.
	(merge_global_decl): Adjust.
	(import_module_binding): Install lazy cookie.
	(set_module_binding): Adjust.  Kill stale & wrong global module
	bits.
	(lookup_by_ident): Lazily load.
	(reuse_namespace): Use fixed_module_binding_slot.
	(make_namespace_finish): Likweise.
	(add_imported_namespace, find_imported_namespace): Adjust.
	gcc/c-family/
	* c.opt (fmodule-lazy): Default on.
	gcc/testsuite/
	* g++.dg/modules/lazy-1_[ab].C: New.

	gcc/cp/
	* module.c (elf::E_BAD_LAZY): New error.
	(elf::has_error): New.
	(elf::get_error): Return string.
	(elf::end): Return bool.
	(elf_in::forget_section): New.
	(module_state::check_error): New.
	(module_state::do_module_import): Use it.
	(module_state::lazy_load): New.
	(module_state::{read,write}_decls): Absorb into callers.
	(module_state::read_{context,config,namespaces,bindings,cluster}): Lose
	from parm.
	(module_state::lazy_depth): New.
	(lazy_load_binding): New.
	(finish_module): Adjust.
	* cp-tree.h (lazy_load_binding): Declare.
	gcc/testsuite/
	* g++.dg/modules/circ-1_c.C: Adjust errors.
	* g++.dg/modules/mod-stamp-1_d.C: Adjust errors.

	gcc/cp/
	* module.c (elf_in::keep_sections): New.
	(elf_in::read): Add type arg.
	(elf_in::find): Remove type arg.
	(elf_in::begin): Coalesce error messages.
	(module_state::loading): New field.
	(module_state::{read,write}_config): Serialize section range ...
	(module_state::{read,write}_namespace): ... not here.
	(module_state::read_decls): Do not read the actual decls.
	(module_state::read): ... do them here.

	gcc/cp/
	* module.c (trees_{in,out}, depset): Reorder definitions.

	gcc/cp/
	* module.c (module_state::{read,write}_binfos): Merge loops.

	gcc/cp/
	* module.c (trees_{in,out}::tree_binfo): Delete.
	(module_state::{read,write}_binfos): New.
	(module_state::{read,write}_class_def): Use them.

2018-04-05  Nathan Sidwell  <nathan@acm.org>

	gcc/
	* doc/invoke.texi (C++ Modules): New section.
	gcc/c-family/
	* c.opt (-fmodule-lazy): New option.
	gcc/cp/
	* module.c (module_state::read_decls): Prepare for laziness.

	gcc/cp/
	* module.c (module_state::tng_*): Rename.

	gcc/cp/
	* module.c (enum tree_tag): Delete tt_definition, tt_binding.
	(trees_in::tag_{binding,definition}): Delete.
	(trees_out::{,maybe_}tag_definition): Delete.
	(trees_{in,out}::define_{function,var,class,enum}): Delete.
	(trees_in::tree_node): Remove tt_definition handling.
	(trees_in::read, trees_out::write): Delete.

	gcc/cp/
	* module.c (module_state::write_namespace): Delete.
	(module_state::{write_bindings,read_bindings}): Likewise.

	gcc/cp/
	* module.c (TNG): Delete.
	(module_state::{tng_read_bindings,write): Constant fold TNG.
	(trees_out::tree_node, trees_in::finish_type): Likewise.

	gcc/cp/
	* module.c (refs_tng): Replace with TNG.

	Switch over to new binding scheme.
	gcc/cp/
	* module.c (TNG): Enable.

	gcc/cp/
	* module.c (module_state::{read,write,mark}_template_def): Deal
	with CLASSTYPE_DECL_LIST.
	(trees_out::tree_node): Check implicit TEMPLATE_DECLs.

	gcc/cp/
	* module.c (trees_out::tree_node): Reorder by-name checks.
	* name-lookup.c (pushdecl_top_level): Replace IS_FRIEND parm with
	MAYBE_INIT.  Set DECL_CONTEXT.  Finish if requested.
	(pushdecl_top_level_and_finish): Use pushdecl_top_level.
	* name-lookup.h (pushdecl_top_leve): Adjust declaration.

2018-04-04  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.c (module_state::{read,write,mark}_template_def): New.
	(module_state::{read_write_mark}_definition): Call them.
	(depset::hash::add_dependency): Don't depend on no-context decls.
	(trees_out::tree_node): Don't try and name no-context decls.

	gcc/cp/
	* module.c (module_state::{read,write}_class_def}): Fixup
	vptr-containing logic.
	(trees_in::tree_binfo): Forward walk.

	gcc/cp/
	* module.c (enum tree_tag): Replace tt_tinfo_pseudo with
	tt_tinfo_typedef.  Add tt_vtable.
	(module_state::mark_class_def): Mark vtables.
	(trees_out::tree_node): Move TINFO processing to decl section.
	Replace tinfo_psuedo handling with tinfo_typedef handling.  Add
	vtable special.
	(trees_in::tree_node): Likewise.
	* rtti.c (struct tinfo_s): Note type is const qualified variant.
	gcc/testsuite/
	* g++.dg/aaa/class-3_d.C: Adjust message.

	gcc/cp/
	* module.c (module_state::read_definition): New.
	(module_state::read_{function,var,class,enum}_def): New.
	(module_state::tng_read_cluster): New.
	(module_state::tng_read_bindings): Call it.
	(trees_in::tree_node): Check refs_tng.

	gcc/cp/
	* module.c (module_state::write_var_def): Write definition.

	gcc/cp/
	* module.c (trees_out::mark_node): Allow preseeding.
	(trees_out::tree_node): Fix as_base.

2018-04-03  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.c (tt_type_name, tt_named): Rename to ...
	(tt_named_type, tt_named_decl): ... here.  Adjust uses.
	(module_state::mark_class_def): Mark fake base.
	(module_state::write_class_def): Write fake base.
	(trees_{in,out}::tree_node): Avoid goto again.
	(trees_in::finish_type): Protect fake base serialize.
	* Make-lang.in (version.o): Depend on cp dir.
	gcc/testsuite/
	* g++.dg/aaa/class-3_d.C: Adjust message.

	gcc/cp/
	* module.c (bytes_in::{use,i,u,wi,str}): Use set_overrun.
	(module_state::tng_write_cluster): Sort cluster here ...
	(module_state::tng_write_bindings): ... not here.
	(module_state::tng_read_bindings): Set refs_tng.
	(trees_{in,out}::define_class): Don't deal with refs_tng here.
	(trees_out::tree_binfo): Protect from dep_walk_p.  Force insert
	new tag.

	Reorder for better logging
	gcc/cp/
	* module.c (trees_{in,out}::core_vals): Stream name-like members
	early.
	(module_state::do_import): Set module purview before streaming.
	* name-lookup.c (set_module_binding): Don't barf on null.

	gcc/
	* gdbinit.in: Add conditions on error catching breakpoints.

	Fix enum types, more globals
	gcc/cp/
	* module.c (module_state::maybe_add_global): New.
	(module_state::init): Use it.
	(trees_{in,out}::core_vals): Special case TYPE of unscoped enum.

2018-04-02  Nathan Sidwell  <nathan@acm.org>

	Read new .bindings section
	gcc/cp/
	* module.c (elf::get_num_sections): New.
	(module_state::tng_{read,write}_namespaces): Serialize section range.
	(module_state::tng_read_bindings): New.
	(module_State::tng_{read,write}_bindings): Adjust.
	(trees_in::define_enum, trees_in::tag_binding): Adjust.
	* name-lookup.h (push_module_binding): Rename to ...
	(set_module_binding): ... here.
	(import_module_binding): Declare.
	* name-lookup.c (import_module_binding): New.
	(push_module_binding): Rename to ...
	(set_module_binding): ... here.  Adjust.

	Kill old .bindings section
	gcc/cp/
	* module.c (module_state::record_namespace): Delete.
	(module_state::write_namespace): Remove bind parm.  Adjust.
	(module_state::read_namespace): Delete.
	(module_state::tng_read_namespaces): New.
	(module_state::write_bindings): Don't write bindings section.
	(module_state::read_bindings): Use tng_read_bindings).
	* name-lookup.c (make_namespace): Public namespaces are exported.
	(push_namespace): Adjust.

	gcc/cp/
	* module.c (trees_{in,out}::define_class): Check refs_tng.
	(trees_out::tree_binfo): Add definition dependency.
	(trees_{in,out}::tree_node): Don't write binfos in refs_tng mode.
	(trees_in::finish_type): Chek refs_tng.

	gcc/cp/
	* module.c (trees_{in,out}::tree_binfo): Serialize entire path.
	(trees_{in,out}::tree_node): Adjust.

2018-03-30  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.c (has_definition): VAR_DECLs too.
	{module_state::mark_{,function_,var_,class_,enum_}definition): New.
	(trees_out::walk_into): Turn into ...
	(trees_out::mark_node): ... this.  Adjust callers.
	(module_state::write{_function_,class_,var_}_def): Define.
	(module_state::find_dependencies): Look in definitions.

2018-03-28  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.c (maybe_get_template): New.
	(depset::hash::maybe_add_definition): Return a depset.
	(depset::hash::add_dependency): Don't deal with template here.
	(module_state::write_{function,class}): New stubs.
	(module_state::write_enum): New.
	(module_state::write_definition): New.
	(module_state::tng_write_cluster): Write binding header.
	(module_state::add_writables): Don't return a bool. No need to
	nadger namespace ownership.
	(module_state::find_dependencies): Adjust.
	(bind_cmp, space_cmp): New.
	(ns_cmp): Delete.
	(module_state::tng_write_bindings): Sort here.
	(trees_out::tree_node): Check dependency of containers.
	(module_purview_p): Defend against early checks.
	* name-lookup.c (extract_module_decls): Don't special-case
	namespaces.
	(push_namespace): Set EXPORT & OWNER inside a module.
	gcc/testsuite/
	* g++.dg/modules/namespace-2.C: Adjust.
	* g++.dg/modules/namespace-3.C: New.
	* g++.dg/modules/scc-1.C: Adjust.
	* g++.dg/modules/scc-2.C: New.

2018-03-27  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.c
	(depset::hash::{add_writables,find_dependencies}): Moved to ...
	(module_state::{add_writables,find_dependencies}): ... here.  Adjust.
	(depset::hash::write_bindings): Moved to ...
	(module_state::tng_write_bindings): ... here.  Adjust.
	(depset::hash::{add_decls,get_work}): New.

	gcc/cp/
	* module.c (hash_definition): New.
	(struct depset::tarjan): New.
	(depset::tarjan_connect, depset::hash::find_sccs): Delete.
	(depset::hash::maybe_add_definition): New.
	(module_state::tng_write_namespaces): New.
	(depset::hash::{maybe_namespace,write_namespaces): Delete.
	(module_state::tng_write_bindings): Adjust.

	gcc/cp/
	* module.c (depset::traits): Hash & compare using name too.

	gcc/cp
	* module.c (refs_tng): Temporary modal hack.
	(tree_tag): Rename tt_import to tt_named.
	(module_state::write_cluster): Fix iteration.
	(module_state::tng_write_bindings): Set and clear refs_tng.
	(trees_out::tree_node): Refs by name when applicable.
	(trees_out::tree_node): Use tt_named.
	gcc/testsuite/
	* g++.dg/modules/by-name-1.C: New.
	* g++.dg/modules/class-3_b.C: Adjust.
	* g++.dg/modules/scc-1.C: More checking.

2018-03-26  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.c (depset::table): Rename to ...
	(depset::hash): ... here.
	(trees_out::deps_only): Rename to ...
	(trees_out::dep_walk_p): ... here.

	gcc/cp/
	* module.c (depset::table::find_exports): Renamed ...
	(depset::table::add_writables): .. here.  Return bool, add
	exported namespaces.
	(depset::table::append): Add namespaces to worklist.
	(mdule_state::write_namespace): Use TREE_PUBLIC.
	* name-lookup.c (extract_module_decls): Only extract decls in our
	purview.
	(make_namespace): Remove FIXME.
	(push_namespace): Set MODULE_OWNER if exporting.
	gcc/testsuite/
	* g++.dg/modules/namespace-2.C: New.

	gcc/testsuite/
	* lib/scanlang.exp (scan-lang-dump-not): new.

	gcc/cp/
	* module.c (depset::visited): Use depset::cluster.  Adjust users.

	gcc/cp/
	* module.c (elf_out::strtab::named_decl): Cope with TYPE constext.
	(elf_out::strtab::write_named_decl): Likewise.
	(module_state::write_cluster): Adjust dump.
	(fixup_unscoped_enum_owner): New.
	* decl.c (finish_enum_value_list): Call
	fixup_unscoped_enum_owner, as necessary.
	* cp-tree.h (fixup_unscoped_enum_owner): Declare.
	gcc/testsuite/
	* g++.dg/modules/scc-1.C: New.

	gcc/cp/
	* module.c (elf_out::strtab): Add name-by-decl.
	(module_state::write_cluster): Find naming decl, and use it.

	gcc/cp/
	* module.c (class depset): Make a class, add accessors.  Implicitly
	hold name as first decl.
	(depset::table::{maybe_insert,find}): New.
	(depset::table::{append,find_exports,find_dependencies}): Adjust.
	(depset::table::{write_bindings,write_namespaces}): Adjust.
	(module_state::write_cluster): Adjust.

	Add depset analysis (incomplete)
	gcc/cp/
	* module.c (struct depset): New.
	(module_state::tng_write_bindings, write_cluster): New.
	(trees_out::{decls,mark_decls,mark_trees,unmark_trees): New.
	(trees_out::{begin,end,walk_into,force_insert): New.
	(module_state::write): Call tng_write_bindings.
	(trees_out::{core_vals,lang_decl_vals,lang_type_vals,tree_node_raw,
	tree_node): Deal with deps_only.

2018-03-23  Nathan Sidwell  <nathan@acm.org>

	Allow dump '-'
	gcc/
	* dumpfile.c (dump_open): New. Allow '-' for stdout.
	(dump_open_alternate_stream, dump_start, dump_begin): Call it.
	(dump_finish): Identify std{out,err} by stream.
	* doc/invoke.texi (fdump-rtl): Document stdout/stderr.

2018-03-16  Nathan Sidwell  <nathan@acm.org>

	Remove -fmodules, forcing -fmodules-{ts,atom}
	gcc/cp/
	* parser.c (cp_parser_diagnose_invalid_type_name): Adjust error.
	gcc/c-family/
	* c.opt (fmodules): Remove.
	gcc/
	* doc/invoke (fmodules): Remove.
	gcc/testsuite/
	* g++.dg/modules/modules.exp: Iterate over -fmodules-{ts,atom}.
	* g++.dg/modules: Mark tests that are -fmodules-ts only.

2018-03-15  Nathan Sidwell  <nathan@acm.org>

	Implement Atom module & import placement
	gcc/
	* doc/invoke.texi (-fmodules): Document -fmodules-atom.
	gcc/c-family/
	* c.opt (fmodules-atom): Renamed from fmodules++.
	gcc/cp/
	* cp-tree.h (import_module): Add parameter.
	* module.c (import_module): Add exporting param.
	(handle_module_option): Adjust.
	* parser.c (cp_parser_module_declaration): Remove fmodules++
	global module parsing.
	(cp_parser_import_declaration): Adjust.
	(cp_parser_declaration_seq_opt): Parse imports under -fmodules++ ...
	(cp_parser_declaration): and not here.
	gcc/testsuite/
	* g++.dg/modules/mod++-decl-0_[abc].C: Adjust.
	* g++.dg/modules/mod++-decl-2.C: Adjust.
	* g++.dg/modules/mod++-decl-3.C: New.

	Implement p0713 - identifiying module source
	gcc/cp/
	* parser.c (cp_parser_module_declaration): Allow global module
	preamble.  Return bool.
	(cp_parser_declaration_seq_opt): Adjust.
	gcc/testsuite/
	* g++.dg/modules/circ-1_d.C: Adjust.
	* g++.dg/modules/global-1_a.C: Adjust.
	* g++.dg/modules/main-[123]-aux.cc: Adjust.
	* g++.dg/modules/main-aux.cc: Adjust.
	* g++.dg/modules/mod-decl-[13].C: Adjust.
	* g++.dg/modules/mod-decl-5_b.C: Adjust.
	* g++.dg/modules/mod-exp-1_b.C: Adjust.
	* g++.dg/modules/mod-sym-2.C: Adjust.
	* g++.dg/modules/proclaim-1.C: Adjust.
	* g++.dg/modules/static-1_a.C: Adjust.
	* g++.dg/modules/p0713-[123].C: New: Adjust.

2018-03-01  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.c (add_module_mapping): Fix double increment.

2018-02-28  Nathan Sidwell  <nathan@acm.org>

	Merge trunk r258084.

	gcc/
	* Makefile.in (REVISION_c): Don't exec REVISION.
	* REVISION: Simple text file.
	gcc/cp/
	* Make-lang.in (MODULE_STAMP): New var.
	(REVISION_s): Wedge stamp into it here.
	(CFLAGS-cp/module.o): Adjust.

	Using flags on overloads.
	gcc/cp/
	* cp-tree.h (OVL_HAS_USING_P): New.
	* tree.c (alloc_ovl): New, broken out of ...
	(ovl_make): ... this.  Use it.  Maybe set OVL_HAS_USING_P.
	(ovl_copy): Use alloc_ovl.  Copy OVL_HAS_USING_P.
	(ovl_insert): Set OVL_HAS_USING_P appropriately.
	(lookup_maybe_add): Comment on OVL_HAS_USING_P.
	* name-lookup.c (name_lookup::add_overload)
	(get_class_binding_direct): Check OVL_HAS_USING_P.
	gcc/testsuite/
	* g++.dg/lookup/using60.C: New.

	gcc/
	* Makefile.in: Exec REVISION maybe.
	* REVISION: New.
	gcc/cp/
	* Make-lang.in: Directly set MODULE_STAMP.

	Map tag recognised in and out of comments
	gcc/cp/
	* module.c
	gcc/testsuite/
	* g++.dg/modules/hello.cc: Clone to ...
	* g++.dg/modules/main{,-[123]}-aux.cc: ... here.
	* g++.dg/modules/main-[123]_a.C: New.
	* g++.dg/modules/main-[123]-map: New.
	* g++.dg/modules/main-map: Delete.
	* g++.dg/modules/main_a.C: Update.

2018-02-27  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.c (version_string): Rename.
	(module_state::write_context): Write compiler version.

2018-02-16  Nathan Sidwell  <nathan@acm.org>

	Use TREE_VISITED
	gcc/cp/
	* module.c (trees_out::fixed_refs): New.
	(trees_out::{begin,end}): New.
	(module_state::init): Use TREE_VISITED.
	(trees_out::{maybe_insert,tree_node}): Likewise.

	gcc/cp/
	* module.c: More commenting.
	(trees_{in,out}::define_class): Don't do AsBase here.
	(trees_in::finish_type, trees_out::tree_node}: Do it here.
	(get_module_owner): Cleanup.

2018-02-15  Nathan Sidwell  <nathan@acm.org>

	Module ownership on containers
	gcc/cp/
	* cp-tree.h (decl_set_module, module_context): Delete.
	(get_module_owner, set_module_owner)
	(set_implicit_module_owner): Declare.
	* decl.c (grokfndecl, grokvardecl, grokdeclarator): Call
	set_module_owner.
	* error.c (dump_module_suffix): Use get_module_owner.
	* mangle.c (maybe_write_module): Likewise.
	* method.c (implicitly_declare_fn): Use set_implicit_module_owner.
	* module.c (module_context, decl_set_module): Delete.
	(trees_in::define_function): Adjust.
	(trees_{in,out}::lang_decl_bools): Set module_owner.
	(trees_{in,out}::tree_node_raw): Adjust.
	(trees_out::tree_node): Adjust.
	(get_module_owner, set_module_owner)
	(set_implicit_module_owner): Define.
	* name-lookup.c (do_pushtag): Use set_module_owner.
	* pt.c (lookup_template_class_1, instanitate_decl): Use
	set_implicit_module_owner.

	gcc/cp/
	* module.c (trees_out::tree_node): Reorder.

	gcc/cp/
	* module.c: Commenting and a few cleanups.

	gcc/cp/
	* module.c (elf): Make more constants private.
	(elf_in::find): Swap args, default to PROGBITS.
	(elf_out::add): Replace type and flags with string_p arg.
	(bytes_in::begin, bytes_out::end): Adjust.
	(data::set_crc): Store zero for no-crc.

	Module map files have more syntax
	gcc/cp/
	* cxx-module-wrapper.sh: Accept src filename, don't search
	MODULE_PATH.
	* module.c (module_state::srcname): New.
	(module_state::print_map): New.
	(make_module_name): Rename to ...
	(make_module_filename): ... here.  Don't assume trailing NUL.
	(find_module_file): Pass srcname.
	(parse_module_mapping): New.
	(add_module_mapping): Call it.  Detect too-deeply nested.
	gcc/c-family/
	* c.opt (fmodule-map-dump): New.
	gcc/
	doc/invoke.texi: Document new module-map file syntax
	gcc/testsuite/
	* g++.dg/modules/hello.c: Adjust.
	* g++.dg/modules/main_a.c: Adjust.
	* g++.dg/modules/main-map: New.
	* g++.dg/modules/modules.exp: Set CXX_MODULE_PATH.

2018-02-13  Nathan Sidwell  <nathan@acm.org>

	Module path is for mapping files. Replace -fmodule-root with
	-fmodule-prefix.
	gcc/cp/
	* cxx-module-wrapper.sh: Adjust.
	* module.c (module_state::lazy_{init,fini}): Drop the lazy.
	(module_state::maybe_early_init): Move into init.
	(module_prefix, module_file_args, module_wrapper): New.
	(make_module_name): New.
	(module_state::occupy): Call it.
	(module_to_filename): Delete.
	(search_module_path): Adjust for finding module-maps.
	(find_module_file): New.
	(add_module_mapping): Reimplement.
	(init_module_processing): Process module_file_args array.
	(module_state::do_import, finish_module): Adjust.
	(maybe_prepend_dir): Delete.
	(handle_module_option): Adjust.
	gcc/c-family/
	* c-opts.c (c_common_post_options): Adjust clean_cxx_module_path
	call.
	* c.opt (fmodule-root=): Delete.
	(fmodule-prefix=): New.
	gcc/
	* doc/invoke.texi (fmodule-root): Replace with ...
	(fmodule-prefix): ... this.
	* incpath.c (clean_cxx_module_path): Drop root appending. Drop
	multilib handling.
	* incpath.h (clean_cxx_module_path): Adjust.
	gcc/testsuite/
	* g++.dg/modules/fmod-file-1_b.C: Adjust.
	* g++.dg/modules/main_a.C: Adjust.
	* g++.dg/modules/modules.exp: Adjust.

2018-02-12  Nathan Sidwell  <nathan@acm.org>

	AS_BASE is by reference.
	gcc/cp/
	* module.c (trees_out::define_class): Break AS_BASE loop during
	streaming.
	(trees_{in,out}::tree_node): Use tt_as_base.

	Mapping files are recursive.
	gcc/cp/
	* module.c (maybe_prepend_dir): New.
	(add_module_mapping): Recurse.  Deal with relative paths.
	(handle_module_option): Move file reading into add_module_mapping.
	gcc/
	* doc/invoke.texi (fmodule-file): Document.

	BINFOs imported by reference.
	gcc/cp/
	* module.c (trees_{in_out}::tree_binfo): New.
	(trees_out::maybe_insert): New.
	(trees_out::insert): Use it.
	(trees_{in,out}::define_class): Stream remaining binfo contents.
	(trees_{in,out}::start): Don't expect BINFOs.
	(trees_{in,out}::core_vals): Likewise.
	(trees_{in,out}::tree_node): Use tt_binfo.
	(trees_out::tree_node): Stream a class's child binfos.
	(trees_in::finish_type): Likewise.

2018-02-11  Nathan Sidwell  <nathan@acm.org>

	Add module map file reading.
	gcc/cp/
	* module.c (add_module_mapping): New, swallow ...
	(add_module_file): ... insertion bits.  Move other bits to ...
	(handle_module_option): ... here.  Read module map file.
	gcc/c-family/
	* c.opt (fmodule-file): Document new semantics.
	gcc/
	* doc/invoke.texi (fmodule-file): Document new semantics.
	gcc/testsuite/
	* g++.dg/modules/fmod-file-1_[ab].C: New.
	* g++.dg/modules/fmod-out-1_[ab].C: New.
	* g++.dg/modules/modules.exp (decode_mod_spec): Augment.

	Keep module-file map in module hash.
	gcc/cp/
	* module.c (module_state): Add empty_p, get_module members.
	Rename set_name, delete set_location.
	(module_file_map, module_file): Delete.
	(module_state::do_import): Use get_module, set filename here.
	(declare_module): No need to set filename here.
	(add_module_file): Use module_state::get_module.

	Move module option processing into module.c.
	gcc/cp/
	* cp-objcp-common.c (add_module_file): Move to module.c
	(cp_handle_option): Call handle_module_option.
	* cp-tree.h (module_output, module_files_map, module_files): Move
	to module.c
	* module.c (module_state::maybe_early_init): New.
	(module_output, module_files): Make static.
	(module_files_map): From cp-tree.h.
	(init_module_processing): Call maybe_early_init.
	(add_module): Moved from cp-objcp-common.c.
	(handle_module_option): New.

	Move module option processing out of c-common.c.
	gcc/c-family/
	* c-common.h (module_output, module_files_map, module_files): Move
	to cp-tree.h.
	* c-common.c (module_output, module_files): Move to module.c
	* c-opts.c (add_module_file): Move to cp-objcp-common.c.
	(c_common_handle_option): Move modules options to
	cp-objcp-common.c.
	gcc/cp/
	* cp-objcp-common.c (add_module_file): Moved from c-opts.c.
	(cp_handle_option): New, from c_common_handle_option.
	* cp-objcp-common.h (LANG_HOOKS_HANDLE_OPTION): Point at
	cp_handle_option.
	* cp-tree.h (module_output, module_files_map, module_files): Moved
	from c-common.h.
	* cp-module.c (module_output, module_files): Moved from c-common.c.

2018-02-09  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.c: Update more comments.

	gcc/cp/
	* module.c: Update a lot of comments.

2018-02-07  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.c (trees_in::tree_node): Absorb ...
	(trees_in::tree_node_special): ... this.

	gcc/cp/
	* module.c (trees_in::tree_node_special): Deserialize tt_node here ...
	(trees_in::tree_node): ... not here.

2018-02-06  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.c (trees_out::tree_node_special): Move into tree_node.

	gcc/cp/
	* module.c (trees_{in,out}::core_vals): Serialize decl name &
	context here.
	(trees_in::tree_node_raw): Don't set name & context here.
	(trees_{in,out}::tree_node): Don't serialize decl name and context
	here.

	Remove old import machinery.
	gcc/cp/
	* module.c (trees_in::tree_node_raw): Set module owner.
	(trees_{in,out}::tree_node): Remove importing here.

	Imports use special tags
	gcc/cp/
	* module.c (module_context): Cope with C++ anon types.
	(trees_{in,out}::tree_node_special): Deal with imports here ...
	(trees_{in,out}::tree_node): ... not here.
	gcc/testsuite/
	* g++.dg/modules/class-3_[bd].C: Adjust.

	Kill namespace module slot hackery
	gcc/cp/
	* name-lookup.c (module_binding_slot): Make CREATE a bool.  Remove
	namespace hackery.
	(find_namespace_partition): Delete.
	(merge_global_decl): Do not expect a namespace.  Remove such
	handling.
	(push_module_binding): Likewise.

	Namespaces use special tags
	gcc/cp/
	* module.c (trees_{in,out}::tree_node_special): Deal with
	namespaces.
	* name-lookup.h (find_imported_namespace): Declare.
	* name-lookup.c (find_imported_namespace): New.

	Less implicit tree numbering, negative indices for back refs
	gcc/cp/
	* module.c (ptr_uint_traits, ptr_uint_hash_map): Rename ...
	(ptr_int_traits, ptr_int_hash_map): ... here.  Map to ints.
	(uint_ptr_traits, uint_ptr_hash_map): Delete.
	(enum record_tag): Delete.
	(enum tree_tag): New.
	(trees_{in,out}::insert): Return int.
	(trees_{in,out}::tree_node_special): Adjust.
	(trees_{in,out}::tree_node): Adjust.
	(trees_out::write, trees_in::read): Adjust.
	gcc/testsuite/
	* g++.dg/modules/class-3_[bd].C: Adjust.

2018-02-05  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* decl2 (c_parse_final_cleanups): Only finish_module if we started
	it.
	* module.c (module_hash_state): Move earlier.
	(module_state): Add hash and modules static members.
	(module_state::set_import): Replace do_import.
	(module_state::lazy_init): Create the hash table and default
	module.
	(trees_in::tree_node_raw): Don't remap a public namespace.
	(module_purview_p, module_interface_p): Adjust.
	(module_state::do_import): Move more stuff to lazy_init.
	(import_module): Deal with setting current module flags.
	(finish_module): Adjust.

	Fix bootstrap
	gcc/cp/
	* module.c (elf): Clean up consts.
	(module_state::record_namespace): Comment args.
	(module_state::read_namespace): Comment unused vars.
	(trees_in::finish_tree): Fix logic error.
	(trees_in::tree_node_special): Fix undefined var.

2018-02-04  Nathan Sidwell  <nathan@acm.org>

	Module purview is implicit.
	gcc/cp/
	* cp-tree.h (lang_decl): Remove module_purview_p field.
	* mangle.c (maybe_write_module): Fix signed/unsigned mismatch.
	* module.c (trees_in::finish): Adjust.
	(trees{in,out}::lang_decl_bools): Drom module_purview_p field.
	(decl_set_module): Done set DECL_MODULE_PURVIEW_P.
	* name-lookup.c (extract_module_decls): check MODULE_PURVIEW_P.
	(make_namespace_finish): Remove inline_p arg.  Adjust callers.
	* pt.c (build_template_decl): Don't copy MODULE_PURVIEW_P.
	* rtti.c (tinfo_base_init): Don't clear MODULE_PURVIEW_P.

	gcc/cp/
	* name-lookup.c (make_namespace_finish): Always create the scope.
	(add_imported_namespace): Check namespace inlineness here.

	gcc/cp/
	* module.c (decl_set_module): Set DECL_MODULE_OWNER.
	* rtti.c (tinfo_base_init): Clear DECL_MODULE_OWNER.

	gcc/cp/
	* decl.c (grokfndecl): Protect decl_set_module call.
	* name-lookup,c (do_pushtag): Likewise.
	* module.c (decl_set_module): Assert namespace context.

2018-02-03  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* cp-tree.h: Adjust comments.
	* module.c (module_purview_p, module_interface_p): Adjust.

	Deserializing uses an array (Nathan is a dumbass)
	gcc/cp/
	* module.c (trees_in): Delete count and tree_map. Add back_refs.
	(trees_in::next): Delete.
	(trees_in::insert): Append to array.
	(trees_in::tree_node_special): Adjust.
	(trees_in::tree_node): Likewise.

2018-02-02  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.c (nodel_ptr_hash): New.
	(non_null_hash): Delete.
	(ptr_uint_traits, uint_ptr_traits): Adjust.
	(module_state_hash): Use nodel_ptr_hash.
	(module_hash): Do not GTY.
	(module_state::do_import, finish_module): Adjust.

	Use TREE_VEC for structured module names.
	gcc/cp/
	* cp-tree.h (module_name_parts): Replace with ...
	(module_vec_name): ... this.
	* mangle.c (maybe_write_modules): Adjust.
	* module.c (module_state): Replace name_parts with vec_name.
	(module_state::set_name): Add maybe_vec parm, construct TREE_VEC.
	(module_vec_name): Replace ...
	(module_name_parts): ... this.
	(module_state::do_import): Construct flat name.
	* parser.c (cp_parser_module_name): Construct TREE_VEC.
	gcc/testsuite/
	* g++.dg/modules/mod-decl-1.C: Add error.

	MODULE_PURVIEW bug fixing.
	gcc/cp/
	* decl2.c (c_parse_final_cleanups): Reset current_module.
	* module.c (module_state::do_import): New, swallow ...
	(do_module_import): ... this.  Update callers.
	* name-lookup.c (name_lookup::search_namespace_only): Fix search
	of SLOT_CURRENT.
	(do_pushdecl): Fix assert.
	(merge_global_decl, push_module_binding, lookup_by_ident): Fix
	module remap thinko.

	Module purview has MODULE_PURVIEW number.
	gcc/cp/
	* module.c (module_state::read): Use MODULE_PURVIEW.
	(trees_{in,out}::tree_node): Adjust.
	(do_module_import, import_module): Likewise.
	* name-lookup.c (module_binding_slot): Adjust.
	(do_pushdecl): Always push to MODULE_SLOT_CURRENT.
	(merge_global_decl): Remap MODULE_PURVIEW.
	(lookup_by_ident, add_imported_namespace): Likewise.

	Rename MODULE_INDEX->MODULE_OWNER
	gcc/cp/
	* cp-tree.h (MODULE_NONE, MODULE_PURVIEW, MODULE_IMPORT_BASE)
	(MODULE_LIMIT): New, renamed from MODULE_INDEX_$FOO.
	(DECL_MODULE_OWNER): New, renamed from DECL_MODULE_INDEX.
	(MAYBE_DECL_MODULE_OWNER): Likewise.
	(struct lang_decl_base): Rename module_index to module_owner.
	* error.c, mangle.c, module.c, name-lookup.c, pt.c: Adjust.

	Keep namespaces on global slot.
	gcc/cp/
	* cp-tree.h (MODULE_SLOT_CURRENT, MODULE_SLOT_GLOBAL): Renamed
	from MODULE_SLOT_TU, MODULE_SLOT_GLOBALS.
	* name-lookup.h (set_module_namespace): Undeclare.
	(add_imported_namespace): Declare.
	* name-lookup.c (module_binding_slot): Remove assert, propagate
	external namespace to GLOBAL slot on creation.
	(update_binding): Don't add namespaces to level.
	(reuse_namespace): New.
	(make_namespace): New, absorb ...
	(create_namespace): ... this. Delete.
	(make_namespace_finish): New.
	(push_namespace): Adjust.
	(add_imported_namespace): New.  Absorb ...
	(set_module_namespace): ... this. Delete.
	* module.c (module_state::read_namespace): Adjust.
	gcc/testsuite/
	* g++.dg/modules/namespace-1_[abc].C: New.

	Fix circularity detection, and other errors
	gcc/cp/
	* module.c (elf::E_BAD_DATA, elf::E_BAD_IMPORT): New.
	(elf::set_error): Default to E_BAD_DATA.
	(elf::end, elf_out::end): Return error string.
	(module_state::set_location): New.
	(module_state::{push,pop}_location): Adjust.
	(do_module_import): Fixup circularity and other errors.
	(declare_module, finish_module): Adjust.
	gcc/testsuite/
	* g++.dg/modules/circ-1_[abcd].C: New.
	* g++.dg/modules/mod-decl-1.C: Adjust errors.
	* g++.dg/modules/mod-decl-2_b.C: Adjust errors.
	* g++.dg/modules/mod-decl-5_b.C: Adjust errors.
	* g++.dg/modules/mod-stamp-1-d.C: Adjust errors.

2018-02-01  Nathan Sidwell  <nathan@acm.org>

	Alloc a slot for global module
	gcc/cp/
	* cp-tree.h (MODULE_INDEX_NONE, MODULE_INDEX_PURVIEW): New.
	(MODULE_SLOT_TU, MODULE_SLOT_GLOBALS): New.
	(MODULE_INDEX_IMPORT_BASE): Increment.
	* module.c (do_module_import): Push reserved slot.
	* name-lookup.c (module_binding_slot): Reserve slots below
	MODULE_INDEX_IMPORT_BASE.

	Bindings point to decls
	gcc/cp/
	* module.c (data::check_crc): Only check.
	(data::get_crc): New.
	(elf_in::find): Return section index.
	(bytes_in::begin): Add by-section-number variant.
	(module_state): Add lazy counter (unused).
	(module_state::write_bindings): Emit decl section number.
	(module_state::read_bindings): Adjust, swallow ...
	(module_state::read_decls): ... this.  Delete.

	Read and parse the binding section in module_state.
	gcc/cp/
	* module.c (modules_state::record_namespace): New.
	(module_state::write_namespace): Adjust, renamed from ...
	(module_state::walk_namespace): ... here.
	(module_state::read_namespace): New.
	(module_state::{read,write}_bindings): Adjust.
	(module_state::finish_module): Adjust.
	* name-lookup.h (set_module_namespace): Declare.
	* name-lookup.c (merge_global_decl): Adjust.
	(create_namespace): New.
	(set_module_namespace): New, use it.
	(push_namespace): Use create_namespace.

	Write binding section in module_state.
	gcc/cp/
	* name-lookup.h (extract_module_decls): Renamed from
	extract_module_bindings.  Adjust signature.
	* name-lookup.c (extract_module_decls): Likewise.
	* module.c (module_state::walk_namespace): New, absorb ...
	(trees_out::walk_namespace): ... this.  Delete.
	(trees_out::write): Reimplement, absorb ...
	(trees_out::{tag_binding,bindings}): ... these.  Delete.
	(module_state::write_bindings): Adjust.

	Merge trunk r257292.

2018-01-31  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.c (cpms_{in,out}): Rename to ...
	(trees_in, trees_out): ... here.

	gcc/cp/
	* module.c (module_state::global_{trees,vec,crc}): New, moved from ...
	(globals{,_arys,_crc}): ... these globale scope vars.
	(cpms_in): Add global_vec member.

	Derive cpm_{in,out} from bytes_{in,out}
	gcc/cp/
	* module.c (cpms_{in,out}): Derive from bytes_{in,out}.  Adjust
	all uses of r & w.

	Kill cpm_stream.
	gcc/cp/
	* module.c (class cpm_stream): Delete.
	(class cpms_{in,out}): Adjust.

	Move elf out of cpms_in, cpms_out.
	gcc/cp/
	* module.c (module_state::{read,write}_bindings): New.
	(module_stste::read_decls): New.
	(cpms_{in,out}::get_elf): Delete.
	(cpms_out::{write,bindings}): Adjust.
	(cpms_in::read): Adjust.

	Add module_stat read & write
	gcc/cp/
	* module.c (module_state::{read,write}): New.
	(cpms_in::read): Adjust.
	(do_import_module, finish_module): Adjust.

	gcc/cp/
	* module.c: Move cpm_stream, cpms_in, cpms_out earlier.

	Move some reading to module_state.
	gcc/cp/
	* module.c (module_state::read_{context,config}): New, swallow ...
	(cpms_in::imports,header): ... these.  Delete.
	(cpms_in::read): Adjust.
	(do_import_module): Adjust.

	Move some writing to module_state.
	gcc/cp/
	* module.c (module_state::write_{context,config}): New, swallow ...
	(cpms_out::imports,header): ... these.  Delete.
	(cpms_out::write): Adjust.
	(finish_module): Adjust.

	Move global tree init.
	gcc/cp/
	* module.c (module_state::lazy_init): New, swallow ...
	(cpm_serial::lazy_globals): ... this.   Adjust callers.

	Reorder class declarations
	gcc/cp/
	* module.c (bytes, bytes_in, bytes_out): Move before module_state.

	Simplify import interface
	gcc/cp/
	* module.c (MODULE_INDEX_IMPORTING, MODULE_INDEX_ERROR): Delete.
	(MODULE_INDEX_UNKNOWN): New.
	(module_state): Initialize mod to MODULE_INDEX_UNKNOWN.
	(cpms_in::read): Return void.
	(do_module_import): Return pointer to module object.
	(cpms_in::imports): Adjust.
	(import_module, declare_module, finish_module): Adjust.

	Module_state owns elf and elf owns stream
	gcc/cp/
	* module.c (elf): Add begin, end members.
	(elf_in, elf_out): Adjust.
	(module_state::announce): New.
	(cpms_{in,out}::get_elf): Adjust.
	(cpms_{in,out}::{begin,end}): Delete.
	(do_module_import, finish_module): Adjust.

	Commonize module location
	gcc/cp/
	* module.c (module_state::{push,pop}_location): Set and restore
	input_location.
	(make_module_file): Lose module_root prepending.
	(do_module_import): Always set module location.
	(declare_module): Create location and filename.
	(finish_module): Adjust.

	Staticize instrumentation
	gcc/cp/
	* module.c (bytes_out): Staticize spans, lengths, is_set.
	(bytes_out::instrument): Make static.
	(cpms_out): Staticize unique, refs, nulls, records.
	(cpms_out::instrument): Make static.  Adjust.

	Separate dumper object
	gcc/cp/
	* cp-tree.h (dump, print_other_binding_stack): Undeclare.
	* name-lookup.c (print_other_binding_stack): Make static.
	* module.c (class dumper): New.
	(cpm_serial): Remove dumping machinery here.  Adjust all uses.
	gcc/testsuite/
	* g++.dg/modules/mod-imp-1_[abcd].C: Adjust dump scans.

	Start refactoring cpm_serial
	gcc/cp/
	* module.c (cpms_{in,out}::elf): Pointer to elf object,
	(cpms_{in,out}::get_elf): New.  Use it.
	(do_module_import, finish_module): Adjust.

2018-01-30  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.c (data::release): Return NULL, update users.
	(cpms_in::{mod_ix,crc}): Delete, adjust users.

	Reorder source
	gcc/cp/
	* module.c (struct data): First.
	(class elf, elf_in & elf_out): Next.

	gcc/cp/
	* module.c (module_state): Remove name_hash, crc_known, set_crc,
	set_location.
	(cpms_in::{read,header}): Add crc_ptr arg.
	(do_module_import): Expected CRC is a pointer.
	(cpms_in::imports): Adjust.

	Push remaps as they happen.
	gcc/cp/
	* module.c (cpms_{in,out}::imports): Write in ascending order.

	Move remap vector into module state.
	gcc/cp/
	* module.c (module_state): Add remap;
	(cpms_in): Remove remap_num, remap_vec.
	(module_state::release): New.
	(cpms_in::{imports,tree_node,read}): Adjust.
	(finish_module): Release module state.

	gcc/cp/
	* module.c (bytes_out::end): Create PROGBITS or STRTAB.
	(cpms_out::write): README is a STRTAB.

	Remove SYMTAB knowledge, the README is better.
	gcc/cp/
	* module.c (elf_out::symtab): Delete.
	(elf_out::end): Adjust.
	(cpms_out::imports): Don't create symtab.

	Section structure completish.
	gcc/cp/
	* module.c (elf::isection): Add flags.
	(elf_out::add): Add section flags.
	(bytes_out::end): Likewise,
	(elf_out::end): Adjust.
	(cpms_out::bindings): Generate bindings section too.
	(cpms_out::write): Add imports to README.  Make string section.
	(cpms_in::read): Adjust.

	Config in header
	gcc/cp/
	* module.c (cpms_{in,out}::tag_conf): Delete.
	(cpms_{in,out}::header): Serialize host & target conf.
	(cpms_in::read, cpms_out::write): Adjust.

	Globals in header
	gcc/cp/
	* module.c (module_state::set_name): Kill string names.
	(cpms_{in,out}::tag_globals): Delete.
	(cpms_{in,out}::header): Do globals.  Add outer crc.
	(cpms_in::read): Absorb cpms_in::read_item.
	(search_module_path, do_module_import): Kill string names.

2018-01-29  Nathan Sidwell  <nathan@acm.org>

	Import table is separate section
	gcc/cp/
	* module.c (bytes): Reorganize CRC calcs.
	(struct elf::symbol): New.
	(struct elf_out::symtab): New.
	(elf_out::end): Deal with symbol table.
	(bytes_{in,out}::{begin,end}): Adjust crc calcs.
	(cpms_{in,out}::imports): New.
	(cpms_{in,out}::tag_import): Delete.
	(cpms_in::read, cpms_out::write): Adjust.

	Header is separate section
	gcc/cp/
	* module.c (module_state_hash::equal): Remove string names.
	(elf_in::find): Find by name.
	(elf_in::name): New.
	(class elf_out::strtab): Rename type.
	(elf_out::strings): New member.
	(elf_in::begin): Veriy string table.  Create default.
	(elf_out::end): Write string table here.
	(bytes_in::begin, bytes_out::end): Always PROGBITS.
	(cpm_stream::rt_eof): Delete.
	(cpms_{in,out}::header): Reimplement.
	(cpms_in::read, cpms_out::write): Adjust.

	Remove string-literal module names :(
	gcc/cp/
	* cp-tree.h (validate_module_name): Remove.
	* module.c (validate_module_name): Delete.
	(bytes_{in,out}::module_name): Delete, adjust callers.
	* parser.c (cp_parser_module_name): Adjust.
	(cp_parser_module_declaration, cp_parser_import_declaration)
	(cp_parser_module_proclamation): Adjust.
	gcc/testsuite/
	* g++.dg/modules/mod++-decl-3_[ab].C: Delete.

	{read,write}_module become member fns
	gcc/cp/
	* module.c (cpms_{in,out}::elf}: Direct member. Adjust ctors.
	(cpms_{in,out}::{begin,end}): New.
	(cpms_in::read, cpms_out::write): New.
	(read_module, write_module): Delete.
	(do_module_import, finish_module): Adjust.

	README section
	gcc/cp/
	* module.c (version2date, version2time, version2string): Moved
	from cpm_serial.
	(struct_data): Broken out of elf.
	(struct elf::isection): Remove link field.  Adjust all uses.
	(class elf_out::strings): New.
	(elf_out::add): New.
	(bytes_out::printf): New.
	(cpm_stream::dump, cpms_in::header): Adjust version handling.
	(write_module): Write README section.

	Fix layering violation
	gcc/cp/
	* module.c (elf): Rename bad -> set_error.
	(elf_out, elf_in): Update.
	(cpm_serial, cpm_writer, cpm_reader): Rename to ...
	(bytes, bytes_out, bytes_in): ... here.
	(bytes_{in,out}): Remove source, sink members.
	(bytes_in): Rename overran -> get_overrun.  Add end, set_overrun.
	Delete bad, get_error.  Adjust users.
	(cpms_in, cpms_out): Add elf field.  Adjust.

2018-01-26  Nathan Sidwell  <nathan@acm.org>

	Simplify buffer filling & drainging
	gcc/cp/
	* module.c (cpm_serial): Add begin, end, use, unuse.
	(cpm_writer): Add use, unuse, begin, end.  Delete reserve, flush,
	seek, tell, checkpoint.
	(cpm_reader): Add overrun, use, begin, overran.  Delete fill,
	checkpoint.
	(cpm_{reader,writer}): Update all seralizers.
	(cpms_{in,out}): Remove checkpointing.

	CRC at section level
	gcc/cp/
	* module.c (elf::data): Add crc routines.
	(cpm_serial): Remove crc routines.
	(cpm_in, cpm_out): Don't calculate crcs.
	(read_module, write_module): Adjust (incomplete).

	BMI is ELF
	gcc/cp/
	* module.c (get_version): Moved from cpm_stream::version.
	(struct non_null_hash, ptr_uint_traits, ptr_uint_hash_map)
	uint_ptr_traits, uint_ptr_hash_map): New.
	(elf, elf_in, elf_out): New classes.
	(cpm_serial, cpm_in, cpm_out): Modify (incomplete).
	(cpms_in, cpms_out): Adjust.
	(read_module, write_module, finish_module): Adjust.

2018-01-24  Nathan Sidwell  <nathan@acm.org>

	Global tree via crc
	gcc/cp/
	* module.c (cpm_stream): Add globals & globals_crc.
	(cpm_stream::next): Add default arg.
	(cpm_stream::cpm_stream): Lazily init globals vector.
	(cpms_{in,out}::mark_present, globals): Delete.
	(cpms_{in,out}::tag_globals): Reimplement.
	(cpms_in::tree_node_special): Read global tree directly.
	* name-lookup.c (extract_module_bindings): Skip RTTI types.

	gcc/cp/
	* module.c (module_state): Replace direct_import with imported &
	exported flags.
	(module_state::do_import): Adjust.
	(enum import_kind): Delete.
	(do_module_import): Adjust.
	(cpms_{in.out}::tag_import): Adjust.
	(module_interface_p, import_module, declare_module)
	(finish_module): Adjust.

2018-01-23  Nathan Sidwell  <nathan@acm.org>

	Static bindings not visible in imports
	gcc/cp/
	* name-lookup.h (decapsulate_binding): Delete.
	(module_binding_vec, extract_module_bindings): Declare.
	* module.c (cpms_{in,out}::tag_binding): Reimplement.
	(cpms_out::bindings): Likewise.
	* name-lookup.c (decapsulate_binding): Delete.
	(extract_module_bindings): New.
	gcc/testsuite/
	* g++.dg/modules/mod++-decl-0_c.C: Remove XFAIL.
	* g++.dg/modules/static-1_[abc].C: New.

2018-01-22  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* tree.c (ovl_insert): No need to sort by USING_P.
	(ovl_iterator::reveal_node): Likewise.

	Update bug reporting instructions
	gcc/
	* configure.ac (ACX_BUGURL): Set new url
	* diagnostic.c (diagnostic_action_after_output): Special ICE
	instructions.
	* configure: Rebuilt.

2018-01-19  Nathan Sidwell  <nathan@acm.org>

	Kill mangle_namespace.
	gcc/cp/
	* cp-tree.h (CPTI_MANGLE, mangle_namespace): Delete.
	* decl.c (cxx_init_decl_processing): Don't create it.
	* module.c (cpms_out::bindings): Don't skip it.
	* name-lookup.c (suggest_alternatives_for): Likewise.

	Import ident by type not index.
	gcc/cp/
	* name-lookup.h (get_ident_in_namespace, get_ident_in_class,
	find_by_ident_in_namespace, find_by_ident_in_class): Delete.
	(lookup_by_ident): Declare.
	* name-lookup.c (get_ident_in_namespace, get_ident_in_class): Delete.
	(find_by_ident_in_namespace, find_by_ident_in_class): Replace with ...
	(lookup_by_ident): ... this.
	* module.c (cpms_{in,out}::ident_imported_decl): Delete.
	(cpms_out::tree_node): Write imported decl info directly.
	(cpms_in::tree_node): Use lookup_by_ident.

	gcc/cp/
	* module.c (cpms_{in.out}::tree_node_special): New, broken out of ...
	(cpms_{in,out}::tree_node): ... here.  Call them.

	Merge trunk r256894.

	gcc/cp/
	* Make-lang.in: Set MODULE_STAMP if non-branch experimental.

	Beginnings of global module correctness
	gcc/cp/
	* cp-tree.h (struct mc_index): New.
	(module_cluster): Use it.
	(MODULE_VECTOR_SLOTS_PER_CLUSTER): New.
	(GLOBAL_MODULE_INDEX, THIS_MODULE_INDEX, IMPORTED_MODULE_BASE): Delete.
	(MODULE_INDEX_IMPORT_BASE): New.
	(DECL_MODULE_PURVIEW_P, MAYBE_DECL_MODULE_PURVIEW_P): New.
	(MAYBE_DECL_MODULE_INDEX): Adjust.
	(MODULE_INDEX_BITS): New.
	(struct lang_decl_base): Add module_purview_p field.
	* decl2.c (c_parse_final_cleanups): Adjust.
	* error.c (dump_module_suffix): Adjust.
	* mangle.c (maybe_write_module): Adjust.
	* module.c (MODULE_INDEX_IMPORTING, MODULE_INDEX_ERROR): New.
	(module_state::freeze): Delete.
	(this_module): Delete.  Replace with (*modules)[0].
	(cpms_in::alloc_remap_vec): Adjust.
	(cpms_in::tag_import): Use MODULE_INDEX_ERROR.
	(cpms_{in,out}::tag_binding): Lose MAIN_P parm.  Adjust.
	(cpms_in::define_function): Remove GLOBAL_MODULE_INDEX handling.
	(cpms_in::read_item): Use MODULE_INDEX_IMPORTING.
	(cpms_in::finish): Remove NODE_MODULE parm.  use
	MAYBE_DECL_MODULE_PURVIEW_P.
	(cpms_{in,out}::lang_decl_bools): Read & write module_purview_p.
	(cpms_in::tree_node_raw): Lose NODE_MODULE parm.  Set module
	directly.
	(cpms_{in,out}::tree_node): Adjust module identification.
	(cpms_out::bindings): Bindings are on a single slot.
	(module_loc): Delete.
	(decl_set_module): Set purview as needed.
	(module_purview_p, module_interface_p): Adjust.
	(read_module): Simplify.
	(do_module_import): Adjust for lack of global module slot.  Use
	MODULE_INDEX_ERROR, MODULE_INDEX_IMPORTING.  Detect already
	declared module here.
	(import_module): Adjust.
	(declare_module): Don't detect already declared here.
	(write_module): Adjust.
	(finish_module): Adjust.
	* name-lookup.c (module_binding_slot): Reimplement.
	(name_lookup::process_module_binding)
	(name_lookup::search_namespace_only, name_lookup::add_module_fns)
	(name_lookup::adl_namespace_only, do_pushdecl): Adjust.
	(merge_global_decl): Kludge into reworking.
	(push_module_binding): Likewise.
	* name-lookup.h (merge_global_decl): Add module parm.
	* pt.c (build_template_decl): Propagate purview.
	* ptree.c (cxx_print_xnode): Adjust.
	* rtti.c (tinfo_base_init): Kludge into working.
	(get_tinfo_desc): Drop unnecessary push/pop abi namespace.
	(emit_tinfo_decl): Simplify.
	gcc/testsuite/
	* g++.dg/modules/global-1_[ab].C: New
	* g++.dg/modules/mod++-decl-0_b.C: Remove xfail.

2018-01-18  Nathan Sidwell  <nathan@acm.org>

	Merge access & discriminator.
	gcc/cp/
	* cp-tree.h (struct lang_decl_base): Rename u2sel to spare.
	(struct lang_decl_min): Replace lang_decl_u2 union with plain
	tree.
	(LANG_DECL_U2_CHECK): Delete.
	(DECL_DISCRIMINATOR_SET_P, DECL_DISCRIMINATOR): Adjust.
	(DECL_CAPTURED_VARIABLE, DECL_ACCESS, THUNK_VIRTUAL_OFFSET): Adjust.
	* decl.c (push_local_name): Represent discriminator as INTEGER_CST.
	(duplicate_decls): Copy DECL_ACCESS. fix formatting.
	* mangle.c (discriminator_for_local_entity): Extract integer value.
	* module.c (cpms_{in,out},lang_decl_bools): Drop u.base.u2sel.
	(cpms_{in,out}::lang_decl_vals): Drop u.min.u2 handling.
	* semantics.c (finish_omp_threadprivate): Drop u.base.u2sel copying.

2018-01-02  Nathan Sidwell  <nathan@acm.org>

	Merge trunk r256078.

	Typedefs!
	gcc/cp/
	* decl.c (grokdeclarator): Set typedef's module/export.
	gcc/testsuite/
	* g++.dg/modules/tdef-2_[abc].C: New.

	gcc/testsuite/
	* g++.dg/modules/tdef-1_[ab].C: New.

2017-12-20  Nathan Sidwell  <nathan@acm.org>

	Variables!
	gcc/cp/
	* decl.c (grokvardecl): Set exporting.
	* module.c (dump_nested_name): Dump integer values.
	(cpms_{in,out}::define_var): New.
	(cpms_{in,out}::tag_definition): Deal with vars.
	(cpms_out::maybe_tag_definition): Likewise.
	(cpms_out::core_bools): Externalize static vars.
	(cpms_out::lang_decl_bools): Likewise for not-really-extern.
	gcc/testsuite/
	* g++.dg/modules/var-1_[ab].C: New.

	Enumerations!
	gcc/cp/
	* module.c (module_state::set_name): Don't deal with crc.
	(module_state::set_crc): New.
	(cpm_serial::get_crc): Don't obscure zero.
	(cpm_writer::tell): New.
	(cpms_out::crc_tell): New.
	(cpms_{in,out}::define_enum): New.
	(cpms_out::header): Save crc location.
	(cpms_in::header): Use set_crc.
	(cpms_out::tag_eof): Adjust.
	(cpms_out::maybe_tag_definition): Deal with enums.
	(cpms_{in,out}::tag_definition): Deal with enums.
	(cpms_{in,out}::core_vals): Do not write enum bits.
	(do_module_import): Use set_crc.
	* name-lookup.c (push_module_binding): Fix assert.
	gcc/testsuite/
	* g++.dg/modules/enum-1_[ab].C: New.

2017-12-19  Nathan Sidwell  <nathan@acm.org>

	Merge trunk r255836.

2017-11-27  Nathan Sidwell  <nathan@acm.org>

	Merge trunk r255166.

2017-11-22  Nathan Sidwell  <nathan@acm.org>

	Non-type template parms, & nested template classes.
	gcc/cp/
	* module.c (cpms_{in,out}::core_vals): Deal with CONST_DECLs.
	gcc/testsuite/
	* g++.dg/modules/tplmem-3_[ab].C: New.

2017-11-21  Nathan Sidwell  <nathan@acm.org>

	Member types
	gcc/testsuite/
	* g++.dg/modules/nested-2_[ab].C: New

	Nested classes.
	gcc/cp/
	* module.c (cpm_reader::wi): Promote before shifting.
	(cpms_out::define_class): Maybe define all members.
	(cpms_out::maybe_tag_definition): Only implicit typedefs are
	defined.
	(cpms_{in.out}::core_vals): Don't stream value cache.
	gcc/testsuite/
	* g++.dg/modules/nested-1_[abc].C: New

2017-11-20  Nathan Sidwell  <nathan@acm.org>

	Merge trunk r254959.

	Template member functions.
	gcc/cp/
	* cp-tree.h (TI_PENDING_TEMPLATE_FLAG): Add TI_CHECK.
	* module.c (cpms_out::maybe_tag_definition): Check DECL_INITIAL,
	write clones.
	(cpms_in::tag_definition): Don't zap clones.
	(cpms_in::finish): Clear TI_PENDING_TEMPLATE_FLAG.
	(cpms_{in,out}::core_vals): Check tcc_unary, tcc_binary.
	* optimize.c (maybe_clone_body): Don't alias when modules.
	gcc/testsuite/
	* g++.dg/modules/tplmem-1_[ab].C: New.

2017-11-17  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.c (cpms_out::tree_node): Fix conv-op identifiers.
	gcc/testsuite/
	* g++.dg/modules/convop-1_[ab].C: New.

2017-11-16  Nathan Sidwell  <nathan@acm.org>

	Constexprs!
	gcc/cp/
	* cp-tree.h (check_constexpr_fundef, find_constexpr_fundef): Declare.
	* constexpr.c (find_constexpr_fundef): New.
	(register_constexpr_fundef): Split checking off to ...
	(check_constexpr_fundef): ... here.  Call
	register_constexpr_fundef.
	* decl.c (): Adjust.
	* module.c (cpms_{in,out}::define_function): Serialize constexpr
	body.
	(cpms_{in,out}::core_vals): Serialize function-scope var initializers.
	gcc/testsuite/
	* g++.dg/modules/cexpr-[12]_[ab].C: New.

	Merge trunk r254823.

	Merge trunk r254819.

2017-11-03  Nathan Sidwell  <nathan@acm.org>

	Virtual bases!
	gcc/cp/
	* Make-lang.in: module.o depends on revision
	* class.c (layout_class_type): Unnamed types do not get base
	types.
	* cxx-module-wrapper.sh: Invoke make.  Strip bad args.
	* module.c (module_context): Allow NULL context.
	(cpms_{in,out}::define_class): Deal with classtype_as_base.
	(cpms_{in,out}::tag_definition): Allow raw class.
	(cpms_{in,out}:ident_imported_decl: Rework class scope.
	(cpms_out::tree_node): Deal with NULL module context.
	* name-lookup.c (maybe_lazily_declare): Break out of ...
	(get_class_binding): ... here.  Call it.
	(get_ident_in_class, find_by_ident_in_class): New.
	* name-lookup.h	(get_ident_in_class, find_by_ident_in_class): Declare.
	gcc/testsuite/
	* g++.dg/modules/class-7_[abc].C: New.
	* g++.dg/modules/main.cc: Move to ...
	* g++.dg/modules/main_a.C: ... here. Adjust.
	* g++.dg/modules/modules.exp: Remove main.cc exceptionalism.

2017-10-26  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.c (module_state): Add filename & loc.
	(module_state::{set,push,pop}_location): New.
	(cpm_stream): Add state member.  Adjust.
	(cpms_{in,out}): Adjust.
	(cpms_in::{header,tag_conf}): Adjust.
	(read_module, write_module): Lose fname arg.
	(search_moule_path): Don't prefix .
	(do_module_import, finish_module): Set location.
	gcc/
	* diagnostic.c (maybe_line_and_column): New.
	(diagnostic_get_location_text, diagnostic_report_current_module):
	Use it.
	gcc/testsuite/
	Markup no-column tests.

2017-10-24  Nathan Sidwell  <nathan@acm.org>

	gcc/cp
	* cxx-module-wrapper.sh: Cleanups.
	* module.c (cpm_stream::global_tree_arys): Add integer_types.
	(cpms_{in,out}::tree_node): Robustify.
	(read_module): Note end of importing.
	(search_module_path): Note if wrapper failed to install.
	* name-lookup.c (merge_global_decl): Zap anticipated decl here ...
	(push_module_binding): ... not here.
	gcc/
	* incpath.c (clean_cxx_module_path): Correct env var name.
	gcc/c-family/
	* c.opt (fmodules++): Add Driver.
	gcc/testsuite/
	* g++.dg/modules/{main.c,hello.cc}: New.
	* g++.dg/modules/modules.exp: Special case main.cc

2017-10-23  Nathan Sidwell  <nathan@acm.org>

	Wrapper program
	gcc/
	* doc/invoke.texi (fmodule-root, fmodule-path, fmodule-wrapper):
	Document.
	* gcc.c (driver::maybe_putenv_CXX_MODULE_WRAPPER): New.
	(driver::main): Call it.
	* gcc.h (driver::maybe_putenv_CXX_MODULE_WRAPPER): Declare.
	* incpath.h (clean_cxx_module_path): Add multilib parm.
	* incpath.c (add_path): Initialize length.
	(clean_cxx_module_path): Append multilib fragment.  Add '.'.
	gcc/c-family/
	* c-opts.c (c_common_post_options): Pass multilib suffx to
	clean_cxx_module_path.
	* c.opt (fmodules): Notify driver.
	(fmodule-hook): Rename to  ...
	(fmodule-wrapper): ... here.
	gcc/cp/
	* Make-lang.in (cxx-module-wrapper): New program.
	* cxx-module-wrapper.sh: New.
	* module.c: Include libiberty.h, tree-diagnostic.h.
	(read_module): Add announcement.
	(module_to_filename): Identifier mapping does not depend on
	module_path.
	(search_module_path): Shell out to wrapper function.
	(do_module_import): Adjust.
	(init_module_processing): Default flag_module_wrapper.
	gcc/testsuite/
	* g++.dg/modules/modules.exp: Adjust.

2017-10-20  Nathan Sidwell  <nathan@acm.org>

	Template class!
	gcc/cp/
	* decl.c (xref_tag_1): Don't decl_set_module here.
	* module.c (cpms_in::define_function): Check templatedness.
	(cpms_{in,out}::define_class): Add maybe_template arg. Add
	templatey bits.
	(cpms_out::maybe_tag_definition): Deal with template classes.
	{cpms_{in,out}::tag_definition): Add maybe_template arg, adjust.
	{cpms_{in,out}::core_vals): Write record template_info.
	* name-lookup.c (set_class_binding): Protect against empty
	member_vec.
	(do_pushtag): Call decl_set_module here.
	* pt.c (build_template_decl): Copy module bits here ...
	(push_template_decl_real): ... not here.
	gcc/testsuite/
	* g++.dg/modules/mod-tpl-2_[ab].C: New.

	Early CRC not time stamps.
	gcc/cp/
	* module.c (module_state::set_name): CRC too.
	(cpm_serial::get_crc): New.
	(cpm_writer::seek): New.
	(cpm_{reader,writer}::bytes4): Rename to ...
	(cpm_{reader,writer}::raw): ... this.  Adjust all users.
	(cpm_reader::get_crc): Delete.
	(module_state::stamp): Replace with ...
	(module_state::crc): ... this.
	(cpms_in::cpms_in): Drop stamp arg.
	(cpms_{in,out}::header): Deal with CRC not timestamp.
	(time2str, timestamp_mismatch): Delete.
	(cpms_{in,out}::tag_eof): Deal with crc.
	(cpms_{in,out}::tag_import): Drop timestamp.
	(read_module, do_module_import): Likewise. Use CRC.
	gcc/testsuite/
	* g++.dg/modules/mod-stamp-1_d.C: Adjust.

	Merge trunk r253954.

2017-10-13  Nathan Sidwell  <nathan@acm.org>

	Template function!
	gcc/
	* tree.h (MARK_TS_TYPE_NON_COMMON): New.
	gcc/cp/
	* cp-objcp-common.c (cp_common_init_ts): Fix
	TEMPLATE_TEMPLATE_PARM, TEMPLATE_TYPE_PARM,
	BOUND_TEMPLATE_TEMPLATE_PARM marking.
	* cp-tree.h (canonical_type_parameter): Declare.
	* module.c (cpms_{in,out}::define_function): Add maybe_template
	parm, adjust.
	(cpms_out::maybe_tag_definition): Allow function templates.
	(cpms_{in,out}:tag_definition): Allow templates.
	(cpms_{in,out}::core_vals): Stream more nodes.
	(cpms_{in,out}::lang_decl_vals): Stream more nodes.
	(cpms_in::finish_type): Deal with TEMPLATE_TYPE_PARM,
	TEMPLATE_TEMPLATE_PARM.
	* pt.c (canonical_type_parameter): Make extern, simplify.
	(push_template_decl_real): Propagate exportednes.
	gcc/testsuite/
	* g++.dg/modules/mod-tpl-1_[ab].C: New.

2017-10-12  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* cp-tree.h (TS_CP_BINDING, TS_CP_WRAPPER, LAST_TS_CP_ENUM): Delete.
	(union lang_tree_node): Adjust GTY desc.
	(cp_tree_node_structure): Take a tree_code.
	* decl.c (cp_tree_node_structure): Take a tree_code.
	* module.c (cpms_{out,in}::core_vals): Order clauses from
	tree-core.h, use cp_tree_node_structure for C++.

	Module name can be a string const (-fmodules++)
	gcc/cp/
	* cp-tree.h (cp_expr): Add constant operator* and operator->.
	(validate_module_name): New.
	(declare_module, import_module): Take cp_expr.
	* error.c (dump_module_suffix): Adjust.
	* module.c (module_state): Add name_hash.  Adjust.
	(module_state_hash): Allow string consts.
	(module_state::set_name): Likewise.
	(cpm_{writer,reader}::module_name): New.
	(dump_nested_name): Name can be a string const.
	(cpms_{out,in}::header): Adjust.
	(cpms_{out,in}::tag_import): Adjust.
	(validate_module_name): New.
	(module_to_filename): Allow string consts.
	(make_module_file): Adjust.
	(do_module_import): Adjust.
	(import_module, declare_module): Adjust.
	* parser.c (cp_parser_module_name): Return cp_expr, allow
	string-cst.
	(cp_parser_module_declaration, cp_parser_import_declaration,
	cp_parser_module_proclamation): Adjust.
	gcc/testsuite/
	* g++.dg/modules/modules.exp (dg-module-bmi): Renamed.
	* g++.dg/modules/mod++-decl-3_[ab].C: New.

	Add -fmodule-path, -fmodule-root.
	gcc/
	* incpath.h (INC_CXX_MPATH): New.
	(clean_cxx_module_path): Declare.
	* incpath.c (clean_cxx_module_path): New.
	gcc/cp/
	* cp-tree.h (init_module_processing): Declare.
	* decl.c (cxx_init_decl_processing): Call init_module_processing.
	* module.c (module_path, module_path_max): New vars.
	(MOD_FNAME_PFX): Delete.
	(module_to_filename): Reimplement.
	(search_module_path, make_module_file): New.
	(do_module_import): Adjust.
	(init_module_processing): New.
	(finish_module): Adjust.
	gcc/c-family/
	* c-opts.c (c_common_handle_option): Process OPT_fmodule_path_.
	(c_common_post_options): Clean module path.
	* c.opt (fmodule-root=, fmodule-path=, fmodule-hook=): New.
	gcc/testsuite/
	* g++.dg/modules/modules.exp: Adjust module name logic.

2017-10-11  Nathan Sidwell  <nathan@acm.org>

	Merge trunk r253654.

2017-10-10  Nathan Sidwell  <nathan@acm.org>

	Merge trunk r253585.

2017-09-25  Nathan Sidwell  <nathan@acm.org>

	gcc/c-family/
	* c_common_handle_option: Handle fmodules++.
	* c.opt (fmodules): Make Uinteger.
	(fmodules++, fmodules-ts): New.
	gcc/cp/
	* parser.c (cp_parser_consume_semicolon_at_end_of_statement):
	Return success bool.
	(cp_parser_translation_unit): Adjust cp_parser_declaration_seq_opt
	call.
	(cp_parser_declaration_seq_opt): Add top_level parm, look for
	module-decl here.
	(cp_parser_module_declaration): Handle -fmodules++ syntax.
	(cp_parser_module_export): No need to handle module-declaration
	here ...
	(cp_parser_declaration): ... or here.
	gcc/
	* doc/invoke.texi (-fmodules++): Document.
	gcc/testsute/
	* g++.dg/modules/mod++-decl-0_[abc].C: New.
	* g++.dg/modules/mod++-decl-[12].C: New.
	* g++.dg/modules/mod-decl-1.C: Adjust expected error.

2017-09-15  Nathan Sidwell  <nathan@acm.org>

	Merge trunk 252831.

2017-07-20  Boris Kolpackov <boris@codesynthesis.com>

	Add -fmodule-output & -fmodule-file options.
	gcc/c-family/
	* c.opt (-fmodule-output): New option.
	(-fmodule-file): New option.
	* c-common.h (module_output): Declare.
	(module_files): Declare.
	* c-common.c (module_output): New variable.
	(module_files): New variable.
	* c-opts.c (add_module_file): New function.
	* c-opts.c: Handle -fmodule-output and -fmodule-file.
	gcc/cp/
	* module.c (finish_module): If specified, use module_output as output
	file name.
	* module.c (do_module_import): Check module_files for a module name
	to file mapping before falling back to default.
	gcc/
	* doc/invoke.texi (C++ Dialect Options): Document -fmodule-output
	and -fmodule-file.

2017-07-17  Nathan Sidwell  <nathan@acm.org>

	Merge trunk r250272.

2017-07-13  Nathan Sidwell  <nathan@acm.org>

	Merge trunk r250159.

2017-07-03  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* cp-tree.h (CLASSTYPE_CONSTRUCTORS, CLASSTYPE_DESTRUCTOR): Use
	lookup_fnfields_slot_nolazy.
	* search.c (lookup_fnfields_idx_nolazy): Don't use
	CLASSTYPE_CONSTRUCTORS, CLASSTYPE_DESTRUCTOR.

	gcc/cp/
	* class.c (type_has_user_declared_move_constructor,
	type_has_user_declared_move_assign): Delete, replace with:
	(classtype_has_user_move_assign_or_ctor_p): ... this.
	* cp-tree.h (type_has_user_declared_move_constructor,
	type_has_user_declared_move_assign): Delete, replace with:
	(classtype_has_user_move_assign_or_ctor_p): ... this.
	* method.c (maybe_explain_implicit_delete): Update.
	(lazily_declare_fn): Update.
	* tree.c (type_has_nontrivial_copy_init): Update.
	* search.c (lookup_fnfields_slot_nolazy): Don't try and complete
	the type.
	* pt.c (check_explicit_specialization): Use regular lookup.

	gcc/cp/
	* class.c (maybe_warn_about_overly_private_class): Ignore
	copy/move ctors.
	* semantics.c (classtype_has_nothrow_assign_or_copy_p): Use
	lookup_fnfields_slot for ctors.

	gcc/cp/
	* module.c (cpms_{out,in}::start): Don't deal with identifiers
	here.
	(cpms_{out,in}::tree_node): Deal with identifiers specially.

	Merge trunk r249852.

2017-06-30  Nathan Sidwell  <nathan@acm.org>

	Merge trunk r249835.

2017-06-29  Nathan Sidwell  <nathan@acm.org>

	Merge trunk r249794.

	gcc/cp/
	* cp-tree.h (class_method_index_for_fn): Delete.
	* decl2.c (check_classfn): Use lookup_fnfields_slot, reimplement
	diagnostics.
	* name-lookup.h (lookup_all_conversions): Declare.
	* name-lookup.c (lookup_all_conversions): New.
	* pt.c (retrieve_specialization): Use lookup_fnfields_slot,
	lookup_all_conversions.
	* search.c (class_method_index_for_fn): Delete.
	gcc/testsuite/
	* g++.dg/concepts/memfun-err.C: Adjust.
	* g++.dg/cpp0x/decltype9.C: Adjust.
	* g++.dg/lookup/decl1.C: Adjust.
	* g++.dg/other/pr28432.C: Adjust.
	* g++.dg/parse/crash12.C: Adjust.
	* g++.dg/parse/enum3.C: Adjust.
	* g++.dg/parse/operator6.C: Adjust.
	* g++.dg/template/crash69.C: Adjust.
	* g++.dg/template/error27.C: Adjust.
	* g++.dg/template/error28.C: Adjust.
	* g++.dg/template/memfriend6.C: Adjust.
	* g++.old-deja/g++.mike/err1.C: Adjust.
	* g++.old-deja/g++.mike/p811.C: Adjust.
	* g++.old-deja/g++.other/crash25.C: Adjust.
	* g++.old-deja/g++.other/dtor4.C: Adjust.
	* g++.old-deja/g++.pt/t37.C: Adjust.

	Merge trunk r249779.

	gcc/cp/
	* class.c (finish_struct): Use OVL_P.
	* cp-tree.h (THIS_NAME, IN_CHARGE_NAME, VTBL_PTR_TYPE,
	VTABLE_DELTA_NAME, VTABLE_PFN_NAME): Delete.
	* decl.c (initialize_predefined_identifiers): Encode them here
	directly.  Rename cdtors consistently.
	(cxx_init_decl_processing): Name vtbl_ptr_type directly.
	* search.c (class_method_index_for_fn): No need to frob cdtor names.

2017-06-28  Nathan Sidwell  <nathan@acm.org>

	cdtor name cleanup. expunge lookup_fnfields_1 use.
	gcc/
	* builtins.c (fold_builtin_FUNCTION) Use
	lang_hooks.decl_printable_name.
	gcc/cp/
	* call.c (build_new_method_call_1) Update cdtor handling.
	* class.c (get_basefndecls): Use lookup_fnfields_slot.
	* cp-tree.h (lookup_fnfields_1): Don't declare.
	* decl.c (register_dtor_fn): Use lookup_fnfields_slot.
	(grokfndecl): Set cdtor name.
	* method.c (implicitly_declare_fn): Adjust cdtor flag setting.
	* pt.c (check_explicit_specialization): Adjust cdtor checking, use
	lookup_fnfields_slot_nolazy.
	* search.c (lookup_fnfields_1): Make static.
	* semantics.c (classtype_has_nothrow_assign_or_copy_p): Use
	lookup_fnfields_slot.
	gcc/testsite/
	* g++.dg/cpp1y/builtin_FUNCTION.C: New.
	* g++.dg/plugin/decl-plugin-test.C: Adjust.

	Merge trunk r249746.

	gcc/cp/
	* cp-tree.h (SET_CLASS_TYPE_P): Use RECORD_OR_UNION_CHECK.
	(NON_UNION_CLASS_TYPE_P): Just check for RECORD_TYPE.
	* call.c (check_dtor_name): Adjust constructor_name check.
	(name_as_c_string): Move const cast.
	(build_new_method_call_1): Use constructor_name from basetype.
	* class.c (get_vfield_name): Measure constructor_name length.
	(build_self_reference): Don't use constructor_name here.
	* cxx-pretty-print.c (is_destructor): Delete.
	(pp_cxx_unqualified_id): Remove bogus dtor code.
	* decl.c (grokdeclarator): Minor cleanup.
	* method.c (implicitly_declare_fn): Use ctor_identifier and
	dtor_identifier.
	* name-lookup.c (constructor_name): Reimplement.
	(constructor_name_p): Likewise.
	(push_class_level_binding_1): Don't use constructor_name here.
	* parser.c (cp_parser_direct_declarator): Reformat to avoid
	nesting ifs.
	* pt.c (tsubst_decl <FUNCTION_DECL>): Move var decls to
	initialization point.  Don't unnecessarily check for ctor name.
	gcc/c-family/
	* c-common.c (resort_field_decl_cmp): Don't declare.

2017-06-27  Nathan Sidwell  <nathan@acm.org>

	Merge trunk r249702.
	gcc/c-family/
	* c-common.h (field_decl_cmp, resort_sorted_fields): Delete.
	* c-common.c (field_decl_cmp, resort_data,
	resort_field_decl_cmp): Move to c-decl.c.
	gcc/c/
	* c-decl.c (field_decl_cmp, resort_data,
	resort_field_decl_cmp): Moved from c-common.c

2017-06-26  Nathan Sidwell  <nathan@acm.org>

	Replace lang_type::sorted_fields with lang_type::bindings.
	gcc/cp/
	* cp-tree.h (lang_type): Delete sorted_fields.  Add bindings
	field.
	(CLASSTYPE_SORTED_FIELDS): Replace with ...
	(CLASSTYPE_BINDINGS): ... this.
	* name-lookup.c (lookup_class_member): Reimplement.
	(count_fields): Delete.
	(sorted_fields_type_new): Delete.
	(add_class_member): New.
	(add_fields_to_record_type): Replace with ...
	(add_class_members): ... this.
	(add_enum_fields_to_record_type): Delete.
	(create_classtype_sorted_fields): Replace with ...
	(set_class_bindings): ... this.
	(insert_late_enum_def_into_classtype_sorted_fields): Replace with ...
	(insert_late_enum_def_bindings): ... this.
	* name-lookup.h (create_classtype_sorted_fields,
	insert_late_enum_def_into_classtype_sorted_fields): Replace with ...
	(set_class_bindings, insert_late_enum_def_bindings): ... this.
	* ptree.h (cxx_print_type): Don't print SORTED_FIELDS.
	* search.c (lookup_field_1): Check CLASSTYPE_BINDINGS.
	* decl.c (finish_enum_value_list): Use insert_late_enum_def_bindings.
	* class.c (finish_struct_1): Use set_class_bindings.
	* module.c (cpms_in::define_class): Likewise.

	Start moving class name lookup around
	gcc/cp/
	* class.c (count_fields, add_fields_to_record_type,
	add_enum_fields_to_record_type, sorted_fields_type_new,
	create_classtype_sorted_fields,
	insert_late_enum_def_into_classtype_sorted_fields): Move to ...
	* name-lookup.c: ... here.
	(lookup_class_member): New.  Broken out of ...
	* search.c (lookup_field_1): ... here.  Call it.
	* name-lookup.h (lookup_class_member,
	create_classtype_sorted_fields,
	insert_late_enum_def_into_classtype_sorted_fields): Declare.

	Merge trunk r249657.

	gcc/cp/
	* cp-tree.h (lang_decl_fn): Remove assignment_operator_p field.
	* module.c (cpms_{out,in}::lang_decl_bools: Likewise.
	libcc1/
	* libcp1plugin.cc (plugin_build_decl): Don't set
	DECL_ASSIGNMENT_OPERATOR_P.

	gcc/
	* Makefile.in (MODULE_STAMP): Set here
	(REVISION, REVISION_c): Override.
	gcc/cp/
	* Make-lang.in (MODULE_STAMP): Not here.

2017-06-23  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* cp-tree.h (DECL_COMPLETE_CONSTRUCTOR_P): Directly compare
	identifier.
	(DECL_BASE_CONSTRUCTOR_P, DECL_COMPLETE_DESTRUCTOR_P,
	DECL_BASE_DESTRUCTOR_P, DECL_DELETING_DESTRUCTOR_P): Likewise.
	(DECL_ASSIGNMENT_OPERATOR_P): Use IDENTIFIER_ASSIGN_OP_P.
	* decl.c (grok_op_properties): Adjust identifier checking.
	* init.c (expand_default_init): Adjust identifier descision.
	* method.c (implicitly_declare_fn): Don't use
	DECL_ASSIGNMENT_OPERATOR_P.
	* search.c (lookup_fnfields_1): Use IDENTIFIER_CTOR_P,
	IDENTIFIER_DTOR_P.
	* call.c (in_charge_arg_for_name): Reimplement.
	(build_special_member_call): Use IDENTIFIER_CDTOR_P,
	IDENTIFIER_DTOR_P.

2017-06-22  Nathan Sidwell  <nathan@acm.org>

	Merge trunk r249572.

	Reorder IDENTIFIER flags
	gcc/cp/
	* cp-tree.h (enum cp_identifier_kind): New.
	(IDENTIFIER_KIND_BIT_0, IDENTIFIER_KIND_BIT_1,
	IDENTIFIER_KIND_BIT_2): New.
	(IDENTIFIER_MARKED): Move to TREE_LANG_FLAG_4.
	(IDENTIFIER_VIRTUAL_P, IDENTIFIER_REPO_CHOSEN): Add IDENTIFIER_CHECK.
	(C_IS_RESERVED_WORD): Replace with ...
	(IDENTIFIER_KEYWORD_P): ... this.
	(IDENTIFIER_CTOR_OR_DTOR_P): Replace with ...
	(IDENTIFIER_CDTOR_P): ... this.
	(IDENTIFIER_CTOR_P, IDENTIFIER_DTOR_P): New.
	(IDENTIFIER_OPNAME_P): Replace with ...
	(IDENTIFIER_ANY_OP_P): ... this.
	(IDENTIFIER_ASSIGN_OP_P): New.
	(IDENTIFIER_TYPENAME_P): Replace with ...
	(IDENTIFIER_CONV_OP_P): ... this.
	(NEW_DELETE_OPNAME_P): Replace with ...
	(IDENTIFIER_NEWDEL_OP_P): ... this.
	(DECL_CONV_FN_P, DECL_OVERLOADED_OPERATOR_P): Adjust.
	(get_identifier_kind_name, set_identifier_kind): Declare.
	* lex.c (get_identifier_kind_name, set_identifier_kind): New.
	(init_operators): Adjust to avoid keywords, use
	set_identifier_kind. Copy TYPE_EXPR slot.
	(init_reswords): Call set_identifier_kind.
	(unqualified_name_lookup_error): Adjust.
	* operators.def (TYPE_EXPR): Remove.
	* decl.c (struct predefined_identifier): Move into ...
	(initialize_predefined_identifiers): ... here.  Call
	set_identifier_kind.
	(grokfndecl, check_var_type, grokdeclarator): Adjust.
	(grok_op_properties): Use IDENTIFIER_ANY_ASSIGN_OP to halve search
	space.  Adjust.
	* call.c (name_as_c_string): Adjust.
	(build_new_method_call_1): Likewise.
	* cp-cilkplus.c (is_conversion_operator_function_decl_p): Likewise.
	* cxx-pretty-print.c (pp_cxx_unqualified_id): Adjust.
	* dump.c (cp_dump_tree): Adjust.
	* error.c (dump_decl_name): Adjust.
	* mangle.c (write_unqualified_id, write_member_name,
	write_expression): Adjust.
	(mangle_conv_op_name_for_type): Use set_identifier_kind.
	* name-lookup.c (do_class_using_decl): Adjust.
	(lookup_name_fuzzy, lookup_name_real_1): Likewise.
	* parser.c (cp_lexer_get_preprocessor_token,
	cp_parser_direct_declarator): Likewise.
	* pt.c (push_template_decl_real, tsubst_decl, tsubst_baselink,
	tsubst_copy, tsubst_copy_and_build): Adjust.
	* ptree.c (cxx_print_identifier): Print identifier kind.
	* search.c (lookup_field_r, lookup_member,
	lookup_fnfields_idx_nolazy): Adjust.
	* semantics.c (finish_id_expression): Adjust..
	* typeck.c (cp_build_addr_expr_1): Adjust.

2017-06-21  Nathan Sidwell  <nathan@acm.org>

	Merge trunk r249464.

	gcc/c-family/
	* c-ada-spec.c (decl_sloc): Ignore builtin fields.
	gcc/cp/
	* class.c (layout_class_type): Anon aggregates can never be bases.
	(finish_struct_1, dump_class_hierarchy_1): CLASSTYPE_AS_BASE can
	be null.
	* cp-tree.h (enum cp_tree_index): Add CPTI_AS_BASE_IDENTIFIER.
	(as_base_identifier): New.
	(module_context): Declare.
	* decl.c (initialize_predefined_identifiers): Initialize as_base.
	* error.c (dump_module_suffix): Use module_context.
	* mangle.c (maybe_write_module): Likewise.
	* module.c (module_context): New.
	(dump_nested_name): Distingush NULL context.
	(cpms_{in,out}::globals): Take array directly.
	(cpms_{in,out}::tree_node_raw): New, broken out of ...
	(cpms_{in,out}::tree_node): ... here.  Call it.  Use
	module_context.
	(cpms_in::finish): Add module number.  Adjust.
	(cpms_{in,out}::tag_trees): Write translation unit decl.

2017-06-16  Nathan Sidwell  <nathan@acm.org>

	Merge trunk r249268.

2017-06-15  Nathan Sidwell  <nathan@acm.org>

	Merge trunk r249217.
	libcc1/
	* libcp1plugin.c (supplement_binding): Don't call
	maybe_remove_implicit_alias.

	First bug report!
	gcc/cp/
	* cp-tree.h (CPTI_MANGLE): New.
	(mangle_namespace): New.
	(maybe_remove_implicit_alias): Delete.
	* decl.c (cxx_init_decl_processing): Create mangle namespace.
	* decl2.c (generate_mangling_alias): Use mangle_namespace.
	* mangle.c (maybe_remove_implicit_alias): Delete.
	(mangle_decl): Use mangle_namespace. Remove alias here.
	* module.c (cpms_out::bindings): Ignore mangle_namespace.
	* name-lookup.h (set_namespace_binding): Declare.
	* name-lookup.c (supplement_binding_1): Don't deal with implicit
	aliases here.
	(set_namespace_binding): New.  Broken out of ...
	(set_global_binding): ... this.  Call it.
	(suggest_alternatives_for): Ignore mangle namespace.
	gcc/testuite/
	* g++.dg/module/bug-1_[ab].C: New.

2017-06-14  Nathan Sidwell  <nathan@acm.org>

	Classes complete - Vcall indices and friends added.
	gcc/cp/
	* module.c (cpms_{out,in}::tree_pair_vec): New.
	(cpms_{out,in}::define_class): Stream vcall indices and friend list.
	gcc/testsuite/
	* g++.dg/module/class-6_[abc].C: New.

2017-06-12  Nathan Sidwell  <nathan@acm.org>

	Merge trunk r249076.

2017-06-09  Nathan Sidwell  <nathan@acm.org>

	Vtable streaming.  Change keyed_classes representation.
	gcc/cp/
	* class.c (finish_struct_1): Adjust keyed_classes pushing.
	* cp-tree.h (CPTI_KEYED_CLASSES): Delete.
	(keyed_classes): Now a vector.
	* decl.c (keyed_classes): Define.
	(cxx_init_decl_processing): Initialize it.
	(record_key_method_defined): Adjust pushing.
	* decl2.c (decl_needed_p): Formatting fixes.
	(c_parse_final_cleanups): Reset current module.
	Call finish_module earlier.  Adjust keyed_classes iteration.
	* pt.c (instantiate_class_template_1): Adjust keyed_classes pushing.
	* module.c (cpms_{out,in}::define_class): Adjust key method
	streaming.
	(cpms_{out,in}::lang_type_bools): Don't srtream interface flags.
	gcc/testsuite/
	* g++.dg/modules/class-5_[abc].C: New.

	Typeinfo streaming
	gcc/cp/
	* cp-tree.h (DECL_TINFO_P): Also for TYPE_DECLs.
	(get_pseudo_tinfo_index, get_pseudo_tinfo_type): Declare.
	* rtti.c (enum tinfo_kind): Add TK_DERIVED_TYPES,
	TK_VMI_CLASS_TYPES, TK_MAX, delete TK_FIXED.
	(tinfo_names): New.
	(typeid_ok_p): Lool at TYPE_MAIN_VARIANT.
	(get_pseudo_to_index): Only determine index, don't create type.
	(get_tinfo_desc): New.  Create the pseudo type.  Set DCL_TINFO_P.
	(create_pseudo_type_info): Delete.
	(get_pseudo_ti_init): Use get_tinfo_desc.
	(get_pseudo_tinfo_index, get_pseudo_tinfo_type): New.
	(create_tinfo_types): Only allocate the vector.
	* module.c (cpms_{out,in}::insert): New.
	(cpm_stream::global_tree_arys): Add sizetype_tab.
	(cpms_out::tag_binding): Don't stream DECL_TINFO_P bindings.
	(cpms_{out,in}::define_class): Don't stream
	CLASSTYPE_TYPEINFO_VAR.  Stream CLASSTYPE_VTABLES.
	(cpms_{out,in}::core_vals): Stream CONSTRUCTORs.
	(cpms_{out,in}::tree_node): Detect DECL_TINFO_P things.

2017-06-08  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.c (cpms_in::read_item, cpms_in::tree_node): More
	diagnostics.
	(cpms_{out,in}::start, cpms_{out,in}::core_vals): Fix call
	handling.
	gcc/testsuite/
	* g++.dg/modules/class-4_[ab].C: New.

	gcc/cp/
	* module.c: Implement dump printf.

2017-06-07  Nathan Sidwell  <nathan@acm.org>

	Merge trunk r248972.

	gcc/cp/
	* module.c (cpms_{out,in}::core_vals): Stream block vars &
	abstract origin.

2017-06-06  Nathan Sidwell  <nathan@acm.org>

	Inline ctors/dtors
	gcc/cp/
	* module.c (cpms_in::define_function): Deal with non-namespace
	fn definitions.
	(cpms_{out,in}::define_class): Define member fns.
	(cpms_in::tag_definition): Clone fn.
	* semantics.c (expand_or_defer_fn_1): Keep cloned fns body when
	modules.
	gcc/testsuite/
	* g++.dg/modules/class-3_[abcd].C: Augment.

	Member functions
	gcc/cp/
	* class.c (resort_type_method_vec): Avoid signed/unsigned compare.
	* module.c (cpms_out::maybe_tag_definition): New.
	(cpms_{out,in}::tag_definition): Always tag, return tagged thing.
	(cpms_{out,in}::chained_decls, tree_vec): New.
	(cpms_{out,in}::define_class): Stream methods, as_base.
	(cpms_{out,in}::core_vals): Stream ARGUMENTs here.
	(cpms_in::tree_node): Cope with immediate definitions.
	gcc/testsuite/
	* g++.dg/modules/class-3_[abcd].C: Augment.

	More PoD struct
	gcc/cp/
	* module.c (cpms_{out,in}::ident_imported_decl): New.
	(cpms_{out,in}::lang_type_vals): New.
	(cpms_{out,in}::core_vals): Blocks and statements.
	(cpms_{out,in}::tree_node): More general import referencing.
	* name-lookup.c (name_lookup::add_module_fns): New.
	(name_lookup::adl_namespace_only): Use it.
	gcc/testsuite/
	* g++.dg/modules/class-3_[abc].C: New.

2017-06-05  Nathan Sidwell  <nathan@acm.org>

	More PoD struct
	gcc/cp/
	* cp-tree.h (default_hash_traits): Make non-deletable.
	(cpms_out::non_null): New hash trait.
	(cpms_in::traits): Use simple_hashmap_traits.
	(cpms_in::define_class, cpms_in::finish_type): Propagate
	completeness.
	(cpms_in::finish_type): Deal with pointer/ref to.
	(cpms_{out,in}::core_vals): Stream ints, pointer/ref to.
	(cpms_{out,in}::tree_node): Interstitial typedef.
	gcc/testsuite/
	* g++.dg/modules/class-1_[abc].C: Extend.
	* g++.dg/modules/class-2_[ab].C: New.

2017-06-02  Nathan Sidwell  <nathan@acm.org>

	Pod struct
	gcc/cp/
	* cp-tree.h (create_classtype_sorted_fields): Declare.
	* class.c (finish_struct_1): Adjust sorted field call.
	(insert_into_classtype_sorted_fields): Rename to ...
	(create_classtype_sorted_fields): ... here.  Export
	* module.c (cpms_{out,in}::tree_vec): New.
	(cpms_{out,in}::define_function): New.
	(cpms_{out,in}::define_class): New.
	(cpms_{out,in}::tag_definition): Adjust.
	(cpms_{out,in}::core_vals): Stream binfo, field_decl.
	gcc/testsuite/
	* g++.dg/modules/class-1_[abcd].C: Add field accesses.

	Merge r248828.

	gcc/cp/
	* modules.c (cpms_out::core_vals, cpms_in::core_vals): Don't
	stream structure fields etc.

2017-06-01  Nathan Sidwell  <nathan@acm.org>

	Incomplete or empty classes.
	gcc/cp/
	* cp-tree.h (ovl_iterator::export_tail): New.
	(TYPE_GET_PTRMEMFUNC_TYPE, TYPE_SET_PTRMEMFUNC_TYPE): Delete.
	(TYPE_PTRMEMFUNC_TYPE): New.
	(maybe_add_lang_type_raw): Add ptrmem_p arg.
	(fit_ptrmem_type_decl): Declare.
	(ovl_insert): Add export_tail.
	* decl.c (build_ptrmemfunc_type): Use fit_ptrmem_type_decl,
	adjust.
	(xref_tag_1): Call decl_set_module.
	* lex.c (maybe_add_lang_type_raw): Add ptrmem_p arg.  Adjust.
	(fit_ptrmem_type_decl): New.
	(cxx_make_type): Adjust.
	* module.c (name_string): New. Use it everywhere.
	(cpm_reader::fill): Check ferror.
	(cpms_out::tag_binding): Skip builtins.  Write types.
	(cpms_out::lang_type_bools, cpms_in::lang_type_bools): New.
	* name-lookup.c (STAT_EXPORTS): New.
	(name_lookup::process_module_binding): Use it.
	(update_binding): Set it.
	(newbinding_bookkeeping): New. Broken out of ...
	(do_pushdecl): ... here.  Call it.
	(push_module_binding): And call it here.  Set STAT_EXPORTS.
	* rtti.c (create_pseudo_type_info): Mark as builtins.
	(get_pseudo_ti_index): Likewise.
	(emit_support_tinfos): Use regular lookup to find type.  Set
	builtins location.
	* tree.c (ovl_insert): Add export_tail arg.
	gcc/testsuite/
	* g++.dg/modules/class-1_[abcd].C: New.

2017-05-31  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.c: Instrumentation.

	Merge trunk r248748.

2017-05-30  Nathan Sidwell  <nathan@acm.org>

	Merge trunk r248694.

	gcc/cp/
	* module.c (cpms_out::tag_binding, cpms_in::tag_binding): Mark
	type too.
	(cpms_out::bindings): Adjust.
	* name-lookup.c (push_module_binding): Add type arg.

	gcc/cp/
	* cp-tree.h (lang_decl_base): Lose decomposition_p flag.
	(lang_decl) Update GTY tags.
	(enum lang_decl_selector): New.  Replace magic consts with this.
	(DECL_DECOMPOSITION_P): Update.
	(SET_DECL_DECOMPOSITION_P): Delete.
	(maybe_add_lang_decl_raw): Second arg is bool.
	(retrofit_lang_decl): Lose selector arg.
	(fit_decomposition_lang_decl): Declare.
	* decl.c (cp_finish_decomp): Use fit_decomposition_lang_decl.
	(grokdeclarator): Likewise.
	* lex.c (maybe_add_lang_decl_raw): Change 2nd arg to bool. Don't
	to copying here.
	(set_decl_linkage, fit_decomposition_lang_decl): New.
	(retrofit_lang_decl): Lose selector arg.
	(cxx_dup_lang_specific_decl): Use selector directly.
	* module.c (cpms_out::lang_decl_bools, cpms_in::lang_decl_bools,
	cpms_out::lang_decl_vals, cpms_in::lang_decl_vals): Use
	lang_decl_selector.
	(cpms_in::tree_node): Adjust maybe_add_lang_decl call.

	gcc/
	* REVISION: Add file.
	gcc/c-family/
	* c-cppbuiltin.c (c_cpp_builtins): Update __cpp_modules=201704.

2017-05-29  Nathan Sidwell  <nathan@acm.org>

	Merge trunk r248578.

	Merge trunk r248574.

	Merge trunk r248571.

2017-05-26  Nathan Sidwell  <nathan@acm.org>

	Merge trunk r248517.

	gcc/cp/
	* cp-tree.h: Comment cleanup.
	* name-lookup.c: Likewise.
	* tree.c: Likewise.

	Merge trunk 248485.
	gcc/cp/
	* lex.c (maybe_retrofit_lang_decl): Add sel parm.

2017-05-25  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* cp-tree.h (ovl_iterator): Make unduplicatable.
	(ovl_iterator::pop): New.
	(lkp_iterator::operator++): Adjust.

	Merge trunk r248454.

	Merge trunk r248436.

2017-05-24  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* name-lookup.c (lookup_name): Reimplement state preservation and
	restoration.
	* tree.c (lookup_mark): Add asserts.
	gcc/testsuite/
	* g++.dg/lookup/koenig14.C: New.

	Merge trunk r248406.

	gcc/cp/
	* call.c (build_operator_new_call, build_new_op_1): Open code ADL
	lookup.
	* name-lookup.h (lookup_function_nonclass): Delete.
	(lookup_arg_dependent): Adjust return type.
	* name-lookup.c (name_lookup): Absorb adl_lookup.
	(name_lookup::search_adl): New.
	(lookup_function_nonclass): Delete.
	(lookup_arg_dependent): Adjust.

2017-05-23  Nathan Sidwell  <nathan@acm.org>

	Merge trunk r248389.

	gcc/cp/
	* name-lookup.c (name_lookup::name_lookup): Lose F parm.
	(name_lookup::ambiguous, add_value, add_type): New.
	(name_lookup::merge_binding): Delete.
	(name_lookup::find_and_mark): Move from adl_lookup.
	(name_lookup::process_binding): Adjust.
	(adl_lookup::search_adl): New.
	(do_lookup_arg_dependent): Call it.
	(qualified_namespace_lookup): Return found flag.
	(unqualified_namespace_lookup): Delete.
	(lookup_name_real_1, push_namepace): Adjust.

	Merge trunk r248377.

	Merge trunk r248365.

2017-05-22  Nathan Sidwell  <nathan@acm.org>

	Merge trunk r248338.
	gcc/cp/
	* name-lookup.c (add_using_namespace): Remove FROM arg.
	(notify_debug_using_namespace): New.
	(finish_namespace_using_directive, push_namespace): Notify debug.
	gcc/testsuite/
	* g++.dg/lookup/strong-using-6.C: Delete.

	gcc/cp/
	* config-lang.in: Update.
	* name-lookup.c (add_using_directive): Rename to ...
	(add_using_namespace): ... here.  Add FROM arg.
	(do_toplevel_using_directive): Fold into add_using_namespace.
	(finish_namespace_using_directive, finish_local_using_directive,
	push_namespace): Adjust.

	Merge trunk r248329.

	gcc/testsuite/
	PR c++/80830
	* g++.dg/lookup/friend20.C: New testcase.

2017-05-19  Nathan Sidwell  <nathan@acm.org>

	Merge trunk r248295.

	gcc/cp/
	* cp-tree.h: Misc cleanups.
	* name-lookup.c (pushdecl_top_level): Fix description.
	gcc/
	* dumpfile.h: Whitespace cleanups.
	* system.h (ATTRIBUTE_NTC_PURE): Delete.
	gcc/testsuite/
	* g++.dg/tree-ssa/ssa-dse-2.C: Restore.

	Merge trunk r248285.

	Merge trunk r248271.

2017-05-18  Nathan Sidwell  <nathan@acm.org>

	Merge trunk r248250.

	LANG_HOOK_REGISTER_DUMPS
	gcc/
	* context.h (context::set_passes): New.
	* context.c (context::context): Do not create pass manager.
	* toplev.c (general_init): Create pass manager here.  Call
	register dump lang hook.
	* doc/invoke.texi: Document -fdump-lang option family.
	* dumpfile.c (dump_files): Remove module and class dumps here.
	(FIRST_AUTO_NUMBERED_DUMP): Adjust.
	* dumpfile.h (tree_dump_index): Remove TDI_lang, TDI_class.
	* langhooks-def.h (lhd_register_dumps): Declare.
	(LANG_HOOKS_REGISTER_DUMPS): Define.
	(LANG_HOOKS_INITIALIZER): Add it.
	* langhooks.c (lhd_register_dumps): Define.
	* langhooks.h (struct lang_hooks): Add register_dumps.
	gcc/c-family/
	* c-opts.c (class_dump_file, class_dump_flags): Delete.
	(c_common_parse_file): Remove class dump handling.
	(get_dump_info): Likewise.
	gcc/cp/
	* class.c (class_dump_id): Define.
	(dump_class_hierarchy, dump_vtable, dump_vtt): Use it.
	* cp-objcp-common.c (cp_register_dumps): New.
	* cp-objcp-common.h (cp_register_dumps): Declare.
	(LANG_HOOKS_REGISTER_DUMPS): Override.
	* cp-tree.h (class_dump_id, module_dump_id): Declare.
	* module.c (module_dump_id): Define.
	(read_module, write_module): Use it.
	gcc/testsuite/
	* g++.dg/inherit/covariant7.C: Adjust.
	* g++.dg/modules/ Adjust scans.

	gcc/cp/
	* cp-tree.h (lookup_add, lookup_maybe_add): Swap args.
	* name-lookup.c (name_lookup::merge_binding,
	adl_lookup::add_functions): Adjust.
	* pt.c (check_explicit_specialization, do_class_deduction): Adjust.
	* tree.c (lookup_add, lookup_maybe_add): Adjust.

	Merge trunk r248192.

2017-05-17  Nathan Sidwell  <nathan@acm.org>

	Merge trunk r248159.

	Merge trunk r248151.
	* cp-tree.h (ovl_insert): Swap first two args.  Update all uses.

	Merge trunk r248144.

2017-05-16  Nathan Sidwell  <nathan@acm.org>

	Merge trunk r248126.

	Merge trunk r248121.

	Merge trunk r248116.

	Merge trunk r248109.

2017-05-15  Nathan Sidwell  <nathan@acm.org>

	Merge trunk r248059.

	gcc/cp/
	* module.c (cpms_in::tag_definition): Robustify.

2017-05-12  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.c (cpms_{in,out}): Rename {read,write}_tree to tree_node.

	gcc/cp/
	* module.c (cpms_{in,out}): Rename read/write fns.

	More inline bodies
	gcc/cp/
	* module.c (cpms_{in,out}::write_core_vals): Read/write
	statement lists & LABEL_DECLs.
	gcc/testsuite/
	* g++.dg/modules/fn-inline-1_c.C: More test.

	Inline function bodies
	gcc/cp/
	* module.c (cpms_{in,out}::write_core_vals): Read/write
	exprs
	(cpms_in::tag_definition): Insert inline function.
	gcc/testsuite/
	* g++.dg/modules/fn-inline-1_[ab].C: New.

	Merge trunk r247968.

	gcc/cp/
	* module.c (cpm_reader::read_tree): Change interface, adjust callers.

	gcc/cp/
	* module.c (cpm_writer): Instrument bool distribution.
	(cpms_out::tag_definition, cpms_in::tag_definition): New.
	(cpms_out, cpms_in): Transfer more stuff.

2017-05-11  Nathan Sidwell  <nathan@acm.org>

	Merge trunk r247911.

2017-05-10  Nathan Sidwell  <nathan@acm.org>

	Merge trunk r247864.

	Merge trunk r247834.

2017-05-09  Nathan Sidwell  <nathan@acm.org>

	Rename -fdump-front-end to -fdump-lang.
	gcc/
	* dumpfile.h (TDF_KIND_MASK, TDF_KIND): New.  Adjust.
	* dumpfile.c (dump_files): Rename file suffix.
	(get_dump_file_name, dump_enable_all): Adjust.
	* doc/invoke.texi: Rename option.
	gcc/testsuite/
	* g++.dg/modules: Adjust tests.

	gcc/cp/
	* module.c (cpms_in::finish): Merge global decls.
	(cpms_in::finish_function, cpms_in::finish_namespace): Delete.
	* name-lookup.h (push_module_namespace): Replace with ...
	(merge_global_decl): ... this.
	* name-lookup.c (push_module_namespace): Morph into ...
	(merge_global_decl): ... this.
	(push_module_binding): Don't re-add found things.

	gcc/
	* tree.h (TREE_CHECK6, tree_check6): Delete.

	Merge trunk r247787.
	gcc/cp/
	* tree.c (type_has_nontrivial_copy_init): Use ovl_iterator.

	Error message module designation.
	gcc/cp/
	* error.c (dump_module_suffix): New.
	(dump_simple_decl, dump_function_name): Use it.
	gcc/testsuite/
	* g++.dg/modules/err-1_[abcd].C: New.

2017-05-08  Nathan Sidwell  <nathan@acm.org>

	Merge trunk r247749.

	Implement 'export module foo;'
	gcc/cp/
	* cp-tree.h (declare_module): Add interface flag.
	(import_export_module): Rename to ...
	(import_module): ... here.  Lose export flag.
	* module.c (import_module): Determine exportness from export
	depth.
	(declare_module): Add interface flag, don't check attribs.
	* parser.c (check_module_outermost): Don't check export depth.
	(cp_parser_module_declaration): Don't deal with imports.
	(cp_parser_import_declaration): New.
	(cp_parser_module_export, cp_parser_declaration): Adjust.
	gcc/testsuite/
	* g++.dg/modules/import-1_[a-g].C: New.

	Implement DR2061
	gcc/cp/
	* name-lookup.c (push_inline_namespace): New.
	(push_namespace): Use it.  Check inline consistency here ...
	* parser.c (cp_parser_namespace_definition): ... not here.
	gcc/testsuite/
	* g++.dg/cpp0x/dr2061.C: New.
	* g++.dg/parse/namespace-alias-1.C: Augment.

	gcc/cp/
	* cp-tree.h, call.c, class.c, name-lookup.c, parser.c, pt.c,
	semantics.c, tree.c: Rename ovl2_iterator to lkp_iterator.

	gcc/cp/
	* name-lookup.h (push_namespace): Return int.
	* name-lookup.c (push_namespace): Return count of depth pushed.
	* parser.c (cp_parser_namespace_definition): Accumulate depth pushed.

2017-05-05  Nathan Sidwell  <nathan@acm.org>

	Merge trunk r247654.

	Merge trunk r247646.

	Merge trunk r247636.

	Indirect import lookup by tagging
	gcc/cp/
	* cp-tree.h (MAYBE_DECL_MODULE_INDEX): New.
	(DECL_GLOBAL_MODULE_P, DECL_THIS_MODULE_P): Delete.
	* mangle.c (maybe_write_module): Adjust.
	* module.c (cpms_out::write_tree, cpms_in::read_tree): Mark
	imported decls by tag.
	* name-lookup.h (key_module_instance, find_module_instance): Declare.
	* name-lookup.c (module_binding_slot): Allow search only.
	(key_module_instance): New.
	(find_module_instance): Use key.
	gcc/testsuite/
	* g++.dg/modules/mod-indirect-1_[a-e].C: New.

2017-05-04  Nathan Sidwell  <nathan@acm.org>

	Merge trunk r247612.
	gcc/testsuite/
	* g++.dg/lookup/using17.C: Adjust error message.

	Overload bindings
	gcc/cp/
	* module.c (cpms_in::tag_binding, cpms_out::tag_binding): Binding
	can be overload.
	(cpms_out::write_bindings): Write whole slot.
	(cpms_in::finish): Look for import match.
	(cpms_in::read_lang_decl_bools, cpms_out::write_lang_decl_bools,
	cpms_in::read_lang_decl_vals, cpms_out::write_lang_decl_vals):
	Implement.
	* name-lookup.c (push_module_binding): Binding can be overload.
	(find_module_instance): New.
	* name-lookup.h (find_module_instance): Declare.
	gcc/testsuite/
	* g++.dg/modules/mod-impl-1_[abcd]: Add overloads.

2017-05-03  Nathan Sidwell  <nathan@acm.org>

	Merge trunk r247593.

	gcc/cp/
	* cp-tree.h (LOOKUP_SEEN_P): Map to TREE_VISITED.
	(LOOKUP_FOUND_P, OVL_LOOKUP_P): Move to lang_flag_4

	Modules via index, working again!
	gcc/cp/
	* module.c (cpms_in::tag_binding): Set module index.
	gcc/testsuite/
	* g++.dg/modules/mod-impl-1_a.C: Remove xfail.

	Namespace partitions.
	gcc/cp/
	* cp-tree.h (MODULE_NAMESPACE_P, GLOBAL_MODULE_NAMESPACE_P,
	CURRENT_MODULE_NAMESPACE_P): Delete.
	(pop_module_namespace, push_module_namespace): Delete.
	* module.c (cpms_out::write_bindings, cpms_in::finish_namespace):
	Remove module namespace hacks.
	(push_module_namespace, pop_module_namespace): Delete.
	(module_to_ext): Swallow into ...
	(module_to_filename): ... here.
	(declare_module): Don't create module namespace symbol.
	* name-lookup.c (module_binding_slot): Fixup global module
	insertion.
	(is_nested_namespce, is_ancestor): Remove module namespace hacks.
	* parser.c (check_module_outermost, cp_parser_module_export,
	cp_parser_module_proclamation,
	cp_parser_namespace_definition): Likewise
	gcc/testsuite/
	* g++.dg/modules/mod-sym-[123].C: Remove xfails.
	* g++.dg/modules/mod-impl-1_a.C: Revert to run test.

	Namespace partitions.
	gcc/cp/
	* cp-tree.h (OVL_EXPORT_P): New. Move OVL_LOOKUP_P.
	(DECL_MODULE_EXPORT_P): Allow any DECL.
	(module_import_bitmap): Declare.
	* decl.c (cxx_init_decl_processing): Export global_namespace.
	* module.c (module_import_bitmap): New.
	(do_module_import): Install as global module, if needed.
	(declare_module): Freeze global imports.
	* name-lookup.c: Include bitmap.h.
	(name_lookup::process_binding): Take split bindings.
	(name_lookup::process_module_binding): New.
	(name_lookup::search_namespace_only): Adjust.
	* tree.c (ovl_insert): Sort by export_p too.

	Merge trunk r247550.

	Namespace partitions.
	gcc/cp/
	* cp-tree.h (MODULES_PER_BINDING_CLUSTER): Delete.
	(MODULE_VECTOR_NUM_CLUSTERS, MODULE_VECTOR_CLUSTER_BASE,
	MODULE_VECTOR_CLUSTER_LAST, MODULE_VECTOR_CLUSTER): New.
	(make_module_vec): Declare.
	* module.c (cpms_out::write_bindings): Look into MODULE_VECTOR.
	* name-lookup.c (modue_binding_slot): New.
	(name_lookup::merge_binding, name_lookup::process_binding): New.
	(name_lookup::search_qualified): Add usings parm.
	(name_lookup::search_namespace_only): Look into MODULE_VECTOR.
	(do_pushdecl): Create module slot.
	(find_namespace_partition): New, from ...
	(push_module_namespace): ... here.  Call it.
	(push_module_binding): Create module slot.
	(push_namespace): Adjust.
	* ptree.c (cxx_print_xnode): Print MODULE_VECTOR.
	* tree.c (make_module_vec): New.

2017-05-02  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* cp-tree.h (saved_scope): Add this_module.
	(current_module): New.
	* module.c (cpms_in): Add remapping vector.  Remove scope.
	(cpms_in::tag_import): Update remapping vector.
	(cpms_out::tag_binding, cpms_in::tag_binding): Write/read module no.
	* name-lookup.c (do_push_to_top_level): Set current_module.

	gcc/doc/
	* invoke.texi (-fdump-front-end): Document.

	Read/write direct namespace bindings part 2.
	gcc/cp/
	* module.c (cpms_out::tag_binding): Write the tag.
	(cpms_in::read_item): Detect rt_binding, set modules slot.
	(cpms_out::write_context_binding): Delete.
	(cpms_out::write_bindings): Simplify.
	(cpms_in::finish_function): Don't push function here.
	(cpms_in::finish_namespace): Adjust.
	(do_module_import): Adjust.
	* name-lookup.h (push_module_namespace): Declare.
	* name-lookup.c (push_module_namespace): New.

	Read/write direct namespace bindings part 1.
	gcc/cp/
	* cp-tree.def (module_vector): New tree type.
	* cp-tree.h (module_cluster, tree_module_vec): New tree.
	(enum cp_tree_node_structure_enum): Add TS_CP_MODULE_VECTOR.
	(lang_tree_node): Add tree_module_vec.
	* decl.c (cp_tree_node_structure): Detect MODULE_VECTOR.
	* module.c (cpms_out::tag_binding, cpms_in::tag_binding): New.
	(cpms_out::write_context_binding): New.
	(cpms_out::walk_namespace): Replace with ...
	(cpms_out::write_bindings): ... this.
	* name-lookup.h (push_module_binding): Declare.
	* name-lookup.c (push_module_binding): New.

2017-05-01  Nathan Sidwell  <nathan@acm.org>

	gcc/
	* tree.c (type_hash_default): Adjust ARRAY_TYPE hash.

	Import timestamp & crc
	gcc/cp
	* module.c (module_state): Add crc & stamp.
	(enum import_kind): New.
	(cpms_out::header, cpms_in::header): Check timestamps.
	(time2str, timestamp_mismatch): New.
	(cpms_out::tag_import, cpms_in::tag_import): Xfer indirect imports
	too.
	(read_module, do_module_import): Check timestamp & crc.
	gcc/testsuite/
	* g++.dg/modules/mod-stamp-1_[abcd].C: New.

	Proper mangle for module.  Still have namespace hack though.
	gcc/cp/
	* cp-tree.h (DECL_GLOBAL_MODULE_P, DECL_THIS_MODULE_P): Protect
	DECL_LANG_SPECIFIC.
	(decl_set_module, module_name, module_name_parts): New.
	* decl.c (duplicate_decls): Check moduleness.
	(grokfndecl): Set moduleness.
	* mangle.c (maybe_write_module): New.
	(write_name): Call it.
	* module.c (module_state::set_name): New.
	(decl_set_module, module_name, module_name_parts): New.
	gcc/testsuite/
	* g+.dg/modules.exp (dg-module-do, module_do_it): Adjust.
	* g++.dg/modules/mod-impl-1_a.C: Adjust & XFAIL.
	* g++.dg/modules/mod-impl-1_c.C: Likewise.
	* g++.dg/modules/mod-sym-1.C: Likewise.
	* g++.dg/modules/mod-sym-2.C: Likewise.
	* g++.dg/modules/mod-sym-3.C: Likewise.

2017-04-28  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* cp-tree.h (struct_lang_base): Add module_index.  Shrink selector.
	(DECL_MODULE_INDEX, DECL_GLOBAL_MODULE_P, DECL_THIS_MODULE_P): New.
	(EXPORTED_P): Rename to ..
	(DECL_EXPORTED_P): ... here.
	* modules.c: Adjust EXPORTED_P uses.

	Module indices and separated import/export info
	gcc/cp/
	* cp-tree.h (GLOBAL_MODULE_INDEX, THIS_MODULE_INDEX,
	IMPORTED_MODULE_BASE): New.
	(import_module, export_module): Replace with ...
	(import_export_module): ... this.
	* module.c: #include bitmap.h.
	(enum import_kind): Delete.
	(struct module_state): New.
	(modules, module_map, this_module): New.
	(imported_modules): Delete.
	(cpms_in::state): New member.  Update constructor.
	(cpms_in::tag_import, cpms_out::tag_import): Take is_export arg.
	(cpms_in::read_item): Assign module index.
	(module_user, is_interface): Delete.
	(dopen, dclose): Delete.  Move to call sites.
	(read_module): Return module index.
	(do_module_import): Reimplement.
	(import_module, export_module): Replace with ...
	(import_export_module): ... this.
	(declare_module, write_module, finish_module): Adjust.
	* parser.c (cp_parser_module_declaration): Adjust,
	gcc/testsuite/
	* g++.dg/modules/mod-decl-5_b.C: Adjust.

2017-04-27  Nathan Sidwell  <nathan@acm.org>

	Kill rt_import popping madness
	gcc/cp/
	* module.c (cpm_serial::rt_export): New tag.
	(cpms_in::tag_import): Do the importing right now.
	(cpms_in::read_item): ... not here.
	(read_module): Pass in dump file name, open it if needed.

	Kill walk_namespaces
	gcc/cp/
	* cp-tree.h (walk_namespaces): Delete.
	* decl.c (walk_namespaces_r, walk_namespaces): Delete.

	Rework module namespace walking
	gcc/cp/
	* name-lookup.h: (decapsulate_binding): Declare.
	* name-lookup.c: (decapsulate_binding): New.
	* module.c (cpms_out::walk_namespace): Iterate over namespace
	bindings, not decls.
	(imported_modules): Key by lang_identifier.  Adjust
	allocation/deletion.

	Refix unhidden extern C
	Revert 2017-04-26 extern_c_slot patch.
	gcc/cp/
	* name-lookup (do_pushdecl): Call check_extern_c_conflict when
	unhiding.
	gcc/testsuite/
	* g++.dg/lookup/extern-c-redecl.C: Adjust.
	* g++.dg/lookup/extern-c-hidden.C: New test.

	Merge trunk r247281.
	gcc/
	* tree.c (type_hash_default): Hash TYPE_TYPELESS_STORAGE.
	gcc/objc/
	* objc-gnu-runtime-abi-01.C (objc_add_static_instance): Use
	pushdecl langhook.

2017-04-26  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* name-lookup.c (extern_c_slot): New.
	(check_extern_c_conflict): Use it.
	(unhidden_extern_c): New.
	(do_pushdecl): Call it.

	gcc/cp/
	* name-lookup.c (extern_c_slot): New.
	(check_extern_c_conflict): Use it.
	(unhidden_extern_c): New.
	(do_puhdecl): Call it.

	Die IDENTIFIER_GLOBAL_BINDINGS! Die!
	gcc/
	* ipa-devirt.c (default_hash_traits <type_pair>): Add GTY((skip))s.
	gcc/cp/
	* cp-tree.h (lang_identifier): Remove namespace_bindings.
	(default_hash_traits<lang_identifier *>): Specialization.
	(IDENTIFIER_NAMESPACE_BINDINGS): Delete.
	(lang_decl_ns): Add bindings map.
	(DECL_NAMESPACE_BINDINGS): New.
	* lex.c (maybe_add_lang_decl_raw): Allocate namespace binding map.
	* name-lookup.c (create_namespace_binding): Delete.
	(find_namespace_binding): Split into ...
	(find_or_create_namespace_slot, find_namespace_slot): ... these.
	Update all callers.
	(extern_c_fns): Change to identifier map.
	* ptree.c (cxx_print_identifier): Remove IDENTIFIER_NAMESPACE_BINDINGS.

2017-04-25  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* name-lookup.c (find_namespace_binding): Return slot
	pointer. Adjust all callers.
	(update_binding): Add slot pointer arg.  Adjust.
	(check_extern_c_conflict): Cons up list of fns.
	(c_linkage_bindings): Use extern_c_fns map.

	gcc/cp/
	* name-lookup.c (extern_c_fns): New hash.
	(check_extern_c_conflict): Reimplement using hash map.
	(do_pushdecl): Move check_extern_c_conflict later.

	Namespace stat hack via special overload
	gcc/cp/
	* name-lookup.c (STAT_HACK_P, STAT_TYPE, STAT_DECL,
	MAYBE_STAT_DECL, MAYBE_STAT_TYPE): New.
	(stat_hack): New.
	(find_namespace_value, name_lookup::search_namespace_only,
	update_binding, do_pushdecl, set_identifier_type_value_with_scope,
	set_global_value, lookup_type_scope_1, do_pushtag): Adjust.

2017-04-24  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* name-lookup.c (add_local_decl): Delete.
	(name_lookup::add): Fold into ...
	(name_lookup::search_namespace_only): ... here.
	(update_binding): Allow pushing the same artificial type.
	(do_pushdecl): Explicitly set namespace type.
	(push_local_binding): Use add_decl_to_level.
	(set_identifier_type_Value_with_scope): Use update_binding for
	namespaces.

	gcc/cp/
	* name-lookup.c (do_nonmember_using_decl): Pass in pointers to
	value and type nodes.
	(do_local_using_directive): Use current_binding_level directly.
	(do_toplevel_using_directive): Adjust.
	(lookup_type_current_level): Delete.

	gcc/cp/
	* name-lookup.c (diagnose_name_conflict): Check decl context.
	(do_nonmember_using_decl): Simplify.
	gcc/testsuite/
	* g++.dg/lookup/using13.C: Adjust error.
	* g++.dg/lookup/using59.C: Likewise,

	gcc/cp/
	* cp-tree.h (SET_IDENTIFIER_GLOBAL_VALUE): Update.
	* name-lookup.h (set_namespace_value): Rename to ....
	(set_global_value): ... here.
	* name-lookup.c (update_namespace_binding): Delete.
	(set_namespace_value): Rename to ....
	(set_global_value): ... here.  Update binding directly.

2017-04-20  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* cp-tree.h (ovl_lookup_keep, ovl_lookup_mark, ovl_lookup_add,
	ovl_lookup_maybe_add): Rename to ...
	(lookup_keep, lookup_mark, lookup_add, lookup_maybe_add): ... these.

	Keep overloads correctly ordered
	gcc/cp/
	* cp-tree.h (ovl_iterator::unhide): Reimplement.
	(ovl_iterator::replace, ovl_iterator::ovl_unhide): Delete.
	(ovl_iterator::remove_node, ovl_iterator::unhide_node): Declare.
	(ovl_insert, ovl_lookup_maybe_add): Declare.
	* name-lookup.c (adl_lookup::add_functions): Adjust.
	(do_lookup_arg_dependent): Adjust.
	(do_nonmember_using_decl): Adjust.
	* pt.c (make_constrained_auto, do_class_deduction): Adjust.
	* tree.c (ov_move_unhidden, ovl_add): Delete.
	(ovl_copy, ovl_insert): New.
	(ovl_iterator::unhide_node, ovl_iterator::remove_node): New.
	(ovl_lookup_mark, ovl_lookup_add): Adjust.
	(ovl_lookup_maybe_add): New.
	(ovl_lookup_keep, ovl_skip_hidden): Adjust.
	(ovl_iterator::ovl_unhide, ovl_iterator::replace): Delete.
	* class.c (add_method): Adjust.

2017-04-14  Nathan Sidwell  <nathan@acm.org>

	Kill per-namespace static_decls.
	gcc/cp/
	* cp-tree.h (static_decls): Declare.
	(wrapup_globals_for_namespace,
	diagnose_inline_vars_for_namespace): Replace with ...
	(wrapup_namespace_globals): ... this.
	* decl.c (static_decls): Define.
	(wrapup_globals_for_namespace,
	diagnose_inline_vars_for_namespace): Replace with ...
	(wrapup_namespace_globals): ... this.
	(cxx_init_decl_processing): Initialize static_decls.
	* decl2.c (c_parse_final_cleanups): Adjust.
	* name-lookup.h (cp_binding_level): Remove static_decls member.
	* name-lookup.c (add_decl_to_level): Adjust.
	(begin_scope): Adjust.

	Merge namespace and local scope binding update
	gcc/cp/
	* name-lookup.c (add_namespace_decl): Delete.
	(namespace_push_binding, local_push_binding): Merge into ...
	(update_binding): ... this.
	(do_pushdecl): Adjust.

2017-04-13  Nathan Sidwell  <nathan@acm.org>

	Cleanups
	gcc/cp/
	* lex.c (unqualified_name_lookup_error): Use pushdecl.
	* name-lookup.h (push_local_binding): Delete.
	* name-lookup.c (add_decl_to_level): New, combining
	add_namespace_decl, add_local_decl.
	(namespace_push_binding, local_push_binding): Adjust.
	(do_pushdecl): Adjust.
	(push_local_binding): Make static.

	Unify binding push part 7
	gcc/cp/
	* name-lookup.c (namespace_push_binding): Merge duplicate code
	from local_push_binding.  Chain the decl.
	(do_pushdecl): Adjust.

	Cleanup pushdecl interface
	gcc/cp/
	* cp-lang.c (cxx_pushdecl): New.
	(LANG_HOOKS_PUSHDECL): Override.
	* name-lookup.h (pushdecl): Remove overload. Add default arg.
	* name-lookup.c (pushdecl): Likewise.
	gcc/c/
	* c-tree.h (pushdecl): Declare.
	gcc/c-family/
	* c-common.c (c_register_builtin_type): Use pushdecl lang hook.
	* c-common.h (pushdecl): Don't declare.	

	Some cleanups
	gcc/cp/
	* name-lookup.c (update_local_overload): Drop oldval parm.
	(replace_local_overload_binding): Delete.  Fold into only caller.
	(fixup_unhidden_decl): Likewise.
	(augment_local_overload_binding): Likewise.

	Unifying binding push part 6
	gcc/cp/
	* name-lookup.c (find_local_binding): New.  Broken out of ...
	(find_local_value): ... this.  Use it.
	(update_local_overload): New.  Broken out of ...
	(replace_local_overload_binding): ... this.  Use it.
	(do_pushdecl): Keep local binding around.
	(local_push_binding): Consume supplement_binding, add_local_decl.

	Unifying binding push part 5
	gcc/cp/
	* name-lookup.c (skip_anticipated_builtins): Kill.
	(namespace_push_binding): Consume supplement_binding.
	(do_pushdecl): Skip hidden builtin here.  Adjust.
	gcc/testsuite/
	* g++.dg/lookup/using59.C: New.

2017-04-12  Nathan Sidwell  <nathan@acm.org>

	Unifying binding push part 4
	gcc/cp/
	* name-lookup.c (namespace_push_binding, local_push_binding):
	Don't dup decls here. Deal with using.
	(do_pushdecl): Adjust.
	gcc/testsuite/
	* g++.dg/lookup/using58.C: New.

	Unifying binding push part 3
	gcc/cp/
	* name-lookup.c (create_local_binding) New.
	(do_local_push_overload): Turn into ...
	(local_push_binding): ... this.
	(do_pushdecl): Adjust.

	Unifying binding push part 2
	gcc/cp/
	* name-lookup.c (create_namespace_binding) New.
	(find_namespace_binding): Use it.
	(do_namespace_push_overload): Convert to ...
	(namespace_push_binding): ... this.
	(do_pusdecl): Adjust

	Unifying binding push part 1
	gcc/cp/
	* name-lookup.c (do_pusdecl): Skip using decls.  Retain namespace.

2017-04-11  Nathan Sidwell  <nathan@acm.org>

	Separating namespace bindings part 15
	gcc/cp/
	* cp-tree.h (PUSH_GLOBAL, PUSH_LOCAL, PUSH_USING): Delete.
	* lex.c (unqualified_name_lookup_error): Adjust push_local_binding
	call.
	* name-lookup.h (push_local_binding): Flags is now bool.
	* name-lookup.c (matching_using_decl_p): Rename to ...
	(matching_fn_p): ... here.  Update callers.
	(set_local_extern_decl_linkage): New.  Broken out of ...
	(do_pushdecl): ... here.  Call it.
	(push_local_binding, augment_local_overload_binding,
	do_local_push_overload, do_local_using_decl): Flags is now bool.
	gcc/testsuite/
	* g++.dg/lookup/extern-redecl1.C: New.
	* g++.dg/parse/ctor9.c: tweak.

	Separating namespace bindings part 14
	gcc/cp/
	* friend.c (do_friend): Use pushdecl directly.
	* name-lookup.h (lookup_name_innermost_nonclass_level): Delete.
	* name-lookup.c (find_local_value): New.  Broken out of ...
	(lookup_name_innermost_nonclass_level_1): ... here.  Call
	it.  Rename to ...
	(lookup_name_innermost_nonclass_level): ... this.  Delete external
	entry point.
	(do_pushdecl): Start handling binding levels directly.  Check
	local class friend injection rule.  More cleanup.
	gcc/testsuite/
	* g++.dg/lookup/friend12.C: Augment & adjust.
	* g++.old-deja/g++.jason/scoping12.C: Adjust.

	Separating namespace bindings part 13
	gcc/cp/
	* name-lookup.c (do_pushdecl): Some cleanups.

	Separating namespace bindings part 12
	gcc/cp/
	* name-lookup.c (do_pushdecl): Move overload pushing next to
	non-overload pushing.

2017-04-10  Nathan Sidwell  <nathan@acm.org>

	Separating namespace bindings part 11
	gcc/cp/
	* name-lookup.c (check_local_shadow): Move lookup code to here ...
	(do_pushdecl): ... from here.

	Separating namespace bindings part 10
	gcc/cp/
	* name-lookup.c (do_pushdecl): Reorder & delete more obsolete code.

	Separating namespace bindings part 9
	gcc/cp/
	* name-lookup.c (do_pushdecl): Delete a tonne of obsolete code.

2017-04-07  Nathan Sidwell  <nathan@acm.org>

	Fix bogus scope handling
	gcc/cp/
	* call.c (make_temporary_var_for_ref_to_temp): Push temp into
	current scope.
	* decl.c (xref_tag_1): Pass ts_lambda to pushtag.
	* name-lookup (do_pushtag): Deal with ts_lambda scope.
	gcc/testsuite
	* g++.dg/cpp0x/forw_enum9.C: Fix testcase.

2017-04-06  Nathan Sidwell  <nathan@acm.org>

	Separating namespace bindings part 8
	gcc/cp/
	* name-lookup.c (do_pushdecl): Kill obsolete C-era code!

	Separating namespace bindings part 7
	gcc/cp/
	* name-lookup.c (check_local_shadow, set_decl_context_in_fn): Break
	out and simplify from ... 
	(do_pushdecl): ... here.  Call them.

	Separating namespace bindings part 6
	gcc/c-family/
	* c-common.h (pushdecl_top_level): Delete.
	gcc/cp/
	* name-lookup.h (pushdecl_top_level): Delete non-friendly version.
	* name-lookup.c (check_extern_c_conflict): New.
	(lookup_extern_c_fun_in_all_ns): Delete.
	(do_pushdecl): Call it.  Rename variables sanely.
	(pushdecl_top_level): Delete non-friendly version.

2017-04-05  Nathan Sidwell  <nathan@acm.org>

	Separating namespace bindings part 5
	gcc/cp/
	* name-lookup.h (getdecls): Rename to ...
	(get_local_decls): ... here.
	* name-lookup.c (pop_bindings_and_leave_scope): Adjust.
	(do_pushdecl): Add some asserts.
	 (getdecls): Rename to ...
	(get_local_decls): ... here.  Assert local scope.
	* decl.c (poplevel): Adjust.
	(start_preparsed_function): Don't set current_function_decl, until
	decl is pushed.
	(store_parm_decls): Adjust.
	* parser.c (synthesize_implicit_template_parm): Adjust.

	Separating namespace bindings part 4
	gcc/cp/
	* cp-lang.c (LANG_HOOKS_GETDECLS): Override.
	(get_global_decls): New.
	* decl.c (poplevel): Assert not in namespace.  Simplify.
	* name-lookup.c (pop_binding): Rename to ...
	(pop_local_binding): ... here.
	(pop_bindings_and_leave_scope): Adjust.
	(getdecls): Assert not in namespace.
	* name-lookup.h (pop_binding): Rename to ...
	(pop_local_binding): ... here.

	Separating namespace bindings part 3
	gcc/cp/
	* name-lookup.c (do_local_push_overload): New, split out of ...
	(push_overloaded_decl_1): ... this.  Delete.
	(push_overloaded_decl): Delete.
	(do_pushdecl): Adjust.

	Separating namespace bindings part 2
	gcc/cp/
	* name-lookup.c (compparms_for_decl_and_using_decl): Replace with ...
	(matching_using_decl_p): ... this.
	(do_namespace_push_overload): New, split out of ...
	(push_overloaded_decl_1): ... this.
	(do_pushdecl): Adjust.
	(do_nonmember_using_decl): Adjust.

2017-04-04  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* name-lookup.h (get_global_value_if_present,
	is_typename_at_global_scope): Delete.
	* class.c (build_vtbl_initializer): Adjust.
	* decl.c (grokdeclarator)
	* except.c (do_get_exception_ptr, do_begin_catch, do_end_catch,
	do_allocate_exception, do_free_exception, build_throw): Adjust.
	* init.c (throw_bad_array_new_length): Adjust.
	* rtti.c (throw_bad_cast, throw_bad_typeid): Adjust.

	gcc/cp/
	* cp-tree.h (CPTI_INIT_LIST_IDENTIFIER, init_list_identifier): New.
	* decl.c (initialize_predefined_identifiers): Initialize
	initializer_list identifier.
	* call.c (is_std_init_list): Adjust.
	* name-lookup.c (do_pushtag): Likewise.
	* pt.c (listify): Likewise.

	Separating namespace bindings part 1
	gcc/cp/
	* name-lookup.h (namespace_binding, set_namespace_binding):
	Replace with ...
	(get_namespace_value, set_namespace_value): ... these.
	(get_global_value_if_present, is_typename_at_global_scope): Adjust.
	* cp-tree.h (IDENTIFIER_GLOBAL_VALUE,
	SET_IDENTIFIER_GLOBAL_VALUE): Adjust.
	(IDENTIFIER_NAMESPACE_VALUE, SET_IDENTIFIER_NAMESPACE_VALUE): Delete.
	* pt.c (listify): Use get_namespace_value.
	* decl.c (poplevel): Use get_namespace_value.
	* name-lookup.c (cp_binding_level_find_binding_for_name): Replace
	with ...
	(find_namespace_binding): ... this.
	(update_namespace_binding, find_namespace_value,
	add_namespace_decl, add_local_decl): New.
	(name_lookup::search_namespace_only,
	adl_lookup::assoc_namespace_only): Adjust.
	(binding_for_name, add_decl_to_level): Delete.
	(fixup_unhidden_decl, do_pushdecl, push_local_binding,
	check_for_out_of_scope_variable,
	set_identifier_type_value_with_scope, push_overloaded_decl_1): Adjust.
	(namespace_binding_1, namespace_binding): Replace with ...
	(get_namespace_value): ... this.
	(set_namespace_binding_1, set_namespace_binding): Replace with ...
	(set_namespace_value): ... this.
	(do_toplevel_using_decl, lookup_type_scope_1,
	lookup_name_innermost_nonclass_level_1, do_push_nested_namespace,
	push_namespace): Adjust.

2017-04-03  Nathan Sidwell  <nathan@acm.org>

	Merge trunk r246647.
	gcc/cp/
	* pt.c (): Adjust guiding decl code.
	libcc1/
	* libcp1plugin.cc (safe_pushdecl_maybe_friend): Adjust.
	(plugin_make_namespace_inline): Adjust.
	(plugin_add_using_namespace): Likewise.

	Remove usings graph.
	gcc/cp/
	* cp-tree.h (lang_decl_ns): Replace tree list ns_using, ns_users
	with tree vector usings & inlinees.
	(DCL_NAMES_SPACE_USING, DECL_NAMESPACE_INLINEES): Update.
	(TREE_INDIRECT_USING): Delete.
	* decl.c (cxx_init_decl_processing): Tweak.
	* name-lookup.h (cp_binding_level): using_directives is a vec.
	* name-lookup.c (name_lookup::do_queue_usings, queue_usings,
	search_namespace, search_usings, queue_namespace,
	search_unqualified, assoc_namespace_only): inlinees and usings are
	vectors.  Remove old TREE_LIST code.
	(namespace_ancestor_1, namespace_ancestor, add_using_namespace_1,
	add_using_namespace): Delete.
	(qualified_namespace_lookup): Tweak.
	(add_using_directive): New.
	(do_toplevel_using_directive, do_local_using_directive): Adjust.
	(push_namespace): Adjust.
	* tree.c (decl_anon_ns_mem_p): Reimplement.
	(cp_free_lang_data): Update.

2017-03-31  Nathan Sidwell  <nathan@acm.org>

	Reimplement unqualified namespace lookup
	gcc/cp/
	* name-lookup.c (name_lookup::state, name_lookup::preserve_state,
	name_lookup::restore_state): New.
	(name_lookup::queue_namespace,
	name_lookup::do_queue_usings, name_lookup::queue_usings,
	name_lookup::search_unqualified): New.
	(unqualified_namespace_lookup_1): Kill.
	(unqualified_namespace_lookup): Adjust.
	(lookup_using_namespace): Kill.
	gcc/testsuite/
	* g++.dg/lookup/lambda1.C: New.

	gcc/cp/
	* name-lookup.c (name_lookup::scopes): Make static. Adjust uses.
	(name_lookup::search_namespace_only): Broken out of ...
	(name_lookup::search_namespace): ... here.  Call it.
	* tree.c (ovl_cache): New.
	(ovl_make, ovl_lookup_keep): Use it.

2017-03-30  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* dump.c (cp_dump_tree): Allow nested overloads.

	Add SCOPE_DEPTH
	gcc/cp/
	* cp-tree.h (SCOPE_DEPTH): New.
	* decl.c (cxx_init_decl_processing): Set current_namespace.
	* name-lookup.h (is_nested_namespace): Declare.
	(is_associated_namespace): Delete.
	* name-lookup.c (is_nested_namespace): New.
	(is_ancestor): Use is_nested_namespace for namespaces.
	(set_decl_namespace): Use is_nested_namespace.
	(namespace_ancestor_1): Likewise.
	(is_associated_namespace): Delete.
	(push_namespace): Set SCOPE_DEPTH.
	* pt.c (check_specialization_namespace): Use is_nested_namespace.
	(check_unqualified_spec_or_inst): Likewise.

	Reimplement qualified namespace lookup
	gcc/cp/
	* name-lookup.c (cp_binding_level_find_binding_for_name): Remove
	premature optimiation.
	(find_binding): Delete.
	(name_lookup): Add flags, move scopes from adl_lookup.
	(name_lookup::search_namespace, search_usings, search_qualified): New.
	(tree_vec_contains): Kill.
	(qualified_namespace_lookup): Kill old O(N^2) code.

	gcc/cp/
	* pt.c (determine_specialization): Use 2-d iterator

2017-03-29  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* cp-tree.h (LOOKUP_MARKED_P, RECORD_MARKED_P): Rename to ...
	(LOOKUP_SEEN_P, LOOKUP_FOUND_P): ... here.  Update everywhere.

	gcc/cp/
	* name-lookup.c (arg_assoc::assoc_expr): Refactor.
	(do_lookup_arg_dependent): Renamed from lookup_arg_dependent_1.
	(lookup_arg_dependent): Adjust.
	(qualified_namespace_lookup): Renamed from
	qualified_lookup_using_namespace.

	Kill DECL_NAMESPACE_ASSOCATIONS
	gcc/cp/
	* cp-tree.h (DECL_NAMESPACE_INLINE_P): Renamed.
	(DECL_NAMESPACE_ASSCIATIONS): Delete.
	(DECL_NAMESPACE_INLINEES): New.
	* name-lookup.c (adl_lookup::assoc_namespace_only): New.
	(adl_lookup::assoc_namespace): Find parent, walk from there.
	(is_associated_namespace): Walk inline namespace tree.
	(push_namepace): Add to INLINEES not ASSOCIATIONS.

	gcc/cp/
	* lambda.c (maybe_add_lambda_conv_op): Use namespace_bindings_p.
	* method.c (implicitly_declare_fn): Likewise.
	* search.c (node_debug_info_needed): Likewise.

	gcc/cp/
	* name-lookup.h (finish_namespace_using_directive): Rename from
	...
	(finish_toplevel_using_directive): ... here.
	* name-lookup.c: Likewise.
	* parser.c (cp_parser_using_directive): Adjust.

2017-03-28  Nathan Sidwell  <nathan@acm.org>

	Cleanup pushdecl_top_level
	gcc/cp/
	* cp-tree.h (pushdecl_top_level_maybe_friend,
	pushdecl_top_level_and_finish): Delete.
	* decl.c (cp_make_fname_decl): Adjust.
	* decl2.c (get_guard, handle_tls_init): Likewise.
	* pt.c (tsubst_friend_class): Likewise.
	* rtti.c (get_tinfo_decl, tinfo_base_init): Likewise.
	* name-lookup.h (pushdecl_top_level, pushdecl_top_level_init): Declare.
	* name-lookup.c (pushdecl_top_level_1): Rename to ...
	(push_decl_top_level): ... here.
	(pushdecl_top_level_init): New.
	(pushdecl_top_level_maybe_friend): Delete.
	(pushdecl_top_level_and_finish): Delete.

	Cleanup pushdecl
	gcc/cp/
	* cp-tree.h (pushdecl, pushdecl_maybe_friend): Delete.
	(pushtag): Delete.
	* decl.c (cp_make_fname_decl): Call pushdecl_outermost_localscope.
	* lambda.c (insert_capture_proxy): Likewise.
	* friend.c (do_friend): Call overloaded pushdecl.
	* name-lookup.h (pushdecl_with_scope): Delete.
	(pushdecl, pushtag, pushdecl_outermost_localscope): Declare.
	* name-lookup.c (pushdecl_maybe_friend_1): Rename to ...
	(do_pushdecl): ... here.
	(pushdecl_maybe_friend): Replace with overloaded pushdecl.
	(pushdecl): Adjust.
	(pushdecl_with_scope_1): Rename to do_pushdecl_with_scope. Adjust.
	(pushdecl_with_scope): Delete.
	(pushdecl_outermost_localscope): New.
	(pushdecl_namespace_level): Adjust.
	(do_pushtag): Renamed from pushtag_1.
	(pushtag): Adjust.

	Cleanup namespace push/pop part 2
	gcc/cp/
	* module.c (cpms_in::finish_namespace): Adjust.
	(push_module_namespace): Adjust.
	* name-lookup.c (push_namespace, pop_namespace): Reimplement.
	(make_namespace_inline): Delete.
	* name-lookup.h (push_namespace): Change prototype.
	* parser.c (cp_parser_namespace_definition): Adjust.

	Cleanup namespace push/pop part 1
	gcc/cp/
	* cp-tree.h (CPTI_GLOBAL, CPTI_GLOBAL_IDENTIFIER, CPTI_GLOBAL_TYPE,
	CPTI_ANON_IDENTIFIER): New.
	(global_namespace, global_identifier, global_type_node,
	anon_identifier): New.
	* decl.c (global_type_node, global_scope_name): Delete.
	(initialize_predefined_identifiers): Add new idents.
	(cxx_init_decl_processing): Adjust.
	* name-lookup.h (global_namespace, global_scope_name,
	global_type_node): Delete.
	* name-lookup (global_namespace, anonymous_namespace_name,
	get_anonomous_namespace_name): Delete.
	(do_push_nested_namespace, do_pop_nested_namespace): New.
	(push_nested_namespace, pop_nested_namespace): Reimplement.

	Cleanup using-directives
	gcc/cp/
	* cp-tree.h (LOOKUP_MARKED_P): Rename from NAME_MARKED_P, update all.
	* name-lookup.h (finish_toplevel_using_directive,
	finish_local_using_directive): Declare.
	(do_using_directive, parse_using_directive): Delete.
	* name-lookup.c (do_using_directive): Delete.
	(do_toplevel_using_directive): Reimplement.
	(do_local_using_directive, do_local_using_directive_1): New.
	(parse_using_directive): Delete.
	(push_using_directive, push_using_directive_1): Delete.
	(finish_toplevel_using_directive, finish_local_using_directive): New.
	* pt.c (tsubst_expr): Adjust.
	* parser.c (cp_parser_using_directive): Adjust.

	Kill strong using
	gcc/
	* doc/extend.texi (Namespace Association): Document removal.
	gcc/cp/
	* name-lookup (parse_using_directive): Remove strong handling.
	gcc/testsuite/
	* g++.dg/lookup/strong-using-6.C: New.

2017-03-27  Nathan Sidwell  <nathan@acm.org>

	Simplify ADL part 2
	gcc/cp
	* cp-tree.h (RECORD_MARKED_P): New.
	* tree.c (ovl_lookup_keep): Allow NULL.
	* name-lookup.c (struct adl_lookup): New.
	(struct arg_lookup): Delete.

2017-03-24  Nathan Sidwell  <nathan@acm.org>

	gcc/
	* tree.h (TREE_CHECK6): New.
	(tree_check6): New.
	gcc/cp/
	* cp-tree.h (NAME_MARKED_P): Add UNION_TYPE.
	* name-lookup.c (arg_lookup): Replace namespace & class vectors
	with visited.
	(arg_assoc_namespace, arg_assoc_class): Use NAME_MARKED_P.
	(lookup_arg_dependent_1): Unmark namespaces and classes.

	gcc/cp/
	* cp-tree.h (ovl2_iterator::operator++): Tweak.

	Simplify ADL part 1
	gcc/cp/
	* cp-tree.h (OVL_LOOKUP_P, NAME_MARKED_P): New.
	(OVL_TRANSIENT_P): Morph into ...
	(OVL_USED_P): ... this.
	(ovl_add_transient): Kill.
	(ovl_maybe_keep): Replace with ...
	(ovl_lookup_keep): ... this.
	(ovl_lookup_mark, ovl_lookup_add): Declare.
	* tree.c (ovl_add): Rename arg.  Set OVL_LOOKUP_P.
	(ovl_add_transient): Kill.
	(ovl_lookup_mark, ovl_lookup_add): New.
	(ovl_maybe_keep): Rename to ...
	(ovl_lookup_keep): ... this.  Adjust.
	* name-lookup.c (name_lookup::add): Use ovl_add directly.
	(struct arg_lookup): Kill args and fn_set.
	(add_function): Replace with ...
	(add_functions): ... this.
	(arg_assoc_namespace, arg_assoc_class_only): Use it.
	(lookup_arg_dependent_1): Use new API.
	* pt.c (tsubst_copy): Assert OVERLOAD is marked used.
	* semantics.c (finish_call_expr): Adjust.

2017-03-23  Nathan Sidwell  <nathan@acm.org>

	Fixup transient_p bug
	gcc/cp/
	* tree.c (ovl_add): Set TRANSIENT_P here.
	(ovl_add_transient): Not here.

	gcc/cp/
	* cp-tree.h (type_unknown_p): Make inline.  Lose TREE_LIST case.
	* tree.c (type_unknown_p): Delete.
	* name-lookup.c (arg_assoc): Lose TREE_LIST case.

	gcc/cp/
	* cp-tree.h (OVL_P, OVL_PLURAL_P): New.
	* name-lookup.c (name_lookup::add, diagnose_name_conflict,
	pushdecl_maybe_friend_1, push_overloaded_decl_1,
	do_nonmember_using_decl, push_class_level_binding_1,
	set_decl_namespace, lookup_arg_dependent_1): Use OVL_P.

	Two dimensional OVERLOADs
	gcc/cp/
	* cp-tree.h (OVL_FIRST): Call ovl_first.
	(ovl_iterator): Add allow_inner, adjust.
	(ovl2_iterator): New.
	(ovl_first): New.
	* name-lookup.c (name_lookup::add): Create 2d overload.
	(do_nonmember_using_decl): 2D overload.
	(lookup_arg_dependent_1, cp_emit_debug_info_for_using): Likewise.
	* call.c (add_candidates): Likewise.
	* class.c (resolve_address_of_overloaded_function): Likewise.
	* parser.c (cp_parser_template_name): Likewise.
	* pt.c (type_dependent_expression_p): Likewise.
	(print_candidates_1): Likewise.
	* ptree.c (cxx_print_xnode): Allow inner overload.
	* semantics.c (finish_call_expr): Keep overload, 2D overload.
	* tree.c (ovl_scope): Allow inner overload.
	gcc/testsuite/
	* g++.dg/lookup/using57.C: New.

2017-03-22  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* name-lookup.c (lookup_qualified_name): Unwrap singleton
	overload.
	(lookup_name_real_1): Remove ovl_hidden assert.
	(lookup_arg_dependent_1): Don't skip hidden here.
	* parser.c (cp_parser_lookup_name): Don't unwrap singleton
	overload here.

2017-03-21  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* name-lookup.c (lookup_name_real_1): Don's skip hidden here.
	Simplify singleton overload extraction.
	* tree.c (ovl_add): Assert no unexpected 2 dimensional overloads.
	gcc/
	* system.h (ATTRIBUTE_NTC_PURE): Define.
	* tree.h (tree_fits_shwi_p, tree_fits_uhwi_p): Use it.

	Refactor lookup part 1
	gcc/cp/
	* name-lookup.c (struct name_lookup): New.
	(struct scope_binding): Delete.
	(EMPTY_SCOPE_BINDING): Delete.
	(build_ambigious): New.
	(name_lookup::add): New.
	(do_nonmember_using_decl): Take pointer to cxx_binding.  Adjust.
	(do_local_using_decl, do_toplevel_using_decl): Adjust.
	(merge_functions, same_entity_p, ambiguous_decl): Delete.
	(suggest_alternatives_for): Adjust lookup functions.
	(unqualified_namespace_lookup_1): Use name_lookup.
	(lookup_qualified_name): Likewise.
	(lookup_using_namespace, qualified_lookup_using_namespace): Take a
	name_lookup.
	gcc/testsuite/
	* g++.dg/lookup/using17.C: Adjust error message.

	Keep hidden overloads at start of OVERLOAD list
	gcc/cp/
	* cp-tree.h (OVL_HIDDEN_P): New.
	(ovl_iterator::hidden_p, unhide): New.
	(DECL_HIDDEN_P): New.
	(hidden_name_p, remove_hidden_names): Delete.
	(ovl_skip_hidden): Declare.
	* decl.c (builtin_function_1): Set DECL_ANTICIPATED before
	pushing.
	(xref_tag_1): Replace hidden_name_p with DECL_HIDDEN_P.
	* name-lookup.c (anticipated_builtin_p,
	skip_anticipated_buitins): New.
	(supplement_binding_1): Use anticipated_builtin_p.
	(replace_local_overload_binding): New. Broken out of
	augment_local_overload_binding.
	(fixup_unhidden_decl): New.
	(pushdecl_maybe_friend_1): Deal with unhiding decl.  Set
	DECL_ANTICIPATED before really pushing.
	(augment_local_overload_binding): Call replace_local_overload_binding.
	(push_overloaded_decl_1): Deal with unhiding decl.
	(do_nonmember_using_decl): Use anticipated_builtin_p.
	(ambiguous_decls): Use ovl_skip_hidden.
	(lookup_name_real_1): Use DECL_HIDDEN_P, ovl_skip_hidden.
	(arg_assoc_namespace): Use DECL_HIDDEN_P.
	(lookup_arg_dependent_1): Use ovl_skip_hidden.
	* pt.c (instantiate_class_template): Use DECL_HIDDEN_P.
	* tree.c (ovl_move_unhidden): New.
	(ovl_add): Deal with hiddenness.
	(ovl_add_transient): Adjust.
	(hidden_name_p, remove_hidden_names): Delete.
	(ovl_skip_hidden): New.
	(ovl_iterator::ovl_unhide): New.
	gcc/testsuite/
	* g++.dg/lookup/friend19.C: New.
	* g++.dg/lookup/using56.C: New.

2017-03-16  Nathan Sidwell  <nathan@acm.org>

	New OVERLOAD representation part 6
	gcc/cp/
	* cp-tree.h: Move ovl handling fns to original location.
	* tree.c (ovl_add): Use ovl_make.
	(ovl_add_transient): Use ovl_add.

	New OVERLOAD representation part 5
	gcc/cp/
	* cp-tree.h (OVL_NEXT): Delete. Update uses.
	(OVL_CHAIN): Check for overload.

	New OVERLOAD representation part 4
	gcc/cp/
	* cp-tree.h (OVL_CURRRENT): Delete.
	(ovl_make): Declare.
	* tree.c (ovl_make): New.
	* constraint.cc (finish_shorthand_constraint): Use ovl_make.
	* typeck.c (build_x_unary_op): Likewise.

	New OVERLOAD representation part 3
	gcc/cp/
	* cp-tree.h: Remove OVLNEW pieces.
	* tree.c: Likewise.

	New OVERLOAD representation part 2
	gcc/cp/
	* cp-tree.h (OVL_VIA_USING_P, OVL_TRANSIENT_P, OVL_SINGLE_P): New
	names.
	* error.c, name-lookup.c, parser.c, search.c, tree.c: Adjust uses.

2017-03-15  Nathan Sidwell  <nathan@acm.org>

	New OVERLOAD representation part 1
	gcc/cp/
	* cp-tree.h (OVL_LENGTH, OVL_USINGS, OVL_FIRST, OVL_NAME,
	OVL_SINGLE, OVL_ELT, OVL_HAS_USING, OVL_HAS_HIDDEN): New.
	(ovl_iterator): Implement new-style iterator.
	* tree.c (tree_ovl_elt_check_failed): New.
	(ovl_maybe_keep): Fixup bracing.
	(ovl_scope): Add new smarts.

	Vectorize OVERLOAD part 9
	gcc/cp/
	* cp-tree.h (build_new_function_call): Lose koenig_p arg.
	(OVL_HAS_USING): New.
	* call.c (build_new_function_call): Lose koenig_p arg.
	* name-lookup.c (augment_local_overload_binding): New.  Broken out
	of ...
	(push_overloaded_decl_1): ... here.  Call it.
	(do_nonmember_using_decl): Lose augment arg.
	(do_local_using_decl): Use augment_local_overload_binding.
	(do_toplevel_using_decl): Adjust do_nonmember_using_decl call.
	* search.c (lookup_field_r): Use OVL_HAS_USING.
	* pt.c (do_class_deduction): Adjust build_new_function_call call.
	* semantics.c (finish_call_expr): Likewise.

	Vectorize OVERLOAD part 8
	gcc/cp/
	* cp-tree.h (ovl_add_transient): Declare.
	* tree.c (ovl_add_transient): New.
	(remove_hidden_names): Build transient.
	* name-lookup.c (do_nonmember_using_decl): Add AUGMENT parm,
	adjust.
	(do_local_using_decl): Ask for newvals from
	do_nonmember_using_decl, iterate over that list.
	(do_toplevel_using_decl): Ask for augmented vals.
	(add_function): Return void.  Remove extraneous
	checks.  Update callers.
	* semantics.c (finish_call_expr): Always call ovl_maybe_keep.

	Vectorize OVERLOAD part 7
	gcc/cp/
	* name-lookup.c (hidden_name_p, remove_hidden_names): Move
	declarations to ...
	* cp-tree.h (hidden_name_p, remove_hidden_names): ... here.
	* call.c (build_new_function_call): Remove hidden pruning.
	* name-lookup.c (hidden_name_p, remove_hidden_names): Move to
	tree.c.
	(lookup_name_real_1): Adjust hidden_name_p call.
	(lookup_arg_dependent_1): Adjust remove_hidden_names call.
	* tree.c (hidden_name_p, remove_hidden_names): Moved from
	name-lookup.h.  Adjust.

	Vectorize OVERLOAD part 6
	gcc/cp/
	* cp-tree.h (OVL_TRANSIENT): Rename from OVL_ARG_DEPENDENT.
	* tree.c (ovl_maybe_keep): Adjust.
	* name-lookup.c (set_namespace_binding_1): Use OVL_SINGLE.
	(lookup_name_real_1): Use OVL_FIRST.
	(add_function): Set OVL_TRANSIENT.
	(lookup_arg_dependent_1): Use OVL_FIRST.
	(cp_emit_debug_info_for_using): Use iterator.

	Add OVERLOAD iterator part 8
	gcc/cp/
	* name-lookup.c (do_nonmember_using_decl): Use iterators

	Add OVERLOAD iterator part 7
	gcc/cp/
	* name-lookup.c (pushdecl_maybe_friend_1): Use OVL_FIRST.
	(push_overloaded_decl_1): Use iterators.
	(consider_binding_level): Use OVL_FIRST.

2017-03-14  Nathan Sidwell  <nathan@acm.org>

	Add OVERLOAD iterator part 6
	gcc/cp/
	* decl2.c (check_class_fn): Use iterators.
	* semantics.c (omp_reduction_lookup): Likewise.
	(finish_omp_reduction_clause): Don't OVL_FIRST here.

	Vectorize OVERLOAD part 5
	gcc/cp/
	* cp-tree.h (ovl_maybe_keep): Declare.
	* tree.c (ovl_maybe_keep): New.
	* semantics.c (finish_call_expr): Call it.
	(finish_omp_clauses): Use new accessrs.
	* class.c (handle_using_decl): Use new accessors.
	(resolve_address_of_overloaded_function): Likewise.
	* pt.c (print_candidates_1, print_candidates): Reimplement.

	Vectorize OVERLOAD part 5
	gcc/cp/
	* cp-tree.h (OVL_SINGLE): New.
	* constraint.cc (resove_constraint_check): Use new iterator.
	(normalize_template_id_expression): Use OVL_FIRST.
	* cvt.c (build_expr_type_conversions): Likewise.
	* error.c (dump_decl): Use OVL_SINGLE.
	* parser.c (cp_parser_nested_name_specifier_opt): Likewise.
	* tree.c (is_overloaded_fn): Likewise.

	Add OVERLOAD iterator part 5
	gcc/cp/
	* cp-tree.h (ovl_iterator::via_using_p): New.
	(ovl_iterator::replace): New.
	(clone_function_decl): Add via_using parm.
	* tree.c (ovl_iterator::replace): New.
	* class.c (add_method): Use ovl_iterator.
	(clone_function_decl): Add via_using parm.  Pass it to add_method.
	(clone_costructors_and_destructors): Pass via_using.
	* pt.c (tsubst_decl, instantiate_template_1): Update
	clone_function_decl call.

	Change add_method signature
	gcc/cp/
	* cp-tree.h (add_method): Change 3rd arg.
	* class.c (add_method): Change 3rd arg to bool. Update.
	(handle_using_decl, one_inheriting_sig, one_inherited_ctor,
	clone_function_decl, finish_struct): Update add_method calls.
	* lambda.c (maybe_add_lambda_conv_op): Likewise.
	* method.c (lazily_declare_fn): Likewise.
	* semantics.c (finish_member_declaration): Likewise.

2017-03-13  Nathan Sidwell  <nathan@acm.org>

	Kill get_first_fn part 3
	gcc/cp/
	* cp-tree.h (get_first_fn): Delete.
	* pt.c (iterative_hash_template_arg, tsubst_copy_and_build): Use
	get_ovl.
	(tsubst_baselink): Use OVL_NAME.
	* typeck.c (invalid_nonstatic_memfn_p, build_x_unary_op,
	cp_build_addr_expr_1): Use get_ovl.
	(finish_class_member_access_expr): Use OVL_NAME.
	* tree.c (dependent_name): Recode.
	(get_first_fn): Delete.

	Kill get_first_fn part 2
	gcc/cp/
	* cp-tree.h (get_ovl): Add want_first parm, make pure.
	* constexpr.c (potential_constant_expression_1): Adjust get_ovl.
	* lambda.c (lambda_function): Likewise.
	* error.c (dump_decl): Use identifier_p.
	* mangle.c (write_expression): Use OVL_NAME.
	* name-lookup.c (pushdecl_class_level): Likewise.
	* parser.c (cp_parser_postfix_expression,
	cp_parser_expression_statement, cp_parser_direct_declarator,
	cp_parser_constructor_declarator_p): Use get_ovl.
	* search.c (lookup_member0: Likewise.
	* typeck2.c (cxx_incomplete_type_diagnostic): Likewise.
	* semantics.c (perform_koenig_lookup): Use OVL_NAME.
	(finish_call_expr, finish_id_expression): Use get_ovl.
	* tree.c (get_ovl): Add want_first arg, adjust.

	Kill get_first_fn part 1
	gcc/cp/
	* call.c (add_list_candidates, build_new_method_call_1): Use
	OVL_FIRST directly.
	* constraint.cc (function_concept_check_p): Likewise.
	* name-lookup.c (validate_nonmember_using_decl): Likewise.
	* constexpr.c (potential_constant_expression_1): Use ovl_fns &
	OVL_FIRST.
	* lambda.c (lambda_function): Likewise.
	* decl.c (grokdeclarator): Use OVL_NAME.
	* error.c (dump_decl): Likewise.
	* friend.c (do_friend): Likewise.
	* mangle.c (write_expression): Likewise.

	Kill get_fns
	gcc/cp/
	* cp-tree.h (get_ovl): New.
	(get_fns): Delete.
	* parser.c (cp_parser_nested_name_specifier_opt): Update.
	* search.c (shared_member_p): Update.
	* semantics.c (omp_reduction_lookup): Update.

	Kill ovl_cons
	gcc/cp/
	* cp-tree.h (ovl_cons): Delete.
	* tree.c (ovl_cons): Delete.
	* class.c (add_method): Use ovl_add.
	* name-lookup.c (push_overloaded_decl_1): Likewise.
	* pt.c (check_explicit_specialization, do_class_deduction): Likewise.
	* typeck.c (build_x_unary_op): Likewise.

	Kill build_overload
	gcc/cp/
	* cp-tree.h (ovl_add): Declare.
	(build_overload): Delete.
	* tree.c (ovl_add): New.
	(build_overload): Delete.
	* class.c (add_method): Use ovl_add.
	* constraint.cc (finish_shorthand_constraint): Likewise.
	* name-lookup.c (do_nonmember_using_decl, merge_functions,
	remove_hidden_names, add_function): Likewise.
	* pt.c (make_constrained_auto): Likewise.

	Rename OVL_USED
	gcc/cp/
	* cp-tree.h (OVL_USED): Rename to ...
	(OVL_VIA_USING): ... here.
	* class.c (add_method): Update.
	* tree.c (ovl_scope): Update.
	* search.c (lookup_field_r): Update.
	* name-lookup.c (push_overloaded_decl_1,
	do_nonmember_using_decl): Update.

	Add OVERLOAD iterator part 4
	gcc/cp/
	* tree.c (cp_tree_equal): Use ovl_iterator.

	Vectorize OVERLOAD part 4
	gcc/cp/
	* cp-tree.h (ovl_iterator::ref): New.
	* semantics.c (finish_omp_reduction_clause): Use OVL_FIRST.
	* tree.c (is_overloaded_fn, get_fns): Likewise.

2017-03-10  Nathan Sidwell  <nathan@acm.org>

	Vectorize OVERLOAD part 3
	gcc/cp/
	* search.c (lookup_field_fuzzy_info::fuzzy_lookup_fn,
	lookup_conversion_operator, lookup_fnfields_idx_nolazy,
	lookup_conversions_r): Use new accessors.

	Vectorize OVERLOAD part 2
	gcc/cp/
	* decl2.c (mark_used): Use new accessors.
	* dump.c (cp_dump_tree): Likewise.
	* error.c (dump_decl, dump_expr, location_of): Likewise.
	* init.c (build_offset_ref): Likewise.
	* parser.c (cp_parser_nested_name_specifier_opt,
	cp_parser_lookup_name): Likewise.
	* pt.c (check_explicit_specialization, check_template_shadow,
	tsubst_baselink): Likewise.
	* ptree.c (cxx_print_xnode): Likewise.

	Vectorize OVERLOAD part 1
	gcc/cp/
	* cp-tree.h (OVL_FIRST, OVL_NAME): New accessors.
	* call.c (build_user_type_conversion_1,
	print_error_for_call_failure, add_candidates): Use them.
	* class.c (method_name_cmp, resort_method_name_cmp,
	resort_type_method_vec, finish_struct_methods, warn_hidden,
	resolve_address_of_overloaded_function,
	note_name_declared_in_class): Likwise.
	* cxx-pretty-print.c (pp_cxx_unqualified_id, pp_cxx_qualified_id,
	cxx_pretty_printer::id_expression,
	cxx_pretty_printer::expression): Likewise.
	* decl.c (poplevel): Likewise.
	* mangle.c (write_member_name): Likewise.
	* method.c (strip_inheriting_ctors): Likewise.
	* typeck.c (cp_build_addr_expr_1): Likewise.

	Makefile-supplied timestamp.
	gcc/cp
	* Make-lang.in: Provide MODULE_STAMP.
	* module.c (cpm_stream::version): Use MODULE_STAMP, not __DATE__ &
	__TIME__.

	Add OVERLOAD iterator part 3
	gcc/cp/
	* name-lookup.c (pushdecl_maybe_friend_1,
	lookup_extern_c_fun_in_all_ns, c_linkage_bindings,
	set_decl_namespace, pushdecl_top_level_and_finish (tree x,
	merge_functions, remove_hidden_names, arg_assoc_namespace,
	arg_assoc, lookup_arg_dependent_1, cp_emit_debug_info_for_using):
	Use new iterator. 
	* pt.c (retrieve_specialization, iterative_hash_template_arg,
	determine_specialization, check_explicit_specialization,
	resolve_overloaded_unification, resolve_nondeduced_context,
	type_dependent_expression_p, dependent_template_p,
	do_class_deduction): Likewise.

	Add OVERLOAD iterator part 2
	gcc/cp/
	* class.c (handle_using_decl,
	maybe_warn_about_overly_private_class, modify_all_vtables,
	get_basefndecls, warn_hidden, add_implicitly_declared_members,
	adjust_clone_args, deduce_noexcept_on_destructors, default_ctor_p,
	in_class_defaulted_default_constructor, user_provided_p,
	type_has_user_provided_constructor,
	type_has_user_provided_or_explicit_constructor,
	type_has_virtual_destructor, type_has_move_constructor,
	type_has_move_assign, type_has_user_declared_move_constructor,
	type_build_ctor_call, type_build_dtor_call,
	type_requires_array_cookie, explain_non_literal_class,
	finish_struct, resolve_address_of_overloaded_function): Use new
	iterator.
	* decl2.c (maybe_warn_sized_delete): Likewise.
	* parser.c (cp_parser_template_name): Tweak loop exit test.
	* semantics.c (finish_call_expr): Likewise.
	* typeck.c (check_template_keyword): Likewise.

	Add OVERLOAD iterator, part 1
	Add MAYBE_BASELINK_FUNCTIONS
	gcc/cp/
	* cp-tree.h (struct ovl_iterator): New.
	(MAYBE_BASELINK_FUNCTIONS): New.
	* call.c (build_op_call_1, add_candidates,
	build_op_delete_call): Use new iterator.
	* lambda.c (maybe_generic_this_capture): Likewise.
	* method.c (inherited_ctor_binfo, binfo_inherited_from): Likewise.
	* parser.c (lookup_literal_operator,
	cp_parser_template_name): Likewise.
	* search.c (shared_member_p, look_for_overrides_here,
	lookup_conversions_r): Likewise.
	* semantics.c (finish_call_expr,
	classtype_has_nothrow_assign_or_copy_p): Likewise.
	* typeck.c (check_template_keyword): Likewise.
	* tree.c (is_overloaded_fn, get_fns): Use MAYBE_BASELINK_FUNCTIONS.

	gcc/cp/
	* gcc/cp/cp-tree.h (NAMESPACE_CHECK): Delete.
	(MODULE_NAMESPACE_P, GLOBAL_MODULE_NAMESPACE,
	NAMESPACE_INLINE_P): Adjust.

	gcc/testsuite/
	* g++.dg/modules/modules.exp: Protect DEFAULT_CXXFLAGS.

2017-03-06  Nathan Sidwell  <nathan@acm.org>

	Add crc checkpointing.
	gcc/cp/
	* module.c (cpm_serial::crc): New.
	(cpm_serial::bit_flush): Compute crc.
	(cpm_serial::crc_unsigned_n, crc_buffer, crc_unsigned): New.
	(cpm_reader::checkpoint, cpm_writer::checkpoint): New.
	(cpm_reader, cpm_writer): Add checkpointing to io.
	(cpms_in, cpms_out): Likewise.

2017-03-05  Nathan Sidwell  <nathan@acm.org>

	Optimize crc.  Push to trunk
	gcc/
	* tree.h (crc32_unsigned_n): Declare.
	(crc32_unsigned, crc32_unsigned): Make inline.
	* tree.c (crc32_unsigned_bits): Replace with ...
	(crc32_unsigned_n): ... this.
	(crc32_unsigned, crc32_byte): Remove.
	(crc32_string): Remove unnecessary braces.

2017-03-04  Nathan Sidwell  <nathan@acm.org>

	Redo bool read/write
	gcc/cp/
	* module.c (cpm_serial::bit_flush): New.
	(cpm_writer::bytes4, cpm_writer::bflush: New.
	(cpm_reader::bytes4, cpm_reader::bflush, cpm_reader::bfill): New.
	(cpm_reader::fill): Rename from reserve.  Update callers.
	(cpm_writer::b, cpm_reader::b): Reimplement.
	(cpm_writer::flush_bits, cpm_reader::flush_bits): Delete.
	(cpms_out::write_tree_ary, cpms_in::read_tree_ary): Call bflush.
	(cpms_out::write_tree, cpms_in::read_tree): Likewise.

	Cleanup test pruning.  Push to trunk.
	gcc/testsuite/g++.dg
	* g++-dg.exp (find-cxx-tests): New.
	(main): Call it to discover direct tests rather than explicit pruning.

2017-03-03  Nathan Sidwell  <nathan@acm.org>

	Cleanup retrofit_lang_decl.  Push to trunk.
	gcc/cp/
	* cp-tree.h (add_lang_decl_raw, add_lang_type_raw): Rename.
	* lex.c (maybe_add_lang_decl_raw, maybe_add_lang_type_raw): Return
	bool.  Don't assert.
	(retrofit_lang_decl, cxx_make_type): Adjust.
	* module.c (cpms_in::read_tree): Verify lang_decl/type insertion
	valid.
	* class.c (alter_access): Directly call retrofit_lang_decl.
	* decl.c (push_local_name, duplicate_decls): Likewise.
	* pt.c (push_template_decl_real, txubs_omp_clauses): Likewise.
	* semantics.c (omp_privatize_field): Likewise.

	Renaming stuff.
	gcc/cp/
	* module.c: Remove anon namespace, rename seriator, reader,
	writer, streamer, in & out.

2017-03-01  Nathan Sidwell  <nathan@acm.org>

	Black triangle achieved
	gcc/cp/
	* cp-tree.h (GLOBAL_MODULE_NAMESPACE_P): New.
	(add_lang_decl_raw, add_lang_type_raw): Declare.
	* lex.c (add_lang_decl_raw): New.  Broken out of ...
	(retrofit_lang_decl): ... here.  Call it.
	(add_lang_type_raw): New.  Broken out of ...
	(cxx_make_type): ... here.  Call it.
	* module.c (out::write_decl_lang_bools, in::read_decl_lang_bools): New.
	(in::~in, in::set_scope): Correct.
	(out::write_tree, in::read_tree): Start lang_type/decl handling.
	(in::finish_type): Fix canonical type handling.
	(in::finish_function): Insert into symbol table.
	(in::finish_function): Preserve scope.
	gcc/testsuite/
	* g++.dg/modules/modules.exp: Add link & execute capability.
	* g++.dg/modules/mod-decl-2_b.C: Remove XFAILs.
	* g++.dg/modules/mod-decl-2_c.C: Remove XFAILs.
	* g++.dg/modules/mod-impl-1_a.C: New.
	* g++.dg/modules/mod-impl-1_b.C: New.
	* g++.dg/modules/mod-impl-1_c.C: New.
	* g++.dg/modules/mod-impl-1_d.C: New.

2017-02-17  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* module.c (in::finish_type): New.
	(in::finish): Call it.
	(out::write_core_vals, in::read_core_vals): Ensure canonical_type
	and type_main_variant are dumped early.
	gcc/testsuite/
	* g++/modules/mod-exp-1_b.C: Extend.

	Canonicalize canonical type hashing
	gcc/
	* tree.h (type_hash_default): Declare.
	* tree.c (type_hash_list, attribute_hash_list): Move into
	type_hash_default.
	(build_type_attribute_qual_variant): Break out hash code calc into
	type_hash_default.
	(type_hash_default): New.  Generic type hash computation.
	(build_range_type_1, build_array_type_1, build_function_type,
	build_method_type_directly, build_offset_type, build_complex_type,
	make_vector_type): Call it.
	gcc/c-family/
	* c-common.c (complete_array_type): Use type_hash_default.

2017-02-16  Nathan Sidwell  <nathan@acm.org>

	Namespace decls!
	gcc/cp/
	* module.c (out::write_tree_ary, in::read_tree_ary): New.
	(out::tag_trees, in::tag_trees): Repurpose.
	(in::finish_namespace, in::finish_function): New.
	(out::write_tree, in::read_tree): Adjust.
	(in::finish): Adjust.

	Some actual tree writing & reading
	gcc/cp/
	* module.c (out::write_core_bools, out::write_core_vals): New.
	(in::read_core_bools, in::read_core_vals): New.
	(in::set_scope): New.
	(out::write_tree, in::read_tree): Call core readers/writers.

	Node length & allocation.  Global trees.
	gcc/cp/
	* module.c (streamer::tags): Rename to ...
	(streamer::record_tag): ... here.  Fixup.
	(out::tag_trees, out::start, out::write_loc): New.
	(in::tag_trees, in::start, in::finish, in::read_loc): New.
	(out::write_tree, in::read_tree): Adjust.
	(write_module): Write global trees.

2017-02-15  Nathan Sidwell  <nathan@acm.org>

	Start of tree reading & writing.  Module namespace fix.
	gcc/cp/
	* cp-tree.h (pop_module_namespace, push_module_namespace): Add flag.
	* parser.c (check_module_outermost, cp_parser_module_export,
	cp_parser_module_proclamation, cp_parser_namespace_definition): Adjust.
	* module.c (pop_module_namespace, push_module_namespace): Add
	flag.
	(reader::read_tree, writer::write_tree): Initial stubs.
	(read_module, write_module, do_import_module, declare_module): Adjust.
	gcc/testsuite/
	* g++.dg/modules/mod-exp-1_a.C: New.
	* g++.dg/modules/mod-exp-1_b.C: New.
	* g++.dg/modules/mod-sym-1.C: Add cases.

2017-02-14  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* Make-lang.in (CFLAGS-cp/module.o): New var.
	* module.c (reader): Add peek_u.
	(reader::str): Force ending NUL.
	(writer::flush_bits): Avoid infinite recursion.
	(streamer): Extend tags, add next.
	(out, in): Add some readers/writers.
	(read_module, do_import_module, write_module): Augment.
	gcc/testsuite/
	* g++.dg/modules/mod-imp-1_a.C
	* g++.dg/modules/mod-imp-1_b.C
	* g++.dg/modules/mod-imp-1_c.C
	* g++.dg/modules/mod-imp-1_d.C

2017-02-10  Nathan Sidwell  <nathan@acm.org>

	Start actually writing & reading module files. (headers only)
	gcc/cp/
	* module.c (seriator, reader, writer, streamer, in, out): New
	classes.
	(read_module, do_import_module, write_module, finish_module): Adjust.

	gcc/
	* gengtype-lex.l (<in_struct>): Add '/'.

2017-02-09  Nathan Sidwell  <nathan@acm.org>

	Dump file
	gcc/
	* dumpfile.h (tree_dump_index): Add TDI_lang.
	(TDF_LANG): New.
	* dumpfile.c (dump_files): Add front-end.
	(dump_option_value_info): Add lang.  Adjust all.
	gcc/cp/
	* cp-tree.h (import_module): Lose is_export parm.
	* module.c: Include dumpfile.h
	(dopen, dclose): New.
	(import_add): Absorb into ...
	(do_import_module): ... here.  Broken out of ...
	(import_module): ... here.  Call it.
	(export_module, declare_module): Adjust.
	(read_module, write_module): Write dump.
	gcc/testsuite/
	* g++.dg/modules/mod-decl-1.C: Adjust.
	* g++.dg/modules/mod-decl-2_b.C: Adjust.
	* g++.dg/modules/mod-decl-5_b.C: Adjust.

	gcc/cp/
	* cp-tree.h (DECL_CHECK): New.
	(NAMESPACE_MODULE_P): Rename to ...
	(MODULE_NAMESPACE_P): ... here.
	(CURRENT_MODULE_NAMESPACE_P): New.
	(MODULE_EXPORT_P): New.
	(import_module): Add is_export param.
	* module.c (mstream, mfname): Delete.
	(imported_modules): Make hash_map.
	(enum import_kind): New.
	(push_module_namespace, pop_module_namespace): Adjust.
	(import_add, import_module, export_module): Adjust.
	(read_module, write_module): New.
	(declare_module, finish_module): Adjust.
	* name-lookup.c (is_ancestor): Adjust.
	gcc/testsuite/
	* g++.dg/modules/mod-decl-5_b.C: Adjust
	* g++.dg/modules/modules.exp: Remote host, tweak module deletion.

2017-02-08  Nathan Sidwell  <nathan@acm.org>

	gcc/cp/
	* name-lookup.c (is_ancestor): Pop from module namespace root.
	gcc/testsuite/
	* g++.dg/modules/mod-sym-3.C: New.

	Module namespaces
	gcc/cp/
	* cp-tree.h (NAMESPACE_MODULE_P): New.
	(push_module_namespace, pop_module_namespace): Declare.
	* module.c (MOD_SYM_PFX, MOD_SYM_DOT): New.
	(module_namespace_name): New.
	(push_module_namespace, pop_module_namespace): New.
	(module_to_ext): New. Broken out of ...
	(module_to_filename): ... here. Call it.
	(declare_module): Push to module namespace.
	* parser.c (check_module_outermost): Deal with module namespace.
	(cp_parser_module_export, cp_parser_module_proclaimation,
	cp_parser_namespace_definition): Likewise.
	gcc/testsuite/
	* g++.dg/modules/mod-decl-1.C: Adjust.
	* g++.dg/modules/mod-sym-1.C: New.
	* g++.dg/modules/mod-sym-2.C: New.

	Cleanup inline namespace creation.
	gcc/cp/
	* name-lookup.h (make_namespace_inline): Declare.
	* name-lookup.c (do_toplevel_using_directive): New.
	(do_using_directive): Call it.
	(make_namespace_inline): New.
	* parser.c (cp_parser_namespace_definition): Call it.

2017-02-07  Nathan Sidwell  <nathan@acm.org>

	PR c++/79369 inline namespaces
	gcc/cp/
	* cp-tree.h (NAMESPACE_CHECK): New.
	(NAMESPACE_INLINE_P): New.
	* name-lookup.h (push_namespace): Return int.
	* name-lookup.c (push_namespace): Return int. Adjust.
	* parser.c (cp_parser_namespace_definition): Reorder nested
	parsing.  Check inline redefinition.
	gcc/testsuite/
	* g++.dg/cpp0x/pr65558.C: Adjust error loc.
	* g++.dg/cpp0x/pr79369.C: New.
	* g++.dg/cpp1z/nested-namespace-def1.C: Adjust.

2017-02-03  Nathan Sidwell  <nathan@acm.org>

	Module files open/closed.  Testsuite extension
	gcc/cp/
	* module.c (mstream, mfname): New.
	(module_to_filename): New.
	(import_module, declare_module, finish_module): Open/close module file.
	gcc/testsuite/
	* g++.dg/modules/modules.exp (mod_spec_to_file, dg-module-if,
	check_module_specs, cleanup_module_files): New.
	* g++.dg/modules/mod-decl-0.C: Adjust
	* g++.dg/modules/mod-decl-1.C: Adjust
	* g++.dg/modules/mod-decl-2_a.C: Adjust
	* g++.dg/modules/mod-decl-3.C: New.
	* g++.dg/modules/mod-decl-3_a.C: Delete.
	* g++.dg/modules/mod-decl-3_b.C: Delete.
	* g++.dg/modules/mod-decl-4.C: Adjust
	* g++.dg/modules/mod-decl-5_a.C: Adjust
	* g++.dg/modules/mod-decl-5_b.C: Adjust
	* g++.dg/modules/proclaim-1.C: Adjust

	Module names are identifiers.
	gcc/cp/
	* config-lang.in (gtfiles): Add modules.c.
	* c-tree.h (module_name_t): Delete.
	(finish_module): Declare.
	* decl2.c (c_pare_final_cleanups): Call finish_module.
	* module.c: Change module_name_t to tree.
	(imported_module): Hash of module names.
	(import_add): New.
	(import_module, declare_module): Use it.
	(export_module): Import module.
	(finish_module): New.
	* parser.c (cp_parser_module_name): Build up identifier.  Adjust
	callers.
	gcc/testsuite/
	* g++.dg/modules/mod-decl-0.C: Adjust.
	* g++.dg/modules/mod-decl-1.C: Adjust.
	* g++.dg/modules/mod-decl-2_b.C: Adjust.
	* g++.dg/modules/mod-decl-2_c.C: New.
	* g++.dg/modules/mod-decl-5_a.C: New.
	* g++.dg/modules/mod-decl-5_b.C: New.

2017-02-02  Nathan Sidwell  <nathan@acm.org>

	[[interface]]
	gcc/cp
	* cp-tree.h: Adjust module interface fns.
	* modules.c (is_interface): New.
	(push_module_export, pop_module_export, module_exporting_level):
	Adjust.
	(module_proclaim): Delete.
	(module_interface_p): New.
	(declare_module): Use 'interface' attrib.
	(mport_module, export_module): Take attribs.
	* parser.c (check_module_outermost, cp_parser_module_declaration,
	cp_parser_module_export, cp_parser_module_proclamation): Adjust.
	gcc/testsuite/
	* g++.dg/modules/mod-decl-2_a.C: Adjust.
	* g++.dg/modules/mod-decl-3_a.C: Adjust.
	* g++.dg/modules/proclaim-1.C: Adjust.
	* g++.dg/modules/mod-decl-4.C: New.

2017-01-27  Nathan Sidwell  <nathan@acm.org>

	Parse proclaimed ownership.
	gcc/cp/
	* cp-tree.h (module_exporting_p, module_proclaim): Declare.
	* module.c (proclaimer): New.
	(module_exporting_p, module_proclaim): New.
	* parser.c (check_module_outermost): New.
	(cp_parser_module_declaration, cp_parser_module_export): Call it.
	(cp_parser_module_proclamation): New.
	(cp_parser_declaration): Add proclaimed-ownership.
	gcc/testsuite/
	* g++.dg/modules/proclaim-1.C: New.

	Parse import & export.  Test infra.
	gcc/cp/
	* cp-tree.h (module_purview_p, push_module_export,
	pop_module_export, declare_module, import_module,
	export_module): Declare.
	* module.c (export_depth): New.
	(module_purview_p, push_module_export, pop_module_export): New
	(declare_module_name): Renme to ...
	(declare_module): ... here.
	(import_module, export_module): Stubs.
	* parser.c (cp_parser_module_declaration): Add IS_EXPORT
	parm. Deal with imports & exports.
	(cp_parser_module_export): New.
	(cp_parser_declaration): Allow module import, export.
	gcc/testsuite/
	* g++.dg/dg.exp: Prune module tests.
	* g++.dg/modules/modules.exp: New.
	* g++.dg/modules/mod-decl-2_[ab].C: New.
	* g++.dg/modules/mod-decl-3_[ab].C: New.

2017-01-25  Nathan Sidwell  <nathan@acm.org>

	Parse module-declaration.
	gcc/cp
	* cp-tree.h (module_name_t): Typedef.
	(declare_module_name): Declare.
	* parser.c (cp_parser_diagnose_invalid_type_name): Explain
	fmodules.
	(cp_parser_module_name, cp_parser_module_declaration): New.
	(cp_parser_declaration): Add module-declaration.
	* module.c (declared_module, module_location): New.
	(declare_module_name): Define.
	gcc/testsuite/
	* g++.dg/modules/mod-decl-0.C: New.
	* g++.dg/modules/mod-decl-1.C: New.

	New flag & keywords, etc
	gcc/c-family/
	* c-common.c (c_common_reswords): Add 'module', 'import'.
	* c-common.h (enum rid): Add RID_MODULE, RID_IMPORT.
	(D_CXX_MODULES, D_CXX_MODULES_FLAGS) New.
	* c-cppbuiltins.c (c_cpp_builtins): Add _cpp_modules define.
	* c.opt: Add fmodules flag.
	gcc/cp/
	* Make-lang.in (CXX_AND_OBJCXX_OBJS): Add module.o.
	* module.c: New file.
	gcc/
	* doc/invoke.texi (-fmodules): Document it.

2017-01-24  Nathan Sidwell  <nathan@acm.org>

	Free up TREE_LANG_FLAG_3.  DECL_CONSTRUCTION_VTABLE_P is useless.
	gcc/cp/
	* cp-tree.h (DECL_CONSTRUCTION_VTABLE_P): Delete.
	(DECL_NON_TRIVIALLY_INITIALIZED_P): Move to TREE_LANG_FLAG_6.
	* class.c (build_ctor_vtbl_group): Don't set
	DECL_CONSTRUCTION_VTABLE_P.
	* decl2.c (determine_visibility_from_class): Don't check
	DECL_CONSTRUCTION_VTABLE_P anymore.

2017-01-23  Nathan Sidwell  <nathan@acm.org>

	Branch creation from trunk:244828
	Use this Changelog for all branch changes, including merges.

Local Variables:
mode: change-log
change-log-default-name: "ChangeLog.modules"
End:
$Rev$