forked from include-what-you-use/include-what-you-use
-
Notifications
You must be signed in to change notification settings - Fork 6
/
iwyu_include_picker.cc
1820 lines (1711 loc) · 85.8 KB
/
iwyu_include_picker.cc
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
//===--- iwyu_include_picker.cc - map to canonical #includes for iwyu -----===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#include "iwyu_include_picker.h"
#include <algorithm> // for find
#include <cstddef> // for size_t
// TODO(wan): make sure IWYU doesn't suggest <iterator>.
#include <iterator> // for find
// not hash_map: it's not as portable and needs hash<string>.
#include <map> // for map, map<>::mapped_type, etc
#include <memory>
#include <string> // for string, basic_string, etc
#include <system_error> // for error_code
#include <utility> // for pair, make_pair
#include <vector> // for vector, vector<>::iterator
#include "iwyu_location_util.h"
#include "iwyu_path_util.h"
#include "iwyu_port.h"
#include "iwyu_regex.h"
#include "iwyu_stl_util.h"
#include "iwyu_string_util.h"
#include "iwyu_verrs.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/ErrorOr.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/SourceMgr.h"
#include "llvm/Support/YAMLParser.h"
#include "clang/Basic/FileManager.h"
using std::find;
using std::make_pair;
using std::map;
using std::pair;
using std::string;
using std::unique_ptr;
using std::vector;
using llvm::MemoryBuffer;
using llvm::SourceMgr;
using llvm::yaml::KeyValueNode;
using llvm::yaml::MappingNode;
using llvm::yaml::Node;
using llvm::yaml::ScalarNode;
using llvm::yaml::SequenceNode;
using llvm::yaml::Stream;
using llvm::yaml::document_iterator;
namespace include_what_you_use {
// If we map from A to B, it means that every time we need a
// symbol from A, we can also get it from B. Another way
// to think about it is that map_to "re-exports" all the
// symbols from map_from.
struct IncludeMapEntry { // A POD so we can make the input static
const char* map_from; // A quoted-include or a symbol name
IncludeVisibility from_visibility;
const char* map_to; // A quoted-include
IncludeVisibility to_visibility;
};
namespace {
// Listed below are all IWYU's native symbol and include mappings,
// loosely based on GCC 4.4's libc and libstdc++.
// Symbol -> include mappings for GNU libc
const IncludeMapEntry libc_symbol_map[] = {
// For library symbols that can be defined in more than one header
// file, maps from symbol-name to legitimate header files.
// This list was generated via
// grep -R '__.*_defined' /usr/include | perl -nle 'm,/usr/include/([^:]*):#\s*\S+ __(.*)_defined, and print qq@ { "$2", kPublic, "<$1>", kPublic },@' | sort -u
// I ignored all entries that only appeared once on the list (eg uint32_t).
// I then added in NULL, which according to [diff.null] C.2.2.3, can
// be defined in <clocale>, <cstddef>, <cstdio>, <cstdlib>,
// <cstring>, <ctime>, or <cwchar>. We also allow their C
// equivalents.
// In each case, I ordered them so <sys/types.h> was first, if it was
// an option for this type. That's the preferred #include all else
// equal. The visibility on the symbol-name is ignored; by convention
// we always set it to kPrivate.
{ "aiocb", kPrivate, "<aio.h>", kPublic },
{ "blkcnt_t", kPrivate, "<sys/types.h>", kPublic },
{ "blkcnt_t", kPrivate, "<sys/stat.h>", kPublic },
{ "blksize_t", kPrivate, "<sys/types.h>", kPublic },
{ "blksize_t", kPrivate, "<sys/stat.h>", kPublic },
{ "cc_t", kPrivate, "<termios.h>", kPublic },
{ "clock_t", kPrivate, "<sys/types.h>", kPublic },
{ "clock_t", kPrivate, "<sys/time.h>", kPublic },
{ "clock_t", kPrivate, "<time.h>", kPublic },
{ "clockid_t", kPrivate, "<sys/types.h>", kPublic },
{ "clockid_t", kPrivate, "<time.h>", kPublic },
{ "daddr_t", kPrivate, "<sys/types.h>", kPublic },
{ "daddr_t", kPrivate, "<rpc/types.h>", kPublic },
{ "dev_t", kPrivate, "<sys/types.h>", kPublic },
{ "dev_t", kPrivate, "<sys/stat.h>", kPublic },
{ "div_t", kPrivate, "<stdlib.h>", kPublic },
{ "double_t", kPrivate, "<math.h>", kPublic },
{ "error_t", kPrivate, "<errno.h>", kPublic },
{ "error_t", kPrivate, "<argp.h>", kPublic },
{ "error_t", kPrivate, "<argz.h>", kPublic },
{ "fd_set", kPrivate, "<sys/select.h>", kPublic },
{ "fd_set", kPrivate, "<sys/time.h>", kPublic },
{ "fenv_t", kPrivate, "<fenv.h>", kPublic },
{ "fexcept_t", kPrivate, "<fenv.h>", kPublic },
{ "FILE", kPrivate, "<stdio.h>", kPublic },
{ "FILE", kPrivate, "<wchar.h>", kPublic },
{ "float_t", kPrivate, "<math.h>", kPublic },
{ "fsblkcnt_t", kPrivate, "<sys/types.h>", kPublic },
{ "fsblkcnt_t", kPrivate, "<sys/statvfs.h>", kPublic },
{ "fsfilcnt_t", kPrivate, "<sys/types.h>", kPublic },
{ "fsfilcnt_t", kPrivate, "<sys/statvfs.h>", kPublic },
{ "getopt", kPrivate, "<unistd.h>", kPublic },
{ "gid_t", kPrivate, "<sys/types.h>", kPublic },
{ "gid_t", kPrivate, "<grp.h>", kPublic },
{ "gid_t", kPrivate, "<pwd.h>", kPublic },
{ "gid_t", kPrivate, "<signal.h>", kPublic },
{ "gid_t", kPrivate, "<stropts.h>", kPublic },
{ "gid_t", kPrivate, "<sys/ipc.h>", kPublic },
{ "gid_t", kPrivate, "<sys/stat.h>", kPublic },
{ "gid_t", kPrivate, "<unistd.h>", kPublic },
{ "htonl", kPrivate, "<arpa/inet.h>", kPublic },
{ "htons", kPrivate, "<arpa/inet.h>", kPublic },
{ "id_t", kPrivate, "<sys/types.h>", kPublic },
{ "id_t", kPrivate, "<sys/resource.h>", kPublic },
{ "imaxdiv_t", kPrivate, "<inttypes.h>", kPublic },
{ "intmax_t", kPrivate, "<stdint.h>", kPublic },
{ "uintmax_t", kPrivate, "<stdint.h>", kPublic },
{ "ino64_t", kPrivate, "<sys/types.h>", kPublic },
{ "ino64_t", kPrivate, "<dirent.h>", kPublic },
{ "ino_t", kPrivate, "<sys/types.h>", kPublic },
{ "ino_t", kPrivate, "<dirent.h>", kPublic },
{ "ino_t", kPrivate, "<sys/stat.h>", kPublic },
{ "int8_t", kPrivate, "<stdint.h>", kPublic },
{ "int16_t", kPrivate, "<stdint.h>", kPublic },
{ "int32_t", kPrivate, "<stdint.h>", kPublic },
{ "int64_t", kPrivate, "<stdint.h>", kPublic },
{ "uint8_t", kPrivate, "<stdint.h>", kPublic },
{ "uint16_t", kPrivate, "<stdint.h>", kPublic },
{ "uint32_t", kPrivate, "<stdint.h>", kPublic },
{ "uint64_t", kPrivate, "<stdint.h>", kPublic },
{ "intptr_t", kPrivate, "<stdint.h>", kPublic },
{ "uintptr_t", kPrivate, "<stdint.h>", kPublic },
{ "iovec", kPrivate, "<sys/uio.h>", kPublic },
{ "iovec", kPrivate, "<sys/socket.h>", kPublic },
{ "itimerspec", kPrivate, "<time.h>", kPublic },
{ "itimerspec", kPrivate, "<sys/timerfd.h>", kPublic },
{ "key_t", kPrivate, "<sys/types.h>", kPublic },
{ "key_t", kPrivate, "<sys/ipc.h>", kPublic },
{ "lconv", kPrivate, "<locale.h>", kPublic },
{ "ldiv_t", kPrivate, "<stdlib.h>", kPublic },
{ "lldiv_t", kPrivate, "<stdlib.h>", kPublic },
{ "max_align_t", kPrivate, "<stddef.h>", kPublic },
{ "mode_t", kPrivate, "<sys/types.h>", kPublic },
{ "mode_t", kPrivate, "<fcntl.h>", kPublic },
{ "mode_t", kPrivate, "<ndbm.h>", kPublic },
{ "mode_t", kPrivate, "<spawn.h>", kPublic },
{ "mode_t", kPrivate, "<sys/ipc.h>", kPublic },
{ "mode_t", kPrivate, "<sys/mman.h>", kPublic },
{ "mode_t", kPrivate, "<sys/stat.h>", kPublic },
{ "nlink_t", kPrivate, "<sys/types.h>", kPublic },
{ "nlink_t", kPrivate, "<sys/stat.h>", kPublic },
{ "ntohl", kPrivate, "<arpa/inet.h>", kPublic },
{ "ntohs", kPrivate, "<arpa/inet.h>", kPublic },
{ "off64_t", kPrivate, "<sys/types.h>", kPublic },
{ "off64_t", kPrivate, "<unistd.h>", kPublic },
{ "off_t", kPrivate, "<sys/types.h>", kPublic },
{ "off_t", kPrivate, "<aio.h>", kPublic },
{ "off_t", kPrivate, "<fcntl.h>", kPublic },
{ "off_t", kPrivate, "<stdio.h>", kPublic },
{ "off_t", kPrivate, "<sys/mman.h>", kPublic },
{ "off_t", kPrivate, "<sys/stat.h>", kPublic },
{ "off_t", kPrivate, "<unistd.h>", kPublic },
{ "optarg", kPrivate, "<unistd.h>", kPublic },
{ "opterr", kPrivate, "<unistd.h>", kPublic },
{ "optind", kPrivate, "<unistd.h>", kPublic },
{ "optopt", kPrivate, "<unistd.h>", kPublic },
{ "pid_t", kPrivate, "<sys/types.h>", kPublic },
{ "pid_t", kPrivate, "<fcntl.h>", kPublic },
{ "pid_t", kPrivate, "<sched.h>", kPublic },
{ "pid_t", kPrivate, "<signal.h>", kPublic },
{ "pid_t", kPrivate, "<spawn.h>", kPublic },
{ "pid_t", kPrivate, "<sys/msg.h>", kPublic },
{ "pid_t", kPrivate, "<sys/sem.h>", kPublic },
{ "pid_t", kPrivate, "<sys/shm.h>", kPublic },
{ "pid_t", kPrivate, "<sys/wait.h>", kPublic },
{ "pid_t", kPrivate, "<termios.h>", kPublic },
{ "pid_t", kPrivate, "<time.h>", kPublic },
{ "pid_t", kPrivate, "<unistd.h>", kPublic },
{ "pid_t", kPrivate, "<utmpx.h>", kPublic },
{ "ptrdiff_t", kPrivate, "<stddef.h>", kPublic },
{ "regex_t", kPrivate, "<regex.h>", kPublic },
{ "regmatch_t", kPrivate, "<regex.h>", kPublic },
{ "regoff_t", kPrivate, "<regex.h>", kPublic },
{ "sigevent", kPrivate, "<signal.h>", kPublic },
{ "sigevent", kPrivate, "<aio.h>", kPublic },
{ "sigevent", kPrivate, "<mqueue.h>", kPublic },
{ "sigevent", kPrivate, "<time.h>", kPublic },
{ "siginfo_t", kPrivate, "<signal.h>", kPublic },
{ "siginfo_t", kPrivate, "<sys/wait.h>", kPublic },
{ "sigset_t", kPrivate, "<signal.h>", kPublic },
{ "sigset_t", kPrivate, "<spawn.h>", kPublic },
{ "sigset_t", kPrivate, "<sys/select.h>", kPublic },
{ "sigval", kPrivate, "<signal.h>", kPublic },
{ "sockaddr", kPrivate, "<sys/socket.h>", kPublic },
{ "socklen_t", kPrivate, "<sys/socket.h>", kPublic },
{ "socklen_t", kPrivate, "<netdb.h>", kPublic },
{ "ssize_t", kPrivate, "<sys/types.h>", kPublic },
{ "ssize_t", kPrivate, "<aio.h>", kPublic },
{ "ssize_t", kPrivate, "<monetary.h>", kPublic },
{ "ssize_t", kPrivate, "<mqueue.h>", kPublic },
{ "ssize_t", kPrivate, "<stdio.h>", kPublic },
{ "ssize_t", kPrivate, "<sys/msg.h>", kPublic },
{ "ssize_t", kPrivate, "<sys/socket.h>", kPublic },
{ "ssize_t", kPrivate, "<sys/uio.h>", kPublic },
{ "ssize_t", kPrivate, "<unistd.h>", kPublic },
{ "stat", kPrivate, "<sys/stat.h>", kPublic },
{ "stat", kPrivate, "<ftw.h>", kPublic },
{ "suseconds_t", kPrivate, "<sys/types.h>", kPublic },
{ "suseconds_t", kPrivate, "<sys/select.h>", kPublic },
{ "suseconds_t", kPrivate, "<sys/time.h>", kPublic },
{ "time_t", kPrivate, "<time.h>", kPublic },
{ "time_t", kPrivate, "<sched.h>", kPublic },
{ "time_t", kPrivate, "<sys/msg.h>", kPublic },
{ "time_t", kPrivate, "<sys/select.h>", kPublic },
{ "time_t", kPrivate, "<sys/sem.h>", kPublic },
{ "time_t", kPrivate, "<sys/shm.h>", kPublic },
{ "time_t", kPrivate, "<sys/stat.h>", kPublic },
{ "time_t", kPrivate, "<sys/time.h>", kPublic },
{ "time_t", kPrivate, "<sys/types.h>", kPublic },
{ "time_t", kPrivate, "<utime.h>", kPublic },
{ "timer_t", kPrivate, "<sys/types.h>", kPublic },
{ "timer_t", kPrivate, "<time.h>", kPublic },
{ "timespec", kPrivate, "<time.h>", kPublic },
{ "timespec", kPrivate, "<aio.h>", kPublic },
{ "timespec", kPrivate, "<mqueue.h>", kPublic },
{ "timespec", kPrivate, "<sched.h>", kPublic },
{ "timespec", kPrivate, "<signal.h>", kPublic },
{ "timespec", kPrivate, "<sys/select.h>", kPublic },
{ "timespec", kPrivate, "<sys/stat.h>", kPublic },
{ "timeval", kPrivate, "<sys/time.h>", kPublic },
{ "timeval", kPrivate, "<sys/resource.h>", kPublic },
{ "timeval", kPrivate, "<sys/select.h>", kPublic },
{ "timeval", kPrivate, "<utmpx.h>", kPublic },
{ "tm", kPrivate, "<time.h>", kPublic },
{ "u_char", kPrivate, "<sys/types.h>", kPublic },
{ "u_char", kPrivate, "<rpc/types.h>", kPublic },
{ "uid_t", kPrivate, "<sys/types.h>", kPublic },
{ "uid_t", kPrivate, "<pwd.h>", kPublic },
{ "uid_t", kPrivate, "<signal.h>", kPublic },
{ "uid_t", kPrivate, "<stropts.h>", kPublic },
{ "uid_t", kPrivate, "<sys/ipc.h>", kPublic },
{ "uid_t", kPrivate, "<sys/stat.h>", kPublic },
{ "uid_t", kPrivate, "<unistd.h>", kPublic },
{ "useconds_t", kPrivate, "<sys/types.h>", kPublic },
{ "useconds_t", kPrivate, "<unistd.h>", kPublic },
{ "wchar_t", kPrivate, "<stddef.h>", kPublic },
{ "wchar_t", kPrivate, "<stdlib.h>", kPublic },
// It is unspecified if the cname headers provide ::size_t.
// <locale.h> is the one header which defines NULL but not size_t.
{ "size_t", kPrivate, "<stddef.h>", kPublic }, // 'canonical' location for size_t
{ "size_t", kPrivate, "<aio.h>", kPublic },
{ "size_t", kPrivate, "<glob.h>", kPublic },
{ "size_t", kPrivate, "<grp.h>", kPublic },
{ "size_t", kPrivate, "<iconv.h>", kPublic },
{ "size_t", kPrivate, "<monetary.h>", kPublic },
{ "size_t", kPrivate, "<mqueue.h>", kPublic },
{ "size_t", kPrivate, "<ndbm.h>", kPublic },
{ "size_t", kPrivate, "<pwd.h>", kPublic },
{ "size_t", kPrivate, "<regex.h>", kPublic },
{ "size_t", kPrivate, "<search.h>", kPublic },
{ "size_t", kPrivate, "<signal.h>", kPublic },
{ "size_t", kPrivate, "<stdio.h>", kPublic },
{ "size_t", kPrivate, "<stdlib.h>", kPublic },
{ "size_t", kPrivate, "<string.h>", kPublic },
{ "size_t", kPrivate, "<strings.h>", kPublic },
{ "size_t", kPrivate, "<sys/mman.h>", kPublic },
{ "size_t", kPrivate, "<sys/msg.h>", kPublic },
{ "size_t", kPrivate, "<sys/sem.h>", kPublic },
{ "size_t", kPrivate, "<sys/shm.h>", kPublic },
{ "size_t", kPrivate, "<sys/socket.h>", kPublic },
{ "size_t", kPrivate, "<sys/types.h>", kPublic },
{ "size_t", kPrivate, "<sys/uio.h>", kPublic },
{ "size_t", kPrivate, "<time.h>", kPublic },
{ "size_t", kPrivate, "<uchar.h>", kPublic },
{ "size_t", kPrivate, "<unistd.h>", kPublic },
{ "size_t", kPrivate, "<wchar.h>", kPublic },
{ "size_t", kPrivate, "<wordexp.h>", kPublic },
// Macros that can be defined in more than one file, don't have the
// same __foo_defined guard that other types do, so the grep above
// doesn't discover them. Until I figure out a better way, I just
// add them in by hand as I discover them.
{ "EOF", kPrivate, "<stdio.h>", kPublic },
{ "EOF", kPrivate, "<libio.h>", kPublic },
{ "FILE", kPrivate, "<stdio.h>", kPublic },
{ "MAP_POPULATE", kPrivate, "<sys/mman.h>", kPublic },
{ "MAP_POPULATE", kPrivate, "<linux/mman.h>", kPublic },
{ "MAP_STACK", kPrivate, "<sys/mman.h>", kPublic },
{ "MAP_STACK", kPrivate, "<linux/mman.h>", kPublic },
{ "MAXHOSTNAMELEN", kPrivate, "<sys/param.h>", kPublic },
{ "MAXHOSTNAMELEN", kPrivate, "<protocols/timed.h>", kPublic },
{ "SIGABRT", kPrivate, "<signal.h>", kPublic },
{ "SIGCHLD", kPrivate, "<signal.h>", kPublic },
{ "SIGCHLD", kPrivate, "<linux/signal.h>", kPublic },
{ "va_list", kPrivate, "<stdarg.h>", kPublic },
{ "va_list", kPrivate, "<stdio.h>", kPublic },
{ "va_list", kPrivate, "<wchar.h>", kPublic },
// These are symbols that could be defined in either stdlib.h or
// malloc.h, but we always want the stdlib location.
{ "malloc", kPrivate, "<stdlib.h>", kPublic },
{ "calloc", kPrivate, "<stdlib.h>", kPublic },
{ "realloc", kPrivate, "<stdlib.h>", kPublic },
{ "free", kPrivate, "<stdlib.h>", kPublic },
// Entries for NULL
{ "NULL", kPrivate, "<stddef.h>", kPublic }, // 'canonical' location for NULL
{ "NULL", kPrivate, "<clocale>", kPublic },
{ "NULL", kPrivate, "<cstddef>", kPublic },
{ "NULL", kPrivate, "<cstdio>", kPublic },
{ "NULL", kPrivate, "<cstdlib>", kPublic },
{ "NULL", kPrivate, "<cstring>", kPublic },
{ "NULL", kPrivate, "<ctime>", kPublic },
{ "NULL", kPrivate, "<cwchar>", kPublic },
{ "NULL", kPrivate, "<locale.h>", kPublic },
{ "NULL", kPrivate, "<stdio.h>", kPublic },
{ "NULL", kPrivate, "<stdlib.h>", kPublic },
{ "NULL", kPrivate, "<string.h>", kPublic },
{ "NULL", kPrivate, "<time.h>", kPublic },
{ "NULL", kPrivate, "<unistd.h>", kPublic },
{ "NULL", kPrivate, "<wchar.h>", kPublic },
};
// Symbol -> include mappings for GNU libstdc++
const IncludeMapEntry libstdcpp_symbol_map[] = {
// Kludge time: almost all STL types take an allocator, but they
// almost always use the default value. Usually we detect that
// and don't try to do IWYU, but sometimes it passes through.
// For instance, when adding two strings, we end up calling
// template<_CharT,_Traits,_Alloc> ... operator+(
// basic_string<_CharT,_Traits,_Alloc>, ...)
// These look like normal template args to us, so we see they're
// used and declare an iwyu dependency, even though we don't need
// to #include the traits or alloc type ourselves. The surest way
// to deal with this is to just say that everyone provides
// std::allocator. We can add more here at need.
{ "std::allocator", kPrivate, "<memory>", kPublic },
{ "std::allocator", kPrivate, "<string>", kPublic },
{ "std::allocator", kPrivate, "<vector>", kPublic },
{ "std::allocator", kPrivate, "<map>", kPublic },
{ "std::allocator", kPrivate, "<set>", kPublic },
// A similar kludge for std::char_traits. basic_string,
// basic_ostream and basic_istream have this as a default template
// argument, and sometimes it bleeds through when clang desugars the
// string/ostream/istream type.
{ "std::char_traits", kPrivate, "<string>", kPublic },
{ "std::char_traits", kPrivate, "<ostream>", kPublic },
{ "std::char_traits", kPrivate, "<istream>", kPublic },
{ "std::size_t", kPrivate, "<cstddef>", kPublic }, // 'canonical' location for std::size_t
{ "std::size_t", kPrivate, "<cstdio>", kPublic },
{ "std::size_t", kPrivate, "<cstdlib>", kPublic },
{ "std::size_t", kPrivate, "<cstring>", kPublic },
{ "std::size_t", kPrivate, "<ctime>", kPublic },
{ "std::size_t", kPrivate, "<cuchar>", kPublic },
{ "std::size_t", kPrivate, "<cwchar>", kPublic },
};
const IncludeMapEntry libc_include_map[] = {
// Private -> public include mappings for GNU libc
// ( cd /usr/include && grep '^ *# *include' {sys/,net/,}* | perl -nle 'm/^([^:]+).*<([^>]+)>/ && print qq@ { "<$2>", kPrivate, "<$1>", kPublic },@' | grep bits/ | sort )
// When I saw more than one mapping for these, I typically picked
// what I thought was the "best" one.
{ "<bits/a.out.h>", kPrivate, "<a.out.h>", kPublic },
{ "<bits/auxv.h>", kPrivate, "<sys/auxv.h>", kPublic },
{ "<bits/byteswap.h>", kPrivate, "<byteswap.h>", kPublic },
{ "<bits/cmathcalls.h>", kPrivate, "<complex.h>", kPublic },
{ "<bits/confname.h>", kPrivate, "<unistd.h>", kPublic },
{ "<bits/dirent.h>", kPrivate, "<dirent.h>", kPublic },
{ "<bits/dlfcn.h>", kPrivate, "<dlfcn.h>", kPublic },
{ "<bits/elfclass.h>", kPrivate, "<link.h>", kPublic },
{ "<bits/endian.h>", kPrivate, "<endian.h>", kPublic },
{ "<bits/environments.h>", kPrivate, "<unistd.h>", kPublic },
{ "<bits/epoll.h>", kPrivate, "<sys/epoll.h>", kPublic },
{ "<bits/errno.h>", kPrivate, "<errno.h>", kPublic },
{ "<bits/error.h>", kPrivate, "<error.h>", kPublic },
{ "<bits/eventfd.h>", kPrivate, "<sys/eventfd.h>", kPublic },
{ "<bits/fcntl.h>", kPrivate, "<fcntl.h>", kPublic },
{ "<bits/fcntl2.h>", kPrivate, "<fcntl.h>", kPublic },
{ "<bits/fenv.h>", kPrivate, "<fenv.h>", kPublic },
{ "<bits/fenvinline.h>", kPrivate, "<fenv.h>", kPublic },
{ "<bits/huge_val.h>", kPrivate, "<math.h>", kPublic },
{ "<bits/huge_valf.h>", kPrivate, "<math.h>", kPublic },
{ "<bits/huge_vall.h>", kPrivate, "<math.h>", kPublic },
{ "<bits/hwcap.h>", kPrivate, "<sys/auxv.h>", kPublic },
{ "<bits/inf.h>", kPrivate, "<math.h>", kPublic },
{ "<bits/inotify.h>", kPrivate, "<sys/inotify.h>", kPublic },
{ "<bits/ioctl-types.h>", kPrivate, "<sys/ioctl.h>", kPublic },
{ "<bits/ioctls.h>", kPrivate, "<sys/ioctl.h>", kPublic },
{ "<bits/ipc.h>", kPrivate, "<sys/ipc.h>", kPublic },
{ "<bits/ipctypes.h>", kPrivate, "<sys/ipc.h>", kPublic },
{ "<bits/libio-ldbl.h>", kPrivate, "<libio.h>", kPublic },
{ "<bits/link.h>", kPrivate, "<link.h>", kPublic },
{ "<bits/locale.h>", kPrivate, "<locale.h>", kPublic },
{ "<bits/math-finite.h>", kPrivate, "<math.h>", kPublic },
{ "<bits/mathcalls.h>", kPrivate, "<math.h>", kPublic },
{ "<bits/mathdef.h>", kPrivate, "<math.h>", kPublic },
{ "<bits/mathinline.h>", kPrivate, "<math.h>", kPublic },
{ "<bits/mman.h>", kPrivate, "<sys/mman.h>", kPublic },
{ "<bits/mman-shared.h>", kPrivate, "<sys/mman.h>", kPublic },
{ "<bits/monetary-ldbl.h>", kPrivate, "<monetary.h>", kPublic },
{ "<bits/mqueue.h>", kPrivate, "<mqueue.h>", kPublic },
{ "<bits/mqueue2.h>", kPrivate, "<mqueue.h>", kPublic },
{ "<bits/msq.h>", kPrivate, "<sys/msg.h>", kPublic },
{ "<bits/nan.h>", kPrivate, "<math.h>", kPublic },
{ "<bits/netdb.h>", kPrivate, "<netdb.h>", kPublic },
{ "<bits/param.h>", kPrivate, "<sys/param.h>", kPublic },
{ "<bits/poll.h>", kPrivate, "<sys/poll.h>", kPrivate },
{ "<bits/poll2.h>", kPrivate, "<sys/poll.h>", kPrivate },
{ "<bits/posix1_lim.h>", kPrivate, "<limits.h>", kPublic },
{ "<bits/posix2_lim.h>", kPrivate, "<limits.h>", kPublic },
{ "<bits/posix_opt.h>", kPrivate, "<unistd.h>", kPublic },
{ "<bits/printf-ldbl.h>", kPrivate, "<printf.h>", kPublic },
{ "<bits/pthreadtypes.h>", kPrivate, "<pthread.h>", kPublic },
{ "<bits/resource.h>", kPrivate, "<sys/resource.h>", kPublic },
{ "<bits/sched.h>", kPrivate, "<sched.h>", kPublic },
{ "<bits/select.h>", kPrivate, "<sys/select.h>", kPublic },
{ "<bits/select2.h>", kPrivate, "<sys/select.h>", kPublic },
{ "<bits/sem.h>", kPrivate, "<sys/sem.h>", kPublic },
{ "<bits/semaphore.h>", kPrivate, "<semaphore.h>", kPublic },
{ "<bits/setjmp.h>", kPrivate, "<setjmp.h>", kPublic },
{ "<bits/setjmp2.h>", kPrivate, "<setjmp.h>", kPublic },
{ "<bits/shm.h>", kPrivate, "<sys/shm.h>", kPublic },
{ "<bits/sigaction.h>", kPrivate, "<signal.h>", kPublic },
{ "<bits/sigcontext.h>", kPrivate, "<signal.h>", kPublic },
{ "<bits/siginfo.h>", kPrivate, "<signal.h>", kPublic },
{ "<bits/signum.h>", kPrivate, "<signal.h>", kPublic },
{ "<bits/sigset.h>", kPrivate, "<signal.h>", kPublic },
{ "<bits/sigstack.h>", kPrivate, "<signal.h>", kPublic },
{ "<bits/sigthread.h>", kPrivate, "<signal.h>", kPublic },
{ "<bits/sockaddr.h>", kPrivate, "<sys/un.h>", kPublic },
{ "<bits/socket.h>", kPrivate, "<sys/socket.h>", kPublic },
{ "<bits/socket2.h>", kPrivate, "<sys/socket.h>", kPublic },
{ "<bits/socket_type.h>", kPrivate, "<sys/socket.h>", kPublic },
{ "<bits/stab.def>", kPrivate, "<stab.h>", kPublic },
{ "<bits/stat.h>", kPrivate, "<sys/stat.h>", kPublic },
{ "<bits/statfs.h>", kPrivate, "<sys/statfs.h>", kPublic },
{ "<bits/statvfs.h>", kPrivate, "<sys/statvfs.h>", kPublic },
{ "<bits/stdio-ldbl.h>", kPrivate, "<stdio.h>", kPublic },
{ "<bits/stdio-lock.h>", kPrivate, "<libio.h>", kPublic },
{ "<bits/stdio.h>", kPrivate, "<stdio.h>", kPublic },
{ "<bits/stdio2.h>", kPrivate, "<stdio.h>", kPublic },
{ "<bits/stdio_lim.h>", kPrivate, "<stdio.h>", kPublic },
{ "<bits/stdlib-bsearch.h>", kPrivate, "<stdlib.h>", kPublic },
{ "<bits/stdlib-float.h>", kPrivate, "<stdlib.h>", kPublic },
{ "<bits/stdlib-ldbl.h>", kPrivate, "<stdlib.h>", kPublic },
{ "<bits/stdlib.h>", kPrivate, "<stdlib.h>", kPublic },
{ "<bits/string.h>", kPrivate, "<string.h>", kPublic },
{ "<bits/string2.h>", kPrivate, "<string.h>", kPublic },
{ "<bits/string3.h>", kPrivate, "<string.h>", kPublic },
{ "<bits/stropts.h>", kPrivate, "<stropts.h>", kPublic },
{ "<bits/struct_stat.h>", kPrivate, "<sys/stat.h>", kPublic },
{ "<bits/struct_stat.h>", kPrivate, "<ftw.h>", kPublic },
{ "<bits/sys_errlist.h>", kPrivate, "<stdio.h>", kPublic },
{ "<bits/syscall.h>", kPrivate, "<sys/syscall.h>", kPublic },
{ "<bits/sysctl.h>", kPrivate, "<sys/sysctl.h>", kPublic },
{ "<bits/syslog-ldbl.h>", kPrivate, "<sys/syslog.h>", kPrivate },
{ "<bits/syslog-path.h>", kPrivate, "<sys/syslog.h>", kPrivate },
{ "<bits/syslog.h>", kPrivate, "<sys/syslog.h>", kPrivate },
{ "<bits/termios-c_lflag.h>", kPrivate, "<termios.h>", kPublic },
{ "<bits/termios-struct.h>", kPrivate, "<termios.h>", kPublic },
{ "<bits/termios-tcflow.h>", kPrivate, "<termios.h>", kPublic },
{ "<bits/termios.h>", kPrivate, "<termios.h>", kPublic },
{ "<bits/time.h>", kPrivate, "<time.h>", kPublic },
{ "<bits/time.h>", kPrivate, "<sys/time.h>", kPublic },
{ "<bits/timerfd.h>", kPrivate, "<sys/timerfd.h>", kPublic },
{ "<bits/timex.h>", kPrivate, "<sys/timex.h>", kPublic },
{ "<bits/types.h>", kPrivate, "<sys/types.h>", kPublic },
{ "<bits/types/siginfo_t.h>", kPrivate, "<signal.h>", kPublic },
{ "<bits/types/siginfo_t.h>", kPrivate, "<sys/wait.h>", kPublic },
{ "<bits/uio.h>", kPrivate, "<sys/uio.h>", kPublic },
{ "<bits/unistd.h>", kPrivate, "<unistd.h>", kPublic },
{ "<bits/ustat.h>", kPrivate, "<sys/ustat.h>", kPrivate },
{ "<bits/utmp.h>", kPrivate, "<utmp.h>", kPublic },
{ "<bits/utmpx.h>", kPrivate, "<utmpx.h>", kPublic },
{ "<bits/utsname.h>", kPrivate, "<sys/utsname.h>", kPublic },
{ "<bits/waitflags.h>", kPrivate, "<sys/wait.h>", kPublic },
{ "<bits/waitstatus.h>", kPrivate, "<sys/wait.h>", kPublic },
{ "<bits/wchar-ldbl.h>", kPrivate, "<wchar.h>", kPublic },
{ "<bits/wchar.h>", kPrivate, "<wchar.h>", kPublic },
{ "<bits/wchar2.h>", kPrivate, "<wchar.h>", kPublic },
{ "<bits/wordsize.h>", kPrivate, "<limits.h>", kPublic },
{ "<bits/xopen_lim.h>", kPrivate, "<limits.h>", kPublic },
{ "<bits/xtitypes.h>", kPrivate, "<stropts.h>", kPublic },
// Sometimes libc tells you what mapping to do via an '#error':
// # error "Never use <bits/dlfcn.h> directly; include <dlfcn.h> instead."
// or
// # error "Never include <bits/socket_type.h> directly; use <sys/socket.h> instead."
// ( cd /usr/include && grep -R '^ *# *error "Never use\|include' * | perl -nle 'm/<([^>]+).*directly.*<([^>]+)/ && print qq@ { "<$1>", kPrivate, "<$2>", kPublic },@' | sort )
{ "<bits/a.out.h>", kPrivate, "<a.out.h>", kPublic },
{ "<bits/byteswap-16.h>", kPrivate, "<byteswap.h>", kPublic },
{ "<bits/byteswap.h>", kPrivate, "<byteswap.h>", kPublic },
{ "<bits/cmathcalls.h>", kPrivate, "<complex.h>", kPublic },
{ "<bits/confname.h>", kPrivate, "<unistd.h>", kPublic },
{ "<bits/dirent.h>", kPrivate, "<dirent.h>", kPublic },
{ "<bits/dlfcn.h>", kPrivate, "<dlfcn.h>", kPublic },
{ "<bits/elfclass.h>", kPrivate, "<link.h>", kPublic },
{ "<bits/endian.h>", kPrivate, "<endian.h>", kPublic },
{ "<bits/epoll.h>", kPrivate, "<sys/epoll.h>", kPublic },
{ "<bits/eventfd.h>", kPrivate, "<sys/eventfd.h>", kPublic },
{ "<bits/fcntl-linux.h>", kPrivate, "<fcntl.h>", kPublic },
{ "<bits/fcntl.h>", kPrivate, "<fcntl.h>", kPublic },
{ "<bits/fenv.h>", kPrivate, "<fenv.h>", kPublic },
{ "<bits/huge_val.h>", kPrivate, "<math.h>", kPublic },
{ "<bits/huge_valf.h>", kPrivate, "<math.h>", kPublic },
{ "<bits/huge_vall.h>", kPrivate, "<math.h>", kPublic },
{ "<bits/in.h>", kPrivate, "<netinet/in.h>", kPublic },
{ "<bits/inf.h>", kPrivate, "<math.h>", kPublic },
{ "<bits/inotify.h>", kPrivate, "<sys/inotify.h>", kPublic },
{ "<bits/ioctl-types.h>", kPrivate, "<sys/ioctl.h>", kPublic },
{ "<bits/ioctls.h>", kPrivate, "<sys/ioctl.h>", kPublic },
{ "<bits/ipc.h>", kPrivate, "<sys/ipc.h>", kPublic },
{ "<bits/ipctypes.h>", kPrivate, "<sys/ipc.h>", kPublic },
{ "<bits/locale.h>", kPrivate, "<locale.h>", kPublic },
{ "<bits/math-finite.h>", kPrivate, "<math.h>", kPublic },
{ "<bits/mathdef.h>", kPrivate, "<math.h>", kPublic },
{ "<bits/mathinline.h>", kPrivate, "<math.h>", kPublic },
{ "<bits/mman-linux.h>", kPrivate, "<sys/mman.h>", kPublic },
{ "<bits/mman.h>", kPrivate, "<sys/mman.h>", kPublic },
{ "<bits/mqueue.h>", kPrivate, "<mqueue.h>", kPublic },
{ "<bits/msq.h>", kPrivate, "<sys/msg.h>", kPublic },
{ "<bits/nan.h>", kPrivate, "<math.h>", kPublic },
{ "<bits/param.h>", kPrivate, "<sys/param.h>", kPublic },
{ "<bits/poll.h>", kPrivate, "<sys/poll.h>", kPrivate },
{ "<bits/predefs.h>", kPrivate, "<features.h>", kPublic },
{ "<bits/resource.h>", kPrivate, "<sys/resource.h>", kPublic },
{ "<bits/select.h>", kPrivate, "<sys/select.h>", kPublic },
{ "<bits/semaphore.h>", kPrivate, "<semaphore.h>", kPublic },
{ "<bits/sigcontext.h>", kPrivate, "<signal.h>", kPublic },
{ "<bits/signalfd.h>", kPrivate, "<sys/signalfd.h>", kPublic },
{ "<bits/stdlib-float.h>", kPrivate, "<stdlib.h>", kPublic },
{ "<bits/string.h>", kPrivate, "<string.h>", kPublic },
{ "<bits/string2.h>", kPrivate, "<string.h>", kPublic },
{ "<bits/string3.h>", kPrivate, "<string.h>", kPublic },
{ "<bits/timerfd.h>", kPrivate, "<sys/timerfd.h>", kPublic },
{ "<bits/typesizes.h>", kPrivate, "<sys/types.h>", kPublic },
// Top-level #includes that just forward to another file:
// $ for i in /usr/include/*; do [ -f $i ] && [ `wc -l < $i` = 1 ] && echo $i; done
// (poll.h, syscall.h, syslog.h, ustat.h, wait.h).
// For each file, I looked at the list of canonical header files --
// http://www.opengroup.org/onlinepubs/9699919799/idx/head.html --
// to decide which of the two files is canonical. If neither is
// on the POSIX.1 1998 list, I just choose the top-level one.
{ "<sys/poll.h>", kPrivate, "<poll.h>", kPublic },
{ "<sys/syslog.h>", kPrivate, "<syslog.h>", kPublic },
{ "<sys/ustat.h>", kPrivate, "<ustat.h>", kPublic },
{ "<wait.h>", kPrivate, "<sys/wait.h>", kPublic },
// These are all files in bits/ that delegate to asm/ and linux/ to
// do all (or lots) of the work. Note these are private->private.
// $ for i in /usr/include/bits/*; do for dir in asm linux; do grep -H -e $dir/`basename $i` $i; done; done
{ "<linux/errno.h>", kPrivate, "<bits/errno.h>", kPrivate },
{ "<asm/ioctls.h>", kPrivate, "<bits/ioctls.h>", kPrivate },
{ "<asm/socket.h>", kPrivate, "<bits/socket.h>", kPrivate },
{ "<linux/socket.h>", kPrivate, "<bits/socket.h>", kPrivate },
// Some asm files have 32- and 64-bit variants:
// $ ls /usr/include/asm/*_{32,64}.h
{ "<asm/posix_types_32.h>", kPrivate, "<asm/posix_types.h>", kPublic },
{ "<asm/posix_types_64.h>", kPrivate, "<asm/posix_types.h>", kPublic },
{ "<asm/unistd_32.h>", kPrivate, "<asm/unistd.h>", kPrivate },
{ "<asm/unistd_64.h>", kPrivate, "<asm/unistd.h>", kPrivate },
// I don't know what grep would have found these. I found them
// via user report.
{ "<asm/errno.h>", kPrivate, "<errno.h>", kPublic },
{ "<asm/errno-base.h>", kPrivate, "<errno.h>", kPublic },
{ "<asm/ptrace-abi.h>", kPrivate, "<asm/ptrace.h>", kPublic },
{ "<asm/unistd.h>", kPrivate, "<sys/syscall.h>", kPublic },
{ "<linux/limits.h>", kPrivate, "<limits.h>", kPublic }, // PATH_MAX
{ "<linux/prctl.h>", kPrivate, "<sys/prctl.h>", kPublic },
{ "<sys/ucontext.h>", kPrivate, "<ucontext.h>", kPublic },
// Exports guaranteed by the C standard
{ "<stdint.h>", kPublic, "<inttypes.h>", kPublic },
};
const IncludeMapEntry stdlib_c_include_map[] = {
// Allow the C++ wrappers around C files. Without these mappings,
// if you #include <cstdio>, iwyu will tell you to replace it with
// <stdio.h>, which is where the symbols are actually defined. We
// inhibit that behavior to keep the <cstdio> alone. Note this is a
// public-to-public mapping: we don't want to *replace* <assert.h>
// with <cassert>, we just want to avoid suggesting changing
// <cassert> back to <assert.h>. (If you *did* want to replace
// assert.h with cassert, you'd change it to a public->private
// mapping.) Here is how I identified the files to map:
// $ for i in /usr/include/c++/4.4/c* ; do ls /usr/include/`basename $i | cut -b2-`.h /usr/lib/gcc/*/4.4/include/`basename $i | cut -b2-`.h 2>/dev/null ; done
//
// These headers are defined in [headers.cpp.c].
// https://github.com/cplusplus/draft/blob/c+%2B20/source/lib-intro.tex
//
// $ curl -s -N https://raw.githubusercontent.com/cplusplus/draft/c%2B%2B20/source/lib-intro.tex | sed -n '/begin{multicolfloattable}.*{headers.cpp.c}/,/end{multicolfloattable}/p' lib-intro.tex | grep tcode | perl -nle 'm/tcode{<c(.*)>}/ && print qq@ { "<$1.h>", kPublic, "<c$1>", kPublic },@' | sort
{ "<assert.h>", kPublic, "<cassert>", kPublic },
{ "<complex.h>", kPublic, "<ccomplex>", kPublic },
{ "<ctype.h>", kPublic, "<cctype>", kPublic },
{ "<errno.h>", kPublic, "<cerrno>", kPublic },
{ "<fenv.h>", kPublic, "<cfenv>", kPublic },
{ "<float.h>", kPublic, "<cfloat>", kPublic },
{ "<inttypes.h>", kPublic, "<cinttypes>", kPublic },
{ "<iso646.h>", kPublic, "<ciso646>", kPublic },
{ "<limits.h>", kPublic, "<climits>", kPublic },
{ "<locale.h>", kPublic, "<clocale>", kPublic },
{ "<math.h>", kPublic, "<cmath>", kPublic },
{ "<setjmp.h>", kPublic, "<csetjmp>", kPublic },
{ "<signal.h>", kPublic, "<csignal>", kPublic },
{ "<stdalign.h>", kPublic, "<cstdalign>", kPublic },
{ "<stdarg.h>", kPublic, "<cstdarg>", kPublic },
{ "<stdbool.h>", kPublic, "<cstdbool>", kPublic },
{ "<stddef.h>", kPublic, "<cstddef>", kPublic },
{ "<stdint.h>", kPublic, "<cstdint>", kPublic },
{ "<stdio.h>", kPublic, "<cstdio>", kPublic },
{ "<stdlib.h>", kPublic, "<cstdlib>", kPublic },
{ "<string.h>", kPublic, "<cstring>", kPublic },
{ "<tgmath.h>", kPublic, "<ctgmath>", kPublic },
{ "<time.h>", kPublic, "<ctime>", kPublic },
{ "<uchar.h>", kPublic, "<cuchar>", kPublic },
{ "<wchar.h>", kPublic, "<cwchar>", kPublic },
{ "<wctype.h>", kPublic, "<cwctype>", kPublic },
};
const char* stdlib_cpp_public_headers[] = {
// These headers are defined in [headers.cpp].
// https://github.com/cplusplus/draft/blob/c+%2B20/source/lib-intro.tex
//
// $ curl -s -N https://raw.githubusercontent.com/cplusplus/draft/c%2B%2B20/source/lib-intro.tex | sed -n '/begin{multicolfloattable}.*{headers.cpp}/,/end{multicolfloattable}/p' lib-intro.tex | grep tcode | perl -nle 'm/tcode{(.*)}/ && print qq@ "$1",@' | sort
"<algorithm>",
"<any>",
"<array>",
"<atomic>",
"<barrier>",
"<bit>",
"<bitset>",
"<charconv>",
"<chrono>",
"<codecvt>",
"<compare>",
"<complex>",
"<concepts>",
"<condition_variable>",
"<coroutine>",
"<deque>",
"<exception>",
"<execution>",
"<filesystem>",
"<format>",
"<forward_list>",
"<fstream>",
"<functional>",
"<future>",
"<initializer_list>",
"<iomanip>",
"<ios>",
"<iosfwd>",
"<iostream>",
"<istream>",
"<iterator>",
"<latch>",
"<limits>",
"<list>",
"<locale>",
"<map>",
"<memory>",
"<memory_resource>",
"<mutex>",
"<new>",
"<numbers>",
"<numeric>",
"<optional>",
"<ostream>",
"<queue>",
"<random>",
"<ranges>",
"<ratio>",
"<regex>",
"<scoped_allocator>",
"<semaphore>",
"<set>",
"<shared_mutex>",
"<source_location>",
"<span>",
"<sstream>",
"<stack>",
"<stdexcept>",
"<stop_token>",
"<streambuf>",
"<string>",
"<string_view>",
"<strstream>",
"<syncstream>",
"<system_error>",
"<thread>",
"<tuple>",
"<typeindex>",
"<typeinfo>",
"<type_traits>",
"<unordered_map>",
"<unordered_set>",
"<utility>",
"<valarray>",
"<variant>",
"<vector>",
"<version>",
};
// Private -> public include mappings for GNU libstdc++
//
// Note: make sure to sync this setting with gcc.stl.headers.imp
//
const IncludeMapEntry libstdcpp_include_map[] = {
// cd /usr/include/c++/10 && grep -r headername | perl -nle 'm/^([^:]+).*@headername\{([^,]*)\}/ && print qq@ { "<$1>", kPrivate, "<$2>", kPublic },@' | sort -u
{ "<backward/auto_ptr.h>", kPrivate, "<memory>", kPublic },
{ "<backward/backward_warning.h>", kPrivate, "<iosfwd>", kPublic },
{ "<backward/binders.h>", kPrivate, "<functional>", kPublic },
{ "<bits/algorithmfwd.h>", kPrivate, "<algorithm>", kPublic },
{ "<bits/allocated_ptr.h>", kPrivate, "<memory>", kPublic },
{ "<bits/allocator.h>", kPrivate, "<memory>", kPublic },
{ "<bits/alloc_traits.h>", kPrivate, "<memory>", kPublic },
{ "<bits/atomic_base.h>", kPrivate, "<atomic>", kPublic },
{ "<bits/atomic_lockfree_defines.h>", kPrivate, "<atomic>", kPublic },
{ "<bits/basic_ios.h>", kPrivate, "<ios>", kPublic },
{ "<bits/basic_ios.tcc>", kPrivate, "<ios>", kPublic },
{ "<bits/basic_string.h>", kPrivate, "<string>", kPublic },
{ "<bits/basic_string.tcc>", kPrivate, "<string>", kPublic },
{ "<bits/boost_concept_check.h>", kPrivate, "<iterator>", kPublic },
{ "<bits/c++0x_warning.h>", kPrivate, "<iosfwd>", kPublic },
{ "<bits/charconv.h>", kPrivate, "<charconv>", kPublic },
{ "<bits/char_traits.h>", kPrivate, "<string>", kPublic },
{ "<bits/codecvt.h>", kPrivate, "<locale>", kPublic },
{ "<bits/concept_check.h>", kPrivate, "<iterator>", kPublic },
{ "<bits/cpp_type_traits.h>", kPrivate, "<ext/type_traits>", kPublic },
{ "<bits/cxxabi_forced.h>", kPrivate, "<cxxabi.h>", kPublic },
{ "<bits/deque.tcc>", kPrivate, "<deque>", kPublic },
{ "<bits/exception_defines.h>", kPrivate, "<exception>", kPublic },
{ "<bits/exception_ptr.h>", kPrivate, "<exception>", kPublic },
{ "<bits/forward_list.h>", kPrivate, "<forward_list>", kPublic },
{ "<bits/forward_list.tcc>", kPrivate, "<forward_list>", kPublic },
{ "<bits/fs_dir.h>", kPrivate, "<filesystem>", kPublic },
{ "<bits/fs_fwd.h>", kPrivate, "<filesystem>", kPublic },
{ "<bits/fs_ops.h>", kPrivate, "<filesystem>", kPublic },
{ "<bits/fs_path.h>", kPrivate, "<filesystem>", kPublic },
{ "<bits/fstream.tcc>", kPrivate, "<fstream>", kPublic },
{ "<bits/functexcept.h>", kPrivate, "<exception>", kPublic },
{ "<bits/functional_hash.h>", kPrivate, "<functional>", kPublic },
{ "<bits/gslice_array.h>", kPrivate, "<valarray>", kPublic },
{ "<bits/gslice.h>", kPrivate, "<valarray>", kPublic },
{ "<bits/hash_bytes.h>", kPrivate, "<functional>", kPublic },
{ "<bits/indirect_array.h>", kPrivate, "<valarray>", kPublic },
{ "<bits/int_limits.h>", kPrivate, "<limits>", kPublic },
{ "<bits/invoke.h>", kPrivate, "<functional>", kPublic },
{ "<bits/ios_base.h>", kPrivate, "<ios>", kPublic },
{ "<bits/istream.tcc>", kPrivate, "<istream>", kPublic },
{ "<bits/iterator_concepts.h>", kPrivate, "<iterator>", kPublic },
{ "<bits/list.tcc>", kPrivate, "<list>", kPublic },
{ "<bits/locale_classes.h>", kPrivate, "<locale>", kPublic },
{ "<bits/locale_classes.tcc>", kPrivate, "<locale>", kPublic },
{ "<bits/locale_conv.h>", kPrivate, "<locale>", kPublic },
{ "<bits/locale_facets.h>", kPrivate, "<locale>", kPublic },
{ "<bits/locale_facets_nonio.h>", kPrivate, "<locale>", kPublic },
{ "<bits/locale_facets_nonio.tcc>", kPrivate, "<locale>", kPublic },
{ "<bits/locale_facets.tcc>", kPrivate, "<locale>", kPublic },
{ "<bits/localefwd.h>", kPrivate, "<locale>", kPublic },
{ "<bits/mask_array.h>", kPrivate, "<valarray>", kPublic },
{ "<bits/memoryfwd.h>", kPrivate, "<memory>", kPublic },
{ "<bits/move.h>", kPrivate, "<utility>", kPublic },
{ "<bits/nested_exception.h>", kPrivate, "<exception>", kPublic },
{ "<bits/ostream_insert.h>", kPrivate, "<ostream>", kPublic },
{ "<bits/ostream.tcc>", kPrivate, "<ostream>", kPublic },
{ "<bits/parse_numbers.h>", kPrivate, "<chrono>", kPublic },
{ "<bits/postypes.h>", kPrivate, "<iosfwd>", kPublic },
{ "<bits/predefined_ops.h>", kPrivate, "<algorithm>", kPublic },
{ "<bits/ptr_traits.h>", kPrivate, "<memory>", kPublic },
{ "<bits/quoted_string.h>", kPrivate, "<iomanip>", kPublic },
{ "<bits/random.h>", kPrivate, "<random>", kPublic },
{ "<bits/random.tcc>", kPrivate, "<random>", kPublic },
{ "<bits/range_access.h>", kPrivate, "<iterator>", kPublic },
{ "<bits/range_cmp.h>", kPrivate, "<functional>", kPublic },
{ "<bits/ranges_algobase.h>", kPrivate, "<algorithm>", kPublic },
{ "<bits/ranges_algo.h>", kPrivate, "<algorithm>", kPublic },
{ "<bits/ranges_uninitialized.h>", kPrivate, "<memory>", kPublic },
{ "<bits/refwrap.h>", kPrivate, "<functional>", kPublic },
{ "<bits/regex_automaton.h>", kPrivate, "<regex>", kPublic },
{ "<bits/regex_automaton.tcc>", kPrivate, "<regex>", kPublic },
{ "<bits/regex_compiler.h>", kPrivate, "<regex>", kPublic },
{ "<bits/regex_compiler.tcc>", kPrivate, "<regex>", kPublic },
{ "<bits/regex_constants.h>", kPrivate, "<regex>", kPublic },
{ "<bits/regex_error.h>", kPrivate, "<regex>", kPublic },
{ "<bits/regex_executor.h>", kPrivate, "<regex>", kPublic },
{ "<bits/regex_executor.tcc>", kPrivate, "<regex>", kPublic },
{ "<bits/regex.h>", kPrivate, "<regex>", kPublic },
{ "<bits/regex_scanner.h>", kPrivate, "<regex>", kPublic },
{ "<bits/regex_scanner.tcc>", kPrivate, "<regex>", kPublic },
{ "<bits/regex.tcc>", kPrivate, "<regex>", kPublic },
{ "<bits/shared_ptr_atomic.h>", kPrivate, "<memory>", kPublic },
{ "<bits/shared_ptr_base.h>", kPrivate, "<memory>", kPublic },
{ "<bits/shared_ptr.h>", kPrivate, "<memory>", kPublic },
{ "<bits/slice_array.h>", kPrivate, "<valarray>", kPublic },
{ "<bits/specfun.h>", kPrivate, "<cmath>", kPublic },
{ "<bits/sstream.tcc>", kPrivate, "<sstream>", kPublic },
{ "<bits/std_function.h>", kPrivate, "<functional>", kPublic },
{ "<bits/std_mutex.h>", kPrivate, "<mutex>", kPublic },
{ "<bits/stl_algobase.h>", kPrivate, "<algorithm>", kPublic },
{ "<bits/stl_algo.h>", kPrivate, "<algorithm>", kPublic },
{ "<bits/stl_bvector.h>", kPrivate, "<vector>", kPublic },
{ "<bits/stl_construct.h>", kPrivate, "<memory>", kPublic },
{ "<bits/stl_deque.h>", kPrivate, "<deque>", kPublic },
{ "<bits/stl_function.h>", kPrivate, "<functional>", kPublic },
{ "<bits/stl_heap.h>", kPrivate, "<queue>", kPublic },
{ "<bits/stl_iterator_base_funcs.h>", kPrivate, "<iterator>", kPublic },
{ "<bits/stl_iterator_base_types.h>", kPrivate, "<iterator>", kPublic },
{ "<bits/stl_iterator.h>", kPrivate, "<iterator>", kPublic },
{ "<bits/stl_list.h>", kPrivate, "<list>", kPublic },
{ "<bits/stl_map.h>", kPrivate, "<map>", kPublic },
{ "<bits/stl_multimap.h>", kPrivate, "<map>", kPublic },
{ "<bits/stl_multiset.h>", kPrivate, "<set>", kPublic },
{ "<bits/stl_numeric.h>", kPrivate, "<numeric>", kPublic },
{ "<bits/stl_pair.h>", kPrivate, "<utility>", kPublic },
{ "<bits/stl_queue.h>", kPrivate, "<queue>", kPublic },
{ "<bits/stl_raw_storage_iter.h>", kPrivate, "<memory>", kPublic },
{ "<bits/stl_relops.h>", kPrivate, "<utility>", kPublic },
{ "<bits/stl_set.h>", kPrivate, "<set>", kPublic },
{ "<bits/stl_stack.h>", kPrivate, "<stack>", kPublic },
{ "<bits/stl_tempbuf.h>", kPrivate, "<memory>", kPublic },
{ "<bits/stl_uninitialized.h>", kPrivate, "<memory>", kPublic },
{ "<bits/stl_vector.h>", kPrivate, "<vector>", kPublic },
{ "<bits/streambuf_iterator.h>", kPrivate, "<iterator>", kPublic },
{ "<bits/streambuf.tcc>", kPrivate, "<streambuf>", kPublic },
{ "<bits/stream_iterator.h>", kPrivate, "<iterator>", kPublic },
{ "<bits/stringfwd.h>", kPrivate, "<string>", kPublic },
{ "<bits/string_view.tcc>", kPrivate, "<string_view>", kPublic },
{ "<bits/uniform_int_dist.h>", kPrivate, "<random>", kPublic },
{ "<bits/unique_lock.h>", kPrivate, "<mutex>", kPublic },
{ "<bits/unique_ptr.h>", kPrivate, "<memory>", kPublic },
{ "<bits/unordered_map.h>", kPrivate, "<unordered_map>", kPublic },
{ "<bits/unordered_set.h>", kPrivate, "<unordered_set>", kPublic },
{ "<bits/utility.h>", kPrivate, "<utility>", kPublic },
{ "<bits/valarray_after.h>", kPrivate, "<valarray>", kPublic },
{ "<bits/valarray_array.h>", kPrivate, "<valarray>", kPublic },
{ "<bits/valarray_array.tcc>", kPrivate, "<valarray>", kPublic },
{ "<bits/valarray_before.h>", kPrivate, "<valarray>", kPublic },
{ "<bits/vector.tcc>", kPrivate, "<vector>", kPublic },
{ "<decimal/decimal.h>", kPrivate, "<decimal>", kPublic },
{ "<experimental/bits/fs_dir.h>", kPrivate, "<experimental/filesystem>", kPublic },
{ "<experimental/bits/fs_fwd.h>", kPrivate, "<experimental/filesystem>", kPublic },
{ "<experimental/bits/fs_ops.h>", kPrivate, "<experimental/filesystem>", kPublic },
{ "<experimental/bits/fs_path.h>", kPrivate, "<experimental/filesystem>", kPublic },
{ "<experimental/bits/net.h>", kPrivate, "<experimental/net>", kPublic },
{ "<experimental/bits/shared_ptr.h>", kPrivate, "<experimental/memory>", kPublic },
{ "<experimental/bits/string_view.tcc>", kPrivate, "<experimental/string_view>", kPublic },
{ "<ext/cast.h>", kPrivate, "<ext/pointer.h>", kPublic },
{ "<ext/random.tcc>", kPrivate, "<ext/random>", kPublic },
{ "<ext/rc_string_base.h>", kPrivate, "<ext/vstring.h>", kPublic },
{ "<ext/ropeimpl.h>", kPrivate, "<ext/rope>", kPublic },
{ "<ext/sso_string_base.h>", kPrivate, "<ext/vstring.h>", kPublic },
{ "<ext/vstring_fwd.h>", kPrivate, "<ext/vstring.h>", kPublic },
{ "<ext/vstring.tcc>", kPrivate, "<ext/vstring.h>", kPublic },
{ "<ext/vstring_util.h>", kPrivate, "<ext/vstring.h>", kPublic },
{ "<tr1/bessel_function.tcc>", kPrivate, "<tr1/cmath>", kPublic },
{ "<tr1/beta_function.tcc>", kPrivate, "<tr1/cmath>", kPublic },
{ "<tr1/ell_integral.tcc>", kPrivate, "<tr1/cmath>", kPublic },
{ "<tr1/exp_integral.tcc>", kPrivate, "<tr1/cmath>", kPublic },
{ "<tr1/functional_hash.h>", kPrivate, "<tr1/functional>", kPublic },
{ "<tr1/gamma.tcc>", kPrivate, "<tr1/cmath>", kPublic },
{ "<tr1/hypergeometric.tcc>", kPrivate, "<tr1/cmath>", kPublic },
{ "<tr1/legendre_function.tcc>", kPrivate, "<tr1/cmath>", kPublic },
{ "<tr1/modified_bessel_func.tcc>", kPrivate, "<tr1/cmath>", kPublic },
{ "<tr1/poly_hermite.tcc>", kPrivate, "<tr1/cmath>", kPublic },
{ "<tr1/poly_laguerre.tcc>", kPrivate, "<tr1/cmath>", kPublic },
{ "<tr1/random.h>", kPrivate, "<tr1/random>", kPublic },
{ "<tr1/random.tcc>", kPrivate, "<tr1/random>", kPublic },
{ "<tr1/riemann_zeta.tcc>", kPrivate, "<tr1/cmath>", kPublic },
{ "<tr1/shared_ptr.h>", kPrivate, "<tr1/memory>", kPublic },
{ "<tr1/special_function_util.h>", kPrivate, "<tr1/cmath>", kPublic },
{ "<tr1/unordered_map.h>", kPrivate, "<tr1/unordered_map>", kPublic },
{ "<tr1/unordered_set.h>", kPrivate, "<tr1/unordered_set>", kPublic },
{ "<tr2/dynamic_bitset.tcc>", kPrivate, "<tr2/dynamic_bitset>", kPublic },
// cd /usr/include/x86_64-linux-gnu/c++/10 && grep -r headername | perl -nle 'm/^([^:]+).*@headername\{([^,]*)\}/ && print qq@ { "<$1>", kPrivate, "<$2>", kPublic },@' | sort -u
{ "<bits/basic_file.h>", kPrivate, "<ios>", kPublic },
{ "<bits/c++allocator.h>", kPrivate, "<memory>", kPublic },
{ "<bits/c++config.h>", kPrivate, "<iosfwd>", kPublic },
{ "<bits/c++config.h>", kPrivate, "<version>", kPublic },
{ "<bits/c++io.h>", kPrivate, "<ios>", kPublic },
{ "<bits/c++locale.h>", kPrivate, "<locale>", kPublic },
{ "<bits/cpu_defines.h>", kPrivate, "<iosfwd>", kPublic },
{ "<bits/ctype_base.h>", kPrivate, "<locale>", kPublic },
{ "<bits/ctype_inline.h>", kPrivate, "<locale>", kPublic },
{ "<bits/cxxabi_tweaks.h>", kPrivate, "<cxxabi.h>", kPublic },
{ "<bits/error_constants.h>", kPrivate, "<system_error>", kPublic },
{ "<bits/messages_members.h>", kPrivate, "<locale>", kPublic },
{ "<bits/opt_random.h>", kPrivate, "<random>", kPublic },
{ "<bits/os_defines.h>", kPrivate, "<iosfwd>", kPublic },
{ "<bits/time_members.h>", kPrivate, "<locale>", kPublic },
{ "<ext/opt_random.h>", kPrivate, "<ext/random>", kPublic },
// ( cd /usr/crosstool/v12/gcc-4.3.1-glibc-2.3.6-grte/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/include/c++/4.3.1 && grep '^ *# *include' {ext/,tr1/,}* | perl -nle 'm/^([^:]+).*<([^>]+)>/ && print qq@ { "<$2>", kPrivate, "<$1>", kPublic },@' | grep -e bits/ -e tr1_impl/ | sort -u)
// I removed a lot of 'meaningless' dependencies -- for instance,
// <functional> #includes <bits/stringfwd.h>, but if someone is
// using strings, <functional> isn't enough to satisfy iwyu.
// We may need to add other dirs in future versions of gcc.
{ "<bits/atomic_word.h>", kPrivate, "<ext/atomicity.h>", kPublic },
{ "<bits/basic_file.h>", kPrivate, "<fstream>", kPublic },
{ "<bits/boost_sp_shared_count.h>", kPrivate, "<memory>", kPublic },
{ "<bits/c++io.h>", kPrivate, "<ext/stdio_sync_filebuf.h>", kPublic },
{ "<bits/c++config.h>", kPrivate, "<cstddef>", kPublic },
{ "<bits/cmath.tcc>", kPrivate, "<cmath>", kPublic },
{ "<bits/codecvt.h>", kPrivate, "<fstream>", kPublic },
{ "<bits/cxxabi_tweaks.h>", kPrivate, "<cxxabi.h>", kPublic },
{ "<bits/functional_hash.h>", kPrivate, "<unordered_map>", kPublic },
{ "<bits/hashtable.h>", kPrivate, "<unordered_map>", kPublic },
{ "<bits/hashtable.h>", kPrivate, "<unordered_set>", kPublic },
{ "<bits/ios_base.h>", kPrivate, "<iostream>", kPublic },
{ "<bits/ios_base.h>", kPrivate, "<iomanip>", kPublic },
{ "<bits/postypes.h>", kPrivate, "<iostream>", kPublic },
{ "<bits/stl_pair.h>", kPrivate, "<tr1/utility>", kPublic },
{ "<bits/stl_tree.h>", kPrivate, "<map>", kPublic },
{ "<bits/stl_tree.h>", kPrivate, "<set>", kPublic },
{ "<tr1_impl/array>", kPrivate, "<array>", kPublic },
{ "<tr1_impl/array>", kPrivate, "<tr1/array>", kPublic },
{ "<tr1_impl/boost_shared_ptr.h>", kPrivate, "<memory>", kPublic },
{ "<tr1_impl/boost_shared_ptr.h>", kPrivate, "<tr1/memory>", kPublic },
{ "<tr1_impl/boost_sp_counted_base.h>", kPrivate, "<memory>", kPublic },
{ "<tr1_impl/boost_sp_counted_base.h>", kPrivate, "<tr1/memory>", kPublic },
{ "<tr1_impl/cctype>", kPrivate, "<cctype>", kPublic },
{ "<tr1_impl/cctype>", kPrivate, "<tr1/cctype>", kPublic },
{ "<tr1_impl/cfenv>", kPrivate, "<cfenv>", kPublic },
{ "<tr1_impl/cfenv>", kPrivate, "<tr1/cfenv>", kPublic },
{ "<tr1_impl/cinttypes>", kPrivate, "<cinttypes>", kPublic },
{ "<tr1_impl/cinttypes>", kPrivate, "<tr1/cinttypes>", kPublic },
{ "<tr1_impl/cmath>", kPrivate, "<cmath>", kPublic },
{ "<tr1_impl/cmath>", kPrivate, "<tr1/cmath>", kPublic },
{ "<tr1_impl/complex>", kPrivate, "<complex>", kPublic },
{ "<tr1_impl/complex>", kPrivate, "<tr1/complex>", kPublic },
{ "<tr1_impl/cstdint>", kPrivate, "<cstdint>", kPublic },
{ "<tr1_impl/cstdint>", kPrivate, "<tr1/cstdint>", kPublic },
{ "<tr1_impl/cstdio>", kPrivate, "<cstdio>", kPublic },
{ "<tr1_impl/cstdio>", kPrivate, "<tr1/cstdio>", kPublic },
{ "<tr1_impl/cstdlib>", kPrivate, "<cstdlib>", kPublic },
{ "<tr1_impl/cstdlib>", kPrivate, "<tr1/cstdlib>", kPublic },
{ "<tr1_impl/cwchar>", kPrivate, "<cwchar>", kPublic },
{ "<tr1_impl/cwchar>", kPrivate, "<tr1/cwchar>", kPublic },
{ "<tr1_impl/cwctype>", kPrivate, "<cwctype>", kPublic },
{ "<tr1_impl/cwctype>", kPrivate, "<tr1/cwctype>", kPublic },
{ "<tr1_impl/functional>", kPrivate, "<functional>", kPublic },
{ "<tr1_impl/functional>", kPrivate, "<tr1/functional>", kPublic },
{ "<tr1_impl/random>", kPrivate, "<random>", kPublic },
{ "<tr1_impl/random>", kPrivate, "<tr1/random>", kPublic },
{ "<tr1_impl/regex>", kPrivate, "<regex>", kPublic },
{ "<tr1_impl/regex>", kPrivate, "<tr1/regex>", kPublic },
{ "<tr1_impl/type_traits>", kPrivate, "<tr1/type_traits>", kPublic },
{ "<tr1_impl/type_traits>", kPrivate, "<type_traits>", kPublic },
{ "<tr1_impl/unordered_map>", kPrivate, "<tr1/unordered_map>", kPublic },
{ "<tr1_impl/unordered_map>", kPrivate, "<unordered_map>", kPublic },
{ "<tr1_impl/unordered_set>", kPrivate, "<tr1/unordered_set>", kPublic },
{ "<tr1_impl/unordered_set>", kPrivate, "<unordered_set>", kPublic },
{ "<tr1_impl/utility>", kPrivate, "<tr1/utility>", kPublic },
{ "<tr1_impl/utility>", kPrivate, "<utility>", kPublic },
// Hash and hashtable-based containers.
{ "<tr1_impl/functional_hash.h>", kPrivate, "<tr1/functional>", kPublic },
{ "<tr1_impl/functional_hash.h>", kPrivate, "<tr1/unordered_map>", kPublic },
{ "<tr1_impl/functional_hash.h>", kPrivate, "<tr1/unordered_set>", kPublic },
{ "<tr1/functional_hash.h>", kPrivate, "<tr1/unordered_map>", kPublic },
{ "<tr1/functional_hash.h>", kPrivate, "<tr1/unordered_set>", kPublic },
{ "<tr1_impl/hashtable>", kPrivate, "<tr1/unordered_map>", kPublic },
{ "<tr1_impl/hashtable>", kPrivate, "<tr1/unordered_set>", kPublic },
{ "<tr1/hashtable.h>", kPrivate, "<tr1/unordered_map>", kPublic },
{ "<tr1/hashtable.h>", kPrivate, "<tr1/unordered_set>", kPublic },
// All .tcc files are gcc internal-include files. We get them from
// ( cd /usr/crosstool/v12/gcc-4.3.1-glibc-2.3.6-grte/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/include/c++/4.3.1 && grep -R '^ *# *include.*tcc' * | perl -nle 'm/^([^:]+).*[<"]([^>"]+)[>"]/ && print qq@ { "<$2>", kPrivate, "<$1>", kPublic },@' | sort )
// I had to manually edit some of the entries to say the map-to is private.
{ "<bits/cmath.tcc>", kPrivate, "<cmath>", kPublic },
{ "<debug/safe_iterator.tcc>", kPrivate, "<debug/safe_iterator.h>", kPublic },
{ "<tr1_impl/random.tcc>", kPrivate, "<tr1_impl/random>", kPrivate },
// Some bits->bits #includes: A few files in bits re-export
// symbols from other files in bits.
// ( cd /usr/crosstool/v12/gcc-4.3.1-glibc-2.3.6-grte/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/include/c++/4.3.1 && grep '^ *# *include.*bits/' bits/* | perl -nle 'm/^([^:]+).*<([^>]+)>/ && print qq@ { "<$2>", kPrivate, "<$1>", kPrivate },@' | grep bits/ | sort -u)
// and carefully picked reasonable-looking results (algorithm
// *uses* pair but doesn't *re-export* pair, for instance).
{ "<bits/c++allocator.h>", kPrivate, "<bits/allocator.h>", kPrivate },
{ "<bits/ctype_base.h>", kPrivate, "<bits/locale_facets.h>", kPrivate },
{ "<bits/ctype_inline.h>", kPrivate, "<bits/locale_facets.h>", kPrivate },
{ "<bits/messages_members.h>", kPrivate,
"<bits/locale_facets_nonio.h>", kPrivate },
{ "<bits/stl_move.h>", kPrivate, "<bits/stl_algobase.h>", kPrivate },
// I don't think we want to be having people move to 'backward/'
// yet. (These hold deprecated STL classes that we still use
// actively.) These are the ones that turned up in an analysis of
{ "<backward/hash_fun.h>", kPrivate, "<hash_map>", kPublic },