summaryrefslogtreecommitdiff
path: root/Utilities/IWYU/mapping.imp
blob: 64436325114a11ed3e4ab6b1e0a732c5be1d196a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
[
  # C++ alternatives to C standard headers
  { 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: [ "<float.h>", public, "<cfloat>", 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: [ "<stdarg.h>", public, "<cstdarg>", public ] },
  { include: [ "<stddef.h>", public, "<cstddef>", public ] },
  { include: [ "<stdio.h>", public, "<cstdio>", public ] },
  { include: [ "<stdlib.h>", public, "<cstdlib>", public ] },
  { include: [ "<string.h>", public, "<cstring>", public ] },
  { include: [ "<time.h>", public, "<ctime>", public ] },
  { include: [ "<wchar.h>", public, "<cwchar>", public ] },
  { include: [ "<wctype.h>", public, "<cwctype>", public ] },

  # HACK: check whether this can be removed with next iwyu release.
  { include: [ "<bits/cxxabi_forced.h>", private, "<ctime>", public ] },
  { include: [ "<bits/shared_ptr.h>", private, "<memory>", public ] },
  { include: [ "<bits/std_function.h>", private, "<functional>", public ] },
  { include: [ "<bits/refwrap.h>", private, "<functional>", public ] },
  { include: [ "<bits/std_abs.h>", private, "<stdlib.h>", public ] },
  { include: [ "<bits/stdint-intn.h>", private, "<stdint.h>", public ] },
  { include: [ "<bits/stdint-uintn.h>", private, "<stdint.h>", public ] },
  { include: [ "<bits/string_view.tcc>", private, "<string_view>", private ] },
  { include: [ "<bits/time.h>", private, "<time.h>", public ] },
  { include: [ "<bits/types/clock_t.h>", private, "<time.h>", public ] },
  { include: [ "<bits/types/mbstate_t.h>", private, "<wchar.h>", public ] },
  { include: [ "<bits/types/struct_timespec.h>", private, "<time.h>", public ] },
  { include: [ "<bits/types/struct_timeval.h>", private, "<time.h>", public ] },
  { include: [ "<bits/types/struct_tm.h>", private, "<time.h>", public ] },
  { include: [ "<bits/types/time_t.h>", private, "<time.h>", public ] },

  # HACK: check whether this can be removed with next iwyu release.
  { symbol: [ "__GLIBC__", private, "<stdlib.h>", public ] },
  { symbol: [ "_Noreturn", private, "<stdlib.h>", public ] },

  # HACK: iwyu wrongly thinks that including <iosfwd> is sufficient.
  { symbol: [ "std::stringstream", private, "<sstream>", public ] },
  { symbol: [ "std::istringstream", private, "<sstream>", public ] },
  { symbol: [ "std::ostringstream", private, "<sstream>", public ] },

  # HACK: iwyu suggests <ext/alloc_traits.h> and <memory> each time vector[] is used.
  # https://github.com/include-what-you-use/include-what-you-use/issues/166
  { include: [ "<ext/alloc_traits.h>", private, "<vector>", public ] },
  { symbol: [ "std::allocator_traits<std::allocator<cmFileLock> >::value_type", private, "<vector>", public ] },
  { symbol: [ "std::allocator_traits<std::allocator<cmFileLockPool::ScopePool> >::value_type", private, "<vector>", public ] },
  { symbol: [ "std::allocator_traits<std::allocator<cmComputeComponentGraph::TarjanEntry> >::value_type", private, "<vector>", public ] },
  { symbol: [ "std::allocator_traits<std::allocator<cmFortranFile> >::value_type", private, "<vector>", public ] },
  { symbol: [ "std::allocator_traits<std::allocator<cmGraphEdgeList> >::value_type", private, "<vector>", public ] },
  { symbol: [ "std::allocator_traits<std::allocator<cmOrderDirectories::ConflictList> >::value_type", private, "<vector>", public ] },
  { symbol: [ "std::allocator_traits<std::allocator<cmStateSnapshot> >::value_type", private, "<vector>", public ] },
  { symbol: [ "std::allocator_traits<std::allocator<std::basic_string<char> > >::value_type", private, "<vector>", public ] },
  { symbol: [ "std::allocator_traits<std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::value_type", private, "<vector>", public ] },
  { symbol: [ "std::allocator_traits<std::allocator<std::vector<std::basic_string<char>, std::allocator<std::basic_string<char> > > > >::value_type", private, "<vector>", public ] },
  { symbol: [ "std::allocator_traits<std::allocator<std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > >::value_type", private, "<vector>", public ] },
  { symbol: [ "std::allocator_traits<std::allocator<uv_stdio_container_s> >::value_type", private, "<vector>", public ] },

  # TODO: enable this block and remove some <utility> includes?
  #{ symbol: [ "std::pair", private, "<utility>", public ] },
  #{ symbol: [ "std::pair", private, "<map>", public ] },
  #{ symbol: [ "std::pair", private, "<set>", public ] },

  # HACK: iwyu wrongly thinks that <system_error> is needed for std::hash
  { symbol: [ "std::hash", private, "<functional>", public ] },

  # HACK: iwyu thinks we use a libstdc++ private type
  { symbol: [ "__gnu_cxx::size_t", private, "<cstddef>", public ] },

  # __decay_and_strip is used internally in the C++11 standard library.
  # IWYU does not classify it as internal and suggests to add <type_traits>.
  # To ignore it, we simply map it to a file that is included anyway.
  # Use 'CMake_IWYU_VERBOSE' to see the fully qualified names that need this.
  # TODO: Can this be simplified with an @-expression?
  #{ symbol: [ "@std::__decay_and_strip<.*>::__type", private, "\"cmConfigure.h\"", public ] },
  { symbol: [ "std::__decay_and_strip<int>::__type", private, "\"cmConfigure.h\"", public ] },
  { symbol: [ "std::__decay_and_strip<bool>::__type", private, "\"cmConfigure.h\"", public ] },
  { symbol: [ "std::__decay_and_strip<char const (&)[1]>::__type", private, "\"cmConfigure.h\"", public ] },
  { symbol: [ "std::__decay_and_strip<cmCommand *&>::__type", private, "\"cmConfigure.h\"", public ] },
  { symbol: [ "std::__decay_and_strip<cmGeneratorTarget *&>::__type", private, "\"cmConfigure.h\"", public ] },
  { symbol: [ "std::__decay_and_strip<cmFindCommon::PathLabel &>::__type", private, "\"cmConfigure.h\"", public ] },
  { symbol: [ "std::__decay_and_strip<cmSearchPath>::__type", private, "\"cmConfigure.h\"", public ] },
  { symbol: [ "std::__decay_and_strip<cm::string_view>::__type", private, "\"cmConfigure.h\"", public ] },
  { symbol: [ "std::__decay_and_strip<std::basic_string<char> &>::__type", private, "\"cmConfigure.h\"", public ] },
  { symbol: [ "std::__decay_and_strip<const std::basic_string<char> &>::__type", private, "\"cmConfigure.h\"", public ] },
  { symbol: [ "std::__decay_and_strip<cmFindPackageCommand::PathLabel &>::__type", private, "\"cmConfigure.h\"", public ] },
  { symbol: [ "std::__decay_and_strip<cmGlobalNinjaGenerator::TargetAlias &>::__type", private, "\"cmConfigure.h\"", public ] },
  { symbol: [ "std::__decay_and_strip<__gnu_cxx::__normal_iterator<const cmCTestTestHandler::cmCTestTestProperties *, std::vector<cmCTestTestHandler::cmCTestTestProperties, std::allocator<cmCTestTestHandler::cmCTestTestProperties> > > &>::__type", private, "\"cmConfigure.h\"", public ] },
  { symbol: [ "std::__decay_and_strip<const __gnu_cxx::__normal_iterator<std::pair<cm::string_view, std::function<void (ArgumentParser::Instance &)> > *, std::vector<std::pair<cm::string_view, std::function<void (ArgumentParser::Instance &)> >, std::allocator<std::pair<cm::string_view, std::function<void (ArgumentParser::Instance &)> > > > > &>::__type", private, "\"cmConfigure.h\"", public ] },
  { symbol: [ "std::__success_type<std::chrono::duration<double, std::ratio<1, 1> > >::type", private, "\"cmConfigure.h\"", public ] },
  { symbol: [ "std::__success_type<std::chrono::duration<long, std::ratio<1, 1000000000> > >::type", private, "\"cmConfigure.h\"", public ] },
  { symbol: [ "std::enable_if<true, std::chrono::duration<long, std::ratio<1, 1> > >::type", private, "\"cmConfigure.h\"", public ] },
  { symbol: [ "std::enable_if<true, std::chrono::duration<long, std::ratio<60, 1> > >::type", private, "\"cmConfigure.h\"", public ] },
  { symbol: [ "std::enable_if<true, std::chrono::duration<long, std::ratio<1, 1000> > >::type", private, "\"cmConfigure.h\"", public ] },
  { symbol: [ "__gnu_cxx::__enable_if<true, bool>::__type", private, "\"cmConfigure.h\"", public ] },
  { symbol: [ "std::remove_reference<Defer &>::type", private, "\"cmConfigure.h\"", public ] },

  # Wrappers for 3rd-party libraries
  { include: [ "@<.*curl/curlver.h>", private, "<cm3p/curl/curl.h>", public ] },
  { include: [ "@<.*curl/system.h>", private, "<cm3p/curl/curl.h>", public ] },
  { include: [ "@<.*json/config.h>", private, "<cm3p/json/value.h>", public ] },
  { include: [ "@<.*json/forwards.h>", private, "<cm3p/json/value.h>", public ] },
  { include: [ "@<.*uv/.+\\.h>", private, "<cm3p/uv.h>", public ] },
  { include: [ "@<.*expat_external.h>", private, "<cm3p/expat.h>", public ] },
  { include: [ "@<.*zconf.h>", private, "<cm3p/zlib.h>", public ] },
  { include: [ "@<.*cm_zlib_mangle.h>", private, "<cm3p/zlib.h>", public ] },
  # # System symbols used by libuv
  { symbol: [ "ssize_t", private, "<cm3p/uv.h>", public ] },

  { symbol: [ "std::ifstream", private, "\"cmsys/FStream.hxx\"", public ] },
  { symbol: [ "std::ofstream", private, "\"cmsys/FStream.hxx\"", public ] },
  { symbol: [ "cmsys::ifstream", private, "\"cmsys/FStream.hxx\"", public ] },
  { symbol: [ "cmsys::ofstream", private, "\"cmsys/FStream.hxx\"", public ] },

  { include: [ "<istream>", public, "\"cmsys/FStream.hxx\"", public ] },
  { include: [ "<ostream>", public, "\"cmsys/FStream.hxx\"", public ] },
  { include: [ "<fstream>", public, "\"cmsys/FStream.hxx\"", public ] },

  { include: [ "<filesystem>", private, "<cm/filesystem>", public ] },
  { include: [ "<optional>", private, "<cm/optional>", public ] },
  { include: [ "<shared_mutex>", private, "<cm/shared_mutex>", public ] },
  { include: [ "<string_view>", private, "<cm/string_view>", public ] },

  # major and minor are used as macro arguments. Those are false matches.
  { symbol: [ "major", private, "\"cmVersion.h\"", public ] },
  { symbol: [ "minor", private, "\"cmVersion.h\"", public ] },

  { include: [ "<curses.h>", private, "\"cmCursesStandardIncludes.h\"", public ] },
  { include: [ "\"form.h\"", private, "\"cmCursesStandardIncludes.h\"", public ] },
  { include: [ "<form.h>", private, "\"cmCursesStandardIncludes.h\"", public ] },

  # Help IWYU understand our explicit instantiation for cmConstStack.
  { symbol: [ "cmConstStack::cmConstStack<T, Stack>", private, "\"cmConstStack.h\"", public ] },
]

# vim: set ft=toml: