File: llvm-3.9.0_threads.patch

package info (click to toggle)
julia 1.0.3%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 49,452 kB
  • sloc: lisp: 236,453; ansic: 55,579; cpp: 25,603; makefile: 1,685; pascal: 1,130; sh: 956; asm: 86; xml: 76
file content (5545 lines) | stat: -rw-r--r-- 190,165 bytes parent folder | download
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
From d1cc48989b13780f21c408fef17dceb104a09c9d Mon Sep 17 00:00:00 2001
From: Alex Crichton <alex@alexcrichton.com>
Date: Thu, 28 Jan 2016 20:44:50 -0800
Subject: [PATCH] Don't compile usage of std::thread

As of the time of this writing it's not actually used anywhere meaningfullly
throughout the LLVM repo that we need, and it unfortunately uses `std::thread`
which isn't available in mingw-w64 toolchains with the win32 threading model
(the one that we use).

The change made to achive this was to just always use the single-threaded
support in `include/llvm/Support/thread.h`, and hopefuly that'll be enough...

For reference, the upstream LLVM bug has been reported [1]

[1]: https://llvm.org/bugs/show_bug.cgi?id=26365
---
 include/llvm/ExecutionEngine/Orc/RPCChannel.h |   13 -
 include/llvm/ExecutionEngine/Orc/RPCUtils.h   |   16 +-
 include/llvm/Support/ThreadPool.h             |    4 +
 include/llvm/Support/thread.h                 |    2 +-
 lib/CodeGen/ParallelCG.cpp                    |    2 +
 lib/LTO/ThinLTOCodeGenerator.cpp              |    4 +-
 lib/Support/ThreadPool.cpp                    |    6 +-
 test/CMakeLists.txt                           |    1 -
 tools/lli/CMakeLists.txt                      |    5 -
 tools/lli/ChildTarget/CMakeLists.txt          |   10 -
 tools/lli/ChildTarget/ChildTarget.cpp         |   78 --
 tools/lli/ChildTarget/LLVMBuild.txt           |   21 -
 tools/lli/LLVMBuild.txt                       |    3 -
 tools/lli/OrcLazyJIT.cpp                      |  158 ----
 tools/lli/OrcLazyJIT.h                        |  163 ----
 tools/lli/RemoteJITUtils.h                    |  152 ---
 tools/lli/lli.cpp                             |    7 +
 tools/llvm-cov/CMakeLists.txt                 |   18 +-
 tools/llvm-cov/CodeCoverage.cpp               |  727 ---------------
 tools/llvm-cov/CoverageFilters.cpp            |   59 --
 tools/llvm-cov/CoverageFilters.h              |  127 ---
 tools/llvm-cov/CoverageReport.cpp             |  235 -----
 tools/llvm-cov/CoverageReport.h               |   41 -
 tools/llvm-cov/CoverageSummaryInfo.cpp        |   71 --
 tools/llvm-cov/CoverageSummaryInfo.h          |  162 ----
 tools/llvm-cov/CoverageViewOptions.h          |   52 --
 tools/llvm-cov/RenderingSupport.h             |   61 --
 tools/llvm-cov/SourceCoverageView.cpp         |  233 -----
 tools/llvm-cov/SourceCoverageView.h           |  285 ------
 tools/llvm-cov/SourceCoverageViewHTML.cpp     |  436 ---------
 tools/llvm-cov/SourceCoverageViewHTML.h       |   83 --
 tools/llvm-cov/SourceCoverageViewText.cpp     |  213 -----
 tools/llvm-cov/SourceCoverageViewText.h       |   83 --
 tools/llvm-cov/TestingSupport.cpp             |   92 --
 tools/llvm-cov/gcov.cpp                       |  145 ---
 tools/llvm-cov/llvm-cov.cpp                   |   79 --
 tools/sancov/sancov.cc                        | 1244 +------------------------
 37 files changed, 43 insertions(+), 5048 deletions(-)
 delete mode 100644 tools/lli/ChildTarget/CMakeLists.txt
 delete mode 100644 tools/lli/ChildTarget/ChildTarget.cpp
 delete mode 100644 tools/lli/ChildTarget/LLVMBuild.txt
 delete mode 100644 tools/lli/OrcLazyJIT.cpp
 delete mode 100644 tools/lli/OrcLazyJIT.h
 delete mode 100644 tools/lli/RemoteJITUtils.h
 delete mode 100644 tools/llvm-cov/CodeCoverage.cpp
 delete mode 100644 tools/llvm-cov/CoverageFilters.cpp
 delete mode 100644 tools/llvm-cov/CoverageFilters.h
 delete mode 100644 tools/llvm-cov/CoverageReport.cpp
 delete mode 100644 tools/llvm-cov/CoverageReport.h
 delete mode 100644 tools/llvm-cov/CoverageSummaryInfo.cpp
 delete mode 100644 tools/llvm-cov/CoverageSummaryInfo.h
 delete mode 100644 tools/llvm-cov/CoverageViewOptions.h
 delete mode 100644 tools/llvm-cov/RenderingSupport.h
 delete mode 100644 tools/llvm-cov/SourceCoverageView.cpp
 delete mode 100644 tools/llvm-cov/SourceCoverageView.h
 delete mode 100644 tools/llvm-cov/SourceCoverageViewHTML.cpp
 delete mode 100644 tools/llvm-cov/SourceCoverageViewHTML.h
 delete mode 100644 tools/llvm-cov/SourceCoverageViewText.cpp
 delete mode 100644 tools/llvm-cov/SourceCoverageViewText.h
 delete mode 100644 tools/llvm-cov/TestingSupport.cpp
 delete mode 100644 tools/llvm-cov/gcov.cpp

diff --git a/include/llvm/ExecutionEngine/Orc/RPCChannel.h b/include/llvm/ExecutionEngine/Orc/RPCChannel.h
index c569e3c..9fb0141 100644
--- a/include/llvm/ExecutionEngine/Orc/RPCChannel.h
+++ b/include/llvm/ExecutionEngine/Orc/RPCChannel.h
@@ -40,42 +40,29 @@ class RPCChannel {
 
   /// Flush the stream if possible.
   virtual Error send() = 0;
-
-  /// Get the lock for stream reading.
-  std::mutex &getReadLock() { return readLock; }
-
-  /// Get the lock for stream writing.
-  std::mutex &getWriteLock() { return writeLock; }
-
-private:
-  std::mutex readLock, writeLock;
 };
 
 /// Notify the channel that we're starting a message send.
 /// Locks the channel for writing.
 inline Error startSendMessage(RPCChannel &C) {
-  C.getWriteLock().lock();
   return Error::success();
 }
 
 /// Notify the channel that we're ending a message send.
 /// Unlocks the channel for writing.
 inline Error endSendMessage(RPCChannel &C) {
-  C.getWriteLock().unlock();
   return Error::success();
 }
 
 /// Notify the channel that we're starting a message receive.
 /// Locks the channel for reading.
 inline Error startReceiveMessage(RPCChannel &C) {
-  C.getReadLock().lock();
   return Error::success();
 }
 
 /// Notify the channel that we're ending a message receive.
 /// Unlocks the channel for reading.
 inline Error endReceiveMessage(RPCChannel &C) {
-  C.getReadLock().unlock();
   return Error::success();
 }
 
