-
Notifications
You must be signed in to change notification settings - Fork 32
/
iwyu.imp
671 lines (658 loc) · 44 KB
/
iwyu.imp
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
[
############################################################################
# Mappings for GNU libc
# ( cd /usr/include && grep '^ *# *include' {sys/,net/,}* | perl -nle 'm/^([^:]+).*<([^>]+)>/ && print qq@ { include: [ "<$2>", private, "<$1>", public ] },@' | grep bits/ | sort )
# When I saw more than one mapping for these, I typically picked
# what I thought was the "best" one.
{ include: [ "<bits/a.out.h>", private, "<a.out.h>", public ] },
{ include: [ "<bits/auxv.h>", private, "<sys/auxv.h>", public ] },
{ include: [ "<bits/byteswap.h>", private, "<byteswap.h>", public ] },
{ include: [ "<bits/cmathcalls.h>", private, "<complex.h>", public ] },
{ include: [ "<bits/confname.h>", private, "<unistd.h>", public ] },
{ include: [ "<bits/dirent.h>", private, "<dirent.h>", public ] },
{ include: [ "<bits/dlfcn.h>", private, "<dlfcn.h>", public ] },
{ include: [ "<bits/elfclass.h>", private, "<link.h>", public ] },
{ include: [ "<bits/endian.h>", private, "<endian.h>", public ] },
{ include: [ "<bits/environments.h>", private, "<unistd.h>", public ] },
{ include: [ "<bits/epoll.h>", private, "<sys/epoll.h>", public ] },
{ include: [ "<bits/errno.h>", private, "<errno.h>", public ] },
{ include: [ "<bits/error.h>", private, "<error.h>", public ] },
{ include: [ "<bits/eventfd.h>", private, "<sys/eventfd.h>", public ] },
{ include: [ "<bits/fcntl.h>", private, "<fcntl.h>", public ] },
{ include: [ "<bits/fcntl2.h>", private, "<fcntl.h>", public ] },
{ include: [ "<bits/fenv.h>", private, "<fenv.h>", public ] },
{ include: [ "<bits/fenvinline.h>", private, "<fenv.h>", public ] },
{ include: [ "<bits/huge_val.h>", private, "<math.h>", public ] },
{ include: [ "<bits/huge_valf.h>", private, "<math.h>", public ] },
{ include: [ "<bits/huge_vall.h>", private, "<math.h>", public ] },
{ include: [ "<bits/hwcap.h>", private, "<sys/auxv.h>", public ] },
{ include: [ "<bits/inf.h>", private, "<math.h>", public ] },
{ include: [ "<bits/inotify.h>", private, "<sys/inotify.h>", public ] },
{ include: [ "<bits/ioctl-types.h>", private, "<sys/ioctl.h>", public ] },
{ include: [ "<bits/ioctls.h>", private, "<sys/ioctl.h>", public ] },
{ include: [ "<bits/ipc.h>", private, "<sys/ipc.h>", public ] },
{ include: [ "<bits/ipctypes.h>", private, "<sys/ipc.h>", public ] },
{ include: [ "<bits/libio-ldbl.h>", private, "<libio.h>", public ] },
{ include: [ "<bits/link.h>", private, "<link.h>", public ] },
{ include: [ "<bits/locale.h>", private, "<locale.h>", public ] },
{ include: [ "<bits/math-finite.h>", private, "<math.h>", public ] },
{ include: [ "<bits/mathcalls.h>", private, "<math.h>", public ] },
{ include: [ "<bits/mathdef.h>", private, "<math.h>", public ] },
{ include: [ "<bits/mathinline.h>", private, "<math.h>", public ] },
{ include: [ "<bits/mman.h>", private, "<sys/mman.h>", public ] },
{ include: [ "<bits/monetary-ldbl.h>", private, "<monetary.h>", public ] },
{ include: [ "<bits/mqueue.h>", private, "<mqueue.h>", public ] },
{ include: [ "<bits/mqueue2.h>", private, "<mqueue.h>", public ] },
{ include: [ "<bits/msq.h>", private, "<sys/msg.h>", public ] },
{ include: [ "<bits/nan.h>", private, "<math.h>", public ] },
{ include: [ "<bits/netdb.h>", private, "<netdb.h>", public ] },
{ include: [ "<bits/param.h>", private, "<sys/param.h>", public ] },
{ include: [ "<bits/poll.h>", private, "<sys/poll.h>", private ] },
{ include: [ "<bits/poll2.h>", private, "<sys/poll.h>", private ] },
{ include: [ "<bits/posix1_lim.h>", private, "<limits.h>", public ] },
{ include: [ "<bits/posix2_lim.h>", private, "<limits.h>", public ] },
{ include: [ "<bits/posix_opt.h>", private, "<unistd.h>", public ] },
{ include: [ "<bits/printf-ldbl.h>", private, "<printf.h>", public ] },
{ include: [ "<bits/pthreadtypes.h>", private, "<pthread.h>", public ] },
{ include: [ "<bits/resource.h>", private, "<sys/resource.h>", public ] },
{ include: [ "<bits/sched.h>", private, "<sched.h>", public ] },
{ include: [ "<bits/select.h>", private, "<sys/select.h>", public ] },
{ include: [ "<bits/select2.h>", private, "<sys/select.h>", public ] },
{ include: [ "<bits/sem.h>", private, "<sys/sem.h>", public ] },
{ include: [ "<bits/semaphore.h>", private, "<semaphore.h>", public ] },
{ include: [ "<bits/setjmp.h>", private, "<setjmp.h>", public ] },
{ include: [ "<bits/setjmp2.h>", private, "<setjmp.h>", public ] },
{ include: [ "<bits/shm.h>", private, "<sys/shm.h>", public ] },
{ include: [ "<bits/sigaction.h>", private, "<signal.h>", public ] },
{ include: [ "<bits/sigcontext.h>", private, "<signal.h>", public ] },
{ include: [ "<bits/siginfo.h>", private, "<signal.h>", public ] },
{ include: [ "<bits/signum.h>", private, "<signal.h>", public ] },
{ include: [ "<bits/sigset.h>", private, "<signal.h>", public ] },
{ include: [ "<bits/sigstack.h>", private, "<signal.h>", public ] },
{ include: [ "<bits/sigthread.h>", private, "<signal.h>", public ] },
{ include: [ "<bits/sockaddr.h>", private, "<sys/un.h>", public ] },
{ include: [ "<bits/socket.h>", private, "<sys/socket.h>", public ] },
{ include: [ "<bits/socket2.h>", private, "<sys/socket.h>", public ] },
{ include: [ "<bits/socket_type.h>", private, "<sys/socket.h>", public ] },
{ include: [ "<bits/stab.def>", private, "<stab.h>", public ] },
{ include: [ "<bits/stat.h>", private, "<sys/stat.h>", public ] },
{ include: [ "<bits/statfs.h>", private, "<sys/statfs.h>", public ] },
{ include: [ "<bits/statvfs.h>", private, "<sys/statvfs.h>", public ] },
{ include: [ "<bits/stdio-ldbl.h>", private, "<stdio.h>", public ] },
{ include: [ "<bits/stdio-lock.h>", private, "<libio.h>", public ] },
{ include: [ "<bits/stdio.h>", private, "<stdio.h>", public ] },
{ include: [ "<bits/stdio2.h>", private, "<stdio.h>", public ] },
{ include: [ "<bits/stdio_lim.h>", private, "<stdio.h>", public ] },
{ include: [ "<bits/stdlib-bsearch.h>", private, "<stdlib.h>", public ] },
{ include: [ "<bits/stdlib-float.h>", private, "<stdlib.h>", public ] },
{ include: [ "<bits/stdlib-ldbl.h>", private, "<stdlib.h>", public ] },
{ include: [ "<bits/stdlib.h>", private, "<stdlib.h>", public ] },
{ include: [ "<bits/string.h>", private, "<string.h>", public ] },
{ include: [ "<bits/string2.h>", private, "<string.h>", public ] },
{ include: [ "<bits/string3.h>", private, "<string.h>", public ] },
{ include: [ "<bits/stropts.h>", private, "<stropts.h>", public ] },
{ include: [ "<bits/sys_errlist.h>", private, "<stdio.h>", public ] },
{ include: [ "<bits/syscall.h>", private, "<sys/syscall.h>", private ] },
{ include: [ "<bits/sysctl.h>", private, "<sys/sysctl.h>", public ] },
{ include: [ "<bits/syslog-ldbl.h>", private, "<sys/syslog.h>", private ] },
{ include: [ "<bits/syslog-path.h>", private, "<sys/syslog.h>", private ] },
{ include: [ "<bits/syslog.h>", private, "<sys/syslog.h>", private ] },
{ include: [ "<bits/termios.h>", private, "<termios.h>", public ] },
{ include: [ "<bits/time.h>", private, "<sys/time.h>", public ] },
{ include: [ "<bits/timerfd.h>", private, "<sys/timerfd.h>", public ] },
{ include: [ "<bits/timex.h>", private, "<sys/timex.h>", public ] },
{ include: [ "<bits/types.h>", private, "<sys/types.h>", public ] },
{ include: [ "<bits/uio.h>", private, "<sys/uio.h>", public ] },
{ include: [ "<bits/unistd.h>", private, "<unistd.h>", public ] },
{ include: [ "<bits/ustat.h>", private, "<sys/ustat.h>", private ] },
{ include: [ "<bits/utmp.h>", private, "<utmp.h>", public ] },
{ include: [ "<bits/utmpx.h>", private, "<utmpx.h>", public ] },
{ include: [ "<bits/utsname.h>", private, "<sys/utsname.h>", public ] },
{ include: [ "<bits/waitflags.h>", private, "<sys/wait.h>", public ] },
{ include: [ "<bits/waitstatus.h>", private, "<sys/wait.h>", public ] },
{ include: [ "<bits/wchar-ldbl.h>", private, "<wchar.h>", public ] },
{ include: [ "<bits/wchar.h>", private, "<wchar.h>", public ] },
{ include: [ "<bits/wchar2.h>", private, "<wchar.h>", public ] },
{ include: [ "<bits/wordsize.h>", private, "<limits.h>", public ] },
{ include: [ "<bits/xopen_lim.h>", private, "<limits.h>", public ] },
{ include: [ "<bits/xtitypes.h>", private, "<stropts.h>", public ] },
# 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@ { include: [ "<$1>", private, "<$2>", public ] },@' | sort )
{ include: [ "<bits/a.out.h>", private, "<a.out.h>", public ] },
{ include: [ "<bits/byteswap-16.h>", private, "<byteswap.h>", public ] },
{ include: [ "<bits/byteswap.h>", private, "<byteswap.h>", public ] },
{ include: [ "<bits/cmathcalls.h>", private, "<complex.h>", public ] },
{ include: [ "<bits/confname.h>", private, "<unistd.h>", public ] },
{ include: [ "<bits/dirent.h>", private, "<dirent.h>", public ] },
{ include: [ "<bits/dlfcn.h>", private, "<dlfcn.h>", public ] },
{ include: [ "<bits/elfclass.h>", private, "<link.h>", public ] },
{ include: [ "<bits/endian.h>", private, "<endian.h>", public ] },
{ include: [ "<bits/epoll.h>", private, "<sys/epoll.h>", public ] },
{ include: [ "<bits/eventfd.h>", private, "<sys/eventfd.h>", public ] },
{ include: [ "<bits/fcntl-linux.h>", private, "<fcntl.h>", public ] },
{ include: [ "<bits/fcntl.h>", private, "<fcntl.h>", public ] },
{ include: [ "<bits/fenv.h>", private, "<fenv.h>", public ] },
{ include: [ "<bits/huge_val.h>", private, "<math.h>", public ] },
{ include: [ "<bits/huge_valf.h>", private, "<math.h>", public ] },
{ include: [ "<bits/huge_vall.h>", private, "<math.h>", public ] },
{ include: [ "<bits/in.h>", private, "<netinet/in.h>", public ] },
{ include: [ "<bits/inf.h>", private, "<math.h>", public ] },
{ include: [ "<bits/inotify.h>", private, "<sys/inotify.h>", public ] },
{ include: [ "<bits/ioctl-types.h>", private, "<sys/ioctl.h>", public ] },
{ include: [ "<bits/ioctls.h>", private, "<sys/ioctl.h>", public ] },
{ include: [ "<bits/ipc.h>", private, "<sys/ipc.h>", public ] },
{ include: [ "<bits/ipctypes.h>", private, "<sys/ipc.h>", public ] },
{ include: [ "<bits/locale.h>", private, "<locale.h>", public ] },
{ include: [ "<bits/math-finite.h>", private, "<math.h>", public ] },
{ include: [ "<bits/mathdef.h>", private, "<math.h>", public ] },
{ include: [ "<bits/mathinline.h>", private, "<math.h>", public ] },
{ include: [ "<bits/mman-linux.h>", private, "<sys/mman.h>", public ] },
{ include: [ "<bits/mman.h>", private, "<sys/mman.h>", public ] },
{ include: [ "<bits/mqueue.h>", private, "<mqueue.h>", public ] },
{ include: [ "<bits/msq.h>", private, "<sys/msg.h>", public ] },
{ include: [ "<bits/nan.h>", private, "<math.h>", public ] },
{ include: [ "<bits/param.h>", private, "<sys/param.h>", public ] },
{ include: [ "<bits/poll.h>", private, "<sys/poll.h>", private ] },
{ include: [ "<bits/predefs.h>", private, "<features.h>", public ] },
{ include: [ "<bits/resource.h>", private, "<sys/resource.h>", public ] },
{ include: [ "<bits/select.h>", private, "<sys/select.h>", public ] },
{ include: [ "<bits/semaphore.h>", private, "<semaphore.h>", public ] },
{ include: [ "<bits/sigcontext.h>", private, "<signal.h>", public ] },
{ include: [ "<bits/signalfd.h>", private, "<sys/signalfd.h>", public ] },
{ include: [ "<bits/stdlib-float.h>", private, "<stdlib.h>", public ] },
{ include: [ "<bits/string.h>", private, "<string.h>", public ] },
{ include: [ "<bits/string2.h>", private, "<string.h>", public ] },
{ include: [ "<bits/string3.h>", private, "<string.h>", public ] },
{ include: [ "<bits/syscall.h>", private, "<sys/syscall.h>", private ] },
{ include: [ "<bits/timerfd.h>", private, "<sys/timerfd.h>", public ] },
{ include: [ "<bits/typesizes.h>", private, "<sys/types.h>", public ] },
# 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.
{ include: [ "<sys/poll.h>", private, "<poll.h>", public ] },
{ include: [ "<sys/syscall.h>", private, "<syscall.h>", public ] },
{ include: [ "<sys/syslog.h>", private, "<syslog.h>", public ] },
{ include: [ "<sys/ustat.h>", private, "<ustat.h>", public ] },
{ include: [ "<wait.h>", private, "<sys/wait.h>", public ] },
# 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
{ include: [ "<linux/errno.h>", private, "<bits/errno.h>", private ] },
{ include: [ "<asm/ioctls.h>", private, "<bits/ioctls.h>", private ] },
{ include: [ "<asm/socket.h>", private, "<bits/socket.h>", private ] },
{ include: [ "<linux/socket.h>", private, "<bits/socket.h>", private ] },
# Some asm files have 32- and 64-bit variants:
# $ ls /usr/include/asm/*_{32,64}.h
{ include: [ "<asm/posix_types_32.h>", private, "<asm/posix_types.h>", public ] },
{ include: [ "<asm/posix_types_64.h>", private, "<asm/posix_types.h>", public ] },
{ include: [ "<asm/unistd_32.h>", private, "<asm/unistd.h>", private ] },
{ include: [ "<asm/unistd_64.h>", private, "<asm/unistd.h>", private ] },
# I don't know what grep would have found these. I found them
# via user report.
{ include: [ "<asm/errno.h>", private, "<errno.h>", public ] },
{ include: [ "<asm/errno-base.h>", private, "<errno.h>", public ] },
{ include: [ "<asm/ptrace-abi.h>", private, "<asm/ptrace.h>", public ] },
{ include: [ "<asm/unistd.h>", private, "<syscall.h>", public ] },
{ include: [ "<linux/limits.h>", private, "<limits.h>", public ] }, # PATH_MAX
{ include: [ "<linux/prctl.h>", private, "<sys/prctl.h>", public ] },
{ include: [ "<sys/ucontext.h>", private, "<ucontext.h>", public ] },
############################################################################
# GCC STL headers
# ( 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@ { include: ["<$2>", private, "<$1>", public ] },@' | 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.
{ include: ["<bits/algorithmfwd.h>", private, "<algorithm>", public ] },
{ include: ["<bits/allocator.h>", private, "<memory>", public ] },
{ include: ["<bits/atomic_word.h>", private, "<ext/atomicity.h>", public ] },
{ include: ["<bits/basic_file.h>", private, "<fstream>", public ] },
{ include: ["<bits/basic_ios.h>", private, "<ios>", public ] },
{ include: ["<bits/basic_string.h>", private, "<string>", public ] },
{ include: ["<bits/basic_string.tcc>", private, "<string>", public ] },
{ include: ["<bits/boost_sp_shared_count.h>", private, "<memory>", public ] },
{ include: ["<bits/c++io.h>", private, "<ext/stdio_sync_filebuf.h>", public ] },
{ include: ["<bits/c++config.h>", private, "<cstddef>", public ] },
{ include: ["<bits/char_traits.h>", private, "<string>", public ] },
{ include: ["<bits/cmath.tcc>", private, "<cmath>", public ] },
{ include: ["<bits/codecvt.h>", private, "<fstream>", public ] },
{ include: ["<bits/cxxabi_tweaks.h>", private, "<cxxabi.h>", public ] },
{ include: ["<bits/deque.tcc>", private, "<deque>", public ] },
{ include: ["<bits/fstream.tcc>", private, "<fstream>", public ] },
{ include: ["<bits/functional_hash.h>", private, "<unordered_map>", public ] },
{ include: ["<bits/gslice.h>", private, "<valarray>", public ] },
{ include: ["<bits/gslice_array.h>", private, "<valarray>", public ] },
{ include: ["<bits/hashtable.h>", private, "<unordered_map>", public ] },
{ include: ["<bits/hashtable.h>", private, "<unordered_set>", public ] },
{ include: ["<bits/indirect_array.h>", private, "<valarray>", public ] },
{ include: ["<bits/ios_base.h>", private, "<iostream>", public ] },
{ include: ["<bits/ios_base.h>", private, "<ios>", public ] },
{ include: ["<bits/ios_base.h>", private, "<iomanip>", public ] },
{ include: ["<bits/locale_classes.h>", private, "<locale>", public ] },
{ include: ["<bits/locale_facets.h>", private, "<locale>", public ] },
{ include: ["<bits/locale_facets_nonio.h>", private, "<locale>", public ] },
{ include: ["<bits/localefwd.h>", private, "<locale>", public ] },
{ include: ["<bits/mask_array.h>", private, "<valarray>", public ] },
{ include: ["<bits/ostream.tcc>", private, "<ostream>", public ] },
{ include: ["<bits/ostream_insert.h>", private, "<ostream>", public ] },
{ include: ["<bits/postypes.h>", private, "<iostream>", public ] },
{ include: ["<bits/slice_array.h>", private, "<valarray>", public ] },
{ include: ["<bits/stl_algo.h>", private, "<algorithm>", public ] },
{ include: ["<bits/stl_algobase.h>", private, "<algorithm>", public ] },
{ include: ["<bits/stl_bvector.h>", private, "<vector>", public ] },
{ include: ["<bits/stl_construct.h>", private, "<memory>", public ] },
{ include: ["<bits/stl_deque.h>", private, "<deque>", public ] },
{ include: ["<bits/stl_function.h>", private, "<functional>", public ] },
{ include: ["<bits/stl_heap.h>", private, "<queue>", public ] },
{ include: ["<bits/stl_iterator.h>", private, "<iterator>", public ] },
{ include: ["<bits/stl_iterator_base_funcs.h>", private, "<iterator>", public ] },
{ include: ["<bits/stl_iterator_base_types.h>", private, "<iterator>", public ] },
{ include: ["<bits/stl_list.h>", private, "<list>", public ] },
{ include: ["<bits/stl_map.h>", private, "<map>", public ] },
{ include: ["<bits/stl_multimap.h>", private, "<map>", public ] },
{ include: ["<bits/stl_multiset.h>", private, "<set>", public ] },
{ include: ["<bits/stl_numeric.h>", private, "<numeric>", public ] },
{ include: ["<bits/stl_pair.h>", private, "<utility>", public ] },
{ include: ["<bits/stl_pair.h>", private, "<tr1/utility>", public ] },
{ include: ["<bits/stl_queue.h>", private, "<queue>", public ] },
{ include: ["<bits/stl_raw_storage_iter.h>", private, "<memory>", public ] },
{ include: ["<bits/stl_relops.h>", private, "<utility>", public ] },
{ include: ["<bits/stl_set.h>", private, "<set>", public ] },
{ include: ["<bits/stl_stack.h>", private, "<stack>", public ] },
{ include: ["<bits/stl_tempbuf.h>", private, "<memory>", public ] },
{ include: ["<bits/stl_tree.h>", private, "<map>", public ] },
{ include: ["<bits/stl_tree.h>", private, "<set>", public ] },
{ include: ["<bits/stl_uninitialized.h>", private, "<memory>", public ] },
{ include: ["<bits/stl_vector.h>", private, "<vector>", public ] },
{ include: ["<bits/stream_iterator.h>", private, "<iterator>", public ] },
{ include: ["<bits/streambuf.tcc>", private, "<streambuf>", public ] },
{ include: ["<bits/streambuf_iterator.h>", private, "<iterator>", public ] },
{ include: ["<bits/stringfwd.h>", private, "<string>", public ] },
{ include: ["<bits/valarray_after.h>", private, "<valarray>", public ] },
{ include: ["<bits/valarray_array.h>", private, "<valarray>", public ] },
{ include: ["<bits/valarray_before.h>", private, "<valarray>", public ] },
{ include: ["<bits/vector.tcc>", private, "<vector>", public ] },
{ include: ["<tr1_impl/array>", private, "<array>", public ] },
{ include: ["<tr1_impl/array>", private, "<tr1/array>", public ] },
{ include: ["<tr1_impl/boost_shared_ptr.h>", private, "<memory>", public ] },
{ include: ["<tr1_impl/boost_shared_ptr.h>", private, "<tr1/memory>", public ] },
{ include: ["<tr1_impl/boost_sp_counted_base.h>", private, "<memory>", public ] },
{ include: ["<tr1_impl/boost_sp_counted_base.h>", private, "<tr1/memory>", public ] },
{ include: ["<tr1_impl/cctype>", private, "<cctype>", public ] },
{ include: ["<tr1_impl/cctype>", private, "<tr1/cctype>", public ] },
{ include: ["<tr1_impl/cfenv>", private, "<cfenv>", public ] },
{ include: ["<tr1_impl/cfenv>", private, "<tr1/cfenv>", public ] },
{ include: ["<tr1_impl/cinttypes>", private, "<cinttypes>", public ] },
{ include: ["<tr1_impl/cinttypes>", private, "<tr1/cinttypes>", public ] },
{ include: ["<tr1_impl/cmath>", private, "<cmath>", public ] },
{ include: ["<tr1_impl/cmath>", private, "<tr1/cmath>", public ] },
{ include: ["<tr1_impl/complex>", private, "<complex>", public ] },
{ include: ["<tr1_impl/complex>", private, "<tr1/complex>", public ] },
{ include: ["<tr1_impl/cstdint>", private, "<cstdint>", public ] },
{ include: ["<tr1_impl/cstdint>", private, "<tr1/cstdint>", public ] },
{ include: ["<tr1_impl/cstdio>", private, "<cstdio>", public ] },
{ include: ["<tr1_impl/cstdio>", private, "<tr1/cstdio>", public ] },
{ include: ["<tr1_impl/cstdlib>", private, "<cstdlib>", public ] },
{ include: ["<tr1_impl/cstdlib>", private, "<tr1/cstdlib>", public ] },
{ include: ["<tr1_impl/cwchar>", private, "<cwchar>", public ] },
{ include: ["<tr1_impl/cwchar>", private, "<tr1/cwchar>", public ] },
{ include: ["<tr1_impl/cwctype>", private, "<cwctype>", public ] },
{ include: ["<tr1_impl/cwctype>", private, "<tr1/cwctype>", public ] },
{ include: ["<tr1_impl/functional>", private, "<functional>", public ] },
{ include: ["<tr1_impl/functional>", private, "<tr1/functional>", public ] },
{ include: ["<tr1_impl/random>", private, "<random>", public ] },
{ include: ["<tr1_impl/random>", private, "<tr1/random>", public ] },
{ include: ["<tr1_impl/regex>", private, "<regex>", public ] },
{ include: ["<tr1_impl/regex>", private, "<tr1/regex>", public ] },
{ include: ["<tr1_impl/type_traits>", private, "<tr1/type_traits>", public ] },
{ include: ["<tr1_impl/type_traits>", private, "<type_traits>", public ] },
{ include: ["<tr1_impl/unordered_map>", private, "<tr1/unordered_map>", public ] },
{ include: ["<tr1_impl/unordered_map>", private, "<unordered_map>", public ] },
{ include: ["<tr1_impl/unordered_set>", private, "<tr1/unordered_set>", public ] },
{ include: ["<tr1_impl/unordered_set>", private, "<unordered_set>", public ] },
{ include: ["<tr1_impl/utility>", private, "<tr1/utility>", public ] },
{ include: ["<tr1_impl/utility>", private, "<utility>", public ] },
# This didn't come from the grep, but seems to be where swap()
# is defined?
{ include: ["<bits/move.h>", private, "<algorithm>", public ] }, # for swap<>()
# Hash and hashtable-based containers.
{ include: ["<tr1_impl/functional_hash.h>", private, "<tr1/functional>", public ] },
{ include: ["<tr1_impl/functional_hash.h>", private, "<tr1/unordered_map>", public ] },
{ include: ["<tr1_impl/functional_hash.h>", private, "<tr1/unordered_set>", public ] },
{ include: ["<tr1/functional_hash.h>", private, "<tr1/functional>", public ] },
{ include: ["<tr1/functional_hash.h>", private, "<tr1/unordered_map>", public ] },
{ include: ["<tr1/functional_hash.h>", private, "<tr1/unordered_set>", public ] },
{ include: ["<tr1_impl/hashtable>", private, "<tr1/unordered_map>", public ] },
{ include: ["<tr1_impl/hashtable>", private, "<tr1/unordered_set>", public ] },
{ include: ["<tr1/hashtable.h>", private, "<tr1/unordered_map>", public ] },
{ include: ["<tr1/hashtable.h>", private, "<tr1/unordered_set>", public ] },
# 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@ { include: ["<$2>", private, "<$1>", public ] },@' | sort )
# I had to manually edit some of the entries to say the map-to is private.
{ include: ["<bits/basic_ios.tcc>", private, "<bits/basic_ios.h>", private ] },
{ include: ["<bits/basic_string.tcc>", private, "<string>", public ] },
{ include: ["<bits/cmath.tcc>", private, "<cmath>", public ] },
{ include: ["<bits/deque.tcc>", private, "<deque>", public ] },
{ include: ["<bits/fstream.tcc>", private, "<fstream>", public ] },
{ include: ["<bits/istream.tcc>", private, "<istream>", public ] },
{ include: ["<bits/list.tcc>", private, "<list>", public ] },
{ include: ["<bits/locale_classes.tcc>", private, "<bits/locale_classes.h>", private ] },
{ include: ["<bits/locale_facets.tcc>", private, "<bits/locale_facets.h>", private ] },
{ include: ["<bits/locale_facets_nonio.tcc>", private,
"<bits/locale_facets_nonio.h>", private ] },
{ include: ["<bits/ostream.tcc>", private, "<ostream>", public ] },
{ include: ["<bits/sstream.tcc>", private, "<sstream>", public ] },
{ include: ["<bits/streambuf.tcc>", private, "<streambuf>", public ] },
{ include: ["<bits/valarray_array.tcc>", private, "<bits/valarray_array.h>", private ] },
{ include: ["<bits/vector.tcc>", private, "<vector>", public ] },
{ include: ["<debug/safe_iterator.tcc>", private, "<debug/safe_iterator.h>", public ] },
{ include: ["<tr1/bessel_function.tcc>", private, "<tr1/cmath>", public ] },
{ include: ["<tr1/beta_function.tcc>", private, "<tr1/cmath>", public ] },
{ include: ["<tr1/ell_integral.tcc>", private, "<tr1/cmath>", public ] },
{ include: ["<tr1/exp_integral.tcc>", private, "<tr1/cmath>", public ] },
{ include: ["<tr1/gamma.tcc>", private, "<tr1/cmath>", public ] },
{ include: ["<tr1/hypergeometric.tcc>", private, "<tr1/cmath>", public ] },
{ include: ["<tr1/legendre_function.tcc>", private, "<tr1/cmath>", public ] },
{ include: ["<tr1/modified_bessel_func.tcc>", private, "<tr1/cmath>", public ] },
{ include: ["<tr1/poly_hermite.tcc>", private, "<tr1/cmath>", public ] },
{ include: ["<tr1/poly_laguerre.tcc>", private, "<tr1/cmath>", public ] },
{ include: ["<tr1/riemann_zeta.tcc>", private, "<tr1/cmath>", public ] },
{ include: ["<tr1_impl/random.tcc>", private, "<tr1_impl/random>", private ] },
# 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@ { include: ["<$2>", private, "<$1>", private ] },@' | grep bits/ | sort -u)
# and carefully picked reasonable-looking results (algorithm
# *uses* pair but doesn't *re-export* pair, for instance).
{ include: ["<bits/boost_concept_check.h>", private,
"<bits/concept_check.h>", private ] },
{ include: ["<bits/c++allocator.h>", private, "<bits/allocator.h>", private ] },
{ include: ["<bits/codecvt.h>", private, "<bits/locale_facets_nonio.h>", private ] },
{ include: ["<bits/ctype_base.h>", private, "<bits/locale_facets.h>", private ] },
{ include: ["<bits/ctype_inline.h>", private, "<bits/locale_facets.h>", private ] },
{ include: ["<bits/functexcept.h>", private, "<bits/stl_algobase.h>", private ] },
{ include: ["<bits/locale_classes.h>", private, "<bits/basic_ios.h>", private ] },
{ include: ["<bits/locale_facets.h>", private, "<bits/basic_ios.h>", private ] },
{ include: ["<bits/messages_members.h>", private,
"<bits/locale_facets_nonio.h>", private ] },
{ include: ["<bits/postypes.h>", private, "<bits/char_traits.h>", private ] },
{ include: ["<bits/slice_array.h>", private, "<bits/valarray_before.h>", private ] },
{ include: ["<bits/stl_construct.h>", private, "<bits/stl_tempbuf.h>", private ] },
{ include: ["<bits/stl_move.h>", private, "<bits/stl_algobase.h>", private ] },
{ include: ["<bits/stl_uninitialized.h>", private, "<bits/stl_tempbuf.h>", private ] },
{ include: ["<bits/stl_vector.h>", private, "<bits/stl_bvector.h>", private ] },
{ include: ["<bits/streambuf_iterator.h>", private, "<bits/basic_ios.h>", private ] },
# 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
{ include: ["<backward/auto_ptr.h>", private, "<memory>", public ] },
{ include: ["<backward/binders.h>", private, "<functional>", public ] },
{ include: ["<backward/hash_fun.h>", private, "<hash_map>", public ] },
{ include: ["<backward/hash_fun.h>", private, "<hash_set>", public ] },
{ include: ["<backward/hashtable.h>", private, "<hash_map>", public ] },
{ include: ["<backward/hashtable.h>", private, "<hash_set>", public ] },
{ include: ["<backward/strstream>", private, "<strstream>", public ] },
# We have backward as part of the -I search path now, so have the
# non-backwards-prefix version as well.
{ include: ["<auto_ptr.h>", private, "<memory>", public ] },
{ include: ["<binders.h>", private, "<functional>", public ] },
{ include: ["<hash_fun.h>", private, "<hash_map>", public ] },
{ include: ["<hash_fun.h>", private, "<hash_set>", public ] },
{ include: ["<hashtable.h>", private, "<hash_map>", public ] },
{ include: ["<hashtable.h>", private, "<hash_set>", public ] },
# (This one should perhaps be found automatically somehow.)
{ include: ["<ext/sso_string_base.h>", private, "<string>", public ] },
# The iostream .h files are confusing. Lots of private headers,
# which are handled above, but we also have public headers
# #including each other (eg <iostream> //includes <istream>). We
# are pretty forgiving: if a user specifies any public header, we
# generally don't require the others.
# ( 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 && egrep '^ *# *include <(istream|ostream|iostream|fstream|sstream|streambuf|ios|iosfwd)>' *stream* ios | perl -nle 'm/^([^:]+).*[<"]([^>"]+)[>"]/ and print qq@ { include: ["<$2>", public, "<$1>", public ] },@' | sort -u )
{ include: ["<ios>", public, "<istream>", public ] },
{ include: ["<ios>", public, "<ostream>", public ] },
{ include: ["<iosfwd>", public, "<ios>", public ] },
{ include: ["<iosfwd>", public, "<streambuf>", public ] },
{ include: ["<istream>", public, "<fstream>", public ] },
{ include: ["<istream>", public, "<iostream>", public ] },
{ include: ["<istream>", public, "<sstream>", public ] },
{ include: ["<ostream>", public, "<fstream>", public ] },
{ include: ["<ostream>", public, "<iostream>", public ] },
{ include: ["<ostream>", public, "<istream>", public ] },
{ include: ["<ostream>", public, "<sstream>", public ] },
{ include: ["<streambuf>", public, "<ios>", public ] },
# The location of exception_defines.h varies by GCC version. It should
# never be included directly.
{ include: ["<bits/exception_defines.h>", private, "<exception>", public ] },
{ include: ["<exception_defines.h>", private, "<exception>", public ] },
############################################################################
# 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@ { symbol: [ "$2", public, "<$1>", public ] },@' | 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 convension
# we always set it to private.
{ symbol: [ "blksize_t", private, "<sys/types.h>", public ] },
{ symbol: [ "blkcnt_t", private, "<sys/stat.h>", public ] },
{ symbol: [ "blkcnt_t", private, "<sys/types.h>", public ] },
{ symbol: [ "blksize_t", private, "<sys/stat.h>", public ] },
{ symbol: [ "daddr_t", private, "<sys/types.h>", public ] },
{ symbol: [ "daddr_t", private, "<rpc/types.h>", public ] },
{ symbol: [ "dev_t", private, "<sys/types.h>", public ] },
{ symbol: [ "dev_t", private, "<sys/stat.h>", public ] },
{ symbol: [ "error_t", private, "<errno.h>", public ] },
{ symbol: [ "error_t", private, "<argp.h>", public ] },
{ symbol: [ "error_t", private, "<argz.h>", public ] },
{ symbol: [ "fsblkcnt_t", private, "<sys/types.h>", public ] },
{ symbol: [ "fsblkcnt_t", private, "<sys/statvfs.h>", public ] },
{ symbol: [ "fsfilcnt_t", private, "<sys/types.h>", public ] },
{ symbol: [ "fsfilcnt_t", private, "<sys/statvfs.h>", public ] },
{ symbol: [ "gid_t", private, "<sys/types.h>", public ] },
{ symbol: [ "gid_t", private, "<grp.h>", public ] },
{ symbol: [ "gid_t", private, "<pwd.h>", public ] },
{ symbol: [ "gid_t", private, "<stropts.h>", public ] },
{ symbol: [ "gid_t", private, "<sys/ipc.h>", public ] },
{ symbol: [ "gid_t", private, "<sys/stat.h>", public ] },
{ symbol: [ "gid_t", private, "<unistd.h>", public ] },
{ symbol: [ "id_t", private, "<sys/types.h>", public ] },
{ symbol: [ "id_t", private, "<sys/resource.h>", public ] },
{ symbol: [ "ino64_t", private, "<sys/types.h>", public ] },
{ symbol: [ "ino64_t", private, "<dirent.h>", public ] },
{ symbol: [ "ino_t", private, "<sys/types.h>", public ] },
{ symbol: [ "ino_t", private, "<dirent.h>", public ] },
{ symbol: [ "ino_t", private, "<sys/stat.h>", public ] },
{ symbol: [ "int8_t", private, "<sys/types.h>", public ] },
{ symbol: [ "int8_t", private, "<stdint.h>", public ] },
{ symbol: [ "intptr_t", private, "<stdint.h>", public ] },
{ symbol: [ "intptr_t", private, "<unistd.h>", public ] },
{ symbol: [ "key_t", private, "<sys/types.h>", public ] },
{ symbol: [ "key_t", private, "<sys/ipc.h>", public ] },
{ symbol: [ "mode_t", private, "<sys/types.h>", public ] },
{ symbol: [ "mode_t", private, "<sys/stat.h>", public ] },
{ symbol: [ "mode_t", private, "<sys/ipc.h>", public ] },
{ symbol: [ "mode_t", private, "<sys/mman.h>", public ] },
{ symbol: [ "nlink_t", private, "<sys/types.h>", public ] },
{ symbol: [ "nlink_t", private, "<sys/stat.h>", public ] },
{ symbol: [ "off64_t", private, "<sys/types.h>", public ] },
{ symbol: [ "off64_t", private, "<unistd.h>", public ] },
{ symbol: [ "off_t", private, "<sys/types.h>", public ] },
{ symbol: [ "off_t", private, "<unistd.h>", public ] },
{ symbol: [ "off_t", private, "<sys/stat.h>", public ] },
{ symbol: [ "off_t", private, "<sys/mman.h>", public ] },
{ symbol: [ "pid_t", private, "<sys/types.h>", public ] },
{ symbol: [ "pid_t", private, "<unistd.h>", public ] },
{ symbol: [ "pid_t", private, "<signal.h>", public ] },
{ symbol: [ "pid_t", private, "<sys/msg.h>", public ] },
{ symbol: [ "pid_t", private, "<sys/shm.h>", public ] },
{ symbol: [ "pid_t", private, "<termios.h>", public ] },
{ symbol: [ "pid_t", private, "<time.h>", public ] },
{ symbol: [ "pid_t", private, "<utmpx.h>", public ] },
{ symbol: [ "sigset_t", private, "<signal.h>", public ] },
{ symbol: [ "sigset_t", private, "<sys/epoll.h>", public ] },
{ symbol: [ "sigset_t", private, "<sys/select.h>", public ] },
{ symbol: [ "socklen_t", private, "<bits/socket.h>", private ] },
{ symbol: [ "socklen_t", private, "<unistd.h>", public ] },
{ symbol: [ "socklen_t", private, "<arpa/inet.h>", public ] },
{ symbol: [ "ssize_t", private, "<sys/types.h>", public ] },
{ symbol: [ "ssize_t", private, "<unistd.h>", public ] },
{ symbol: [ "ssize_t", private, "<monetary.h>", public ] },
{ symbol: [ "ssize_t", private, "<sys/msg.h>", public ] },
{ symbol: [ "suseconds_t", private, "<sys/types.h>", public ] },
{ symbol: [ "suseconds_t", private, "<sys/time.h>", public ] },
{ symbol: [ "suseconds_t", private, "<sys/select.h>", public ] },
{ symbol: [ "u_char", private, "<sys/types.h>", public ] },
{ symbol: [ "u_char", private, "<rpc/types.h>", public ] },
{ symbol: [ "uid_t", private, "<sys/types.h>", public ] },
{ symbol: [ "uid_t", private, "<unistd.h>", public ] },
{ symbol: [ "uid_t", private, "<pwd.h>", public ] },
{ symbol: [ "uid_t", private, "<signal.h>", public ] },
{ symbol: [ "uid_t", private, "<stropts.h>", public ] },
{ symbol: [ "uid_t", private, "<sys/ipc.h>", public ] },
{ symbol: [ "uid_t", private, "<sys/stat.h>", public ] },
{ symbol: [ "useconds_t", private, "<sys/types.h>", public ] },
{ symbol: [ "useconds_t", private, "<unistd.h>", public ] },
# glob.h seems to define size_t if necessary, but it should come from stddef.
{ symbol: [ "size_t", private, "<stddef.h>", public ] },
{ symbol: [ "size_t", private, "<stdio.h>", public ] },
{ symbol: [ "size_t", private, "<stdlib.h>", public ] },
{ symbol: [ "size_t", private, "<string.h>", public ] },
{ symbol: [ "size_t", private, "<time.h>", public ] },
{ symbol: [ "size_t", private, "<wchar.h>", public ] },
# 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.
{ symbol: [ "EOF", private, "<stdio.h>", public ] },
{ symbol: [ "EOF", private, "<libio.h>", public ] },
{ symbol: [ "va_list", private, "<stdarg.h>", public ] },
# These are symbols that could be defined in either stdlib.h or
# malloc.h, but we always want the stdlib location.
{ symbol: [ "malloc", private, "<stdlib.h>", public ] },
{ symbol: [ "calloc", private, "<stdlib.h>", public ] },
{ symbol: [ "realloc", private, "<stdlib.h>", public ] },
{ symbol: [ "free", private, "<stdlib.h>", public ] },
# Entries for NULL
{ symbol: [ "NULL", private, "<stddef.h>", public ] }, # 'canonical' location for NULL
{ symbol: [ "NULL", private, "<clocale>", public ] },
{ symbol: [ "NULL", private, "<cstddef>", public ] },
{ symbol: [ "NULL", private, "<cstdio>", public ] },
{ symbol: [ "NULL", private, "<cstdlib>", public ] },
{ symbol: [ "NULL", private, "<cstring>", public ] },
{ symbol: [ "NULL", private, "<ctime>", public ] },
{ symbol: [ "NULL", private, "<cwchar>", public ] },
{ symbol: [ "NULL", private, "<locale.h>", public ] },
{ symbol: [ "NULL", private, "<stdio.h>", public ] },
{ symbol: [ "NULL", private, "<stdlib.h>", public ] },
{ symbol: [ "NULL", private, "<string.h>", public ] },
{ symbol: [ "NULL", private, "<time.h>", public ] },
{ symbol: [ "NULL", private, "<wchar.h>", public ] },
# 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.
{ symbol: [ "std::allocator", private, "<memory>", public ] },
{ symbol: [ "std::allocator", private, "<string>", public ] },
{ symbol: [ "std::allocator", private, "<vector>", public ] },
{ symbol: [ "std::allocator", private, "<map>", public ] },
{ symbol: [ "std::allocator", private, "<set>", public ] },
# 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.
{ symbol: [ "std::char_traits", private, "<string>", public ] },
{ symbol: [ "std::char_traits", private, "<ostream>", public ] },
{ symbol: [ "std::char_traits", private, "<istream>", public ] },
############################################################################
# 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 C++14 [headers]p3. You can get them with
# $ sed -n '/begin{floattable}.*{tab:cpp.c.headers}/,/end{floattable}/p' lib-intro.tex | grep tcode | perl -nle 'm/tcode{<c(.*)>}/ && print qq@ { include: [ "<$1.h>", public, "<c$1>", public ] },@' | sort
# on https://github.com/cplusplus/draft/blob/master/source/lib-intro.tex
{ include: [ "<assert.h>", public, "<cassert>", public ] },
{ include: [ "<complex.h>", public, "<ccomplex>", public ] },
{ include: [ "<ctype.h>", public, "<cctype>", public ] },
{ include: [ "<errno.h>", public, "<cerrno>", public ] },
{ include: [ "<fenv.h>", public, "<cfenv>", public ] },
{ include: [ "<float.h>", public, "<cfloat>", public ] },
{ include: [ "<inttypes.h>", public, "<cinttypes>", public ] },
{ include: [ "<iso646.h>", public, "<ciso646>", public ] },
{ include: [ "<limits.h>", public, "<climits>", public ] },
{ include: [ "<locale.h>", public, "<clocale>", public ] },
{ include: [ "<math.h>", public, "<cmath>", public ] },
{ include: [ "<setjmp.h>", public, "<csetjmp>", public ] },
{ include: [ "<signal.h>", public, "<csignal>", public ] },
{ include: [ "<stdalign.h>", public, "<cstdalign>", public ] },
{ include: [ "<stdarg.h>", public, "<cstdarg>", public ] },
{ include: [ "<stdbool.h>", public, "<cstdbool>", public ] },
{ include: [ "<stddef.h>", public, "<cstddef>", public ] },
{ include: [ "<stdint.h>", public, "<cstdint>", public ] },
{ include: [ "<stdio.h>", public, "<cstdio>", public ] },
{ include: [ "<stdlib.h>", public, "<cstdlib>", public ] },
{ include: [ "<string.h>", public, "<cstring>", public ] },
{ include: [ "<tgmath.h>", public, "<ctgmath>", public ] },
{ include: [ "<time.h>", public, "<ctime>", public ] },
{ include: [ "<uchar.h>", public, "<cuchar>", public ] },
{ include: [ "<wchar.h>", public, "<cwchar>", public ] },
{ include: [ "<wctype.h>", public, "<cwctype>", public ] },
############################################################################
# libc++ headers
{ include: ["<__functional_base>", private, "<functional>", public ] },
{ include: ["<__mutex_base>", private, "<mutex>", public ] },
{ include: ["<__hash_table>", private, "<unordered_map>", public ] },
{ include: ["<__hash_table>", private, "<unordered_set>", public ] },
{ include: ["<__tree>", private, "<map>", public ] },
{ include: ["<__tree>", private, "<set>", public ] },
{ include: ["<__bit_reference>", private, "<vector>", public ] },
{ symbol: [ "std::move", private, "<algorithm>", public ] },
{ symbol: [ "std::string", private, "<string>", public ] },
############################################################################
# Xapian headers
{ include: ["\"xapian.h\"", private, "<xapian.h>", public] },
{ include: ["@<xapian/.*>", private, "<xapian.h>", public] },
{ include: ["@\"xapian/.*\"", private, "<xapian.h>", public] },
############################################################################
# Custom mappings
{ include: [ "<secure/_string.h>", private, "<string.h>", public ] },
{ include: [ "<_wctype.h>", private, "<wctype.h>", public ] },
{ symbol: [ "htonl", private, "<arpa/inet.h>", public ] },
{ symbol: [ "htons", private, "<arpa/inet.h>", public ] },
{ symbol: [ "ntohl", private, "<arpa/inet.h>", public ] },
{ symbol: [ "ntohs", private, "<arpa/inet.h>", public ] },
{ symbol: [ "time_t", private, "<time.h>", public ] },
{ symbol: [ "int8_t", private, "<sys/types.h>", public ] },
{ symbol: [ "uint8_t", private, "<sys/types.h>", public ] },
{ symbol: [ "int16_t", private, "<sys/types.h>", public ] },
{ symbol: [ "uint16_t", private, "<sys/types.h>", public ] },
{ symbol: [ "int32_t", private, "<sys/types.h>", public ] },
{ symbol: [ "uint32_t", private, "<sys/types.h>", public ] },
{ symbol: [ "int64_t", private, "<sys/types.h>", public ] },
{ symbol: [ "uint64_t", private, "<sys/types.h>", public ] }
]