diff --git a/include/llvm/ExecutionEngine/Orc/RPCUtils.h b/include/llvm/ExecutionEngine/Orc/RPCUtils.h
index 966a496..b6c8ebd 100644
--- a/include/llvm/ExecutionEngine/Orc/RPCUtils.h
+++ b/include/llvm/ExecutionEngine/Orc/RPCUtils.h
@@ -102,6 +102,7 @@ class RPCBase {
 
     template <typename ChannelT>
     static Error readResult(ChannelT &C, std::promise<OptionalReturn> &P) {
+#if 0
       RetT Val;
       auto Err = deserialize(C, Val);
       auto Err2 = endReceiveMessage(C);
@@ -112,11 +113,14 @@ class RPCBase {
         return Err;
       }
       P.set_value(std::move(Val));
+#endif
       return Error::success();
     }
 
     static void abandon(std::promise<OptionalReturn> &P) {
+#if 0
       P.set_value(OptionalReturn());
+#endif
     }
 
     template <typename ChannelT, typename SequenceNumberT>
@@ -159,11 +163,17 @@ class RPCBase {
     template <typename ChannelT>
     static Error readResult(ChannelT &C, std::promise<OptionalReturn> &P) {
       // Void functions don't have anything to deserialize, so we're good.
+#if 0
       P.set_value(true);
+#endif
       return endReceiveMessage(C);
     }
 
-    static void abandon(std::promise<OptionalReturn> &P) { P.set_value(false); }
+    static void abandon(std::promise<OptionalReturn> &P) {
+#if 0
+        P.set_value(false);
+#endif
+    }
 
     template <typename ChannelT, typename SequenceNumberT>
     static Error respond(ChannelT &C, SequenceNumberT SeqNo,
@@ -617,13 +627,11 @@ class RPC : public RPCBase {
     }
 
     void reset() {
-      std::lock_guard<std::mutex> Lock(SeqNoLock);
       NextSequenceNumber = 0;
       FreeSequenceNumbers.clear();
     }
 
     SequenceNumberT getSequenceNumber() {
-      std::lock_guard<std::mutex> Lock(SeqNoLock);
       if (FreeSequenceNumbers.empty())
         return NextSequenceNumber++;
       auto SequenceNumber = FreeSequenceNumbers.back();
@@ -632,12 +640,10 @@ class RPC : public RPCBase {
     }
 
     void releaseSequenceNumber(SequenceNumberT SequenceNumber) {
-      std::lock_guard<std::mutex> Lock(SeqNoLock);
       FreeSequenceNumbers.push_back(SequenceNumber);
     }
 
   private:
-    std::mutex SeqNoLock;
     SequenceNumberT NextSequenceNumber = 0;
     std::vector<SequenceNumberT> FreeSequenceNumbers;
   };
diff --git a/include/llvm/Support/ThreadPool.h b/include/llvm/Support/ThreadPool.h
index 665cec2..c3aa64d 100644
--- a/include/llvm/Support/ThreadPool.h
+++ b/include/llvm/Support/ThreadPool.h
@@ -16,6 +16,8 @@
 
 #include "llvm/Support/thread.h"
 
+# if 0
+
 #ifdef _MSC_VER
 // concrt.h depends on eh.h for __uncaught_exception declaration
 // even if we disable exceptions.
@@ -134,4 +136,6 @@ class ThreadPool {
 };
 }
 
+# endif
+
 #endif // LLVM_SUPPORT_THREAD_POOL_H
diff --git a/include/llvm/Support/thread.h b/include/llvm/Support/thread.h
index 9c45418..27d42d2 100644
--- a/include/llvm/Support/thread.h
+++ b/include/llvm/Support/thread.h
@@ -19,7 +19,7 @@
 
 #include "llvm/Config/llvm-config.h"
 
-#if LLVM_ENABLE_THREADS
+#if LLVM_ENABLE_THREADS && 0
 
 #ifdef _MSC_VER
 // concrt.h depends on eh.h for __uncaught_exception declaration
diff --git a/lib/CodeGen/ParallelCG.cpp b/lib/CodeGen/ParallelCG.cpp
index ccdaec1..1f35590 100644
--- a/lib/CodeGen/ParallelCG.cpp
+++ b/lib/CodeGen/ParallelCG.cpp
@@ -49,6 +49,7 @@ std::unique_ptr<Module> llvm::splitCodeGen(
     return M;
   }
 
+#if 0
   // Create ThreadPool in nested scope so that threads will be joined
   // on destruction.
   {
@@ -95,5 +96,6 @@ std::unique_ptr<Module> llvm::splitCodeGen(
         PreserveLocals);
   }
 
+#endif
   return {};
 }
diff --git a/lib/LTO/ThinLTOCodeGenerator.cpp b/lib/LTO/ThinLTOCodeGenerator.cpp
index bfb0980..e4f9977 100644
--- a/lib/LTO/ThinLTOCodeGenerator.cpp
+++ b/lib/LTO/ThinLTOCodeGenerator.cpp
@@ -64,7 +64,7 @@ extern cl::opt<bool> LTODiscardValueNames;
 namespace {
 
 static cl::opt<int> ThreadCount("threads",
-                                cl::init(std::thread::hardware_concurrency()));
+                                cl::init(1));
 
 static void diagnosticHandler(const DiagnosticInfo &DI) {
   DiagnosticPrinterRawOStream DP(errs());
@@ -667,6 +667,7 @@ std::unique_ptr<MemoryBuffer> ThinLTOCodeGenerator::codegen(Module &TheModule) {
 
 // Main entry point for the ThinLTO processing
 void ThinLTOCodeGenerator::run() {
+#if 0
   if (CodeGenOnly) {
     // Perform only parallel codegen and return.
     ThreadPool Pool;
@@ -832,4 +833,5 @@ void ThinLTOCodeGenerator::run() {
   // If statistics were requested, print them out now.
   if (llvm::AreStatisticsEnabled())
     llvm::PrintStatistics();
+#endif
 }
diff --git a/lib/Support/ThreadPool.cpp b/lib/Support/ThreadPool.cpp
index db03a4d..71f4933 100644
--- a/lib/Support/ThreadPool.cpp
+++ b/lib/Support/ThreadPool.cpp
@@ -11,6 +11,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+#if 0
+
 #include "llvm/Support/ThreadPool.h"
 
 #include "llvm/Config/llvm-config.h"
@@ -18,7 +20,7 @@
 
 using namespace llvm;
 
-#if LLVM_ENABLE_THREADS
+#if LLVM_ENABLE_THREADS && 0
 
 // Default to std::thread::hardware_concurrency
 ThreadPool::ThreadPool() : ThreadPool(std::thread::hardware_concurrency()) {}
@@ -156,3 +158,5 @@ ThreadPool::~ThreadPool() {
 }
 
 #endif
+
+#endif
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index e5773bd..40122bd 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -27,7 +27,6 @@ set(LLVM_TEST_DEPENDS
           count
           llc
           lli
-          lli-child-target
           llvm-ar
           llvm-as
           llvm-bcanalyzer
diff --git a/tools/lli/CMakeLists.txt b/tools/lli/CMakeLists.txt
index 2bdd066..8a4c9d0 100644
--- a/tools/lli/CMakeLists.txt
+++ b/tools/lli/CMakeLists.txt
@@ -1,7 +1,3 @@
-if ( LLVM_INCLUDE_UTILS )
-  add_subdirectory(ChildTarget)
-endif()
-
 set(LLVM_LINK_COMPONENTS
   CodeGen
   Core
diff --git a/tools/lli/ChildTarget/CMakeLists.txt b/tools/lli/ChildTarget/CMakeLists.txt
deleted file mode 100644
index e4fe0c7..0000000
--- a/tools/lli/ChildTarget/CMakeLists.txt
+++ /dev/null
@@ -1,10 +0,0 @@
-set(LLVM_LINK_COMPONENTS
-  OrcJIT
-  RuntimeDyld
-  Support
-  )
-
-add_llvm_utility(lli-child-target
-  ChildTarget.cpp
-)
-
diff --git a/tools/lli/ChildTarget/ChildTarget.cpp b/tools/lli/ChildTarget/ChildTarget.cpp
deleted file mode 100644
index f6d2413..0000000
--- a/tools/lli/ChildTarget/ChildTarget.cpp
+++ /dev/null
@@ -1,78 +0,0 @@
-#include "llvm/ExecutionEngine/Orc/OrcABISupport.h"
-#include "llvm/ExecutionEngine/Orc/OrcRemoteTargetServer.h"
-#include "llvm/Support/Debug.h"
-#include "llvm/Support/DynamicLibrary.h"
-#include "llvm/Support/Process.h"
-#include <sstream>
-
-#include "../RemoteJITUtils.h"
-
-using namespace llvm;
-using namespace llvm::orc;
-using namespace llvm::sys;
-
-#ifdef __x86_64__
-typedef OrcX86_64_SysV HostOrcArch;
-#else
-typedef OrcGenericABI HostOrcArch;
-#endif
-
-ExitOnError ExitOnErr;
-
-int main(int argc, char *argv[]) {
-
-  if (argc != 3) {
-    errs() << "Usage: " << argv[0] << " <input fd> <output fd>\n";
-    return 1;
-  }
-
-  ExitOnErr.setBanner(std::string(argv[0]) + ":");
-
-  int InFD;
-  int OutFD;
-  {
-    std::istringstream InFDStream(argv[1]), OutFDStream(argv[2]);
-    InFDStream >> InFD;
-    OutFDStream >> OutFD;
-  }
-
-  if (sys::DynamicLibrary::LoadLibraryPermanently(nullptr)) {
-    errs() << "Error loading program symbols.\n";
-    return 1;
-  }
-
-  auto SymbolLookup = [](const std::string &Name) {
-    return RTDyldMemoryManager::getSymbolAddressInProcess(Name);
-  };
-
-  auto RegisterEHFrames = [](uint8_t *Addr, uint32_t Size) {
-    RTDyldMemoryManager::registerEHFramesInProcess(Addr, Size);
-  };
-
-  auto DeregisterEHFrames = [](uint8_t *Addr, uint32_t Size) {
-    RTDyldMemoryManager::deregisterEHFramesInProcess(Addr, Size);
-  };
-
-  FDRPCChannel Channel(InFD, OutFD);
-  typedef remote::OrcRemoteTargetServer<FDRPCChannel, HostOrcArch> JITServer;
-  JITServer Server(Channel, SymbolLookup, RegisterEHFrames, DeregisterEHFrames);
-
-  while (1) {
-    uint32_t RawId;
-    ExitOnErr(Server.startReceivingFunction(Channel, RawId));
-    auto Id = static_cast<JITServer::JITFuncId>(RawId);
-    switch (Id) {
-    case JITServer::TerminateSessionId:
-      ExitOnErr(Server.handleTerminateSession());
-      return 0;
-    default:
-      ExitOnErr(Server.handleKnownFunction(Id));
-      break;
-    }
-  }
-
-  close(InFD);
-  close(OutFD);
-
-  return 0;
-}
diff --git a/tools/lli/ChildTarget/LLVMBuild.txt b/tools/lli/ChildTarget/LLVMBuild.txt
deleted file mode 100644
index daf6df1..0000000
--- a/tools/lli/ChildTarget/LLVMBuild.txt
+++ /dev/null
@@ -1,21 +0,0 @@
-;===- ./tools/lli/ChildTarget/LLVMBuild.txt --------------------*- Conf -*--===;
-;
-;                     The LLVM Compiler Infrastructure
-;
-; This file is distributed under the University of Illinois Open Source
-; License. See LICENSE.TXT for details.
-;
-;===------------------------------------------------------------------------===;
-;
-; This is an LLVMBuild description file for the components in this subdirectory.
-;
-; For more information on the LLVMBuild system, please see:
-;
-;   http://llvm.org/docs/LLVMBuild.html
-;
-;===------------------------------------------------------------------------===;
-
-[component_0]
-type = Tool
-name = lli-child-target
-parent = lli
diff --git a/tools/lli/LLVMBuild.txt b/tools/lli/LLVMBuild.txt
index 9d889bf..4738504 100644
--- a/tools/lli/LLVMBuild.txt
+++ b/tools/lli/LLVMBuild.txt
@@ -15,9 +15,6 @@
 ;
 ;===------------------------------------------------------------------------===;
 
-[common]
-subdirectories = ChildTarget
-
 [component_0]
 type = Tool
 name = lli
diff --git a/tools/lli/OrcLazyJIT.cpp b/tools/lli/OrcLazyJIT.cpp
index b13e769..8b13789 100644
--- a/tools/lli/OrcLazyJIT.cpp
+++ b/tools/lli/OrcLazyJIT.cpp
@@ -1,158 +1 @@
-//===------ OrcLazyJIT.cpp - Basic Orc-based JIT for lazy execution -------===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include "OrcLazyJIT.h"
-#include "llvm/ExecutionEngine/Orc/OrcABISupport.h"
-#include "llvm/Support/Debug.h"
-#include "llvm/Support/DynamicLibrary.h"
-#include <cstdio>
-#include <system_error>
-
-using namespace llvm;
-
-namespace {
-
-  enum class DumpKind { NoDump, DumpFuncsToStdOut, DumpModsToStdErr,
-                        DumpModsToDisk };
-
-  cl::opt<DumpKind> OrcDumpKind("orc-lazy-debug",
-                                cl::desc("Debug dumping for the orc-lazy JIT."),
-                                cl::init(DumpKind::NoDump),
-                                cl::values(
-                                  clEnumValN(DumpKind::NoDump, "no-dump",
-                                             "Don't dump anything."),
-                                  clEnumValN(DumpKind::DumpFuncsToStdOut,
-                                             "funcs-to-stdout",
-                                             "Dump function names to stdout."),
-                                  clEnumValN(DumpKind::DumpModsToStdErr,
-                                             "mods-to-stderr",
-                                             "Dump modules to stderr."),
-                                  clEnumValN(DumpKind::DumpModsToDisk,
-                                             "mods-to-disk",
-                                             "Dump modules to the current "
-                                             "working directory. (WARNING: "
-                                             "will overwrite existing files)."),
-                                  clEnumValEnd),
-                                cl::Hidden);
-
-  cl::opt<bool> OrcInlineStubs("orc-lazy-inline-stubs",
-                               cl::desc("Try to inline stubs"),
-                               cl::init(true), cl::Hidden);
-}
-
-OrcLazyJIT::TransformFtor OrcLazyJIT::createDebugDumper() {
-
-  switch (OrcDumpKind) {
-  case DumpKind::NoDump:
-    return [](std::unique_ptr<Module> M) { return M; };
-
-  case DumpKind::DumpFuncsToStdOut:
-    return [](std::unique_ptr<Module> M) {
-      printf("[ ");
-
-      for (const auto &F : *M) {
-        if (F.isDeclaration())
-          continue;
-
-        if (F.hasName()) {
-          std::string Name(F.getName());
-          printf("%s ", Name.c_str());
-        } else
-          printf("<anon> ");
-      }
-
-      printf("]\n");
-      return M;
-    };
-
-  case DumpKind::DumpModsToStdErr:
-    return [](std::unique_ptr<Module> M) {
-             dbgs() << "----- Module Start -----\n" << *M
-                    << "----- Module End -----\n";
-
-             return M;
-           };
-
-  case DumpKind::DumpModsToDisk:
-    return [](std::unique_ptr<Module> M) {
-             std::error_code EC;
-             raw_fd_ostream Out(M->getModuleIdentifier() + ".ll", EC,
-                                sys::fs::F_Text);
-             if (EC) {
-               errs() << "Couldn't open " << M->getModuleIdentifier()
-                      << " for dumping.\nError:" << EC.message() << "\n";
-               exit(1);
-             }
-             Out << *M;
-             return M;
-           };
-  }
-  llvm_unreachable("Unknown DumpKind");
-}
-
-// Defined in lli.cpp.
-CodeGenOpt::Level getOptLevel();
-
-
-template <typename PtrTy>
-static PtrTy fromTargetAddress(orc::TargetAddress Addr) {
-  return reinterpret_cast<PtrTy>(static_cast<uintptr_t>(Addr));
-}
-
-int llvm::runOrcLazyJIT(std::unique_ptr<Module> M, int ArgC, char* ArgV[]) {
-  // Add the program's symbols into the JIT's search space.
-  if (sys::DynamicLibrary::LoadLibraryPermanently(nullptr)) {
-    errs() << "Error loading program symbols.\n";
-    return 1;
-  }
-
-  // Grab a target machine and try to build a factory function for the
-  // target-specific Orc callback manager.
-  EngineBuilder EB;
-  EB.setOptLevel(getOptLevel());
-  auto TM = std::unique_ptr<TargetMachine>(EB.selectTarget());
-  Triple T(TM->getTargetTriple());
-  auto CompileCallbackMgr = orc::createLocalCompileCallbackManager(T, 0);
-
-  // If we couldn't build the factory function then there must not be a callback
-  // manager for this target. Bail out.
-  if (!CompileCallbackMgr) {
-    errs() << "No callback manager available for target '"
-           << TM->getTargetTriple().str() << "'.\n";
-    return 1;
-  }
-
-  auto IndirectStubsMgrBuilder = orc::createLocalIndirectStubsManagerBuilder(T);
-
-  // If we couldn't build a stubs-manager-builder for this target then bail out.
-  if (!IndirectStubsMgrBuilder) {
-    errs() << "No indirect stubs manager available for target '"
-           << TM->getTargetTriple().str() << "'.\n";
-    return 1;
-  }
-
-  // Everything looks good. Build the JIT.
-  OrcLazyJIT J(std::move(TM), std::move(CompileCallbackMgr),
-               std::move(IndirectStubsMgrBuilder),
-               OrcInlineStubs);
-
-  // Add the module, look up main and run it.
-  auto MainHandle = J.addModule(std::move(M));
-  auto MainSym = J.findSymbolIn(MainHandle, "main");
-
-  if (!MainSym) {
-    errs() << "Could not find main function.\n";
-    return 1;
-  }
-
-  typedef int (*MainFnPtr)(int, char*[]);
-  auto Main = fromTargetAddress<MainFnPtr>(MainSym.getAddress());
-  return Main(ArgC, ArgV);
-}
 
diff --git a/tools/lli/OrcLazyJIT.h b/tools/lli/OrcLazyJIT.h
deleted file mode 100644
index 733bdd8..0000000
--- a/tools/lli/OrcLazyJIT.h
+++ /dev/null
@@ -1,163 +0,0 @@
-//===--- OrcLazyJIT.h - Basic Orc-based JIT for lazy execution --*- C++ -*-===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// Simple Orc-based JIT. Uses the compile-on-demand layer to break up and
-// lazily compile modules.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_TOOLS_LLI_ORCLAZYJIT_H
-#define LLVM_TOOLS_LLI_ORCLAZYJIT_H
-
-#include "llvm/ADT/Triple.h"
-#include "llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h"
-#include "llvm/ExecutionEngine/Orc/CompileUtils.h"
-#include "llvm/ExecutionEngine/Orc/ExecutionUtils.h"
-#include "llvm/ExecutionEngine/Orc/IRCompileLayer.h"
-#include "llvm/ExecutionEngine/Orc/IRTransformLayer.h"
-#include "llvm/ExecutionEngine/Orc/ObjectLinkingLayer.h"
-#include "llvm/ExecutionEngine/RTDyldMemoryManager.h"
-
-namespace llvm {
-
-class OrcLazyJIT {
-public:
-
-  typedef orc::JITCompileCallbackManager CompileCallbackMgr;
-  typedef orc::ObjectLinkingLayer<> ObjLayerT;
-  typedef orc::IRCompileLayer<ObjLayerT> CompileLayerT;
-  typedef std::function<std::unique_ptr<Module>(std::unique_ptr<Module>)>
-    TransformFtor;
-  typedef orc::IRTransformLayer<CompileLayerT, TransformFtor> IRDumpLayerT;
-  typedef orc::CompileOnDemandLayer<IRDumpLayerT, CompileCallbackMgr> CODLayerT;
-  typedef CODLayerT::IndirectStubsManagerBuilderT
-    IndirectStubsManagerBuilder;
-  typedef CODLayerT::ModuleSetHandleT ModuleHandleT;
-
-  OrcLazyJIT(std::unique_ptr<TargetMachine> TM,
-             std::unique_ptr<CompileCallbackMgr> CCMgr,
-             IndirectStubsManagerBuilder IndirectStubsMgrBuilder,
-             bool InlineStubs)
-      : TM(std::move(TM)), DL(this->TM->createDataLayout()),
-	CCMgr(std::move(CCMgr)),
-	ObjectLayer(),
-        CompileLayer(ObjectLayer, orc::SimpleCompiler(*this->TM)),
-        IRDumpLayer(CompileLayer, createDebugDumper()),
-        CODLayer(IRDumpLayer, extractSingleFunction, *this->CCMgr,
-                 std::move(IndirectStubsMgrBuilder), InlineStubs),
-        CXXRuntimeOverrides(
-            [this](const std::string &S) { return mangle(S); }) {}
-
-  ~OrcLazyJIT() {
-    // Run any destructors registered with __cxa_atexit.
-    CXXRuntimeOverrides.runDestructors();
-    // Run any IR destructors.
-    for (auto &DtorRunner : IRStaticDestructorRunners)
-      DtorRunner.runViaLayer(CODLayer);
-  }
-
-  ModuleHandleT addModule(std::unique_ptr<Module> M) {
-    // Attach a data-layout if one isn't already present.
-    if (M->getDataLayout().isDefault())
-      M->setDataLayout(DL);
-
-    // Record the static constructors and destructors. We have to do this before
-    // we hand over ownership of the module to the JIT.
-    std::vector<std::string> CtorNames, DtorNames;
-    for (auto Ctor : orc::getConstructors(*M))
-      CtorNames.push_back(mangle(Ctor.Func->getName()));
-    for (auto Dtor : orc::getDestructors(*M))
-      DtorNames.push_back(mangle(Dtor.Func->getName()));
-
-    // Symbol resolution order:
-    //   1) Search the JIT symbols.
-    //   2) Check for C++ runtime overrides.
-    //   3) Search the host process (LLI)'s symbol table.
-    auto Resolver =
-      orc::createLambdaResolver(
-        [this](const std::string &Name) {
-          if (auto Sym = CODLayer.findSymbol(Name, true))
-            return Sym.toRuntimeDyldSymbol();
-          if (auto Sym = CXXRuntimeOverrides.searchOverrides(Name))
-            return Sym;
-
-          if (auto Addr =
-              RTDyldMemoryManager::getSymbolAddressInProcess(Name))
-            return RuntimeDyld::SymbolInfo(Addr, JITSymbolFlags::Exported);
-
-          return RuntimeDyld::SymbolInfo(nullptr);
-        },
-        [](const std::string &Name) {
-          return RuntimeDyld::SymbolInfo(nullptr);
-        }
-      );
-
-    // Add the module to the JIT.
-    std::vector<std::unique_ptr<Module>> S;
-    S.push_back(std::move(M));
-    auto H = CODLayer.addModuleSet(std::move(S),
-				   llvm::make_unique<SectionMemoryManager>(),
-				   std::move(Resolver));
-
-    // Run the static constructors, and save the static destructor runner for
-    // execution when the JIT is torn down.
-    orc::CtorDtorRunner<CODLayerT> CtorRunner(std::move(CtorNames), H);
-    CtorRunner.runViaLayer(CODLayer);
-
-    IRStaticDestructorRunners.emplace_back(std::move(DtorNames), H);
-
-    return H;
-  }
-
-  orc::JITSymbol findSymbol(const std::string &Name) {
-    return CODLayer.findSymbol(mangle(Name), true);
-  }
-
-  orc::JITSymbol findSymbolIn(ModuleHandleT H, const std::string &Name) {
-    return CODLayer.findSymbolIn(H, mangle(Name), true);
-  }
-
-private:
-
-  std::string mangle(const std::string &Name) {
-    std::string MangledName;
-    {
-      raw_string_ostream MangledNameStream(MangledName);
-      Mangler::getNameWithPrefix(MangledNameStream, Name, DL);
-    }
-    return MangledName;
-  }
-
-  static std::set<Function*> extractSingleFunction(Function &F) {
-    std::set<Function*> Partition;
-    Partition.insert(&F);
-    return Partition;
-  }
-
-  static TransformFtor createDebugDumper();
-
-  std::unique_ptr<TargetMachine> TM;
-  DataLayout DL;
-  SectionMemoryManager CCMgrMemMgr;
-
-  std::unique_ptr<CompileCallbackMgr> CCMgr;
-  ObjLayerT ObjectLayer;
-  CompileLayerT CompileLayer;
-  IRDumpLayerT IRDumpLayer;
-  CODLayerT CODLayer;
-
-  orc::LocalCXXRuntimeOverrides CXXRuntimeOverrides;
-  std::vector<orc::CtorDtorRunner<CODLayerT>> IRStaticDestructorRunners;
-};
-
-int runOrcLazyJIT(std::unique_ptr<Module> M, int ArgC, char* ArgV[]);
-
-} // end namespace llvm
-
-#endif
diff --git a/tools/lli/RemoteJITUtils.h b/tools/lli/RemoteJITUtils.h
deleted file mode 100644
index 15068d2..0000000
--- a/tools/lli/RemoteJITUtils.h
+++ /dev/null
@@ -1,152 +0,0 @@
-//===-- RemoteJITUtils.h - Utilities for remote-JITing with LLI -*- C++ -*-===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// Utilities for remote-JITing with LLI.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_TOOLS_LLI_REMOTEJITUTILS_H
-#define LLVM_TOOLS_LLI_REMOTEJITUTILS_H
-
-#include "llvm/ExecutionEngine/Orc/RPCChannel.h"
-#include "llvm/ExecutionEngine/RTDyldMemoryManager.h"
-#include <mutex>
-
-#if !defined(_MSC_VER) && !defined(__MINGW32__)
-#include <unistd.h>
-#else
-#include <io.h>
-#endif
-
-/// RPC channel that reads from and writes from file descriptors.
-class FDRPCChannel final : public llvm::orc::remote::RPCChannel {
-public:
-  FDRPCChannel(int InFD, int OutFD) : InFD(InFD), OutFD(OutFD) {}
-
-  llvm::Error readBytes(char *Dst, unsigned Size) override {
-    assert(Dst && "Attempt to read into null.");
-    ssize_t Completed = 0;
-    while (Completed < static_cast<ssize_t>(Size)) {
-      ssize_t Read = ::read(InFD, Dst + Completed, Size - Completed);
-      if (Read <= 0) {
-        auto ErrNo = errno;
-        if (ErrNo == EAGAIN || ErrNo == EINTR)
-          continue;
-        else
-          return llvm::errorCodeToError(
-                   std::error_code(errno, std::generic_category()));
-      }
-      Completed += Read;
-    }
-    return llvm::Error::success();
-  }
-
-  llvm::Error appendBytes(const char *Src, unsigned Size) override {
-    assert(Src && "Attempt to append from null.");
-    ssize_t Completed = 0;
-    while (Completed < static_cast<ssize_t>(Size)) {
-      ssize_t Written = ::write(OutFD, Src + Completed, Size - Completed);
-      if (Written < 0) {
-        auto ErrNo = errno;
-        if (ErrNo == EAGAIN || ErrNo == EINTR)
-          continue;
-        else
-          return llvm::errorCodeToError(
-                   std::error_code(errno, std::generic_category()));
-      }
-      Completed += Written;
-    }
-    return llvm::Error::success();
-  }
-
-  llvm::Error send() override { return llvm::Error::success(); }
-
-private:
-  int InFD, OutFD;
-};
-
-// launch the remote process (see lli.cpp) and return a channel to it.
-std::unique_ptr<FDRPCChannel> launchRemote();
-
-namespace llvm {
-
-// ForwardingMM - Adapter to connect MCJIT to Orc's Remote memory manager.
-class ForwardingMemoryManager : public llvm::RTDyldMemoryManager {
-public:
-  void setMemMgr(std::unique_ptr<RuntimeDyld::MemoryManager> MemMgr) {
-    this->MemMgr = std::move(MemMgr);
-  }
-
-  void setResolver(std::unique_ptr<RuntimeDyld::SymbolResolver> Resolver) {
-    this->Resolver = std::move(Resolver);
-  }
-
-  uint8_t *allocateCodeSection(uintptr_t Size, unsigned Alignment,
-                               unsigned SectionID,
-                               StringRef SectionName) override {
-    return MemMgr->allocateCodeSection(Size, Alignment, SectionID, SectionName);
-  }
-
-  uint8_t *allocateDataSection(uintptr_t Size, unsigned Alignment,
-                               unsigned SectionID, StringRef SectionName,
-                               bool IsReadOnly) override {
-    return MemMgr->allocateDataSection(Size, Alignment, SectionID, SectionName,
-                                       IsReadOnly);
-  }
-
-  void reserveAllocationSpace(uintptr_t CodeSize, uint32_t CodeAlign,
-                              uintptr_t RODataSize, uint32_t RODataAlign,
-                              uintptr_t RWDataSize,
-                              uint32_t RWDataAlign) override {
-    MemMgr->reserveAllocationSpace(CodeSize, CodeAlign, RODataSize, RODataAlign,
-                                   RWDataSize, RWDataAlign);
-  }
-
-  bool needsToReserveAllocationSpace() override {
-    return MemMgr->needsToReserveAllocationSpace();
-  }
-
-  void registerEHFrames(uint8_t *Addr, uint64_t LoadAddr,
-                        size_t Size) override {
-    MemMgr->registerEHFrames(Addr, LoadAddr, Size);
-  }
-
-  void deregisterEHFrames(uint8_t *Addr, uint64_t LoadAddr,
-                          size_t Size) override {
-    MemMgr->deregisterEHFrames(Addr, LoadAddr, Size);
-  }
-
-  bool finalizeMemory(std::string *ErrMsg = nullptr) override {
-    return MemMgr->finalizeMemory(ErrMsg);
-  }
-
-  void notifyObjectLoaded(RuntimeDyld &RTDyld,
-                          const object::ObjectFile &Obj) override {
-    MemMgr->notifyObjectLoaded(RTDyld, Obj);
-  }
-
-  // Don't hide the sibling notifyObjectLoaded from RTDyldMemoryManager.
-  using RTDyldMemoryManager::notifyObjectLoaded;
-
-  RuntimeDyld::SymbolInfo findSymbol(const std::string &Name) override {
-    return Resolver->findSymbol(Name);
-  }
-
-  RuntimeDyld::SymbolInfo
-  findSymbolInLogicalDylib(const std::string &Name) override {
-    return Resolver->findSymbolInLogicalDylib(Name);
-  }
-
-private:
-  std::unique_ptr<RuntimeDyld::MemoryManager> MemMgr;
-  std::unique_ptr<RuntimeDyld::SymbolResolver> Resolver;
-};
-}
-
-#endif
diff --git a/tools/lli/lli.cpp b/tools/lli/lli.cpp
index 92de5da..7203af2 100644
--- a/tools/lli/lli.cpp
+++ b/tools/lli/lli.cpp
@@ -13,6 +13,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+#if 0
+
 #include "OrcLazyJIT.h"
 #include "RemoteJITUtils.h"
 #include "llvm/IR/LLVMContext.h"
@@ -751,3 +753,8 @@ std::unique_ptr<FDRPCChannel> launchRemote() {
   return llvm::make_unique<FDRPCChannel>(PipeFD[1][0], PipeFD[0][1]);
 #endif
 }
+#endif
+
+int main(int argc, char **argv, char * const *envp) {
+  return 0;
+}
diff --git a/tools/llvm-cov/CodeCoverage.cpp b/tools/llvm-cov/CodeCoverage.cpp
index 0a4d1a6..8b13789 100644
--- a/tools/llvm-cov/CodeCoverage.cpp
+++ b/tools/llvm-cov/CodeCoverage.cpp
@@ -1,727 +1 @@
-//===- CodeCoverage.cpp - Coverage tool based on profiling instrumentation-===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// The 'CodeCoverageTool' class implements a command line tool to analyze and
-// report coverage information using the profiling instrumentation and code
-// coverage mapping.
-//
-//===----------------------------------------------------------------------===//
 
-#include "CoverageFilters.h"
-#include "CoverageReport.h"
-#include "CoverageViewOptions.h"
-#include "RenderingSupport.h"
-#include "SourceCoverageView.h"
-#include "llvm/ADT/SmallString.h"
-#include "llvm/ADT/StringRef.h"
-#include "llvm/ADT/Triple.h"
-#include "llvm/ProfileData/Coverage/CoverageMapping.h"
-#include "llvm/ProfileData/InstrProfReader.h"
-#include "llvm/Support/CommandLine.h"
-#include "llvm/Support/FileSystem.h"
-#include "llvm/Support/Format.h"
-#include "llvm/Support/MemoryBuffer.h"
-#include "llvm/Support/Path.h"
-#include "llvm/Support/Process.h"
-#include "llvm/Support/Program.h"
-#include "llvm/Support/ThreadPool.h"
-#include "llvm/Support/ToolOutputFile.h"
-#include <functional>
-#include <system_error>
-
-using namespace llvm;
-using namespace coverage;
-
-namespace {
-/// \brief The implementation of the coverage tool.
-class CodeCoverageTool {
-public:
-  enum Command {
-    /// \brief The show command.
-    Show,
-    /// \brief The report command.
-    Report
-  };
-
-  /// \brief Print the error message to the error output stream.
-  void error(const Twine &Message, StringRef Whence = "");
-
-  /// \brief Record (but do not print) an error message in a thread-safe way.
-  void deferError(const Twine &Message, StringRef Whence = "");
-
-  /// \brief Record (but do not print) a warning message in a thread-safe way.
-  void deferWarning(const Twine &Message, StringRef Whence = "");
-
-  /// \brief Print (and then clear) all deferred error and warning messages.
-  void consumeDeferredMessages();
-
-  /// \brief Append a reference to a private copy of \p Path into SourceFiles.
-  void addCollectedPath(const std::string &Path);
-
-  /// \brief Return a memory buffer for the given source file.
-  ErrorOr<const MemoryBuffer &> getSourceFile(StringRef SourceFile);
-
-  /// \brief Create source views for the expansions of the view.
-  void attachExpansionSubViews(SourceCoverageView &View,
-                               ArrayRef<ExpansionRecord> Expansions,
-                               const CoverageMapping &Coverage);
-
-  /// \brief Create the source view of a particular function.
-  std::unique_ptr<SourceCoverageView>
-  createFunctionView(const FunctionRecord &Function,
-                     const CoverageMapping &Coverage);
-
-  /// \brief Create the main source view of a particular source file.
-  std::unique_ptr<SourceCoverageView>
-  createSourceFileView(StringRef SourceFile, const CoverageMapping &Coverage);
-
-  /// \brief Load the coverage mapping data. Return nullptr if an error occured.
-  std::unique_ptr<CoverageMapping> load();
-
-  /// \brief If a demangler is available, demangle all symbol names.
-  void demangleSymbols(const CoverageMapping &Coverage);
-
-  /// \brief Demangle \p Sym if possible. Otherwise, just return \p Sym.
-  StringRef getSymbolForHumans(StringRef Sym) const;
-
-  int run(Command Cmd, int argc, const char **argv);
-
-  typedef llvm::function_ref<int(int, const char **)> CommandLineParserType;
-
-  int show(int argc, const char **argv,
-           CommandLineParserType commandLineParser);
-
-  int report(int argc, const char **argv,
-             CommandLineParserType commandLineParser);
-
-  std::string ObjectFilename;
-  CoverageViewOptions ViewOpts;
-  std::string PGOFilename;
-  CoverageFiltersMatchAll Filters;
-  std::vector<StringRef> SourceFiles;
-  bool CompareFilenamesOnly;
-  StringMap<std::string> RemappedFilenames;
-  std::string CoverageArch;
-
-private:
-  /// A cache for demangled symbol names.
-  StringMap<std::string> DemangledNames;
-
-  /// File paths (absolute, or otherwise) to input source files.
-  std::vector<std::string> CollectedPaths;
-
-  /// Errors and warnings which have not been printed.
-  std::mutex DeferredMessagesLock;
-  std::vector<std::string> DeferredMessages;
-
-  /// A container for input source file buffers.
-  std::mutex LoadedSourceFilesLock;
-  std::vector<std::pair<std::string, std::unique_ptr<MemoryBuffer>>>
-      LoadedSourceFiles;
-};
-}
-
-static std::string getErrorString(const Twine &Message, StringRef Whence,
-                                  bool Warning) {
-  std::string Str = (Warning ? "warning" : "error");
-  Str += ": ";
-  if (!Whence.empty())
-    Str += Whence.str() + ": ";
-  Str += Message.str() + "\n";
-  return Str;
-}
-
-void CodeCoverageTool::error(const Twine &Message, StringRef Whence) {
-  errs() << getErrorString(Message, Whence, false);
-}
-
-void CodeCoverageTool::deferError(const Twine &Message, StringRef Whence) {
-  std::unique_lock<std::mutex> Guard{DeferredMessagesLock};
-  DeferredMessages.emplace_back(getErrorString(Message, Whence, false));
-}
-
-void CodeCoverageTool::deferWarning(const Twine &Message, StringRef Whence) {
-  std::unique_lock<std::mutex> Guard{DeferredMessagesLock};
-  DeferredMessages.emplace_back(getErrorString(Message, Whence, true));
-}
-
-void CodeCoverageTool::consumeDeferredMessages() {
-  std::unique_lock<std::mutex> Guard{DeferredMessagesLock};
-  for (const std::string &Message : DeferredMessages)
-    ViewOpts.colored_ostream(errs(), raw_ostream::RED) << Message;
-  DeferredMessages.clear();
-}
-
-void CodeCoverageTool::addCollectedPath(const std::string &Path) {
-  CollectedPaths.push_back(Path);
-  SourceFiles.emplace_back(CollectedPaths.back());
-}
-
-ErrorOr<const MemoryBuffer &>
-CodeCoverageTool::getSourceFile(StringRef SourceFile) {
-  // If we've remapped filenames, look up the real location for this file.
-  std::unique_lock<std::mutex> Guard{LoadedSourceFilesLock};
-  if (!RemappedFilenames.empty()) {
-    auto Loc = RemappedFilenames.find(SourceFile);
-    if (Loc != RemappedFilenames.end())
-      SourceFile = Loc->second;
-  }
-  for (const auto &Files : LoadedSourceFiles)
-    if (sys::fs::equivalent(SourceFile, Files.first))
-      return *Files.second;
-  auto Buffer = MemoryBuffer::getFile(SourceFile);
-  if (auto EC = Buffer.getError()) {
-    deferError(EC.message(), SourceFile);
-    return EC;
-  }
-  LoadedSourceFiles.emplace_back(SourceFile, std::move(Buffer.get()));
-  return *LoadedSourceFiles.back().second;
-}
-
-void CodeCoverageTool::attachExpansionSubViews(
-    SourceCoverageView &View, ArrayRef<ExpansionRecord> Expansions,
-    const CoverageMapping &Coverage) {
-  if (!ViewOpts.ShowExpandedRegions)
-    return;
-  for (const auto &Expansion : Expansions) {
-    auto ExpansionCoverage = Coverage.getCoverageForExpansion(Expansion);
-    if (ExpansionCoverage.empty())
-      continue;
-    auto SourceBuffer = getSourceFile(ExpansionCoverage.getFilename());
-    if (!SourceBuffer)
-      continue;
-
-    auto SubViewExpansions = ExpansionCoverage.getExpansions();
-    auto SubView =
-        SourceCoverageView::create(Expansion.Function.Name, SourceBuffer.get(),
-                                   ViewOpts, std::move(ExpansionCoverage));
-    attachExpansionSubViews(*SubView, SubViewExpansions, Coverage);
-    View.addExpansion(Expansion.Region, std::move(SubView));
-  }
-}
-
-std::unique_ptr<SourceCoverageView>
-CodeCoverageTool::createFunctionView(const FunctionRecord &Function,
-                                     const CoverageMapping &Coverage) {
-  auto FunctionCoverage = Coverage.getCoverageForFunction(Function);
-  if (FunctionCoverage.empty())
-    return nullptr;
-  auto SourceBuffer = getSourceFile(FunctionCoverage.getFilename());
-  if (!SourceBuffer)
-    return nullptr;
-
-  auto Expansions = FunctionCoverage.getExpansions();
-  auto View = SourceCoverageView::create(getSymbolForHumans(Function.Name),
-                                         SourceBuffer.get(), ViewOpts,
-                                         std::move(FunctionCoverage));
-  attachExpansionSubViews(*View, Expansions, Coverage);
-
-  return View;
-}
-
-std::unique_ptr<SourceCoverageView>
-CodeCoverageTool::createSourceFileView(StringRef SourceFile,
-                                       const CoverageMapping &Coverage) {
-  auto SourceBuffer = getSourceFile(SourceFile);
-  if (!SourceBuffer)
-    return nullptr;
-  auto FileCoverage = Coverage.getCoverageForFile(SourceFile);
-  if (FileCoverage.empty())
-    return nullptr;
-
-  auto Expansions = FileCoverage.getExpansions();
-  auto View = SourceCoverageView::create(SourceFile, SourceBuffer.get(),
-                                         ViewOpts, std::move(FileCoverage));
-  attachExpansionSubViews(*View, Expansions, Coverage);
-
-  for (const auto *Function : Coverage.getInstantiations(SourceFile)) {
-    auto SubViewCoverage = Coverage.getCoverageForFunction(*Function);
-    auto SubViewExpansions = SubViewCoverage.getExpansions();
-    auto SubView = SourceCoverageView::create(
-        getSymbolForHumans(Function->Name), SourceBuffer.get(), ViewOpts,
-        std::move(SubViewCoverage));
-    attachExpansionSubViews(*SubView, SubViewExpansions, Coverage);
-
-    if (SubView) {
-      unsigned FileID = Function->CountedRegions.front().FileID;
-      unsigned Line = 0;
-      for (const auto &CR : Function->CountedRegions)
-        if (CR.FileID == FileID)
-          Line = std::max(CR.LineEnd, Line);
-      View->addInstantiation(Function->Name, Line, std::move(SubView));
-    }
-  }
-  return View;
-}
-
-static bool modifiedTimeGT(StringRef LHS, StringRef RHS) {
-  sys::fs::file_status Status;
-  if (sys::fs::status(LHS, Status))
-    return false;
-  auto LHSTime = Status.getLastModificationTime();
-  if (sys::fs::status(RHS, Status))
-    return false;
-  auto RHSTime = Status.getLastModificationTime();
-  return LHSTime > RHSTime;
-}
-
-std::unique_ptr<CoverageMapping> CodeCoverageTool::load() {
-  if (modifiedTimeGT(ObjectFilename, PGOFilename))
-    errs() << "warning: profile data may be out of date - object is newer\n";
-  auto CoverageOrErr = CoverageMapping::load(ObjectFilename, PGOFilename,
-                                             CoverageArch);
-  if (Error E = CoverageOrErr.takeError()) {
-    colored_ostream(errs(), raw_ostream::RED)
-        << "error: Failed to load coverage: " << toString(std::move(E)) << "\n";
-    return nullptr;
-  }
-  auto Coverage = std::move(CoverageOrErr.get());
-  unsigned Mismatched = Coverage->getMismatchedCount();
-  if (Mismatched) {
-    colored_ostream(errs(), raw_ostream::RED)
-        << "warning: " << Mismatched << " functions have mismatched data. ";
-    errs() << "\n";
-  }
-
-  if (CompareFilenamesOnly) {
-    auto CoveredFiles = Coverage.get()->getUniqueSourceFiles();
-    for (auto &SF : SourceFiles) {
-      StringRef SFBase = sys::path::filename(SF);
-      for (const auto &CF : CoveredFiles)
-        if (SFBase == sys::path::filename(CF)) {
-          RemappedFilenames[CF] = SF;
-          SF = CF;
-          break;
-        }
-    }
-  }
-
-  demangleSymbols(*Coverage);
-
-  return Coverage;
-}
-
-void CodeCoverageTool::demangleSymbols(const CoverageMapping &Coverage) {
-  if (!ViewOpts.hasDemangler())
-    return;
-
-  // Pass function names to the demangler in a temporary file.
-  int InputFD;
-  SmallString<256> InputPath;
-  std::error_code EC =
-      sys::fs::createTemporaryFile("demangle-in", "list", InputFD, InputPath);
-  if (EC) {
-    error(InputPath, EC.message());
-    return;
-  }
-  tool_output_file InputTOF{InputPath, InputFD};
-
-  unsigned NumSymbols = 0;
-  for (const auto &Function : Coverage.getCoveredFunctions()) {
-    InputTOF.os() << Function.Name << '\n';
-    ++NumSymbols;
-  }
-  InputTOF.os().close();
-
-  // Use another temporary file to store the demangler's output.
-  int OutputFD;
-  SmallString<256> OutputPath;
-  EC = sys::fs::createTemporaryFile("demangle-out", "list", OutputFD,
-                                    OutputPath);
-  if (EC) {
-    error(OutputPath, EC.message());
-    return;
-  }
-  tool_output_file OutputTOF{OutputPath, OutputFD};
-  OutputTOF.os().close();
-
-  // Invoke the demangler.
-  std::vector<const char *> ArgsV;
-  for (const std::string &Arg : ViewOpts.DemanglerOpts)
-    ArgsV.push_back(Arg.c_str());
-  ArgsV.push_back(nullptr);
-  StringRef InputPathRef = InputPath.str();
-  StringRef OutputPathRef = OutputPath.str();
-  StringRef StderrRef;
-  const StringRef *Redirects[] = {&InputPathRef, &OutputPathRef, &StderrRef};
-  std::string ErrMsg;
-  int RC = sys::ExecuteAndWait(ViewOpts.DemanglerOpts[0], ArgsV.data(),
-                               /*env=*/nullptr, Redirects, /*secondsToWait=*/0,
-                               /*memoryLimit=*/0, &ErrMsg);
-  if (RC) {
-    error(ErrMsg, ViewOpts.DemanglerOpts[0]);
-    return;
-  }
-
-  // Parse the demangler's output.
-  auto BufOrError = MemoryBuffer::getFile(OutputPath);
-  if (!BufOrError) {
-    error(OutputPath, BufOrError.getError().message());
-    return;
-  }
-
-  std::unique_ptr<MemoryBuffer> DemanglerBuf = std::move(*BufOrError);
-
-  SmallVector<StringRef, 8> Symbols;
-  StringRef DemanglerData = DemanglerBuf->getBuffer();
-  DemanglerData.split(Symbols, '\n', /*MaxSplit=*/NumSymbols,
-                      /*KeepEmpty=*/false);
-  if (Symbols.size() != NumSymbols) {
-    error("Demangler did not provide expected number of symbols");
-    return;
-  }
-
-  // Cache the demangled names.
-  unsigned I = 0;
-  for (const auto &Function : Coverage.getCoveredFunctions())
-    DemangledNames[Function.Name] = Symbols[I++];
-}
-
-StringRef CodeCoverageTool::getSymbolForHumans(StringRef Sym) const {
-  const auto DemangledName = DemangledNames.find(Sym);
-  if (DemangledName == DemangledNames.end())
-    return Sym;
-  return DemangledName->getValue();
-}
-
-int CodeCoverageTool::run(Command Cmd, int argc, const char **argv) {
-  cl::opt<std::string, true> ObjectFilename(
-      cl::Positional, cl::Required, cl::location(this->ObjectFilename),
-      cl::desc("Covered executable or object file."));
-
-  cl::list<std::string> InputSourceFiles(
-      cl::Positional, cl::desc("<Source files>"), cl::ZeroOrMore);
-
-  cl::opt<std::string, true> PGOFilename(
-      "instr-profile", cl::Required, cl::location(this->PGOFilename),
-      cl::desc(
-          "File with the profile data obtained after an instrumented run"));
-
-  cl::opt<std::string> Arch(
-      "arch", cl::desc("architecture of the coverage mapping binary"));
-
-  cl::opt<bool> DebugDump("dump", cl::Optional,
-                          cl::desc("Show internal debug dump"));
-
-  cl::opt<CoverageViewOptions::OutputFormat> Format(
-      "format", cl::desc("Output format for line-based coverage reports"),
-      cl::values(clEnumValN(CoverageViewOptions::OutputFormat::Text, "text",
-                            "Text output"),
-                 clEnumValN(CoverageViewOptions::OutputFormat::HTML, "html",
-                            "HTML output"),
-                 clEnumValEnd),
-      cl::init(CoverageViewOptions::OutputFormat::Text));
-
-  cl::opt<bool> FilenameEquivalence(
-      "filename-equivalence", cl::Optional,
-      cl::desc("Treat source files as equivalent to paths in the coverage data "
-               "when the file names match, even if the full paths do not"));
-
-  cl::OptionCategory FilteringCategory("Function filtering options");
-
-  cl::list<std::string> NameFilters(
-      "name", cl::Optional,
-      cl::desc("Show code coverage only for functions with the given name"),
-      cl::ZeroOrMore, cl::cat(FilteringCategory));
-
-  cl::list<std::string> NameRegexFilters(
-      "name-regex", cl::Optional,
-      cl::desc("Show code coverage only for functions that match the given "
-               "regular expression"),
-      cl::ZeroOrMore, cl::cat(FilteringCategory));
-
-  cl::opt<double> RegionCoverageLtFilter(
-      "region-coverage-lt", cl::Optional,
-      cl::desc("Show code coverage only for functions with region coverage "
-               "less than the given threshold"),
-      cl::cat(FilteringCategory));
-
-  cl::opt<double> RegionCoverageGtFilter(
-      "region-coverage-gt", cl::Optional,
-      cl::desc("Show code coverage only for functions with region coverage "
-               "greater than the given threshold"),
-      cl::cat(FilteringCategory));
-
-  cl::opt<double> LineCoverageLtFilter(
-      "line-coverage-lt", cl::Optional,
-      cl::desc("Show code coverage only for functions with line coverage less "
-               "than the given threshold"),
-      cl::cat(FilteringCategory));
-
-  cl::opt<double> LineCoverageGtFilter(
-      "line-coverage-gt", cl::Optional,
-      cl::desc("Show code coverage only for functions with line coverage "
-               "greater than the given threshold"),
-      cl::cat(FilteringCategory));
-
-  cl::opt<cl::boolOrDefault> UseColor(
-      "use-color", cl::desc("Emit colored output (default=autodetect)"),
-      cl::init(cl::BOU_UNSET));
-
-  cl::list<std::string> DemanglerOpts(
-      "Xdemangler", cl::desc("<demangler-path>|<demangler-option>"));
-
-  auto commandLineParser = [&, this](int argc, const char **argv) -> int {
-    cl::ParseCommandLineOptions(argc, argv, "LLVM code coverage tool\n");
-    ViewOpts.Debug = DebugDump;
-    CompareFilenamesOnly = FilenameEquivalence;
-
-    ViewOpts.Format = Format;
-    switch (ViewOpts.Format) {
-    case CoverageViewOptions::OutputFormat::Text:
-      ViewOpts.Colors = UseColor == cl::BOU_UNSET
-                            ? sys::Process::StandardOutHasColors()
-                            : UseColor == cl::BOU_TRUE;
-      break;
-    case CoverageViewOptions::OutputFormat::HTML:
-      if (UseColor == cl::BOU_FALSE)
-        error("Color output cannot be disabled when generating html.");
-      ViewOpts.Colors = true;
-      break;
-    }
-
-    // If a demangler is supplied, check if it exists and register it.
-    if (DemanglerOpts.size()) {
-      auto DemanglerPathOrErr = sys::findProgramByName(DemanglerOpts[0]);
-      if (!DemanglerPathOrErr) {
-        error("Could not find the demangler!",
-              DemanglerPathOrErr.getError().message());
-        return 1;
-      }
-      DemanglerOpts[0] = *DemanglerPathOrErr;
-      ViewOpts.DemanglerOpts.swap(DemanglerOpts);
-    }
-
-    // Create the function filters
-    if (!NameFilters.empty() || !NameRegexFilters.empty()) {
-      auto NameFilterer = new CoverageFilters;
-      for (const auto &Name : NameFilters)
-        NameFilterer->push_back(llvm::make_unique<NameCoverageFilter>(Name));
-      for (const auto &Regex : NameRegexFilters)
-        NameFilterer->push_back(
-            llvm::make_unique<NameRegexCoverageFilter>(Regex));
-      Filters.push_back(std::unique_ptr<CoverageFilter>(NameFilterer));
-    }
-    if (RegionCoverageLtFilter.getNumOccurrences() ||
-        RegionCoverageGtFilter.getNumOccurrences() ||
-        LineCoverageLtFilter.getNumOccurrences() ||
-        LineCoverageGtFilter.getNumOccurrences()) {
-      auto StatFilterer = new CoverageFilters;
-      if (RegionCoverageLtFilter.getNumOccurrences())
-        StatFilterer->push_back(llvm::make_unique<RegionCoverageFilter>(
-            RegionCoverageFilter::LessThan, RegionCoverageLtFilter));
-      if (RegionCoverageGtFilter.getNumOccurrences())
-        StatFilterer->push_back(llvm::make_unique<RegionCoverageFilter>(
-            RegionCoverageFilter::GreaterThan, RegionCoverageGtFilter));
-      if (LineCoverageLtFilter.getNumOccurrences())
-        StatFilterer->push_back(llvm::make_unique<LineCoverageFilter>(
-            LineCoverageFilter::LessThan, LineCoverageLtFilter));
-      if (LineCoverageGtFilter.getNumOccurrences())
-        StatFilterer->push_back(llvm::make_unique<LineCoverageFilter>(
-            RegionCoverageFilter::GreaterThan, LineCoverageGtFilter));
-      Filters.push_back(std::unique_ptr<CoverageFilter>(StatFilterer));
-    }
-
-    if (!Arch.empty() &&
-        Triple(Arch).getArch() == llvm::Triple::ArchType::UnknownArch) {
-      errs() << "error: Unknown architecture: " << Arch << "\n";
-      return 1;
-    }
-    CoverageArch = Arch;
-
-    for (const auto &File : InputSourceFiles) {
-      SmallString<128> Path(File);
-      if (!CompareFilenamesOnly)
-        if (std::error_code EC = sys::fs::make_absolute(Path)) {
-          errs() << "error: " << File << ": " << EC.message();
-          return 1;
-        }
-      addCollectedPath(Path.str());
-    }
-    return 0;
-  };
-
-  switch (Cmd) {
-  case Show:
-    return show(argc, argv, commandLineParser);
-  case Report:
-    return report(argc, argv, commandLineParser);
-  }
-  return 0;
-}
-
-int CodeCoverageTool::show(int argc, const char **argv,
-                           CommandLineParserType commandLineParser) {
-
-  cl::OptionCategory ViewCategory("Viewing options");
-
-  cl::opt<bool> ShowLineExecutionCounts(
-      "show-line-counts", cl::Optional,
-      cl::desc("Show the execution counts for each line"), cl::init(true),
-      cl::cat(ViewCategory));
-
-  cl::opt<bool> ShowRegions(
-      "show-regions", cl::Optional,
-      cl::desc("Show the execution counts for each region"),
-      cl::cat(ViewCategory));
-
-  cl::opt<bool> ShowBestLineRegionsCounts(
-      "show-line-counts-or-regions", cl::Optional,
-      cl::desc("Show the execution counts for each line, or the execution "
-               "counts for each region on lines that have multiple regions"),
-      cl::cat(ViewCategory));
-
-  cl::opt<bool> ShowExpansions("show-expansions", cl::Optional,
-                               cl::desc("Show expanded source regions"),
-                               cl::cat(ViewCategory));
-
-  cl::opt<bool> ShowInstantiations("show-instantiations", cl::Optional,
-                                   cl::desc("Show function instantiations"),
-                                   cl::cat(ViewCategory));
-
-  cl::opt<std::string> ShowOutputDirectory(
-      "output-dir", cl::init(""),
-      cl::desc("Directory in which coverage information is written out"));
-  cl::alias ShowOutputDirectoryA("o", cl::desc("Alias for --output-dir"),
-                                 cl::aliasopt(ShowOutputDirectory));
-
-  auto Err = commandLineParser(argc, argv);
-  if (Err)
-    return Err;
-
-  ViewOpts.ShowLineNumbers = true;
-  ViewOpts.ShowLineStats = ShowLineExecutionCounts.getNumOccurrences() != 0 ||
-                           !ShowRegions || ShowBestLineRegionsCounts;
-  ViewOpts.ShowRegionMarkers = ShowRegions || ShowBestLineRegionsCounts;
-  ViewOpts.ShowLineStatsOrRegionMarkers = ShowBestLineRegionsCounts;
-  ViewOpts.ShowExpandedRegions = ShowExpansions;
-  ViewOpts.ShowFunctionInstantiations = ShowInstantiations;
-  ViewOpts.ShowOutputDirectory = ShowOutputDirectory;
-
-  if (ViewOpts.hasOutputDirectory()) {
-    if (auto E = sys::fs::create_directories(ViewOpts.ShowOutputDirectory)) {
-      error("Could not create output directory!", E.message());
-      return 1;
-    }
-  }
-
-  auto Coverage = load();
-  if (!Coverage)
-    return 1;
-
-  auto Printer = CoveragePrinter::create(ViewOpts);
-
-  if (!Filters.empty()) {
-    auto OSOrErr = Printer->createViewFile("functions", /*InToplevel=*/true);
-    if (Error E = OSOrErr.takeError()) {
-      error("Could not create view file!", toString(std::move(E)));
-      return 1;
-    }
-    auto OS = std::move(OSOrErr.get());
-
-    // Show functions.
-    for (const auto &Function : Coverage->getCoveredFunctions()) {
-      if (!Filters.matches(Function))
-        continue;
-
-      auto mainView = createFunctionView(Function, *Coverage);
-      if (!mainView) {
-        ViewOpts.colored_ostream(errs(), raw_ostream::RED)
-            << "warning: Could not read coverage for '" << Function.Name << "'."
-            << "\n";
-        continue;
-      }
-
-      mainView->print(*OS.get(), /*WholeFile=*/false, /*ShowSourceName=*/true);
-    }
-
-    Printer->closeViewFile(std::move(OS));
-    return 0;
-  }
-
-  // Show files
-  bool ShowFilenames = SourceFiles.size() != 1;
-
-  if (SourceFiles.empty())
-    // Get the source files from the function coverage mapping.
-    for (StringRef Filename : Coverage->getUniqueSourceFiles())
-      SourceFiles.push_back(Filename);
-
-  // Create an index out of the source files.
-  if (ViewOpts.hasOutputDirectory()) {
-    if (Error E = Printer->createIndexFile(SourceFiles)) {
-      error("Could not create index file!", toString(std::move(E)));
-      return 1;
-    }
-  }
-
-  // In -output-dir mode, it's safe to use multiple threads to print files.
-  unsigned ThreadCount = 1;
-  if (ViewOpts.hasOutputDirectory())
-    ThreadCount = std::thread::hardware_concurrency();
-  ThreadPool Pool(ThreadCount);
-
-  for (StringRef SourceFile : SourceFiles) {
-    Pool.async([this, SourceFile, &Coverage, &Printer, ShowFilenames] {
-      auto View = createSourceFileView(SourceFile, *Coverage);
-      if (!View) {
-        deferWarning("The file '" + SourceFile.str() + "' isn't covered.");
-        return;
-      }
-
-      auto OSOrErr = Printer->createViewFile(SourceFile, /*InToplevel=*/false);
-      if (Error E = OSOrErr.takeError()) {
-        deferError("Could not create view file!", toString(std::move(E)));
-        return;
-      }
-      auto OS = std::move(OSOrErr.get());
-
-      View->print(*OS.get(), /*Wholefile=*/true,
-                  /*ShowSourceName=*/ShowFilenames);
-      Printer->closeViewFile(std::move(OS));
-    });
-  }
-
-  Pool.wait();
-
-  consumeDeferredMessages();
-
-  return 0;
-}
-
-int CodeCoverageTool::report(int argc, const char **argv,
-                             CommandLineParserType commandLineParser) {
-  auto Err = commandLineParser(argc, argv);
-  if (Err)
-    return Err;
-
-  if (ViewOpts.Format == CoverageViewOptions::OutputFormat::HTML)
-    error("HTML output for summary reports is not yet supported.");
-
-  auto Coverage = load();
-  if (!Coverage)
-    return 1;
-
-  CoverageReport Report(ViewOpts, std::move(Coverage));
-  if (SourceFiles.empty())
-    Report.renderFileReports(llvm::outs());
-  else
-    Report.renderFunctionReports(SourceFiles, llvm::outs());
-  return 0;
-}
-
-int showMain(int argc, const char *argv[]) {
-  CodeCoverageTool Tool;
-  return Tool.run(CodeCoverageTool::Show, argc, argv);
-}
-
-int reportMain(int argc, const char *argv[]) {
-  CodeCoverageTool Tool;
-  return Tool.run(CodeCoverageTool::Report, argc, argv);
-}
diff --git a/tools/llvm-cov/CoverageFilters.cpp b/tools/llvm-cov/CoverageFilters.cpp
index 325dd72..8b13789 100644
--- a/tools/llvm-cov/CoverageFilters.cpp
+++ b/tools/llvm-cov/CoverageFilters.cpp
@@ -1,59 +1 @@
-//===- CoverageFilters.cpp - Function coverage mapping filters ------------===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// These classes provide filtering for function coverage mapping records.
-//
-//===----------------------------------------------------------------------===//
 
-#include "CoverageFilters.h"
-#include "CoverageSummaryInfo.h"
-#include "llvm/Support/Regex.h"
-
-using namespace llvm;
-
-bool NameCoverageFilter::matches(const coverage::FunctionRecord &Function) {
-  StringRef FuncName = Function.Name;
-  return FuncName.find(Name) != StringRef::npos;
-}
-
-bool
-NameRegexCoverageFilter::matches(const coverage::FunctionRecord &Function) {
-  return llvm::Regex(Regex).match(Function.Name);
-}
-
-bool RegionCoverageFilter::matches(const coverage::FunctionRecord &Function) {
-  return PassesThreshold(FunctionCoverageSummary::get(Function)
-                             .RegionCoverage.getPercentCovered());
-}
-
-bool LineCoverageFilter::matches(const coverage::FunctionRecord &Function) {
-  return PassesThreshold(
-      FunctionCoverageSummary::get(Function).LineCoverage.getPercentCovered());
-}
-
-void CoverageFilters::push_back(std::unique_ptr<CoverageFilter> Filter) {
-  Filters.push_back(std::move(Filter));
-}
-
-bool CoverageFilters::matches(const coverage::FunctionRecord &Function) {
-  for (const auto &Filter : Filters) {
-    if (Filter->matches(Function))
-      return true;
-  }
-  return false;
-}
-
-bool
-CoverageFiltersMatchAll::matches(const coverage::FunctionRecord &Function) {
-  for (const auto &Filter : Filters) {
-    if (!Filter->matches(Function))
-      return false;
-  }
-  return true;
-}
diff --git a/tools/llvm-cov/CoverageFilters.h b/tools/llvm-cov/CoverageFilters.h
deleted file mode 100644
index 756c4b4..0000000
--- a/tools/llvm-cov/CoverageFilters.h
+++ /dev/null
@@ -1,127 +0,0 @@
-//===- CoverageFilters.h - Function coverage mapping filters --------------===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// These classes provide filtering for function coverage mapping records.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_COV_COVERAGEFILTERS_H
-#define LLVM_COV_COVERAGEFILTERS_H
-
-#include "llvm/ProfileData/Coverage/CoverageMapping.h"
-#include <memory>
-#include <vector>
-
-namespace llvm {
-
-/// \brief Matches specific functions that pass the requirement of this filter.
-class CoverageFilter {
-public:
-  virtual ~CoverageFilter() {}
-
-  /// \brief Return true if the function passes the requirements of this filter.
-  virtual bool matches(const coverage::FunctionRecord &Function) {
-    return true;
-  }
-};
-
-/// \brief Matches functions that contain a specific string in their name.
-class NameCoverageFilter : public CoverageFilter {
-  StringRef Name;
-
-public:
-  NameCoverageFilter(StringRef Name) : Name(Name) {}
-
-  bool matches(const coverage::FunctionRecord &Function) override;
-};
-
-/// \brief Matches functions whose name matches a certain regular expression.
-class NameRegexCoverageFilter : public CoverageFilter {
-  StringRef Regex;
-
-public:
-  NameRegexCoverageFilter(StringRef Regex) : Regex(Regex) {}
-
-  bool matches(const coverage::FunctionRecord &Function) override;
-};
-
-/// \brief Matches numbers that pass a certain threshold.
-template <typename T> class StatisticThresholdFilter {
-public:
-  enum Operation { LessThan, GreaterThan };
-
-protected:
-  Operation Op;
-  T Threshold;
-
-  StatisticThresholdFilter(Operation Op, T Threshold)
-      : Op(Op), Threshold(Threshold) {}
-
-  /// \brief Return true if the given number is less than
-  /// or greater than the certain threshold.
-  bool PassesThreshold(T Value) const {
-    switch (Op) {
-    case LessThan:
-      return Value < Threshold;
-    case GreaterThan:
-      return Value > Threshold;
-    }
-    return false;
-  }
-};
-
-/// \brief Matches functions whose region coverage percentage
-/// is above/below a certain percentage.
-class RegionCoverageFilter : public CoverageFilter,
-                             public StatisticThresholdFilter<double> {
-public:
-  RegionCoverageFilter(Operation Op, double Threshold)
-      : StatisticThresholdFilter(Op, Threshold) {}
-
-  bool matches(const coverage::FunctionRecord &Function) override;
-};
-
-/// \brief Matches functions whose line coverage percentage
-/// is above/below a certain percentage.
-class LineCoverageFilter : public CoverageFilter,
-                           public StatisticThresholdFilter<double> {
-public:
-  LineCoverageFilter(Operation Op, double Threshold)
-      : StatisticThresholdFilter(Op, Threshold) {}
-
-  bool matches(const coverage::FunctionRecord &Function) override;
-};
-
-/// \brief A collection of filters.
-/// Matches functions that match any filters contained
-/// in an instance of this class.
-class CoverageFilters : public CoverageFilter {
-protected:
-  std::vector<std::unique_ptr<CoverageFilter>> Filters;
-
-public:
-  /// \brief Append a filter to this collection.
-  void push_back(std::unique_ptr<CoverageFilter> Filter);
-
-  bool empty() const { return Filters.empty(); }
-
-  bool matches(const coverage::FunctionRecord &Function) override;
-};
-
-/// \brief A collection of filters.
-/// Matches functions that match all of the filters contained
-/// in an instance of this class.
-class CoverageFiltersMatchAll : public CoverageFilters {
-public:
-  bool matches(const coverage::FunctionRecord &Function) override;
-};
-
-} // namespace llvm
-
-#endif // LLVM_COV_COVERAGEFILTERS_H
diff --git a/tools/llvm-cov/CoverageReport.cpp b/tools/llvm-cov/CoverageReport.cpp
index 10e53b3..8b13789 100644
--- a/tools/llvm-cov/CoverageReport.cpp
+++ b/tools/llvm-cov/CoverageReport.cpp
@@ -1,235 +1 @@
-//===- CoverageReport.cpp - Code coverage report -------------------------===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This class implements rendering of a code coverage report.
-//
-//===----------------------------------------------------------------------===//
 
-#include "CoverageReport.h"
-#include "RenderingSupport.h"
-#include "llvm/Support/FileSystem.h"
-#include "llvm/Support/Format.h"
-
-using namespace llvm;
-namespace {
-/// \brief Helper struct which prints trimmed and aligned columns.
-struct Column {
-  enum TrimKind { NoTrim, WidthTrim, LeftTrim, RightTrim };
-
-  enum AlignmentKind { LeftAlignment, RightAlignment };
-
-  StringRef Str;
-  unsigned Width;
-  TrimKind Trim;
-  AlignmentKind Alignment;
-
-  Column(StringRef Str, unsigned Width)
-      : Str(Str), Width(Width), Trim(WidthTrim), Alignment(LeftAlignment) {}
-
-  Column &set(TrimKind Value) {
-    Trim = Value;
-    return *this;
-  }
-
-  Column &set(AlignmentKind Value) {
-    Alignment = Value;
-    return *this;
-  }
-
-  void render(raw_ostream &OS) const;
-};
-
-raw_ostream &operator<<(raw_ostream &OS, const Column &Value) {
-  Value.render(OS);
-  return OS;
-}
-}
-
-void Column::render(raw_ostream &OS) const {
-  if (Str.size() <= Width) {
-    if (Alignment == RightAlignment) {
-      OS.indent(Width - Str.size());
-      OS << Str;
-      return;
-    }
-    OS << Str;
-    OS.indent(Width - Str.size());
-    return;
-  }
-
-  switch (Trim) {
-  case NoTrim:
-    OS << Str;
-    break;
-  case WidthTrim:
-    OS << Str.substr(0, Width);
-    break;
-  case LeftTrim:
-    OS << "..." << Str.substr(Str.size() - Width + 3);
-    break;
-  case RightTrim:
-    OS << Str.substr(0, Width - 3) << "...";
-    break;
-  }
-}
-
-static Column column(StringRef Str, unsigned Width) {
-  return Column(Str, Width);
-}
-
-template <typename T>
-static Column column(StringRef Str, unsigned Width, const T &Value) {
-  return Column(Str, Width).set(Value);
-}
-
-static size_t FileReportColumns[] = {25, 10, 8, 8, 10, 10};
-static size_t FunctionReportColumns[] = {25, 10, 8, 8, 10, 8, 8};
-
-/// \brief  Adjust column widths to fit long file paths and function names.
-static void adjustColumnWidths(coverage::CoverageMapping *CM) {
-  for (StringRef Filename : CM->getUniqueSourceFiles()) {
-    FileReportColumns[0] = std::max(FileReportColumns[0], Filename.size());
-    for (const auto &F : CM->getCoveredFunctions(Filename)) {
-      FunctionReportColumns[0] =
-          std::max(FunctionReportColumns[0], F.Name.size());
-    }
-  }
-}
-
-/// \brief Prints a horizontal divider which spans across the given columns.
-template <typename T, size_t N>
-static void renderDivider(T (&Columns)[N], raw_ostream &OS) {
-  unsigned Length = 0;
-  for (unsigned I = 0; I < N; ++I)
-    Length += Columns[I];
-  for (unsigned I = 0; I < Length; ++I)
-    OS << '-';
-}
-
-/// \brief Return the color which correponds to the coverage
-/// percentage of a certain metric.
-template <typename T>
-static raw_ostream::Colors determineCoveragePercentageColor(const T &Info) {
-  if (Info.isFullyCovered())
-    return raw_ostream::GREEN;
-  return Info.getPercentCovered() >= 80.0 ? raw_ostream::YELLOW
-                                          : raw_ostream::RED;
-}
-
-void CoverageReport::render(const FileCoverageSummary &File, raw_ostream &OS) {
-  OS << column(File.Name, FileReportColumns[0], Column::NoTrim)
-     << format("%*u", FileReportColumns[1],
-               (unsigned)File.RegionCoverage.NumRegions);
-  Options.colored_ostream(OS, File.RegionCoverage.isFullyCovered()
-                                  ? raw_ostream::GREEN
-                                  : raw_ostream::RED)
-      << format("%*u", FileReportColumns[2], (unsigned)File.RegionCoverage.NotCovered);
-  Options.colored_ostream(OS,
-                          determineCoveragePercentageColor(File.RegionCoverage))
-      << format("%*.2f", FileReportColumns[3] - 1,
-                File.RegionCoverage.getPercentCovered()) << '%';
-  OS << format("%*u", FileReportColumns[4],
-               (unsigned)File.FunctionCoverage.NumFunctions);
-  Options.colored_ostream(
-      OS, determineCoveragePercentageColor(File.FunctionCoverage))
-      << format("%*.2f", FileReportColumns[5] - 1,
-                File.FunctionCoverage.getPercentCovered()) << '%';
-  OS << "\n";
-}
-
-void CoverageReport::render(const FunctionCoverageSummary &Function,
-                            raw_ostream &OS) {
-  OS << column(Function.Name, FunctionReportColumns[0], Column::RightTrim)
-     << format("%*u", FunctionReportColumns[1],
-               (unsigned)Function.RegionCoverage.NumRegions);
-  Options.colored_ostream(OS, Function.RegionCoverage.isFullyCovered()
-                                  ? raw_ostream::GREEN
-                                  : raw_ostream::RED)
-      << format("%*u", FunctionReportColumns[2],
-                (unsigned)Function.RegionCoverage.NotCovered);
-  Options.colored_ostream(
-      OS, determineCoveragePercentageColor(Function.RegionCoverage))
-      << format("%*.2f", FunctionReportColumns[3] - 1,
-                Function.RegionCoverage.getPercentCovered()) << '%';
-  OS << format("%*u", FunctionReportColumns[4],
-               (unsigned)Function.LineCoverage.NumLines);
-  Options.colored_ostream(OS, Function.LineCoverage.isFullyCovered()
-                                  ? raw_ostream::GREEN
-                                  : raw_ostream::RED)
-      << format("%*u", FunctionReportColumns[5],
-                (unsigned)Function.LineCoverage.NotCovered);
-  Options.colored_ostream(
-      OS, determineCoveragePercentageColor(Function.LineCoverage))
-      << format("%*.2f", FunctionReportColumns[6] - 1,
-                Function.LineCoverage.getPercentCovered()) << '%';
-  OS << "\n";
-}
-
-void CoverageReport::renderFunctionReports(ArrayRef<StringRef> Files,
-                                           raw_ostream &OS) {
-  adjustColumnWidths(Coverage.get());
-  bool isFirst = true;
-  for (StringRef Filename : Files) {
-    if (isFirst)
-      isFirst = false;
-    else
-      OS << "\n";
-    OS << "File '" << Filename << "':\n";
-    OS << column("Name", FunctionReportColumns[0])
-       << column("Regions", FunctionReportColumns[1], Column::RightAlignment)
-       << column("Miss", FunctionReportColumns[2], Column::RightAlignment)
-       << column("Cover", FunctionReportColumns[3], Column::RightAlignment)
-       << column("Lines", FunctionReportColumns[4], Column::RightAlignment)
-       << column("Miss", FunctionReportColumns[5], Column::RightAlignment)
-       << column("Cover", FunctionReportColumns[6], Column::RightAlignment);
-    OS << "\n";
-    renderDivider(FunctionReportColumns, OS);
-    OS << "\n";
-    FunctionCoverageSummary Totals("TOTAL");
-    for (const auto &F : Coverage->getCoveredFunctions(Filename)) {
-      FunctionCoverageSummary Function = FunctionCoverageSummary::get(F);
-      ++Totals.ExecutionCount;
-      Totals.RegionCoverage += Function.RegionCoverage;
-      Totals.LineCoverage += Function.LineCoverage;
-      render(Function, OS);
-    }
-    if (Totals.ExecutionCount) {
-      renderDivider(FunctionReportColumns, OS);
-      OS << "\n";
-      render(Totals, OS);
-    }
-  }
-}
-
-void CoverageReport::renderFileReports(raw_ostream &OS) {
-  adjustColumnWidths(Coverage.get());
-  OS << column("Filename", FileReportColumns[0])
-     << column("Regions", FileReportColumns[1], Column::RightAlignment)
-     << column("Miss", FileReportColumns[2], Column::RightAlignment)
-     << column("Cover", FileReportColumns[3], Column::RightAlignment)
-     << column("Functions", FileReportColumns[4], Column::RightAlignment)
-     << column("Executed", FileReportColumns[5], Column::RightAlignment)
-     << "\n";
-  renderDivider(FileReportColumns, OS);
-  OS << "\n";
-
-  FileCoverageSummary Totals("TOTAL");
-  for (StringRef Filename : Coverage->getUniqueSourceFiles()) {
-    FileCoverageSummary Summary(Filename);
-    for (const auto &F : Coverage->getCoveredFunctions(Filename)) {
-      FunctionCoverageSummary Function = FunctionCoverageSummary::get(F);
-      Summary.addFunction(Function);
-      Totals.addFunction(Function);
-    }
-    render(Summary, OS);
-  }
-  renderDivider(FileReportColumns, OS);
-  OS << "\n";
-  render(Totals, OS);
-}
diff --git a/tools/llvm-cov/CoverageReport.h b/tools/llvm-cov/CoverageReport.h
deleted file mode 100644
index bb3d734..0000000
--- a/tools/llvm-cov/CoverageReport.h
+++ /dev/null
@@ -1,41 +0,0 @@
-//===- CoverageReport.h - Code coverage report ---------------------------===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This class implements rendering of a code coverage report.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_COV_COVERAGEREPORT_H
-#define LLVM_COV_COVERAGEREPORT_H
-
-#include "CoverageSummaryInfo.h"
-#include "CoverageViewOptions.h"
-
-namespace llvm {
-
-/// \brief Displays the code coverage report.
-class CoverageReport {
-  const CoverageViewOptions &Options;
-  std::unique_ptr<coverage::CoverageMapping> Coverage;
-
-  void render(const FileCoverageSummary &File, raw_ostream &OS);
-  void render(const FunctionCoverageSummary &Function, raw_ostream &OS);
-
-public:
-  CoverageReport(const CoverageViewOptions &Options,
-                 std::unique_ptr<coverage::CoverageMapping> Coverage)
-      : Options(Options), Coverage(std::move(Coverage)) {}
-
-  void renderFunctionReports(ArrayRef<StringRef> Files, raw_ostream &OS);
-
-  void renderFileReports(raw_ostream &OS);
-};
-}
-
-#endif // LLVM_COV_COVERAGEREPORT_H
diff --git a/tools/llvm-cov/CoverageSummaryInfo.cpp b/tools/llvm-cov/CoverageSummaryInfo.cpp
index de89750..8b13789 100644
--- a/tools/llvm-cov/CoverageSummaryInfo.cpp
+++ b/tools/llvm-cov/CoverageSummaryInfo.cpp
@@ -1,71 +1 @@
-//===- CoverageSummaryInfo.cpp - Coverage summary for function/file -------===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// These structures are used to represent code coverage metrics
-// for functions/files.
-//
-//===----------------------------------------------------------------------===//
 
-#include "CoverageSummaryInfo.h"
-
-using namespace llvm;
-using namespace coverage;
-
-FunctionCoverageSummary
-FunctionCoverageSummary::get(const coverage::FunctionRecord &Function) {
-  // Compute the region coverage
-  size_t NumCodeRegions = 0, CoveredRegions = 0;
-  for (auto &CR : Function.CountedRegions) {
-    if (CR.Kind != CounterMappingRegion::CodeRegion)
-      continue;
-    ++NumCodeRegions;
-    if (CR.ExecutionCount != 0)
-      ++CoveredRegions;
-  }
-
-  // Compute the line coverage
-  size_t NumLines = 0, CoveredLines = 0;
-  for (unsigned FileID = 0, E = Function.Filenames.size(); FileID < E;
-       ++FileID) {
-    // Find the line start and end of the function's source code
-    // in that particular file
-    unsigned LineStart = std::numeric_limits<unsigned>::max();
-    unsigned LineEnd = 0;
-    for (auto &CR : Function.CountedRegions) {
-      if (CR.FileID != FileID)
-        continue;
-      LineStart = std::min(LineStart, CR.LineStart);
-      LineEnd = std::max(LineEnd, CR.LineEnd);
-    }
-    unsigned LineCount = LineEnd - LineStart + 1;
-
-    // Get counters
-    llvm::SmallVector<uint64_t, 16> ExecutionCounts;
-    ExecutionCounts.resize(LineCount, 0);
-    for (auto &CR : Function.CountedRegions) {
-      if (CR.FileID != FileID)
-        continue;
-      // Ignore the lines that were skipped by the preprocessor.
-      auto ExecutionCount = CR.ExecutionCount;
-      if (CR.Kind == CounterMappingRegion::SkippedRegion) {
-        LineCount -= CR.LineEnd - CR.LineStart + 1;
-        ExecutionCount = 1;
-      }
-      for (unsigned I = CR.LineStart; I <= CR.LineEnd; ++I)
-        ExecutionCounts[I - LineStart] = ExecutionCount;
-    }
-    CoveredLines += LineCount - std::count(ExecutionCounts.begin(),
-                                           ExecutionCounts.end(), 0);
-    NumLines += LineCount;
-  }
-  return FunctionCoverageSummary(
-      Function.Name, Function.ExecutionCount,
-      RegionCoverageInfo(CoveredRegions, NumCodeRegions),
-      LineCoverageInfo(CoveredLines, 0, NumLines));
-}
diff --git a/tools/llvm-cov/CoverageSummaryInfo.h b/tools/llvm-cov/CoverageSummaryInfo.h
deleted file mode 100644
index 822742b..0000000
--- a/tools/llvm-cov/CoverageSummaryInfo.h
+++ /dev/null
@@ -1,162 +0,0 @@
-//===- CoverageSummaryInfo.h - Coverage summary for function/file ---------===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// These structures are used to represent code coverage metrics
-// for functions/files.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_COV_COVERAGESUMMARYINFO_H
-#define LLVM_COV_COVERAGESUMMARYINFO_H
-
-#include "llvm/ProfileData/Coverage/CoverageMapping.h"
-#include "llvm/Support/raw_ostream.h"
-
-namespace llvm {
-
-/// \brief Provides information about region coverage for a function/file.
-struct RegionCoverageInfo {
-  /// \brief The number of regions that were executed at least once.
-  size_t Covered;
-
-  /// \brief The number of regions that weren't executed.
-  size_t NotCovered;
-
-  /// \brief The total number of regions in a function/file.
-  size_t NumRegions;
-
-  RegionCoverageInfo() : Covered(0), NotCovered(0), NumRegions(0) {}
-
-  RegionCoverageInfo(size_t Covered, size_t NumRegions)
-      : Covered(Covered), NotCovered(NumRegions - Covered),
-        NumRegions(NumRegions) {}
-
-  RegionCoverageInfo &operator+=(const RegionCoverageInfo &RHS) {
-    Covered += RHS.Covered;
-    NotCovered += RHS.NotCovered;
-    NumRegions += RHS.NumRegions;
-    return *this;
-  }
-
-  bool isFullyCovered() const { return Covered == NumRegions; }
-
-  double getPercentCovered() const {
-    if (NumRegions == 0)
-      return 0.0;
-    return double(Covered) / double(NumRegions) * 100.0;
-  }
-};
-
-/// \brief Provides information about line coverage for a function/file.
-struct LineCoverageInfo {
-  /// \brief The number of lines that were executed at least once.
-  size_t Covered;
-
-  /// \brief The number of lines that weren't executed.
-  size_t NotCovered;
-
-  /// \brief The number of lines that aren't code.
-  size_t NonCodeLines;
-
-  /// \brief The total number of lines in a function/file.
-  size_t NumLines;
-
-  LineCoverageInfo()
-      : Covered(0), NotCovered(0), NonCodeLines(0), NumLines(0) {}
-
-  LineCoverageInfo(size_t Covered, size_t NumNonCodeLines, size_t NumLines)
-      : Covered(Covered), NotCovered(NumLines - NumNonCodeLines - Covered),
-        NonCodeLines(NumNonCodeLines), NumLines(NumLines) {}
-
-  LineCoverageInfo &operator+=(const LineCoverageInfo &RHS) {
-    Covered += RHS.Covered;
-    NotCovered += RHS.NotCovered;
-    NonCodeLines += RHS.NonCodeLines;
-    NumLines += RHS.NumLines;
-    return *this;
-  }
-
-  bool isFullyCovered() const { return Covered == (NumLines - NonCodeLines); }
-
-  double getPercentCovered() const {
-    if (NumLines - NonCodeLines == 0)
-      return 0.0;
-    return double(Covered) / double(NumLines - NonCodeLines) * 100.0;
-  }
-};
-
-/// \brief Provides information about function coverage for a file.
-struct FunctionCoverageInfo {
-  /// \brief The number of functions that were executed.
-  size_t Executed;
-
-  /// \brief The total number of functions in this file.
-  size_t NumFunctions;
-
-  FunctionCoverageInfo() : Executed(0), NumFunctions(0) {}
-
-  FunctionCoverageInfo(size_t Executed, size_t NumFunctions)
-      : Executed(Executed), NumFunctions(NumFunctions) {}
-
-  void addFunction(bool Covered) {
-    if (Covered)
-      ++Executed;
-    ++NumFunctions;
-  }
-
-  bool isFullyCovered() const { return Executed == NumFunctions; }
-
-  double getPercentCovered() const {
-    if (NumFunctions == 0)
-      return 0.0;
-    return double(Executed) / double(NumFunctions) * 100.0;
-  }
-};
-
-/// \brief A summary of function's code coverage.
-struct FunctionCoverageSummary {
-  StringRef Name;
-  uint64_t ExecutionCount;
-  RegionCoverageInfo RegionCoverage;
-  LineCoverageInfo LineCoverage;
-
-  FunctionCoverageSummary(StringRef Name) : Name(Name), ExecutionCount(0) {}
-
-  FunctionCoverageSummary(StringRef Name, uint64_t ExecutionCount,
-                          const RegionCoverageInfo &RegionCoverage,
-                          const LineCoverageInfo &LineCoverage)
-      : Name(Name), ExecutionCount(ExecutionCount),
-        RegionCoverage(RegionCoverage), LineCoverage(LineCoverage) {
-  }
-
-  /// \brief Compute the code coverage summary for the given function coverage
-  /// mapping record.
-  static FunctionCoverageSummary
-  get(const coverage::FunctionRecord &Function);
-};
-
-/// \brief A summary of file's code coverage.
-struct FileCoverageSummary {
-  StringRef Name;
-  RegionCoverageInfo RegionCoverage;
-  LineCoverageInfo LineCoverage;
-  FunctionCoverageInfo FunctionCoverage;
-
-  FileCoverageSummary(StringRef Name) : Name(Name) {}
-
-  void addFunction(const FunctionCoverageSummary &Function) {
-    RegionCoverage += Function.RegionCoverage;
-    LineCoverage += Function.LineCoverage;
-    FunctionCoverage.addFunction(/*Covered=*/Function.ExecutionCount > 0);
-  }
-};
-
-} // namespace llvm
-
-#endif // LLVM_COV_COVERAGESUMMARYINFO_H
diff --git a/tools/llvm-cov/CoverageViewOptions.h b/tools/llvm-cov/CoverageViewOptions.h
deleted file mode 100644
index 350c264..0000000
--- a/tools/llvm-cov/CoverageViewOptions.h
+++ /dev/null
@@ -1,52 +0,0 @@
-//===- CoverageViewOptions.h - Code coverage display options -------------===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_COV_COVERAGEVIEWOPTIONS_H
-#define LLVM_COV_COVERAGEVIEWOPTIONS_H
-
-#include "RenderingSupport.h"
-#include <vector>
-
-namespace llvm {
-
-/// \brief The options for displaying the code coverage information.
-struct CoverageViewOptions {
-  enum class OutputFormat {
-    Text,
-    HTML
-  };
-
-  bool Debug;
-  bool Colors;
-  bool ShowLineNumbers;
-  bool ShowLineStats;
-  bool ShowRegionMarkers;
-  bool ShowLineStatsOrRegionMarkers;
-  bool ShowExpandedRegions;
-  bool ShowFunctionInstantiations;
-  bool ShowFullFilenames;
-  OutputFormat Format;
-  std::string ShowOutputDirectory;
-  std::vector<std::string> DemanglerOpts;
-
-  /// \brief Change the output's stream color if the colors are enabled.
-  ColoredRawOstream colored_ostream(raw_ostream &OS,
-                                    raw_ostream::Colors Color) const {
-    return llvm::colored_ostream(OS, Color, Colors);
-  }
-
-  /// \brief Check if an output directory has been specified.
-  bool hasOutputDirectory() const { return !ShowOutputDirectory.empty(); }
-
-  /// \brief Check if a demangler has been specified.
-  bool hasDemangler() const { return !DemanglerOpts.empty(); }
-};
-}
-
-#endif // LLVM_COV_COVERAGEVIEWOPTIONS_H
diff --git a/tools/llvm-cov/RenderingSupport.h b/tools/llvm-cov/RenderingSupport.h
deleted file mode 100644
index aa70fbc..0000000
--- a/tools/llvm-cov/RenderingSupport.h
+++ /dev/null
@@ -1,61 +0,0 @@
-//===- RenderingSupport.h - output stream rendering support functions  ----===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_COV_RENDERINGSUPPORT_H
-#define LLVM_COV_RENDERINGSUPPORT_H
-
-#include "llvm/Support/raw_ostream.h"
-#include <utility>
-
-namespace llvm {
-
-/// \brief A helper class that resets the output stream's color if needed
-/// when destroyed.
-class ColoredRawOstream {
-  ColoredRawOstream(const ColoredRawOstream &OS) = delete;
-
-public:
-  raw_ostream &OS;
-  bool IsColorUsed;
-
-  ColoredRawOstream(raw_ostream &OS, bool IsColorUsed)
-      : OS(OS), IsColorUsed(IsColorUsed) {}
-
-  ColoredRawOstream(ColoredRawOstream &&Other)
-      : OS(Other.OS), IsColorUsed(Other.IsColorUsed) {
-    // Reset the other IsColorUsed so that the other object won't reset the
-    // color when destroyed.
-    Other.IsColorUsed = false;
-  }
-
-  ~ColoredRawOstream() {
-    if (IsColorUsed)
-      OS.resetColor();
-  }
-};
-
-template <typename T>
-inline raw_ostream &operator<<(const ColoredRawOstream &OS, T &&Value) {
-  return OS.OS << std::forward<T>(Value);
-}
-
-/// \brief Change the color of the output stream if the `IsColorUsed` flag
-/// is true. Returns an object that resets the color when destroyed.
-inline ColoredRawOstream colored_ostream(raw_ostream &OS,
-                                         raw_ostream::Colors Color,
-                                         bool IsColorUsed = true,
-                                         bool Bold = false, bool BG = false) {
-  if (IsColorUsed)
-    OS.changeColor(Color, Bold, BG);
-  return ColoredRawOstream(OS, IsColorUsed);
-}
-
-} // namespace llvm
-
-#endif // LLVM_COV_RENDERINGSUPPORT_H
diff --git a/tools/llvm-cov/SourceCoverageView.cpp b/tools/llvm-cov/SourceCoverageView.cpp
index baf7c14..8b13789 100644
--- a/tools/llvm-cov/SourceCoverageView.cpp
+++ b/tools/llvm-cov/SourceCoverageView.cpp
@@ -1,233 +1 @@
-//===- SourceCoverageView.cpp - Code coverage view for source code --------===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-///
-/// \file This class implements rendering for code coverage of source code.
-///
-//===----------------------------------------------------------------------===//
 
-#include "SourceCoverageView.h"
-#include "SourceCoverageViewHTML.h"
-#include "SourceCoverageViewText.h"
-#include "llvm/ADT/SmallString.h"
-#include "llvm/ADT/StringExtras.h"
-#include "llvm/Support/FileSystem.h"
-#include "llvm/Support/LineIterator.h"
-#include "llvm/Support/Path.h"
-
-using namespace llvm;
-
-void CoveragePrinter::StreamDestructor::operator()(raw_ostream *OS) const {
-  if (OS == &outs())
-    return;
-  delete OS;
-}
-
-std::string CoveragePrinter::getOutputPath(StringRef Path, StringRef Extension,
-                                           bool InToplevel, bool Relative) {
-  assert(Extension.size() && "The file extension may not be empty");
-
-  SmallString<256> FullPath;
-
-  if (!Relative)
-    FullPath.append(Opts.ShowOutputDirectory);
-
-  if (!InToplevel)
-    sys::path::append(FullPath, getCoverageDir());
-
-  SmallString<256> ParentPath = sys::path::parent_path(Path);
-  sys::path::remove_dots(ParentPath, /*remove_dot_dots=*/true);
-  sys::path::append(FullPath, sys::path::relative_path(ParentPath));
-
-  auto PathFilename = (sys::path::filename(Path) + "." + Extension).str();
-  sys::path::append(FullPath, PathFilename);
-
-  return FullPath.str();
-}
-
-Expected<CoveragePrinter::OwnedStream>
-CoveragePrinter::createOutputStream(StringRef Path, StringRef Extension,
-                                    bool InToplevel) {
-  if (!Opts.hasOutputDirectory())
-    return OwnedStream(&outs());
-
-  std::string FullPath = getOutputPath(Path, Extension, InToplevel, false);
-
-  auto ParentDir = sys::path::parent_path(FullPath);
-  if (auto E = sys::fs::create_directories(ParentDir))
-    return errorCodeToError(E);
-
-  std::error_code E;
-  raw_ostream *RawStream = new raw_fd_ostream(FullPath, E, sys::fs::F_RW);
-  auto OS = CoveragePrinter::OwnedStream(RawStream);
-  if (E)
-    return errorCodeToError(E);
-  return std::move(OS);
-}
-
-std::unique_ptr<CoveragePrinter>
-CoveragePrinter::create(const CoverageViewOptions &Opts) {
-  switch (Opts.Format) {
-  case CoverageViewOptions::OutputFormat::Text:
-    return llvm::make_unique<CoveragePrinterText>(Opts);
-  case CoverageViewOptions::OutputFormat::HTML:
-    return llvm::make_unique<CoveragePrinterHTML>(Opts);
-  }
-  llvm_unreachable("Unknown coverage output format!");
-}
-
-std::string SourceCoverageView::formatCount(uint64_t N) {
-  std::string Number = utostr(N);
-  int Len = Number.size();
-  if (Len <= 3)
-    return Number;
-  int IntLen = Len % 3 == 0 ? 3 : Len % 3;
-  std::string Result(Number.data(), IntLen);
-  if (IntLen != 3) {
-    Result.push_back('.');
-    Result += Number.substr(IntLen, 3 - IntLen);
-  }
-  Result.push_back(" kMGTPEZY"[(Len - 1) / 3]);
-  return Result;
-}
-
-bool SourceCoverageView::shouldRenderRegionMarkers(
-    bool LineHasMultipleRegions) const {
-  return getOptions().ShowRegionMarkers &&
-         (!getOptions().ShowLineStatsOrRegionMarkers || LineHasMultipleRegions);
-}
-
-bool SourceCoverageView::hasSubViews() const {
-  return !ExpansionSubViews.empty() || !InstantiationSubViews.empty();
-}
-
-std::unique_ptr<SourceCoverageView>
-SourceCoverageView::create(StringRef SourceName, const MemoryBuffer &File,
-                           const CoverageViewOptions &Options,
-                           coverage::CoverageData &&CoverageInfo) {
-  switch (Options.Format) {
-  case CoverageViewOptions::OutputFormat::Text:
-    return llvm::make_unique<SourceCoverageViewText>(SourceName, File, Options,
-                                                     std::move(CoverageInfo));
-  case CoverageViewOptions::OutputFormat::HTML:
-    return llvm::make_unique<SourceCoverageViewHTML>(SourceName, File, Options,
-                                                     std::move(CoverageInfo));
-  }
-  llvm_unreachable("Unknown coverage output format!");
-}
-
-void SourceCoverageView::addExpansion(
-    const coverage::CounterMappingRegion &Region,
-    std::unique_ptr<SourceCoverageView> View) {
-  ExpansionSubViews.emplace_back(Region, std::move(View));
-}
-
-void SourceCoverageView::addInstantiation(
-    StringRef FunctionName, unsigned Line,
-    std::unique_ptr<SourceCoverageView> View) {
-  InstantiationSubViews.emplace_back(FunctionName, Line, std::move(View));
-}
-
-void SourceCoverageView::print(raw_ostream &OS, bool WholeFile,
-                               bool ShowSourceName, unsigned ViewDepth) {
-  if (ShowSourceName)
-    renderSourceName(OS);
-
-  renderViewHeader(OS);
-
-  // We need the expansions and instantiations sorted so we can go through them
-  // while we iterate lines.
-  std::sort(ExpansionSubViews.begin(), ExpansionSubViews.end());
-  std::sort(InstantiationSubViews.begin(), InstantiationSubViews.end());
-  auto NextESV = ExpansionSubViews.begin();
-  auto EndESV = ExpansionSubViews.end();
-  auto NextISV = InstantiationSubViews.begin();
-  auto EndISV = InstantiationSubViews.end();
-
-  // Get the coverage information for the file.
-  auto NextSegment = CoverageInfo.begin();
-  auto EndSegment = CoverageInfo.end();
-
-  unsigned FirstLine = NextSegment != EndSegment ? NextSegment->Line : 0;
-  const coverage::CoverageSegment *WrappedSegment = nullptr;
-  SmallVector<const coverage::CoverageSegment *, 8> LineSegments;
-  for (line_iterator LI(File, /*SkipBlanks=*/false); !LI.is_at_eof(); ++LI) {
-    // If we aren't rendering the whole file, we need to filter out the prologue
-    // and epilogue.
-    if (!WholeFile) {
-      if (NextSegment == EndSegment)
-        break;
-      else if (LI.line_number() < FirstLine)
-        continue;
-    }
-
-    // Collect the coverage information relevant to this line.
-    if (LineSegments.size())
-      WrappedSegment = LineSegments.back();
-    LineSegments.clear();
-    while (NextSegment != EndSegment && NextSegment->Line == LI.line_number())
-      LineSegments.push_back(&*NextSegment++);
-
-    // Calculate a count to be for the line as a whole.
-    LineCoverageStats LineCount;
-    if (WrappedSegment && WrappedSegment->HasCount)
-      LineCount.addRegionCount(WrappedSegment->Count);
-    for (const auto *S : LineSegments)
-      if (S->HasCount && S->IsRegionEntry)
-        LineCount.addRegionStartCount(S->Count);
-
-    renderLinePrefix(OS, ViewDepth);
-    if (getOptions().ShowLineStats)
-      renderLineCoverageColumn(OS, LineCount);
-    if (getOptions().ShowLineNumbers)
-      renderLineNumberColumn(OS, LI.line_number());
-
-    // If there are expansion subviews, we want to highlight the first one.
-    unsigned ExpansionColumn = 0;
-    if (NextESV != EndESV && NextESV->getLine() == LI.line_number() &&
-        getOptions().Colors)
-      ExpansionColumn = NextESV->getStartCol();
-
-    // Display the source code for the current line.
-    renderLine(OS, {*LI, LI.line_number()}, WrappedSegment, LineSegments,
-               ExpansionColumn, ViewDepth);
-
-    // Show the region markers.
-    if (shouldRenderRegionMarkers(LineCount.hasMultipleRegions()))
-      renderRegionMarkers(OS, LineSegments, ViewDepth);
-
-    // Show the expansions and instantiations for this line.
-    bool RenderedSubView = false;
-    for (; NextESV != EndESV && NextESV->getLine() == LI.line_number();
-         ++NextESV) {
-      renderViewDivider(OS, ViewDepth + 1);
-
-      // Re-render the current line and highlight the expansion range for
-      // this subview.
-      if (RenderedSubView) {
-        ExpansionColumn = NextESV->getStartCol();
-        renderExpansionSite(OS, {*LI, LI.line_number()}, WrappedSegment,
-                            LineSegments, ExpansionColumn, ViewDepth);
-        renderViewDivider(OS, ViewDepth + 1);
-      }
-
-      renderExpansionView(OS, *NextESV, ViewDepth + 1);
-      RenderedSubView = true;
-    }
-    for (; NextISV != EndISV && NextISV->Line == LI.line_number(); ++NextISV) {
-      renderViewDivider(OS, ViewDepth + 1);
-      renderInstantiationView(OS, *NextISV, ViewDepth + 1);
-      RenderedSubView = true;
-    }
-    if (RenderedSubView)
-      renderViewDivider(OS, ViewDepth + 1);
-    renderLineSuffix(OS, ViewDepth);
-  }
-
-  renderViewFooter(OS);
-}
diff --git a/tools/llvm-cov/SourceCoverageView.h b/tools/llvm-cov/SourceCoverageView.h
deleted file mode 100644
index feef959..0000000
--- a/tools/llvm-cov/SourceCoverageView.h
+++ /dev/null
@@ -1,285 +0,0 @@
-//===- SourceCoverageView.h - Code coverage view for source code ----------===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-///
-/// \file This class implements rendering for code coverage of source code.
-///
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_COV_SOURCECOVERAGEVIEW_H
-#define LLVM_COV_SOURCECOVERAGEVIEW_H
-
-#include "CoverageViewOptions.h"
-#include "llvm/ProfileData/Coverage/CoverageMapping.h"
-#include "llvm/Support/MemoryBuffer.h"
-#include <vector>
-
-namespace llvm {
-
-class SourceCoverageView;
-
-/// \brief A view that represents a macro or include expansion.
-struct ExpansionView {
-  coverage::CounterMappingRegion Region;
-  std::unique_ptr<SourceCoverageView> View;
-
-  ExpansionView(const coverage::CounterMappingRegion &Region,
-                std::unique_ptr<SourceCoverageView> View)
-      : Region(Region), View(std::move(View)) {}
-  ExpansionView(ExpansionView &&RHS)
-      : Region(std::move(RHS.Region)), View(std::move(RHS.View)) {}
-  ExpansionView &operator=(ExpansionView &&RHS) {
-    Region = std::move(RHS.Region);
-    View = std::move(RHS.View);
-    return *this;
-  }
-
-  unsigned getLine() const { return Region.LineStart; }
-  unsigned getStartCol() const { return Region.ColumnStart; }
-  unsigned getEndCol() const { return Region.ColumnEnd; }
-
-  friend bool operator<(const ExpansionView &LHS, const ExpansionView &RHS) {
-    return LHS.Region.startLoc() < RHS.Region.startLoc();
-  }
-};
-
-/// \brief A view that represents a function instantiation.
-struct InstantiationView {
-  StringRef FunctionName;
-  unsigned Line;
-  std::unique_ptr<SourceCoverageView> View;
-
-  InstantiationView(StringRef FunctionName, unsigned Line,
-                    std::unique_ptr<SourceCoverageView> View)
-      : FunctionName(FunctionName), Line(Line), View(std::move(View)) {}
-  InstantiationView(InstantiationView &&RHS)
-      : FunctionName(std::move(RHS.FunctionName)), Line(std::move(RHS.Line)),
-        View(std::move(RHS.View)) {}
-  InstantiationView &operator=(InstantiationView &&RHS) {
-    FunctionName = std::move(RHS.FunctionName);
-    Line = std::move(RHS.Line);
-    View = std::move(RHS.View);
-    return *this;
-  }
-
-  friend bool operator<(const InstantiationView &LHS,
-                        const InstantiationView &RHS) {
-    return LHS.Line < RHS.Line;
-  }
-};
-
-/// \brief Coverage statistics for a single line.
-struct LineCoverageStats {
-  uint64_t ExecutionCount;
-  unsigned RegionCount;
-  bool Mapped;
-
-  LineCoverageStats() : ExecutionCount(0), RegionCount(0), Mapped(false) {}
-
-  bool isMapped() const { return Mapped; }
-
-  bool hasMultipleRegions() const { return RegionCount > 1; }
-
-  void addRegionStartCount(uint64_t Count) {
-    // The max of all region starts is the most interesting value.
-    addRegionCount(RegionCount ? std::max(ExecutionCount, Count) : Count);
-    ++RegionCount;
-  }
-
-  void addRegionCount(uint64_t Count) {
-    Mapped = true;
-    ExecutionCount = Count;
-  }
-};
-
-/// \brief A file manager that handles format-aware file creation.
-class CoveragePrinter {
-  const CoverageViewOptions &Opts;
-
-public:
-  struct StreamDestructor {
-    void operator()(raw_ostream *OS) const;
-  };
-
-  using OwnedStream = std::unique_ptr<raw_ostream, StreamDestructor>;
-
-protected:
-  CoveragePrinter(const CoverageViewOptions &Opts) : Opts(Opts) {}
-
-  /// \brief Return `OutputDir/ToplevelDir/Path.Extension`. If \p InToplevel is
-  /// false, skip the ToplevelDir component. If \p Relative is false, skip the
-  /// OutputDir component.
-  std::string getOutputPath(StringRef Path, StringRef Extension,
-                            bool InToplevel, bool Relative = true);
-
-  /// \brief If directory output is enabled, create a file in that directory
-  /// at the path given by getOutputPath(). Otherwise, return stdout.
-  Expected<OwnedStream> createOutputStream(StringRef Path, StringRef Extension,
-                                           bool InToplevel);
-
-  /// \brief Return the sub-directory name for file coverage reports.
-  static StringRef getCoverageDir() { return "coverage"; }
-
-public:
-  static std::unique_ptr<CoveragePrinter>
-  create(const CoverageViewOptions &Opts);
-
-  virtual ~CoveragePrinter() {}
-
-  /// @name File Creation Interface
-  /// @{
-
-  /// \brief Create a file to print a coverage view into.
-  virtual Expected<OwnedStream> createViewFile(StringRef Path,
-                                               bool InToplevel) = 0;
-
-  /// \brief Close a file which has been used to print a coverage view.
-  virtual void closeViewFile(OwnedStream OS) = 0;
-
-  /// \brief Create an index which lists reports for the given source files.
-  virtual Error createIndexFile(ArrayRef<StringRef> SourceFiles) = 0;
-
-  /// @}
-};
-
-/// \brief A code coverage view of a source file or function.
-///
-/// A source coverage view and its nested sub-views form a file-oriented
-/// representation of code coverage data. This view can be printed out by a
-/// renderer which implements the Rendering Interface.
-class SourceCoverageView {
-  /// A function or file name.
-  StringRef SourceName;
-
-  /// A memory buffer backing the source on display.
-  const MemoryBuffer &File;
-
-  /// Various options to guide the coverage renderer.
-  const CoverageViewOptions &Options;
-
-  /// Complete coverage information about the source on display.
-  coverage::CoverageData CoverageInfo;
-
-  /// A container for all expansions (e.g macros) in the source on display.
-  std::vector<ExpansionView> ExpansionSubViews;
-
-  /// A container for all instantiations (e.g template functions) in the source
-  /// on display.
-  std::vector<InstantiationView> InstantiationSubViews;
-
-protected:
-  struct LineRef {
-    StringRef Line;
-    int64_t LineNo;
-
-    LineRef(StringRef Line, int64_t LineNo) : Line(Line), LineNo(LineNo) {}
-  };
-
-  using CoverageSegmentArray = ArrayRef<const coverage::CoverageSegment *>;
-
-  /// @name Rendering Interface
-  /// @{
-
-  /// \brief Render a header for the view.
-  virtual void renderViewHeader(raw_ostream &OS) = 0;
-
-  /// \brief Render a footer for the view.
-  virtual void renderViewFooter(raw_ostream &OS) = 0;
-
-  /// \brief Render the source name for the view.
-  virtual void renderSourceName(raw_ostream &OS) = 0;
-
-  /// \brief Render the line prefix at the given \p ViewDepth.
-  virtual void renderLinePrefix(raw_ostream &OS, unsigned ViewDepth) = 0;
-
-  /// \brief Render the line suffix at the given \p ViewDepth.
-  virtual void renderLineSuffix(raw_ostream &OS, unsigned ViewDepth) = 0;
-
-  /// \brief Render a view divider at the given \p ViewDepth.
-  virtual void renderViewDivider(raw_ostream &OS, unsigned ViewDepth) = 0;
-
-  /// \brief Render a source line with highlighting.
-  virtual void renderLine(raw_ostream &OS, LineRef L,
-                          const coverage::CoverageSegment *WrappedSegment,
-                          CoverageSegmentArray Segments, unsigned ExpansionCol,
-                          unsigned ViewDepth) = 0;
-
-  /// \brief Render the line's execution count column.
-  virtual void renderLineCoverageColumn(raw_ostream &OS,
-                                        const LineCoverageStats &Line) = 0;
-
-  /// \brief Render the line number column.
-  virtual void renderLineNumberColumn(raw_ostream &OS, unsigned LineNo) = 0;
-
-  /// \brief Render all the region's execution counts on a line.
-  virtual void renderRegionMarkers(raw_ostream &OS,
-                                   CoverageSegmentArray Segments,
-                                   unsigned ViewDepth) = 0;
-
-  /// \brief Render the site of an expansion.
-  virtual void
-  renderExpansionSite(raw_ostream &OS, LineRef L,
-                      const coverage::CoverageSegment *WrappedSegment,
-                      CoverageSegmentArray Segments, unsigned ExpansionCol,
-                      unsigned ViewDepth) = 0;
-
-  /// \brief Render an expansion view and any nested views.
-  virtual void renderExpansionView(raw_ostream &OS, ExpansionView &ESV,
-                                   unsigned ViewDepth) = 0;
-
-  /// \brief Render an instantiation view and any nested views.
-  virtual void renderInstantiationView(raw_ostream &OS, InstantiationView &ISV,
-                                       unsigned ViewDepth) = 0;
-
-  /// @}
-
-  /// \brief Format a count using engineering notation with 3 significant
-  /// digits.
-  static std::string formatCount(uint64_t N);
-
-  /// \brief Check if region marker output is expected for a line.
-  bool shouldRenderRegionMarkers(bool LineHasMultipleRegions) const;
-
-  /// \brief Check if there are any sub-views attached to this view.
-  bool hasSubViews() const;
-
-  SourceCoverageView(StringRef SourceName, const MemoryBuffer &File,
-                     const CoverageViewOptions &Options,
-                     coverage::CoverageData &&CoverageInfo)
-      : SourceName(SourceName), File(File), Options(Options),
-        CoverageInfo(std::move(CoverageInfo)) {}
-
-public:
-  static std::unique_ptr<SourceCoverageView>
-  create(StringRef SourceName, const MemoryBuffer &File,
-         const CoverageViewOptions &Options,
-         coverage::CoverageData &&CoverageInfo);
-
-  virtual ~SourceCoverageView() {}
-
-  StringRef getSourceName() const { return SourceName; }
-
-  const CoverageViewOptions &getOptions() const { return Options; }
-
-  /// \brief Add an expansion subview to this view.
-  void addExpansion(const coverage::CounterMappingRegion &Region,
-                    std::unique_ptr<SourceCoverageView> View);
-
-  /// \brief Add a function instantiation subview to this view.
-  void addInstantiation(StringRef FunctionName, unsigned Line,
-                        std::unique_ptr<SourceCoverageView> View);
-
-  /// \brief Print the code coverage information for a specific portion of a
-  /// source file to the output stream.
-  void print(raw_ostream &OS, bool WholeFile, bool ShowSourceName,
-             unsigned ViewDepth = 0);
-};
-
-} // namespace llvm
-
-#endif // LLVM_COV_SOURCECOVERAGEVIEW_H
diff --git a/tools/llvm-cov/SourceCoverageViewHTML.cpp b/tools/llvm-cov/SourceCoverageViewHTML.cpp
index 81963e5..8b13789 100644
--- a/tools/llvm-cov/SourceCoverageViewHTML.cpp
+++ b/tools/llvm-cov/SourceCoverageViewHTML.cpp
@@ -1,436 +1 @@
-//===- SourceCoverageViewHTML.cpp - A html code coverage view -------------===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-///
-/// \file This file implements the html coverage renderer.
-///
-//===----------------------------------------------------------------------===//
 
-#include "SourceCoverageViewHTML.h"
-#include "llvm/ADT/Optional.h"
-#include "llvm/ADT/SmallString.h"
-#include "llvm/ADT/StringExtras.h"
-#include "llvm/Support/Path.h"
-
-using namespace llvm;
-
-namespace {
-
-const char *BeginHeader =
-  "<head>"
-    "<meta name='viewport' content='width=device-width,initial-scale=1'>"
-    "<meta charset='UTF-8'>";
-
-const char *CSSForCoverage =
-  "<style>"
-R"(
-
-.red {
-  background-color: #FFD0D0;
-}
-.cyan {
-  background-color: cyan;
-}
-.black {
-  background-color: black;
-  color: white;
-}
-.green {
-  background-color: #98FFA6;
-  color: white;
-}
-.magenta {
-  background-color: #F998FF;
-  color: white;
-}
-body {
-  font-family: -apple-system, sans-serif;
-}
-pre {
-  margin-top: 0px !important;
-  margin-bottom: 0px !important;
-}
-.source-name-title {
-  padding: 5px 10px;
-  border-bottom: 1px solid #dbdbdb;
-  background-color: #eee;
-}
-.centered {
-  display: table;
-  margin-left: auto;
-  margin-right: auto;
-  border: 1px solid #dbdbdb;
-  border-radius: 3px;
-}
-.expansion-view {
-  background-color: rgba(0, 0, 0, 0);
-  margin-left: 0px;
-  margin-top: 5px;
-  margin-right: 5px;
-  margin-bottom: 5px;
-  border: 1px solid #dbdbdb;
-  border-radius: 3px;
-}
-table {
-  border-collapse: collapse;
-}
-.line-number {
-  text-align: right;
-  color: #aaa;
-}
-.covered-line {
-  text-align: right;
-  color: #0080ff;
-}
-.uncovered-line {
-  text-align: right;
-  color: #ff3300;
-}
-.tooltip {
-  position: relative;
-  display: inline;
-  background-color: #b3e6ff;
-  text-decoration: none;
-}
-.tooltip span.tooltip-content {
-  position: absolute;
-  width: 100px;
-  margin-left: -50px;
-  color: #FFFFFF;
-  background: #000000;
-  height: 30px;
-  line-height: 30px;
-  text-align: center;
-  visibility: hidden;
-  border-radius: 6px;
-}
-.tooltip span.tooltip-content:after {
-  content: '';
-  position: absolute;
-  top: 100%;
-  left: 50%;
-  margin-left: -8px;
-  width: 0; height: 0;
-  border-top: 8px solid #000000;
-  border-right: 8px solid transparent;
-  border-left: 8px solid transparent;
-}
-:hover.tooltip span.tooltip-content {
-  visibility: visible;
-  opacity: 0.8;
-  bottom: 30px;
-  left: 50%;
-  z-index: 999;
-}
-th, td {
-  vertical-align: top;
-  padding: 2px 5px;
-  border-collapse: collapse;
-  border-right: solid 1px #eee;
-  border-left: solid 1px #eee;
-}
-td:first-child {
-  border-left: none;
-}
-td:last-child {
-  border-right: none;
-}
-
-)"
-  "</style>";
-
-const char *EndHeader = "</head>";
-
-const char *BeginCenteredDiv = "<div class='centered'>";
-
-const char *EndCenteredDiv = "</div>";
-
-const char *BeginSourceNameDiv = "<div class='source-name-title'>";
-
-const char *EndSourceNameDiv = "</div>";
-
-const char *BeginCodeTD = "<td class='code'>";
-
-const char *EndCodeTD = "</td>";
-
-const char *BeginPre = "<pre>";
-
-const char *EndPre = "</pre>";
-
-const char *BeginExpansionDiv = "<div class='expansion-view'>";
-
-const char *EndExpansionDiv = "</div>";
-
-const char *BeginTable = "<table>";
-
-const char *EndTable = "</table>";
-
-void emitPrelude(raw_ostream &OS) {
-  OS << "<!doctype html>"
-        "<html>"
-     << BeginHeader << CSSForCoverage << EndHeader << "<body>"
-     << BeginCenteredDiv;
-}
-
-void emitEpilog(raw_ostream &OS) {
-  OS << EndCenteredDiv << "</body>"
-                          "</html>";
-}
-
-// Return a string with the special characters in \p Str escaped.
-std::string escape(StringRef Str) {
-  std::string Result;
-  for (char C : Str) {
-    if (C == '&')
-      Result += "&amp;";
-    else if (C == '<')
-      Result += "&lt;";
-    else if (C == '>')
-      Result += "&gt;";
-    else if (C == '\"')
-      Result += "&quot;";
-    else
-      Result += C;
-  }
-  return Result;
-}
-
-// Create a \p Name tag around \p Str, and optionally set its \p ClassName.
-std::string tag(const std::string &Name, const std::string &Str,
-                const std::string &ClassName = "") {
-  std::string Tag = "<" + Name;
-  if (ClassName != "")
-    Tag += " class='" + ClassName + "'";
-  return Tag + ">" + Str + "</" + Name + ">";
-}
-
-// Create an anchor to \p Link with the label \p Str.
-std::string a(const std::string &Link, const std::string &Str) {
-  return "<a href='" + Link + "'>" + Str + "</a>";
-}
-
-} // anonymous namespace
-
-Expected<CoveragePrinter::OwnedStream>
-CoveragePrinterHTML::createViewFile(StringRef Path, bool InToplevel) {
-  auto OSOrErr = createOutputStream(Path, "html", InToplevel);
-  if (!OSOrErr)
-    return OSOrErr;
-
-  OwnedStream OS = std::move(OSOrErr.get());
-  emitPrelude(*OS.get());
-  return std::move(OS);
-}
-
-void CoveragePrinterHTML::closeViewFile(OwnedStream OS) {
-  emitEpilog(*OS.get());
-}
-
-Error CoveragePrinterHTML::createIndexFile(ArrayRef<StringRef> SourceFiles) {
-  auto OSOrErr = createOutputStream("index", "html", /*InToplevel=*/true);
-  if (Error E = OSOrErr.takeError())
-    return E;
-  auto OS = std::move(OSOrErr.get());
-  raw_ostream &OSRef = *OS.get();
-
-  // Emit a table containing links to reports for each file in the covmapping.
-  emitPrelude(OSRef);
-  OSRef << BeginSourceNameDiv << "Index" << EndSourceNameDiv;
-  OSRef << BeginTable;
-  for (StringRef SF : SourceFiles) {
-    std::string LinkText = escape(sys::path::relative_path(SF));
-    std::string LinkTarget =
-        escape(getOutputPath(SF, "html", /*InToplevel=*/false));
-    OSRef << tag("tr", tag("td", tag("pre", a(LinkTarget, LinkText), "code")));
-  }
-  OSRef << EndTable;
-  emitEpilog(OSRef);
-
-  return Error::success();
-}
-
-void SourceCoverageViewHTML::renderViewHeader(raw_ostream &OS) {
-  OS << BeginTable;
-}
-
-void SourceCoverageViewHTML::renderViewFooter(raw_ostream &OS) {
-  OS << EndTable;
-}
-
-void SourceCoverageViewHTML::renderSourceName(raw_ostream &OS) {
-  OS << BeginSourceNameDiv << tag("pre", escape(getSourceName()))
-     << EndSourceNameDiv;
-}
-
-void SourceCoverageViewHTML::renderLinePrefix(raw_ostream &OS, unsigned) {
-  OS << "<tr>";
-}
-
-void SourceCoverageViewHTML::renderLineSuffix(raw_ostream &OS, unsigned) {
-  // If this view has sub-views, renderLine() cannot close the view's cell.
-  // Take care of it here, after all sub-views have been rendered.
-  if (hasSubViews())
-    OS << EndCodeTD;
-  OS << "</tr>";
-}
-
-void SourceCoverageViewHTML::renderViewDivider(raw_ostream &, unsigned) {
-  // The table-based output makes view dividers unnecessary.
-}
-
-void SourceCoverageViewHTML::renderLine(
-    raw_ostream &OS, LineRef L, const coverage::CoverageSegment *WrappedSegment,
-    CoverageSegmentArray Segments, unsigned ExpansionCol, unsigned) {
-  StringRef Line = L.Line;
-
-  // Steps for handling text-escaping, highlighting, and tooltip creation:
-  //
-  // 1. Split the line into N+1 snippets, where N = |Segments|. The first
-  //    snippet starts from Col=1 and ends at the start of the first segment.
-  //    The last snippet starts at the last mapped column in the line and ends
-  //    at the end of the line. Both are required but may be empty.
-
-  SmallVector<std::string, 8> Snippets;
-
-  unsigned LCol = 1;
-  auto Snip = [&](unsigned Start, unsigned Len) {
-    assert(Start + Len <= Line.size() && "Snippet extends past the EOL");
-    Snippets.push_back(Line.substr(Start, Len));
-    LCol += Len;
-  };
-
-  Snip(LCol - 1, Segments.empty() ? 0 : (Segments.front()->Col - 1));
-
-  for (unsigned I = 1, E = Segments.size(); I < E; ++I) {
-    assert(LCol == Segments[I - 1]->Col && "Snippet start position is wrong");
-    Snip(LCol - 1, Segments[I]->Col - LCol);
-  }
-
-  // |Line| + 1 is needed to avoid underflow when, e.g |Line| = 0 and LCol = 1.
-  Snip(LCol - 1, Line.size() + 1 - LCol);
-  assert(LCol == Line.size() + 1 && "Final snippet doesn't reach the EOL");
-
-  // 2. Escape all of the snippets.
-
-  for (unsigned I = 0, E = Snippets.size(); I < E; ++I)
-    Snippets[I] = escape(Snippets[I]);
-
-  // 3. Use \p WrappedSegment to set the highlight for snippets 0 and 1. Use
-  //    segment 1 to set the highlight for snippet 2, segment 2 to set the
-  //    highlight for snippet 3, and so on.
-
-  Optional<std::string> Color;
-  auto Highlight = [&](const std::string &Snippet) {
-    return tag("span", Snippet, Color.getValue());
-  };
-
-  auto CheckIfUncovered = [](const coverage::CoverageSegment *S) {
-    return S && S->HasCount && S->Count == 0;
-  };
-
-  if (CheckIfUncovered(WrappedSegment) ||
-      CheckIfUncovered(Segments.empty() ? nullptr : Segments.front())) {
-    Color = "red";
-    Snippets[0] = Highlight(Snippets[0]);
-    Snippets[1] = Highlight(Snippets[1]);
-  }
-
-  for (unsigned I = 1, E = Segments.size(); I < E; ++I) {
-    const auto *CurSeg = Segments[I];
-    if (CurSeg->Col == ExpansionCol)
-      Color = "cyan";
-    else if (CheckIfUncovered(CurSeg))
-      Color = "red";
-    else
-      Color = None;
-
-    if (Color.hasValue())
-      Snippets[I + 1] = Highlight(Snippets[I + 1]);
-  }
-
-  // 4. Snippets[1:N+1] correspond to \p Segments[0:N]: use these to generate
-  //    sub-line region count tooltips if needed.
-
-  bool HasMultipleRegions = [&] {
-    unsigned RegionCount = 0;
-    for (const auto *S : Segments)
-      if (S->HasCount && S->IsRegionEntry)
-        if (++RegionCount > 1)
-          return true;
-    return false;
-  }();
-
-  if (shouldRenderRegionMarkers(HasMultipleRegions)) {
-    for (unsigned I = 0, E = Segments.size(); I < E; ++I) {
-      const auto *CurSeg = Segments[I];
-      if (!CurSeg->IsRegionEntry || !CurSeg->HasCount)
-        continue;
-
-      Snippets[I + 1] =
-          tag("div", Snippets[I + 1] + tag("span", formatCount(CurSeg->Count),
-                                          "tooltip-content"),
-              "tooltip");
-    }
-  }
-
-  OS << BeginCodeTD;
-  OS << BeginPre;
-  for (const auto &Snippet : Snippets)
-    OS << Snippet;
-  OS << EndPre;
-
-  // If there are no sub-views left to attach to this cell, end the cell.
-  // Otherwise, end it after the sub-views are rendered (renderLineSuffix()).
-  if (!hasSubViews())
-    OS << EndCodeTD;
-}
-
-void SourceCoverageViewHTML::renderLineCoverageColumn(
-    raw_ostream &OS, const LineCoverageStats &Line) {
-  std::string Count = "";
-  if (Line.isMapped())
-    Count = tag("pre", formatCount(Line.ExecutionCount));
-  std::string CoverageClass =
-      (Line.ExecutionCount > 0) ? "covered-line" : "uncovered-line";
-  OS << tag("td", Count, CoverageClass);
-}
-
-void SourceCoverageViewHTML::renderLineNumberColumn(raw_ostream &OS,
-                                                    unsigned LineNo) {
-  OS << tag("td", tag("pre", utostr(uint64_t(LineNo))), "line-number");
-}
-
-void SourceCoverageViewHTML::renderRegionMarkers(raw_ostream &,
-                                                 CoverageSegmentArray,
-                                                 unsigned) {
-  // Region markers are rendered in-line using tooltips.
-}
-
-void SourceCoverageViewHTML::renderExpansionSite(
-    raw_ostream &OS, LineRef L, const coverage::CoverageSegment *WrappedSegment,
-    CoverageSegmentArray Segments, unsigned ExpansionCol, unsigned ViewDepth) {
-  // Render the line containing the expansion site. No extra formatting needed.
-  renderLine(OS, L, WrappedSegment, Segments, ExpansionCol, ViewDepth);
-}
-
-void SourceCoverageViewHTML::renderExpansionView(raw_ostream &OS,
-                                                 ExpansionView &ESV,
-                                                 unsigned ViewDepth) {
-  OS << BeginExpansionDiv;
-  ESV.View->print(OS, /*WholeFile=*/false, /*ShowSourceName=*/false,
-                  ViewDepth + 1);
-  OS << EndExpansionDiv;
-}
-
-void SourceCoverageViewHTML::renderInstantiationView(raw_ostream &OS,
-                                                     InstantiationView &ISV,
-                                                     unsigned ViewDepth) {
-  OS << BeginExpansionDiv;
-  ISV.View->print(OS, /*WholeFile=*/false, /*ShowSourceName=*/true, ViewDepth);
-  OS << EndExpansionDiv;
-}
diff --git a/tools/llvm-cov/SourceCoverageViewHTML.h b/tools/llvm-cov/SourceCoverageViewHTML.h
deleted file mode 100644
index 50ecf2b..0000000
--- a/tools/llvm-cov/SourceCoverageViewHTML.h
+++ /dev/null
@@ -1,83 +0,0 @@
-//===- SourceCoverageViewHTML.h - A html code coverage view ---------------===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-///
-/// \file This file defines the interface to the html coverage renderer.
-///
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_COV_SOURCECOVERAGEVIEWHTML_H
-#define LLVM_COV_SOURCECOVERAGEVIEWHTML_H
-
-#include "SourceCoverageView.h"
-
-namespace llvm {
-
-/// \brief A coverage printer for html output.
-class CoveragePrinterHTML : public CoveragePrinter {
-public:
-  Expected<OwnedStream> createViewFile(StringRef Path,
-                                       bool InToplevel) override;
-
-  void closeViewFile(OwnedStream OS) override;
-
-  Error createIndexFile(ArrayRef<StringRef> SourceFiles) override;
-
-  CoveragePrinterHTML(const CoverageViewOptions &Opts)
-      : CoveragePrinter(Opts) {}
-};
-
-/// \brief A code coverage view which supports html-based rendering.
-class SourceCoverageViewHTML : public SourceCoverageView {
-  void renderViewHeader(raw_ostream &OS) override;
-
-  void renderViewFooter(raw_ostream &OS) override;
-
-  void renderSourceName(raw_ostream &OS) override;
-
-  void renderLinePrefix(raw_ostream &OS, unsigned ViewDepth) override;
-
-  void renderLineSuffix(raw_ostream &OS, unsigned ViewDepth) override;
-
-  void renderViewDivider(raw_ostream &OS, unsigned ViewDepth) override;
-
-  void renderLine(raw_ostream &OS, LineRef L,
-                  const coverage::CoverageSegment *WrappedSegment,
-                  CoverageSegmentArray Segments, unsigned ExpansionCol,
-                  unsigned ViewDepth) override;
-
-  void renderExpansionSite(raw_ostream &OS, LineRef L,
-                           const coverage::CoverageSegment *WrappedSegment,
-                           CoverageSegmentArray Segments, unsigned ExpansionCol,
-                           unsigned ViewDepth) override;
-
-  void renderExpansionView(raw_ostream &OS, ExpansionView &ESV,
-                           unsigned ViewDepth) override;
-
-  void renderInstantiationView(raw_ostream &OS, InstantiationView &ISV,
-                               unsigned ViewDepth) override;
-
-  void renderLineCoverageColumn(raw_ostream &OS,
-                                const LineCoverageStats &Line) override;
-
-  void renderLineNumberColumn(raw_ostream &OS, unsigned LineNo) override;
-
-  void renderRegionMarkers(raw_ostream &OS, CoverageSegmentArray Segments,
-                           unsigned ViewDepth) override;
-
-public:
-  SourceCoverageViewHTML(StringRef SourceName, const MemoryBuffer &File,
-                         const CoverageViewOptions &Options,
-                         coverage::CoverageData &&CoverageInfo)
-      : SourceCoverageView(SourceName, File, Options, std::move(CoverageInfo)) {
-  }
-};
-
-} // namespace llvm
-
-#endif // LLVM_COV_SOURCECOVERAGEVIEWHTML_H
diff --git a/tools/llvm-cov/SourceCoverageViewText.cpp b/tools/llvm-cov/SourceCoverageViewText.cpp
index ae9d6da..8b13789 100644
--- a/tools/llvm-cov/SourceCoverageViewText.cpp
+++ b/tools/llvm-cov/SourceCoverageViewText.cpp
@@ -1,213 +1 @@
-//===- SourceCoverageViewText.cpp - A text-based code coverage view -------===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-///
-/// \file This file implements the text-based coverage renderer.
-///
-//===----------------------------------------------------------------------===//
 
-#include "SourceCoverageViewText.h"
-#include "llvm/ADT/Optional.h"
-#include "llvm/ADT/SmallString.h"
-#include "llvm/ADT/StringExtras.h"
-
-using namespace llvm;
-
-Expected<CoveragePrinter::OwnedStream>
-CoveragePrinterText::createViewFile(StringRef Path, bool InToplevel) {
-  return createOutputStream(Path, "txt", InToplevel);
-}
-
-void CoveragePrinterText::closeViewFile(OwnedStream OS) {
-  OS->operator<<('\n');
-}
-
-Error CoveragePrinterText::createIndexFile(ArrayRef<StringRef> SourceFiles) {
-  auto OSOrErr = createOutputStream("index", "txt", /*InToplevel=*/true);
-  if (Error E = OSOrErr.takeError())
-    return E;
-  auto OS = std::move(OSOrErr.get());
-  raw_ostream &OSRef = *OS.get();
-
-  for (StringRef SF : SourceFiles)
-    OSRef << getOutputPath(SF, "txt", /*InToplevel=*/false) << '\n';
-
-  return Error::success();
-}
-
-namespace {
-
-static const unsigned LineCoverageColumnWidth = 7;
-static const unsigned LineNumberColumnWidth = 5;
-
-/// \brief Get the width of the leading columns.
-unsigned getCombinedColumnWidth(const CoverageViewOptions &Opts) {
-  return (Opts.ShowLineStats ? LineCoverageColumnWidth + 1 : 0) +
-         (Opts.ShowLineNumbers ? LineNumberColumnWidth + 1 : 0);
-}
-
-/// \brief The width of the line that is used to divide between the view and
-/// the subviews.
-unsigned getDividerWidth(const CoverageViewOptions &Opts) {
-  return getCombinedColumnWidth(Opts) + 4;
-}
-
-} // anonymous namespace
-
-void SourceCoverageViewText::renderViewHeader(raw_ostream &) {}
-
-void SourceCoverageViewText::renderViewFooter(raw_ostream &) {}
-
-void SourceCoverageViewText::renderSourceName(raw_ostream &OS) {
-  getOptions().colored_ostream(OS, raw_ostream::CYAN) << getSourceName()
-                                                      << ":\n";
-}
-
-void SourceCoverageViewText::renderLinePrefix(raw_ostream &OS,
-                                              unsigned ViewDepth) {
-  for (unsigned I = 0; I < ViewDepth; ++I)
-    OS << "  |";
-}
-
-void SourceCoverageViewText::renderLineSuffix(raw_ostream &, unsigned) {}
-
-void SourceCoverageViewText::renderViewDivider(raw_ostream &OS,
-                                               unsigned ViewDepth) {
-  assert(ViewDepth != 0 && "Cannot render divider at top level");
-  renderLinePrefix(OS, ViewDepth - 1);
-  OS.indent(2);
-  unsigned Length = getDividerWidth(getOptions());
-  for (unsigned I = 0; I < Length; ++I)
-    OS << '-';
-  OS << '\n';
-}
-
-void SourceCoverageViewText::renderLine(
-    raw_ostream &OS, LineRef L,
-    const coverage::CoverageSegment *WrappedSegment,
-    CoverageSegmentArray Segments, unsigned ExpansionCol, unsigned ViewDepth) {
-  StringRef Line = L.Line;
-  unsigned LineNumber = L.LineNo;
-
-  Optional<raw_ostream::Colors> Highlight;
-  SmallVector<std::pair<unsigned, unsigned>, 2> HighlightedRanges;
-
-  // The first segment overlaps from a previous line, so we treat it specially.
-  if (WrappedSegment && WrappedSegment->HasCount && WrappedSegment->Count == 0)
-    Highlight = raw_ostream::RED;
-
-  // Output each segment of the line, possibly highlighted.
-  unsigned Col = 1;
-  for (const auto *S : Segments) {
-    unsigned End = std::min(S->Col, static_cast<unsigned>(Line.size()) + 1);
-    colored_ostream(OS, Highlight ? *Highlight : raw_ostream::SAVEDCOLOR,
-                    getOptions().Colors && Highlight, /*Bold=*/false,
-                    /*BG=*/true)
-        << Line.substr(Col - 1, End - Col);
-    if (getOptions().Debug && Highlight)
-      HighlightedRanges.push_back(std::make_pair(Col, End));
-    Col = End;
-    if (Col == ExpansionCol)
-      Highlight = raw_ostream::CYAN;
-    else if (S->HasCount && S->Count == 0)
-      Highlight = raw_ostream::RED;
-    else
-      Highlight = None;
-  }
-
-  // Show the rest of the line.
-  colored_ostream(OS, Highlight ? *Highlight : raw_ostream::SAVEDCOLOR,
-                  getOptions().Colors && Highlight, /*Bold=*/false, /*BG=*/true)
-      << Line.substr(Col - 1, Line.size() - Col + 1);
-  OS << '\n';
-
-  if (getOptions().Debug) {
-    for (const auto &Range : HighlightedRanges)
-      errs() << "Highlighted line " << LineNumber << ", " << Range.first
-             << " -> " << Range.second << '\n';
-    if (Highlight)
-      errs() << "Highlighted line " << LineNumber << ", " << Col << " -> ?\n";
-  }
-}
-
-void SourceCoverageViewText::renderLineCoverageColumn(
-    raw_ostream &OS, const LineCoverageStats &Line) {
-  if (!Line.isMapped()) {
-    OS.indent(LineCoverageColumnWidth) << '|';
-    return;
-  }
-  std::string C = formatCount(Line.ExecutionCount);
-  OS.indent(LineCoverageColumnWidth - C.size());
-  colored_ostream(OS, raw_ostream::MAGENTA,
-                  Line.hasMultipleRegions() && getOptions().Colors)
-      << C;
-  OS << '|';
-}
-
-void SourceCoverageViewText::renderLineNumberColumn(raw_ostream &OS,
-                                                    unsigned LineNo) {
-  SmallString<32> Buffer;
-  raw_svector_ostream BufferOS(Buffer);
-  BufferOS << LineNo;
-  auto Str = BufferOS.str();
-  // Trim and align to the right.
-  Str = Str.substr(0, std::min(Str.size(), (size_t)LineNumberColumnWidth));
-  OS.indent(LineNumberColumnWidth - Str.size()) << Str << '|';
-}
-
-void SourceCoverageViewText::renderRegionMarkers(
-    raw_ostream &OS, CoverageSegmentArray Segments, unsigned ViewDepth) {
-  renderLinePrefix(OS, ViewDepth);
-  OS.indent(getCombinedColumnWidth(getOptions()));
-
-  unsigned PrevColumn = 1;
-  for (const auto *S : Segments) {
-    if (!S->IsRegionEntry)
-      continue;
-    // Skip to the new region.
-    if (S->Col > PrevColumn)
-      OS.indent(S->Col - PrevColumn);
-    PrevColumn = S->Col + 1;
-    std::string C = formatCount(S->Count);
-    PrevColumn += C.size();
-    OS << '^' << C;
-  }
-  OS << '\n';
-
-  if (getOptions().Debug)
-    for (const auto *S : Segments)
-      errs() << "Marker at " << S->Line << ":" << S->Col << " = "
-             << formatCount(S->Count) << (S->IsRegionEntry ? "\n" : " (pop)\n");
-}
-
-void SourceCoverageViewText::renderExpansionSite(
-    raw_ostream &OS, LineRef L, const coverage::CoverageSegment *WrappedSegment,
-    CoverageSegmentArray Segments, unsigned ExpansionCol, unsigned ViewDepth) {
-  renderLinePrefix(OS, ViewDepth);
-  OS.indent(getCombinedColumnWidth(getOptions()) + (ViewDepth == 0 ? 0 : 1));
-  renderLine(OS, L, WrappedSegment, Segments, ExpansionCol, ViewDepth);
-}
-
-void SourceCoverageViewText::renderExpansionView(raw_ostream &OS,
-                                                 ExpansionView &ESV,
-                                                 unsigned ViewDepth) {
-  // Render the child subview.
-  if (getOptions().Debug)
-    errs() << "Expansion at line " << ESV.getLine() << ", " << ESV.getStartCol()
-           << " -> " << ESV.getEndCol() << '\n';
-  ESV.View->print(OS, /*WholeFile=*/false, /*ShowSourceName=*/false,
-                  ViewDepth + 1);
-}
-
-void SourceCoverageViewText::renderInstantiationView(raw_ostream &OS,
-                                                     InstantiationView &ISV,
-                                                     unsigned ViewDepth) {
-  renderLinePrefix(OS, ViewDepth);
-  OS << ' ';
-  ISV.View->print(OS, /*WholeFile=*/false, /*ShowSourceName=*/true, ViewDepth);
-}
diff --git a/tools/llvm-cov/SourceCoverageViewText.h b/tools/llvm-cov/SourceCoverageViewText.h
deleted file mode 100644
index b233124..0000000
--- a/tools/llvm-cov/SourceCoverageViewText.h
+++ /dev/null
@@ -1,83 +0,0 @@
-//===- SourceCoverageViewText.h - A text-based code coverage view ---------===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-///
-/// \file This file defines the interface to the text-based coverage renderer.
-///
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_COV_SOURCECOVERAGEVIEWTEXT_H
-#define LLVM_COV_SOURCECOVERAGEVIEWTEXT_H
-
-#include "SourceCoverageView.h"
-
-namespace llvm {
-
-/// \brief A coverage printer for text output.
-class CoveragePrinterText : public CoveragePrinter {
-public:
-  Expected<OwnedStream> createViewFile(StringRef Path,
-                                       bool InToplevel) override;
-
-  void closeViewFile(OwnedStream OS) override;
-
-  Error createIndexFile(ArrayRef<StringRef> SourceFiles) override;
-
-  CoveragePrinterText(const CoverageViewOptions &Opts)
-      : CoveragePrinter(Opts) {}
-};
-
-/// \brief A code coverage view which supports text-based rendering.
-class SourceCoverageViewText : public SourceCoverageView {
-  void renderViewHeader(raw_ostream &OS) override;
-
-  void renderViewFooter(raw_ostream &OS) override;
-
-  void renderSourceName(raw_ostream &OS) override;
-
-  void renderLinePrefix(raw_ostream &OS, unsigned ViewDepth) override;
-
-  void renderLineSuffix(raw_ostream &OS, unsigned ViewDepth) override;
-
-  void renderViewDivider(raw_ostream &OS, unsigned ViewDepth) override;
-
-  void renderLine(raw_ostream &OS, LineRef L,
-                  const coverage::CoverageSegment *WrappedSegment,
-                  CoverageSegmentArray Segments, unsigned ExpansionCol,
-                  unsigned ViewDepth) override;
-
-  void renderExpansionSite(raw_ostream &OS, LineRef L,
-                           const coverage::CoverageSegment *WrappedSegment,
-                           CoverageSegmentArray Segments, unsigned ExpansionCol,
-                           unsigned ViewDepth) override;
-
-  void renderExpansionView(raw_ostream &OS, ExpansionView &ESV,
-                           unsigned ViewDepth) override;
-
-  void renderInstantiationView(raw_ostream &OS, InstantiationView &ISV,
-                               unsigned ViewDepth) override;
-
-  void renderLineCoverageColumn(raw_ostream &OS,
-                                const LineCoverageStats &Line) override;
-
-  void renderLineNumberColumn(raw_ostream &OS, unsigned LineNo) override;
-
-  void renderRegionMarkers(raw_ostream &OS, CoverageSegmentArray Segments,
-                           unsigned ViewDepth) override;
-
-public:
-  SourceCoverageViewText(StringRef SourceName, const MemoryBuffer &File,
-                         const CoverageViewOptions &Options,
-                         coverage::CoverageData &&CoverageInfo)
-      : SourceCoverageView(SourceName, File, Options, std::move(CoverageInfo)) {
-  }
-};
-
-} // namespace llvm
-
-#endif // LLVM_COV_SOURCECOVERAGEVIEWTEXT_H
diff --git a/tools/llvm-cov/TestingSupport.cpp b/tools/llvm-cov/TestingSupport.cpp
index 72768f4..8b13789 100644
--- a/tools/llvm-cov/TestingSupport.cpp
+++ b/tools/llvm-cov/TestingSupport.cpp
@@ -1,92 +1 @@
-//===- TestingSupport.cpp - Convert objects files into test files --------===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
 
-#include "llvm/Object/ObjectFile.h"
-#include "llvm/ProfileData/InstrProf.h"
-#include "llvm/Support/CommandLine.h"
-#include "llvm/Support/LEB128.h"
-#include "llvm/Support/raw_ostream.h"
-#include <functional>
-#include <system_error>
-
-using namespace llvm;
-using namespace object;
-
-int convertForTestingMain(int argc, const char *argv[]) {
-  cl::opt<std::string> InputSourceFile(cl::Positional, cl::Required,
-                                       cl::desc("<Source file>"));
-
-  cl::opt<std::string> OutputFilename(
-      "o", cl::Required,
-      cl::desc(
-          "File with the profile data obtained after an instrumented run"));
-
-  cl::ParseCommandLineOptions(argc, argv, "LLVM code coverage tool\n");
-
-  auto ObjErr = llvm::object::ObjectFile::createObjectFile(InputSourceFile);
-  if (!ObjErr) {
-    std::string Buf;
-    raw_string_ostream OS(Buf);
-    logAllUnhandledErrors(ObjErr.takeError(), OS, "");
-    OS.flush();
-    errs() << "error: " << Buf;
-    return 1;
-  }
-  ObjectFile *OF = ObjErr.get().getBinary();
-  auto BytesInAddress = OF->getBytesInAddress();
-  if (BytesInAddress != 8) {
-    errs() << "error: 64 bit binary expected\n";
-    return 1;
-  }
-
-  // Look for the sections that we are interested in.
-  int FoundSectionCount = 0;
-  SectionRef ProfileNames, CoverageMapping;
-  for (const auto &Section : OF->sections()) {
-    StringRef Name;
-    if (Section.getName(Name))
-      return 1;
-    if (Name == llvm::getInstrProfNameSectionName(false)) {
-      ProfileNames = Section;
-    } else if (Name == llvm::getInstrProfCoverageSectionName(false)) {
-      CoverageMapping = Section;
-    } else
-      continue;
-    ++FoundSectionCount;
-  }
-  if (FoundSectionCount != 2)
-    return 1;
-
-  // Get the contents of the given sections.
-  uint64_t ProfileNamesAddress = ProfileNames.getAddress();
-  StringRef CoverageMappingData;
-  StringRef ProfileNamesData;
-  if (CoverageMapping.getContents(CoverageMappingData) ||
-      ProfileNames.getContents(ProfileNamesData))
-    return 1;
-
-  int FD;
-  if (auto Err =
-          sys::fs::openFileForWrite(OutputFilename, FD, sys::fs::F_None)) {
-    errs() << "error: " << Err.message() << "\n";
-    return 1;
-  }
-
-  raw_fd_ostream OS(FD, true);
-  OS << "llvmcovmtestdata";
-  encodeULEB128(ProfileNamesData.size(), OS);
-  encodeULEB128(ProfileNamesAddress, OS);
-  OS << ProfileNamesData;
-  // Coverage mapping data is expected to have an alignment of 8.
-  for (unsigned Pad = OffsetToAlignment(OS.tell(), 8); Pad; --Pad)
-    OS.write(uint8_t(0));
-  OS << CoverageMappingData;
-
-  return 0;
-}
diff --git a/tools/llvm-cov/gcov.cpp b/tools/llvm-cov/gcov.cpp
index 4652fed..8b13789 100644
--- a/tools/llvm-cov/gcov.cpp
+++ b/tools/llvm-cov/gcov.cpp
@@ -1,145 +1 @@
-//===- gcov.cpp - GCOV compatible LLVM coverage tool ----------------------===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// llvm-cov is a command line tools to analyze and report coverage information.
-//
-//===----------------------------------------------------------------------===//
 
-#include "llvm/ADT/SmallString.h"
-#include "llvm/Support/CommandLine.h"
-#include "llvm/Support/Errc.h"
-#include "llvm/Support/FileSystem.h"
-#include "llvm/Support/GCOV.h"
-#include "llvm/Support/Path.h"
-#include <system_error>
-using namespace llvm;
-
-static void reportCoverage(StringRef SourceFile, StringRef ObjectDir,
-                           const std::string &InputGCNO,
-                           const std::string &InputGCDA, bool DumpGCOV,
-                           const GCOV::Options &Options) {
-  SmallString<128> CoverageFileStem(ObjectDir);
-  if (CoverageFileStem.empty()) {
-    // If no directory was specified with -o, look next to the source file.
-    CoverageFileStem = sys::path::parent_path(SourceFile);
-    sys::path::append(CoverageFileStem, sys::path::stem(SourceFile));
-  } else if (sys::fs::is_directory(ObjectDir))
-    // A directory name was given. Use it and the source file name.
-    sys::path::append(CoverageFileStem, sys::path::stem(SourceFile));
-  else
-    // A file was given. Ignore the source file and look next to this file.
-    sys::path::replace_extension(CoverageFileStem, "");
-
-  std::string GCNO = InputGCNO.empty()
-                         ? std::string(CoverageFileStem.str()) + ".gcno"
-                         : InputGCNO;
-  std::string GCDA = InputGCDA.empty()
-                         ? std::string(CoverageFileStem.str()) + ".gcda"
-                         : InputGCDA;
-  GCOVFile GF;
-
-  ErrorOr<std::unique_ptr<MemoryBuffer>> GCNO_Buff =
-      MemoryBuffer::getFileOrSTDIN(GCNO);
-  if (std::error_code EC = GCNO_Buff.getError()) {
-    errs() << GCNO << ": " << EC.message() << "\n";
-    return;
-  }
-  GCOVBuffer GCNO_GB(GCNO_Buff.get().get());
-  if (!GF.readGCNO(GCNO_GB)) {
-    errs() << "Invalid .gcno File!\n";
-    return;
-  }
-
-  ErrorOr<std::unique_ptr<MemoryBuffer>> GCDA_Buff =
-      MemoryBuffer::getFileOrSTDIN(GCDA);
-  if (std::error_code EC = GCDA_Buff.getError()) {
-    if (EC != errc::no_such_file_or_directory) {
-      errs() << GCDA << ": " << EC.message() << "\n";
-      return;
-    }
-    // Clear the filename to make it clear we didn't read anything.
-    GCDA = "-";
-  } else {
-    GCOVBuffer GCDA_GB(GCDA_Buff.get().get());
-    if (!GF.readGCDA(GCDA_GB)) {
-      errs() << "Invalid .gcda File!\n";
-      return;
-    }
-  }
-
-  if (DumpGCOV)
-    GF.dump();
-
-  FileInfo FI(Options);
-  GF.collectLineCounts(FI);
-  FI.print(llvm::outs(), SourceFile, GCNO, GCDA);
-}
-
-int gcovMain(int argc, const char *argv[]) {
-  cl::list<std::string> SourceFiles(cl::Positional, cl::OneOrMore,
-                                    cl::desc("SOURCEFILE"));
-
-  cl::opt<bool> AllBlocks("a", cl::Grouping, cl::init(false),
-                          cl::desc("Display all basic blocks"));
-  cl::alias AllBlocksA("all-blocks", cl::aliasopt(AllBlocks));
-
-  cl::opt<bool> BranchProb("b", cl::Grouping, cl::init(false),
-                           cl::desc("Display branch probabilities"));
-  cl::alias BranchProbA("branch-probabilities", cl::aliasopt(BranchProb));
-
-  cl::opt<bool> BranchCount("c", cl::Grouping, cl::init(false),
-                            cl::desc("Display branch counts instead "
-                                     "of percentages (requires -b)"));
-  cl::alias BranchCountA("branch-counts", cl::aliasopt(BranchCount));
-
-  cl::opt<bool> LongNames("l", cl::Grouping, cl::init(false),
-                          cl::desc("Prefix filenames with the main file"));
-  cl::alias LongNamesA("long-file-names", cl::aliasopt(LongNames));
-
-  cl::opt<bool> FuncSummary("f", cl::Grouping, cl::init(false),
-                            cl::desc("Show coverage for each function"));
-  cl::alias FuncSummaryA("function-summaries", cl::aliasopt(FuncSummary));
-
-  cl::opt<bool> NoOutput("n", cl::Grouping, cl::init(false),
-                         cl::desc("Do not output any .gcov files"));
-  cl::alias NoOutputA("no-output", cl::aliasopt(NoOutput));
-
-  cl::opt<std::string> ObjectDir(
-      "o", cl::value_desc("DIR|FILE"), cl::init(""),
-      cl::desc("Find objects in DIR or based on FILE's path"));
-  cl::alias ObjectDirA("object-directory", cl::aliasopt(ObjectDir));
-  cl::alias ObjectDirB("object-file", cl::aliasopt(ObjectDir));
-
-  cl::opt<bool> PreservePaths("p", cl::Grouping, cl::init(false),
-                              cl::desc("Preserve path components"));
-  cl::alias PreservePathsA("preserve-paths", cl::aliasopt(PreservePaths));
-
-  cl::opt<bool> UncondBranch("u", cl::Grouping, cl::init(false),
-                             cl::desc("Display unconditional branch info "
-                                      "(requires -b)"));
-  cl::alias UncondBranchA("unconditional-branches", cl::aliasopt(UncondBranch));
-
-  cl::OptionCategory DebugCat("Internal and debugging options");
-  cl::opt<bool> DumpGCOV("dump", cl::init(false), cl::cat(DebugCat),
-                         cl::desc("Dump the gcov file to stderr"));
-  cl::opt<std::string> InputGCNO("gcno", cl::cat(DebugCat), cl::init(""),
-                                 cl::desc("Override inferred gcno file"));
-  cl::opt<std::string> InputGCDA("gcda", cl::cat(DebugCat), cl::init(""),
-                                 cl::desc("Override inferred gcda file"));
-
-  cl::ParseCommandLineOptions(argc, argv, "LLVM code coverage tool\n");
-
-  GCOV::Options Options(AllBlocks, BranchProb, BranchCount, FuncSummary,
-                        PreservePaths, UncondBranch, LongNames, NoOutput);
-
-  for (const auto &SourceFile : SourceFiles)
-    reportCoverage(SourceFile, ObjectDir, InputGCNO, InputGCDA, DumpGCOV,
-                   Options);
-  return 0;
-}
diff --git a/tools/llvm-cov/llvm-cov.cpp b/tools/llvm-cov/llvm-cov.cpp
index ba60cd9..aa1f228 100644
--- a/tools/llvm-cov/llvm-cov.cpp
+++ b/tools/llvm-cov/llvm-cov.cpp
@@ -10,85 +10,6 @@
 // llvm-cov is a command line tools to analyze and report coverage information.
 //
 //===----------------------------------------------------------------------===//
-
-#include "llvm/ADT/StringRef.h"
-#include "llvm/ADT/StringSwitch.h"
-#include "llvm/Support/CommandLine.h"
-#include "llvm/Support/ManagedStatic.h"
-#include "llvm/Support/Path.h"
-#include "llvm/Support/PrettyStackTrace.h"
-#include "llvm/Support/Process.h"
-#include "llvm/Support/Signals.h"
-#include "llvm/Support/raw_ostream.h"
-#include <string>
-
-using namespace llvm;
-
-/// \brief The main entry point for the 'show' subcommand.
-int showMain(int argc, const char *argv[]);
-
-/// \brief The main entry point for the 'report' subcommand.
-int reportMain(int argc, const char *argv[]);
-
-/// \brief The main entry point for the 'convert-for-testing' subcommand.
-int convertForTestingMain(int argc, const char *argv[]);
-
-/// \brief The main entry point for the gcov compatible coverage tool.
-int gcovMain(int argc, const char *argv[]);
-
-/// \brief Top level help.
-static int helpMain(int argc, const char *argv[]) {
-  errs() << "Usage: llvm-cov {gcov|report|show} [OPTION]...\n\n"
-         << "Shows code coverage information.\n\n"
-         << "Subcommands:\n"
-         << "  gcov:   Work with the gcov format.\n"
-         << "  show:   Annotate source files using instrprof style coverage.\n"
-         << "  report: Summarize instrprof style coverage information.\n";
-  return 0;
-}
-
-/// \brief Top level version information.
-static int versionMain(int argc, const char *argv[]) {
-  cl::PrintVersionMessage();
-  return 0;
-}
-
 int main(int argc, const char **argv) {
-  // Print a stack trace if we signal out.
-  sys::PrintStackTraceOnErrorSignal(argv[0]);
-  PrettyStackTraceProgram X(argc, argv);
-  llvm_shutdown_obj Y; // Call llvm_shutdown() on exit.
-
-  // If argv[0] is or ends with 'gcov', always be gcov compatible
-  if (sys::path::stem(argv[0]).endswith_lower("gcov"))
-    return gcovMain(argc, argv);
-
-  // Check if we are invoking a specific tool command.
-  if (argc > 1) {
-    typedef int (*MainFunction)(int, const char *[]);
-    MainFunction Func = StringSwitch<MainFunction>(argv[1])
-                            .Case("convert-for-testing", convertForTestingMain)
-                            .Case("gcov", gcovMain)
-                            .Case("report", reportMain)
-                            .Case("show", showMain)
-                            .Cases("-h", "-help", "--help", helpMain)
-                            .Cases("-version", "--version", versionMain)
-                            .Default(nullptr);
-
-    if (Func) {
-      std::string Invocation = std::string(argv[0]) + " " + argv[1];
-      argv[1] = Invocation.c_str();
-      return Func(argc - 1, argv + 1);
-    }
-  }
-
-  if (argc > 1) {
-    if (sys::Process::StandardErrHasColors())
-      errs().changeColor(raw_ostream::RED);
-    errs() << "Unrecognized command: " << argv[1] << ".\n\n";
-    if (sys::Process::StandardErrHasColors())
-      errs().resetColor();
-  }
-  helpMain(argc, argv);
   return 1;
 }
diff --git a/tools/sancov/sancov.cc b/tools/sancov/sancov.cc
index 55b0370..c869a73 100644
--- a/tools/sancov/sancov.cc
+++ b/tools/sancov/sancov.cc
@@ -10,1249 +10,7 @@
 // This file is a command-line tool for reading and analyzing sanitizer
 // coverage.
 //===----------------------------------------------------------------------===//
-#include "llvm/ADT/STLExtras.h"
-#include "llvm/ADT/Twine.h"
-#include "llvm/DebugInfo/Symbolize/Symbolize.h"
-#include "llvm/MC/MCAsmInfo.h"
-#include "llvm/MC/MCContext.h"
-#include "llvm/MC/MCDisassembler/MCDisassembler.h"
-#include "llvm/MC/MCInst.h"
-#include "llvm/MC/MCInstPrinter.h"
-#include "llvm/MC/MCInstrAnalysis.h"
-#include "llvm/MC/MCInstrInfo.h"
-#include "llvm/MC/MCObjectFileInfo.h"
-#include "llvm/MC/MCRegisterInfo.h"
-#include "llvm/MC/MCSubtargetInfo.h"
-#include "llvm/Object/Archive.h"
-#include "llvm/Object/Binary.h"
-#include "llvm/Object/ELFObjectFile.h"
-#include "llvm/Object/ObjectFile.h"
-#include "llvm/Support/Casting.h"
-#include "llvm/Support/CommandLine.h"
-#include "llvm/Support/Errc.h"
-#include "llvm/Support/ErrorOr.h"
-#include "llvm/Support/FileSystem.h"
-#include "llvm/Support/LineIterator.h"
-#include "llvm/Support/MD5.h"
-#include "llvm/Support/ManagedStatic.h"
-#include "llvm/Support/MemoryBuffer.h"
-#include "llvm/Support/Path.h"
-#include "llvm/Support/PrettyStackTrace.h"
-#include "llvm/Support/Regex.h"
-#include "llvm/Support/Signals.h"
-#include "llvm/Support/SpecialCaseList.h"
-#include "llvm/Support/TargetRegistry.h"
-#include "llvm/Support/TargetSelect.h"
-#include "llvm/Support/ToolOutputFile.h"
-#include "llvm/Support/raw_ostream.h"
-
-#include <algorithm>
-#include <set>
-#include <stdio.h>
-#include <string>
-#include <utility>
-#include <vector>
-
-using namespace llvm;
-
-namespace {
-
-// --------- COMMAND LINE FLAGS ---------
-
-enum ActionType {
-  PrintAction,
-  PrintCovPointsAction,
-  CoveredFunctionsAction,
-  NotCoveredFunctionsAction,
-  HtmlReportAction,
-  StatsAction
-};
-
-cl::opt<ActionType> Action(
-    cl::desc("Action (required)"), cl::Required,
-    cl::values(clEnumValN(PrintAction, "print", "Print coverage addresses"),
-               clEnumValN(PrintCovPointsAction, "print-coverage-pcs",
-                          "Print coverage instrumentation points addresses."),
-               clEnumValN(CoveredFunctionsAction, "covered-functions",
-                          "Print all covered funcions."),
-               clEnumValN(NotCoveredFunctionsAction, "not-covered-functions",
-                          "Print all not covered funcions."),
-               clEnumValN(HtmlReportAction, "html-report",
-                          "Print HTML coverage report."),
-               clEnumValN(StatsAction, "print-coverage-stats",
-                          "Print coverage statistics."),
-               clEnumValEnd));
-
-static cl::list<std::string>
-    ClInputFiles(cl::Positional, cl::OneOrMore,
-                 cl::desc("(<binary file>|<.sancov file>)..."));
-
-static cl::opt<bool> ClDemangle("demangle", cl::init(true),
-                                cl::desc("Print demangled function name."));
-
-static cl::opt<std::string> ClStripPathPrefix(
-    "strip_path_prefix", cl::init(""),
-    cl::desc("Strip this prefix from file paths in reports."));
-
-static cl::opt<std::string>
-    ClBlacklist("blacklist", cl::init(""),
-                cl::desc("Blacklist file (sanitizer blacklist format)."));
-
-static cl::opt<bool> ClUseDefaultBlacklist(
-    "use_default_blacklist", cl::init(true), cl::Hidden,
-    cl::desc("Controls if default blacklist should be used."));
-
-static const char *const DefaultBlacklistStr = "fun:__sanitizer_.*\n"
-                                               "src:/usr/include/.*\n"
-                                               "src:.*/libc\\+\\+/.*\n";
-
-// --------- FORMAT SPECIFICATION ---------
-
-struct FileHeader {
-  uint32_t Bitness;
-  uint32_t Magic;
-};
-
-static const uint32_t BinCoverageMagic = 0xC0BFFFFF;
-static const uint32_t Bitness32 = 0xFFFFFF32;
-static const uint32_t Bitness64 = 0xFFFFFF64;
-
-// --------- ERROR HANDLING ---------
-
-static void Fail(const llvm::Twine &E) {
-  errs() << "Error: " << E << "\n";
-  exit(1);
-}
-
-static void FailIfError(std::error_code Error) {
-  if (!Error)
-    return;
-  errs() << "Error: " << Error.message() << "(" << Error.value() << ")\n";
-  exit(1);
-}
-
-template <typename T> static void FailIfError(const ErrorOr<T> &E) {
-  FailIfError(E.getError());
-}
-
-static void FailIfError(Error Err) {
-  if (Err) {
-    logAllUnhandledErrors(std::move(Err), errs(), "Error: ");
-    exit(1);
-  }
-}
-
-template <typename T> static void FailIfError(Expected<T> &E) {
-  FailIfError(E.takeError());
-}
-
-static void FailIfNotEmpty(const llvm::Twine &E) {
-  if (E.str().empty())
-    return;
-  Fail(E);
-}
-
-template <typename T>
-static void FailIfEmpty(const std::unique_ptr<T> &Ptr,
-                        const std::string &Message) {
-  if (Ptr.get())
-    return;
-  Fail(Message);
-}
-
-// ---------
-
-// Produces std::map<K, std::vector<E>> grouping input
-// elements by FuncTy result.
-template <class RangeTy, class FuncTy>
-static inline auto group_by(const RangeTy &R, FuncTy F)
-    -> std::map<typename std::decay<decltype(F(*R.begin()))>::type,
-                std::vector<typename std::decay<decltype(*R.begin())>::type>> {
-  std::map<typename std::decay<decltype(F(*R.begin()))>::type,
-           std::vector<typename std::decay<decltype(*R.begin())>::type>>
-      Result;
-  for (const auto &E : R) {
-    Result[F(E)].push_back(E);
-  }
-  return Result;
-}
-
-template <typename T>
-static void readInts(const char *Start, const char *End,
-                     std::set<uint64_t> *Ints) {
-  const T *S = reinterpret_cast<const T *>(Start);
-  const T *E = reinterpret_cast<const T *>(End);
-  std::copy(S, E, std::inserter(*Ints, Ints->end()));
-}
-
-struct FileLoc {
-  bool operator<(const FileLoc &RHS) const {
-    return std::tie(FileName, Line) < std::tie(RHS.FileName, RHS.Line);
-  }
-
-  std::string FileName;
-  uint32_t Line;
-};
-
-struct FileFn {
-  bool operator<(const FileFn &RHS) const {
-    return std::tie(FileName, FunctionName) <
-           std::tie(RHS.FileName, RHS.FunctionName);
-  }
-
-  std::string FileName;
-  std::string FunctionName;
-};
-
-struct FnLoc {
-  bool operator<(const FnLoc &RHS) const {
-    return std::tie(Loc, FunctionName) < std::tie(RHS.Loc, RHS.FunctionName);
-  }
-
-  FileLoc Loc;
-  std::string FunctionName;
-};
-
-std::string stripPathPrefix(std::string Path) {
-  if (ClStripPathPrefix.empty())
-    return Path;
-  size_t Pos = Path.find(ClStripPathPrefix);
-  if (Pos == std::string::npos)
-    return Path;
-  return Path.substr(Pos + ClStripPathPrefix.size());
-}
-
-static std::unique_ptr<symbolize::LLVMSymbolizer> createSymbolizer() {
-  symbolize::LLVMSymbolizer::Options SymbolizerOptions;
-  SymbolizerOptions.Demangle = ClDemangle;
-  SymbolizerOptions.UseSymbolTable = true;
-  return std::unique_ptr<symbolize::LLVMSymbolizer>(
-      new symbolize::LLVMSymbolizer(SymbolizerOptions));
-}
-
-// A DILineInfo with address.
-struct AddrInfo : public DILineInfo {
-  uint64_t Addr;
-
-  AddrInfo(const DILineInfo &DI, uint64_t Addr) : DILineInfo(DI), Addr(Addr) {
-    FileName = normalizeFilename(FileName);
-  }
-
-private:
-  static std::string normalizeFilename(const std::string &FileName) {
-    SmallString<256> S(FileName);
-    sys::path::remove_dots(S, /* remove_dot_dot */ true);
-    return S.str().str();
-  }
-};
-
-class Blacklists {
-public:
-  Blacklists()
-      : DefaultBlacklist(createDefaultBlacklist()),
-        UserBlacklist(createUserBlacklist()) {}
-
-  // AddrInfo contains normalized filename. It is important to check it rather
-  // than DILineInfo.
-  bool isBlacklisted(const AddrInfo &AI) {
-    if (DefaultBlacklist && DefaultBlacklist->inSection("fun", AI.FunctionName))
-      return true;
-    if (DefaultBlacklist && DefaultBlacklist->inSection("src", AI.FileName))
-      return true;
-    if (UserBlacklist && UserBlacklist->inSection("fun", AI.FunctionName))
-      return true;
-    if (UserBlacklist && UserBlacklist->inSection("src", AI.FileName))
-      return true;
-    return false;
-  }
-
-private:
-  static std::unique_ptr<SpecialCaseList> createDefaultBlacklist() {
-    if (!ClUseDefaultBlacklist)
-      return std::unique_ptr<SpecialCaseList>();
-    std::unique_ptr<MemoryBuffer> MB =
-        MemoryBuffer::getMemBuffer(DefaultBlacklistStr);
-    std::string Error;
-    auto Blacklist = SpecialCaseList::create(MB.get(), Error);
-    FailIfNotEmpty(Error);
-    return Blacklist;
-  }
-
-  static std::unique_ptr<SpecialCaseList> createUserBlacklist() {
-    if (ClBlacklist.empty())
-      return std::unique_ptr<SpecialCaseList>();
-
-    return SpecialCaseList::createOrDie({{ClBlacklist}});
-  }
-  std::unique_ptr<SpecialCaseList> DefaultBlacklist;
-  std::unique_ptr<SpecialCaseList> UserBlacklist;
-};
-
-// Collect all debug info for given addresses.
-static std::vector<AddrInfo> getAddrInfo(const std::string &ObjectFile,
-                                         const std::set<uint64_t> &Addrs,
-                                         bool InlinedCode) {
-  std::vector<AddrInfo> Result;
-  auto Symbolizer(createSymbolizer());
-  Blacklists B;
-
-  for (auto Addr : Addrs) {
-    auto LineInfo = Symbolizer->symbolizeCode(ObjectFile, Addr);
-    FailIfError(LineInfo);
-    auto LineAddrInfo = AddrInfo(*LineInfo, Addr);
-    if (B.isBlacklisted(LineAddrInfo))
-      continue;
-    Result.push_back(LineAddrInfo);
-    if (InlinedCode) {
-      auto InliningInfo = Symbolizer->symbolizeInlinedCode(ObjectFile, Addr);
-      FailIfError(InliningInfo);
-      for (uint32_t I = 0; I < InliningInfo->getNumberOfFrames(); ++I) {
-        auto FrameInfo = InliningInfo->getFrame(I);
-        auto FrameAddrInfo = AddrInfo(FrameInfo, Addr);
-        if (B.isBlacklisted(FrameAddrInfo))
-          continue;
-        Result.push_back(FrameAddrInfo);
-      }
-    }
-  }
-
-  return Result;
-}
-
-// Locate __sanitizer_cov* function addresses that are used for coverage
-// reporting.
-static std::set<uint64_t>
-findSanitizerCovFunctions(const object::ObjectFile &O) {
-  std::set<uint64_t> Result;
-
-  for (const object::SymbolRef &Symbol : O.symbols()) {
-    Expected<uint64_t> AddressOrErr = Symbol.getAddress();
-    FailIfError(errorToErrorCode(AddressOrErr.takeError()));
-
-    Expected<StringRef> NameOrErr = Symbol.getName();
-    FailIfError(errorToErrorCode(NameOrErr.takeError()));
-    StringRef Name = NameOrErr.get();
-
-    if (Name == "__sanitizer_cov" || Name == "__sanitizer_cov_with_check" ||
-        Name == "__sanitizer_cov_trace_func_enter") {
-      if (!(Symbol.getFlags() & object::BasicSymbolRef::SF_Undefined))
-        Result.insert(AddressOrErr.get());
-    }
-  }
-
-  return Result;
-}
-
-// Locate addresses of all coverage points in a file. Coverage point
-// is defined as the 'address of instruction following __sanitizer_cov
-// call - 1'.
-static void getObjectCoveragePoints(const object::ObjectFile &O,
-                                    std::set<uint64_t> *Addrs) {
-  Triple TheTriple("unknown-unknown-unknown");
-  TheTriple.setArch(Triple::ArchType(O.getArch()));
-  auto TripleName = TheTriple.getTriple();
-
-  std::string Error;
-  const Target *TheTarget = TargetRegistry::lookupTarget(TripleName, Error);
-  FailIfNotEmpty(Error);
-
-  std::unique_ptr<const MCSubtargetInfo> STI(
-      TheTarget->createMCSubtargetInfo(TripleName, "", ""));
-  FailIfEmpty(STI, "no subtarget info for target " + TripleName);
-
-  std::unique_ptr<const MCRegisterInfo> MRI(
-      TheTarget->createMCRegInfo(TripleName));
-  FailIfEmpty(MRI, "no register info for target " + TripleName);
-
-  std::unique_ptr<const MCAsmInfo> AsmInfo(
-      TheTarget->createMCAsmInfo(*MRI, TripleName));
-  FailIfEmpty(AsmInfo, "no asm info for target " + TripleName);
-
-  std::unique_ptr<const MCObjectFileInfo> MOFI(new MCObjectFileInfo);
-  MCContext Ctx(AsmInfo.get(), MRI.get(), MOFI.get());
-  std::unique_ptr<MCDisassembler> DisAsm(
-      TheTarget->createMCDisassembler(*STI, Ctx));
-  FailIfEmpty(DisAsm, "no disassembler info for target " + TripleName);
-
-  std::unique_ptr<const MCInstrInfo> MII(TheTarget->createMCInstrInfo());
-  FailIfEmpty(MII, "no instruction info for target " + TripleName);
-
-  std::unique_ptr<const MCInstrAnalysis> MIA(
-      TheTarget->createMCInstrAnalysis(MII.get()));
-  FailIfEmpty(MIA, "no instruction analysis info for target " + TripleName);
-
-  auto SanCovAddrs = findSanitizerCovFunctions(O);
-  if (SanCovAddrs.empty())
-    Fail("__sanitizer_cov* functions not found");
-
-  for (object::SectionRef Section : O.sections()) {
-    if (Section.isVirtual() || !Section.isText()) // llvm-objdump does the same.
-      continue;
-    uint64_t SectionAddr = Section.getAddress();
-    uint64_t SectSize = Section.getSize();
-    if (!SectSize)
-      continue;
-
-    StringRef BytesStr;
-    FailIfError(Section.getContents(BytesStr));
-    ArrayRef<uint8_t> Bytes(reinterpret_cast<const uint8_t *>(BytesStr.data()),
-                            BytesStr.size());
-
-    for (uint64_t Index = 0, Size = 0; Index < Section.getSize();
-         Index += Size) {
-      MCInst Inst;
-      if (!DisAsm->getInstruction(Inst, Size, Bytes.slice(Index),
-                                  SectionAddr + Index, nulls(), nulls())) {
-        if (Size == 0)
-          Size = 1;
-        continue;
-      }
-      uint64_t Addr = Index + SectionAddr;
-      // Sanitizer coverage uses the address of the next instruction - 1.
-      uint64_t CovPoint = Addr + Size - 1;
-      uint64_t Target;
-      if (MIA->isCall(Inst) &&
-          MIA->evaluateBranch(Inst, SectionAddr + Index, Size, Target) &&
-          SanCovAddrs.find(Target) != SanCovAddrs.end())
-        Addrs->insert(CovPoint);
-    }
-  }
-}
-
-static void
-visitObjectFiles(const object::Archive &A,
-                 function_ref<void(const object::ObjectFile &)> Fn) {
-  Error Err;
-  for (auto &C : A.children(Err)) {
-    Expected<std::unique_ptr<object::Binary>> ChildOrErr = C.getAsBinary();
-    FailIfError(errorToErrorCode(ChildOrErr.takeError()));
-    if (auto *O = dyn_cast<object::ObjectFile>(&*ChildOrErr.get()))
-      Fn(*O);
-    else
-      FailIfError(object::object_error::invalid_file_type);
-  }
-  FailIfError(std::move(Err));
-}
-
-static void
-visitObjectFiles(const std::string &FileName,
-                 function_ref<void(const object::ObjectFile &)> Fn) {
-  Expected<object::OwningBinary<object::Binary>> BinaryOrErr =
-      object::createBinary(FileName);
-  if (!BinaryOrErr)
-    FailIfError(errorToErrorCode(BinaryOrErr.takeError()));
-
-  object::Binary &Binary = *BinaryOrErr.get().getBinary();
-  if (object::Archive *A = dyn_cast<object::Archive>(&Binary))
-    visitObjectFiles(*A, Fn);
-  else if (object::ObjectFile *O = dyn_cast<object::ObjectFile>(&Binary))
-    Fn(*O);
-  else
-    FailIfError(object::object_error::invalid_file_type);
-}
-
-std::set<uint64_t> findSanitizerCovFunctions(const std::string &FileName) {
-  std::set<uint64_t> Result;
-  visitObjectFiles(FileName, [&](const object::ObjectFile &O) {
-    auto Addrs = findSanitizerCovFunctions(O);
-    Result.insert(Addrs.begin(), Addrs.end());
-  });
-  return Result;
-}
-
-// Locate addresses of all coverage points in a file. Coverage point
-// is defined as the 'address of instruction following __sanitizer_cov
-// call - 1'.
-std::set<uint64_t> getCoveragePoints(const std::string &FileName) {
-  std::set<uint64_t> Result;
-  visitObjectFiles(FileName, [&](const object::ObjectFile &O) {
-    getObjectCoveragePoints(O, &Result);
-  });
-  return Result;
-}
-
-static void printCovPoints(const std::string &ObjFile, raw_ostream &OS) {
-  for (uint64_t Addr : getCoveragePoints(ObjFile)) {
-    OS << "0x";
-    OS.write_hex(Addr);
-    OS << "\n";
-  }
-}
-
-static std::string escapeHtml(const std::string &S) {
-  std::string Result;
-  Result.reserve(S.size());
-  for (char Ch : S) {
-    switch (Ch) {
-    case '&':
-      Result.append("&amp;");
-      break;
-    case '\'':
-      Result.append("&apos;");
-      break;
-    case '"':
-      Result.append("&quot;");
-      break;
-    case '<':
-      Result.append("&lt;");
-      break;
-    case '>':
-      Result.append("&gt;");
-      break;
-    default:
-      Result.push_back(Ch);
-      break;
-    }
-  }
-  return Result;
-}
-
-// Adds leading zeroes wrapped in 'lz' style.
-// Leading zeroes help locate 000% coverage.
-static std::string formatHtmlPct(size_t Pct) {
-  Pct = std::max(std::size_t{0}, std::min(std::size_t{100}, Pct));
-
-  std::string Num = std::to_string(Pct);
-  std::string Zeroes(3 - Num.size(), '0');
-  if (!Zeroes.empty())
-    Zeroes = "<span class='lz'>" + Zeroes + "</span>";
-
-  return Zeroes + Num;
-}
-
-static std::string anchorName(const std::string &Anchor) {
-  llvm::MD5 Hasher;
-  llvm::MD5::MD5Result Hash;
-  Hasher.update(Anchor);
-  Hasher.final(Hash);
-
-  SmallString<32> HexString;
-  llvm::MD5::stringifyResult(Hash, HexString);
-  return HexString.str().str();
-}
-
-static ErrorOr<bool> isCoverageFile(const std::string &FileName) {
-  ErrorOr<std::unique_ptr<MemoryBuffer>> BufOrErr =
-      MemoryBuffer::getFile(FileName);
-  if (!BufOrErr) {
-    errs() << "Warning: " << BufOrErr.getError().message() << "("
-           << BufOrErr.getError().value()
-           << "), filename: " << llvm::sys::path::filename(FileName) << "\n";
-    return BufOrErr.getError();
-  }
-  std::unique_ptr<MemoryBuffer> Buf = std::move(BufOrErr.get());
-  if (Buf->getBufferSize() < 8) {
-    return false;
-  }
-  const FileHeader *Header =
-      reinterpret_cast<const FileHeader *>(Buf->getBufferStart());
-  return Header->Magic == BinCoverageMagic;
-}
-
-struct CoverageStats {
-  CoverageStats() : AllPoints(0), CovPoints(0), AllFns(0), CovFns(0) {}
-
-  size_t AllPoints;
-  size_t CovPoints;
-  size_t AllFns;
-  size_t CovFns;
-};
-
-static raw_ostream &operator<<(raw_ostream &OS, const CoverageStats &Stats) {
-  OS << "all-edges: " << Stats.AllPoints << "\n";
-  OS << "cov-edges: " << Stats.CovPoints << "\n";
-  OS << "all-functions: " << Stats.AllFns << "\n";
-  OS << "cov-functions: " << Stats.CovFns << "\n";
-  return OS;
-}
-
-class CoverageData {
-public:
-  // Read single file coverage data.
-  static ErrorOr<std::unique_ptr<CoverageData>>
-  read(const std::string &FileName) {
-    ErrorOr<std::unique_ptr<MemoryBuffer>> BufOrErr =
-        MemoryBuffer::getFile(FileName);
-    if (!BufOrErr)
-      return BufOrErr.getError();
-    std::unique_ptr<MemoryBuffer> Buf = std::move(BufOrErr.get());
-    if (Buf->getBufferSize() < 8) {
-      errs() << "File too small (<8): " << Buf->getBufferSize();
-      return make_error_code(errc::illegal_byte_sequence);
-    }
-    const FileHeader *Header =
-        reinterpret_cast<const FileHeader *>(Buf->getBufferStart());
-
-    if (Header->Magic != BinCoverageMagic) {
-      errs() << "Wrong magic: " << Header->Magic;
-      return make_error_code(errc::illegal_byte_sequence);
-    }
-
-    auto Addrs = llvm::make_unique<std::set<uint64_t>>();
-
-    switch (Header->Bitness) {
-    case Bitness64:
-      readInts<uint64_t>(Buf->getBufferStart() + 8, Buf->getBufferEnd(),
-                         Addrs.get());
-      break;
-    case Bitness32:
-      readInts<uint32_t>(Buf->getBufferStart() + 8, Buf->getBufferEnd(),
-                         Addrs.get());
-      break;
-    default:
-      errs() << "Unsupported bitness: " << Header->Bitness;
-      return make_error_code(errc::illegal_byte_sequence);
-    }
-
-    return std::unique_ptr<CoverageData>(new CoverageData(std::move(Addrs)));
-  }
-
-  // Merge multiple coverage data together.
-  static std::unique_ptr<CoverageData>
-  merge(const std::vector<std::unique_ptr<CoverageData>> &Covs) {
-    auto Addrs = llvm::make_unique<std::set<uint64_t>>();
-
-    for (const auto &Cov : Covs)
-      Addrs->insert(Cov->Addrs->begin(), Cov->Addrs->end());
-
-    return std::unique_ptr<CoverageData>(new CoverageData(std::move(Addrs)));
-  }
-
-  // Read list of files and merges their coverage info.
-  static ErrorOr<std::unique_ptr<CoverageData>>
-  readAndMerge(const std::vector<std::string> &FileNames) {
-    std::vector<std::unique_ptr<CoverageData>> Covs;
-    for (const auto &FileName : FileNames) {
-      auto Cov = read(FileName);
-      if (!Cov)
-        return Cov.getError();
-      Covs.push_back(std::move(Cov.get()));
-    }
-    return merge(Covs);
-  }
-
-  // Print coverage addresses.
-  void printAddrs(raw_ostream &OS) {
-    for (auto Addr : *Addrs) {
-      OS << "0x";
-      OS.write_hex(Addr);
-      OS << "\n";
-    }
-  }
-
-protected:
-  explicit CoverageData(std::unique_ptr<std::set<uint64_t>> Addrs)
-      : Addrs(std::move(Addrs)) {}
-
-  friend class CoverageDataWithObjectFile;
-
-  std::unique_ptr<std::set<uint64_t>> Addrs;
-};
-
-// Coverage data translated into source code line-level information.
-// Fetches debug info in constructor and calculates various information per
-// request.
-class SourceCoverageData {
-public:
-  enum LineStatus {
-    // coverage information for the line is not available.
-    // default value in maps.
-    UNKNOWN = 0,
-    // the line is fully covered.
-    COVERED = 1,
-    // the line is fully uncovered.
-    NOT_COVERED = 2,
-    // some points in the line a covered, some are not.
-    MIXED = 3
-  };
-
-  SourceCoverageData(std::string ObjectFile, const std::set<uint64_t> &Addrs)
-      : AllCovPoints(getCoveragePoints(ObjectFile)) {
-    if (!std::includes(AllCovPoints.begin(), AllCovPoints.end(), Addrs.begin(),
-                       Addrs.end())) {
-      Fail("Coverage points in binary and .sancov file do not match.");
-    }
-
-    AllAddrInfo = getAddrInfo(ObjectFile, AllCovPoints, true);
-    CovAddrInfo = getAddrInfo(ObjectFile, Addrs, true);
-  }
-
-  // Compute number of coverage points hit/total in a file.
-  // file_name -> <coverage, all_coverage>
-  std::map<std::string, std::pair<size_t, size_t>> computeFileCoverage() {
-    std::map<std::string, std::pair<size_t, size_t>> FileCoverage;
-    auto AllCovPointsByFile =
-        group_by(AllAddrInfo, [](const AddrInfo &AI) { return AI.FileName; });
-    auto CovPointsByFile =
-        group_by(CovAddrInfo, [](const AddrInfo &AI) { return AI.FileName; });
-
-    for (const auto &P : AllCovPointsByFile) {
-      const std::string &FileName = P.first;
-
-      FileCoverage[FileName] =
-          std::make_pair(CovPointsByFile[FileName].size(),
-                         AllCovPointsByFile[FileName].size());
-    }
-    return FileCoverage;
-  }
-
-  // line_number -> line_status.
-  typedef std::map<int, LineStatus> LineStatusMap;
-  // file_name -> LineStatusMap
-  typedef std::map<std::string, LineStatusMap> FileLineStatusMap;
-
-  // fills in the {file_name -> {line_no -> status}} map.
-  FileLineStatusMap computeLineStatusMap() {
-    FileLineStatusMap StatusMap;
-
-    auto AllLocs = group_by(AllAddrInfo, [](const AddrInfo &AI) {
-      return FileLoc{AI.FileName, AI.Line};
-    });
-    auto CovLocs = group_by(CovAddrInfo, [](const AddrInfo &AI) {
-      return FileLoc{AI.FileName, AI.Line};
-    });
-
-    for (const auto &P : AllLocs) {
-      const FileLoc &Loc = P.first;
-      auto I = CovLocs.find(Loc);
-
-      if (I == CovLocs.end()) {
-        StatusMap[Loc.FileName][Loc.Line] = NOT_COVERED;
-      } else {
-        StatusMap[Loc.FileName][Loc.Line] =
-            (I->second.size() == P.second.size()) ? COVERED : MIXED;
-      }
-    }
-    return StatusMap;
-  }
-
-  std::set<FileFn> computeAllFunctions() const {
-    std::set<FileFn> Fns;
-    for (const auto &AI : AllAddrInfo) {
-      Fns.insert(FileFn{AI.FileName, AI.FunctionName});
-    }
-    return Fns;
-  }
-
-  std::set<FileFn> computeCoveredFunctions() const {
-    std::set<FileFn> Fns;
-    auto CovFns = group_by(CovAddrInfo, [](const AddrInfo &AI) {
-      return FileFn{AI.FileName, AI.FunctionName};
-    });
-
-    for (const auto &P : CovFns) {
-      Fns.insert(P.first);
-    }
-    return Fns;
-  }
-
-  std::set<FileFn> computeNotCoveredFunctions() const {
-    std::set<FileFn> Fns;
-
-    auto AllFns = group_by(AllAddrInfo, [](const AddrInfo &AI) {
-      return FileFn{AI.FileName, AI.FunctionName};
-    });
-    auto CovFns = group_by(CovAddrInfo, [](const AddrInfo &AI) {
-      return FileFn{AI.FileName, AI.FunctionName};
-    });
-
-    for (const auto &P : AllFns) {
-      if (CovFns.find(P.first) == CovFns.end()) {
-        Fns.insert(P.first);
-      }
-    }
-    return Fns;
-  }
-
-  // Compute % coverage for each function.
-  std::map<FileFn, int> computeFunctionsCoverage() const {
-    std::map<FileFn, int> FnCoverage;
-    auto AllFns = group_by(AllAddrInfo, [](const AddrInfo &AI) {
-      return FileFn{AI.FileName, AI.FunctionName};
-    });
-
-    auto CovFns = group_by(CovAddrInfo, [](const AddrInfo &AI) {
-      return FileFn{AI.FileName, AI.FunctionName};
-    });
-
-    for (const auto &P : AllFns) {
-      FileFn F = P.first;
-      FnCoverage[F] = CovFns[F].size() * 100 / P.second.size();
-    }
-
-    return FnCoverage;
-  }
-
-  typedef std::map<FileLoc, std::set<std::string>> FunctionLocs;
-  // finds first line number in a file for each function.
-  FunctionLocs resolveFunctions(const std::set<FileFn> &Fns) const {
-    std::vector<AddrInfo> FnAddrs;
-    for (const auto &AI : AllAddrInfo) {
-      if (Fns.find(FileFn{AI.FileName, AI.FunctionName}) != Fns.end())
-        FnAddrs.push_back(AI);
-    }
-
-    auto GroupedAddrs = group_by(FnAddrs, [](const AddrInfo &AI) {
-      return FnLoc{FileLoc{AI.FileName, AI.Line}, AI.FunctionName};
-    });
-
-    FunctionLocs Result;
-    std::string LastFileName;
-    std::set<std::string> ProcessedFunctions;
-
-    for (const auto &P : GroupedAddrs) {
-      const FnLoc &Loc = P.first;
-      std::string FileName = Loc.Loc.FileName;
-      std::string FunctionName = Loc.FunctionName;
-
-      if (LastFileName != FileName)
-        ProcessedFunctions.clear();
-      LastFileName = FileName;
-
-      if (!ProcessedFunctions.insert(FunctionName).second)
-        continue;
-
-      auto FLoc = FileLoc{FileName, Loc.Loc.Line};
-      Result[FLoc].insert(FunctionName);
-    }
-    return Result;
-  }
-
-  std::set<std::string> files() const {
-    std::set<std::string> Files;
-    for (const auto &AI : AllAddrInfo) {
-      Files.insert(AI.FileName);
-    }
-    return Files;
-  }
-
-  void collectStats(CoverageStats *Stats) const {
-    Stats->AllPoints += AllCovPoints.size();
-    Stats->AllFns += computeAllFunctions().size();
-    Stats->CovFns += computeCoveredFunctions().size();
-  }
-
-private:
-  const std::set<uint64_t> AllCovPoints;
-
-  std::vector<AddrInfo> AllAddrInfo;
-  std::vector<AddrInfo> CovAddrInfo;
-};
-
-static void printFunctionLocs(const SourceCoverageData::FunctionLocs &FnLocs,
-                              raw_ostream &OS) {
-  for (const auto &Fns : FnLocs) {
-    for (const auto &Fn : Fns.second) {
-      OS << stripPathPrefix(Fns.first.FileName) << ":" << Fns.first.Line << " "
-         << Fn << "\n";
-    }
-  }
-}
-
-// Holder for coverage data + filename of corresponding object file.
-class CoverageDataWithObjectFile : public CoverageData {
-public:
-  static ErrorOr<std::unique_ptr<CoverageDataWithObjectFile>>
-  readAndMerge(const std::string &ObjectFile,
-               const std::vector<std::string> &FileNames) {
-    auto MergedDataOrError = CoverageData::readAndMerge(FileNames);
-    if (!MergedDataOrError)
-      return MergedDataOrError.getError();
-    return std::unique_ptr<CoverageDataWithObjectFile>(
-        new CoverageDataWithObjectFile(ObjectFile,
-                                       std::move(MergedDataOrError.get())));
-  }
-
-  std::string object_file() const { return ObjectFile; }
-
-  // Print list of covered functions.
-  // Line format: <file_name>:<line> <function_name>
-  void printCoveredFunctions(raw_ostream &OS) const {
-    SourceCoverageData SCovData(ObjectFile, *Addrs);
-    auto CoveredFns = SCovData.computeCoveredFunctions();
-    printFunctionLocs(SCovData.resolveFunctions(CoveredFns), OS);
-  }
-
-  // Print list of not covered functions.
-  // Line format: <file_name>:<line> <function_name>
-  void printNotCoveredFunctions(raw_ostream &OS) const {
-    SourceCoverageData SCovData(ObjectFile, *Addrs);
-    auto NotCoveredFns = SCovData.computeNotCoveredFunctions();
-    printFunctionLocs(SCovData.resolveFunctions(NotCoveredFns), OS);
-  }
-
-  void printReport(raw_ostream &OS) const {
-    SourceCoverageData SCovData(ObjectFile, *Addrs);
-    auto LineStatusMap = SCovData.computeLineStatusMap();
-
-    std::set<FileFn> AllFns = SCovData.computeAllFunctions();
-    // file_loc -> set[function_name]
-    auto AllFnsByLoc = SCovData.resolveFunctions(AllFns);
-    auto FileCoverage = SCovData.computeFileCoverage();
-
-    auto FnCoverage = SCovData.computeFunctionsCoverage();
-    auto FnCoverageByFile =
-        group_by(FnCoverage, [](const std::pair<FileFn, int> &FileFn) {
-          return FileFn.first.FileName;
-        });
-
-    // TOC
-
-    size_t NotCoveredFilesCount = 0;
-    std::set<std::string> Files = SCovData.files();
-
-    // Covered Files.
-    OS << "<details open><summary>Touched Files</summary>\n";
-    OS << "<table>\n";
-    OS << "<tr><th>File</th><th>Coverage %</th>";
-    OS << "<th>Hit (Total) Fns</th></tr>\n";
-    for (const auto &FileName : Files) {
-      std::pair<size_t, size_t> FC = FileCoverage[FileName];
-      if (FC.first == 0) {
-        NotCoveredFilesCount++;
-        continue;
-      }
-      size_t CovPct = FC.second == 0 ? 100 : 100 * FC.first / FC.second;
-
-      OS << "<tr><td><a href=\"#" << anchorName(FileName) << "\">"
-         << stripPathPrefix(FileName) << "</a></td>"
-         << "<td>" << formatHtmlPct(CovPct) << "%</td>"
-         << "<td>" << FC.first << " (" << FC.second << ")"
-         << "</tr>\n";
-    }
-    OS << "</table>\n";
-    OS << "</details>\n";
-
-    // Not covered files.
-    if (NotCoveredFilesCount) {
-      OS << "<details><summary>Not Touched Files</summary>\n";
-      OS << "<table>\n";
-      for (const auto &FileName : Files) {
-        std::pair<size_t, size_t> FC = FileCoverage[FileName];
-        if (FC.first == 0)
-          OS << "<tr><td>" << stripPathPrefix(FileName) << "</td>\n";
-      }
-      OS << "</table>\n";
-      OS << "</details>\n";
-    } else {
-      OS << "<p>Congratulations! All source files are touched.</p>\n";
-    }
-
-    // Source
-    for (const auto &FileName : Files) {
-      std::pair<size_t, size_t> FC = FileCoverage[FileName];
-      if (FC.first == 0)
-        continue;
-      OS << "<a name=\"" << anchorName(FileName) << "\"></a>\n";
-      OS << "<h2>" << stripPathPrefix(FileName) << "</h2>\n";
-      OS << "<details open><summary>Function Coverage</summary>";
-      OS << "<div class='fnlist'>\n";
-
-      auto &FileFnCoverage = FnCoverageByFile[FileName];
-
-      for (const auto &P : FileFnCoverage) {
-        std::string FunctionName = P.first.FunctionName;
-
-        OS << "<div class='fn' style='order: " << P.second << "'>";
-        OS << "<span class='pct'>" << formatHtmlPct(P.second)
-           << "%</span>&nbsp;";
-        OS << "<span class='name'><a href=\"#"
-           << anchorName(FileName + "::" + FunctionName) << "\">";
-        OS << escapeHtml(FunctionName) << "</a></span>";
-        OS << "</div>\n";
-      }
-      OS << "</div></details>\n";
-
-      ErrorOr<std::unique_ptr<MemoryBuffer>> BufOrErr =
-          MemoryBuffer::getFile(FileName);
-      if (!BufOrErr) {
-        OS << "Error reading file: " << FileName << " : "
-           << BufOrErr.getError().message() << "("
-           << BufOrErr.getError().value() << ")\n";
-        continue;
-      }
-
-      OS << "<pre>\n";
-      const auto &LineStatuses = LineStatusMap[FileName];
-      for (line_iterator I = line_iterator(*BufOrErr.get(), false);
-           !I.is_at_eof(); ++I) {
-        uint32_t Line = I.line_number();
-        { // generate anchors (if any);
-          FileLoc Loc = FileLoc{FileName, Line};
-          auto It = AllFnsByLoc.find(Loc);
-          if (It != AllFnsByLoc.end()) {
-            for (const std::string &Fn : It->second) {
-              OS << "<a name=\"" << anchorName(FileName + "::" + Fn)
-                 << "\"></a>";
-            };
-          }
-        }
-
-        OS << "<span ";
-        auto LIT = LineStatuses.find(I.line_number());
-        auto Status = (LIT != LineStatuses.end()) ? LIT->second
-                                                  : SourceCoverageData::UNKNOWN;
-        switch (Status) {
-        case SourceCoverageData::UNKNOWN:
-          OS << "class=unknown";
-          break;
-        case SourceCoverageData::COVERED:
-          OS << "class=covered";
-          break;
-        case SourceCoverageData::NOT_COVERED:
-          OS << "class=notcovered";
-          break;
-        case SourceCoverageData::MIXED:
-          OS << "class=mixed";
-          break;
-        }
-        OS << ">";
-        OS << escapeHtml(*I) << "</span>\n";
-      }
-      OS << "</pre>\n";
-    }
-  }
-
-  void collectStats(CoverageStats *Stats) const {
-    Stats->CovPoints += Addrs->size();
-
-    SourceCoverageData SCovData(ObjectFile, *Addrs);
-    SCovData.collectStats(Stats);
-  }
-
-private:
-  CoverageDataWithObjectFile(std::string ObjectFile,
-                             std::unique_ptr<CoverageData> Coverage)
-      : CoverageData(std::move(Coverage->Addrs)),
-        ObjectFile(std::move(ObjectFile)) {}
-  const std::string ObjectFile;
-};
-
-// Multiple coverage files data organized by object file.
-class CoverageDataSet {
-public:
-  static ErrorOr<std::unique_ptr<CoverageDataSet>>
-  readCmdArguments(std::vector<std::string> FileNames) {
-    // Short name => file name.
-    std::map<std::string, std::string> ObjFiles;
-    std::string FirstObjFile;
-    std::set<std::string> CovFiles;
-
-    // Partition input values into coverage/object files.
-    for (const auto &FileName : FileNames) {
-      auto ErrorOrIsCoverage = isCoverageFile(FileName);
-      if (!ErrorOrIsCoverage)
-        continue;
-      if (ErrorOrIsCoverage.get()) {
-        CovFiles.insert(FileName);
-      } else {
-        auto ShortFileName = llvm::sys::path::filename(FileName);
-        if (ObjFiles.find(ShortFileName) != ObjFiles.end()) {
-          Fail("Duplicate binary file with a short name: " + ShortFileName);
-        }
-
-        ObjFiles[ShortFileName] = FileName;
-        if (FirstObjFile.empty())
-          FirstObjFile = FileName;
-      }
-    }
-
-    Regex SancovRegex("(.*)\\.[0-9]+\\.sancov");
-    SmallVector<StringRef, 2> Components;
-
-    // Object file => list of corresponding coverage file names.
-    auto CoverageByObjFile = group_by(CovFiles, [&](std::string FileName) {
-      auto ShortFileName = llvm::sys::path::filename(FileName);
-      auto Ok = SancovRegex.match(ShortFileName, &Components);
-      if (!Ok) {
-        Fail("Can't match coverage file name against "
-             "<module_name>.<pid>.sancov pattern: " +
-             FileName);
-      }
-
-      auto Iter = ObjFiles.find(Components[1]);
-      if (Iter == ObjFiles.end()) {
-        Fail("Object file for coverage not found: " + FileName);
-      }
-      return Iter->second;
-    });
-
-    // Read coverage.
-    std::vector<std::unique_ptr<CoverageDataWithObjectFile>> MergedCoverage;
-    for (const auto &Pair : CoverageByObjFile) {
-      if (findSanitizerCovFunctions(Pair.first).empty()) {
-        for (const auto &FileName : Pair.second) {
-          CovFiles.erase(FileName);
-        }
-
-        errs()
-            << "Ignoring " << Pair.first
-            << " and its coverage because  __sanitizer_cov* functions were not "
-               "found.\n";
-        continue;
-      }
-
-      auto DataOrError =
-          CoverageDataWithObjectFile::readAndMerge(Pair.first, Pair.second);
-      FailIfError(DataOrError);
-      MergedCoverage.push_back(std::move(DataOrError.get()));
-    }
-
-    return std::unique_ptr<CoverageDataSet>(
-        new CoverageDataSet(FirstObjFile, &MergedCoverage, CovFiles));
-  }
-
-  void printCoveredFunctions(raw_ostream &OS) const {
-    for (const auto &Cov : Coverage) {
-      Cov->printCoveredFunctions(OS);
-    }
-  }
-
-  void printNotCoveredFunctions(raw_ostream &OS) const {
-    for (const auto &Cov : Coverage) {
-      Cov->printNotCoveredFunctions(OS);
-    }
-  }
-
-  void printStats(raw_ostream &OS) const {
-    CoverageStats Stats;
-    for (const auto &Cov : Coverage) {
-      Cov->collectStats(&Stats);
-    }
-    OS << Stats;
-  }
-
-  void printReport(raw_ostream &OS) const {
-    auto Title =
-        (llvm::sys::path::filename(MainObjFile) + " Coverage Report").str();
-
-    OS << "<html>\n";
-    OS << "<head>\n";
-
-    // Stylesheet
-    OS << "<style>\n";
-    OS << ".covered { background: #7F7; }\n";
-    OS << ".notcovered { background: #F77; }\n";
-    OS << ".mixed { background: #FF7; }\n";
-    OS << "summary { font-weight: bold; }\n";
-    OS << "details > summary + * { margin-left: 1em; }\n";
-    OS << ".fnlist { display: flex; flex-flow: column nowrap; }\n";
-    OS << ".fn { display: flex; flex-flow: row nowrap; }\n";
-    OS << ".pct { width: 3em; text-align: right; margin-right: 1em; }\n";
-    OS << ".name { flex: 2; }\n";
-    OS << ".lz { color: lightgray; }\n";
-    OS << "</style>\n";
-    OS << "<title>" << Title << "</title>\n";
-    OS << "</head>\n";
-    OS << "<body>\n";
-
-    // Title
-    OS << "<h1>" << Title << "</h1>\n";
-
-    // Modules TOC.
-    if (Coverage.size() > 1) {
-      for (const auto &CovData : Coverage) {
-        OS << "<li><a href=\"#module_" << anchorName(CovData->object_file())
-           << "\">" << llvm::sys::path::filename(CovData->object_file())
-           << "</a></li>\n";
-      }
-    }
-
-    for (const auto &CovData : Coverage) {
-      if (Coverage.size() > 1) {
-        OS << "<h2>" << llvm::sys::path::filename(CovData->object_file())
-           << "</h2>\n";
-      }
-      OS << "<a name=\"module_" << anchorName(CovData->object_file())
-         << "\"></a>\n";
-      CovData->printReport(OS);
-    }
-
-    // About
-    OS << "<details><summary>About</summary>\n";
-    OS << "Coverage files:<ul>";
-    for (const auto &InputFile : CoverageFiles) {
-      llvm::sys::fs::file_status Status;
-      llvm::sys::fs::status(InputFile, Status);
-      OS << "<li>" << stripPathPrefix(InputFile) << " ("
-         << Status.getLastModificationTime().str() << ")</li>\n";
-    }
-    OS << "</ul></details>\n";
-
-    OS << "</body>\n";
-    OS << "</html>\n";
-  }
-
-  bool empty() const { return Coverage.empty(); }
-
-private:
-  explicit CoverageDataSet(
-      const std::string &MainObjFile,
-      std::vector<std::unique_ptr<CoverageDataWithObjectFile>> *Data,
-      const std::set<std::string> &CoverageFiles)
-      : MainObjFile(MainObjFile), CoverageFiles(CoverageFiles) {
-    Data->swap(this->Coverage);
-  }
-
-  const std::string MainObjFile;
-  std::vector<std::unique_ptr<CoverageDataWithObjectFile>> Coverage;
-  const std::set<std::string> CoverageFiles;
-};
-
-} // namespace
 
 int main(int argc, char **argv) {
-  // Print stack trace if we signal out.
-  sys::PrintStackTraceOnErrorSignal(argv[0]);
-  PrettyStackTraceProgram X(argc, argv);
-  llvm_shutdown_obj Y; // Call llvm_shutdown() on exit.
-
-  llvm::InitializeAllTargetInfos();
-  llvm::InitializeAllTargetMCs();
-  llvm::InitializeAllDisassemblers();
-
-  cl::ParseCommandLineOptions(argc, argv, "Sanitizer Coverage Processing Tool");
-
-  // -print doesn't need object files.
-  if (Action == PrintAction) {
-    auto CovData = CoverageData::readAndMerge(ClInputFiles);
-    FailIfError(CovData);
-    CovData.get()->printAddrs(outs());
-    return 0;
-  } else if (Action == PrintCovPointsAction) {
-    // -print-coverage-points doesn't need coverage files.
-    for (const std::string &ObjFile : ClInputFiles) {
-      printCovPoints(ObjFile, outs());
-    }
-    return 0;
-  }
-
-  auto CovDataSet = CoverageDataSet::readCmdArguments(ClInputFiles);
-  FailIfError(CovDataSet);
-
-  if (CovDataSet.get()->empty()) {
-    Fail("No coverage files specified.");
-  }
-
-  switch (Action) {
-  case CoveredFunctionsAction: {
-    CovDataSet.get()->printCoveredFunctions(outs());
-    return 0;
-  }
-  case NotCoveredFunctionsAction: {
-    CovDataSet.get()->printNotCoveredFunctions(outs());
-    return 0;
-  }
-  case HtmlReportAction: {
-    CovDataSet.get()->printReport(outs());
-    return 0;
-  }
-  case StatsAction: {
-    CovDataSet.get()->printStats(outs());
-    return 0;
-  }
-  case PrintAction:
-  case PrintCovPointsAction:
-    llvm_unreachable("unsupported action");
-  }
+  return 0;
 }
diff --git a/unittests/Support/ThreadPool.cpp b/unittests/Support/ThreadPool.cpp
index 69a24bc..b185859 100644
--- a/unittests/Support/ThreadPool.cpp
+++ b/unittests/Support/ThreadPool.cpp
@@ -7,6 +7,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+#if 0
+
 #include "llvm/Support/ThreadPool.h"
 
 #include "llvm/ADT/STLExtras.h"
@@ -166,3 +168,5 @@ TEST_F(ThreadPoolTest, PoolDestruction) {
   }
   ASSERT_EQ(5, checked_in);
 }
+
+#endif