mapping.imp 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. [
  2. # C++ alternatives to C standard headers
  3. { include: [ "<assert.h>", public, "<cassert>", public ] },
  4. { include: [ "<complex.h>", public, "<ccomplex>", public ] },
  5. { include: [ "<ctype.h>", public, "<cctype>", public ] },
  6. { include: [ "<errno.h>", public, "<cerrno>", public ] },
  7. { include: [ "<float.h>", public, "<cfloat>", public ] },
  8. { include: [ "<iso646.h>", public, "<ciso646>", public ] },
  9. { include: [ "<limits.h>", public, "<climits>", public ] },
  10. { include: [ "<locale.h>", public, "<clocale>", public ] },
  11. { include: [ "<math.h>", public, "<cmath>", public ] },
  12. { include: [ "<setjmp.h>", public, "<csetjmp>", public ] },
  13. { include: [ "<signal.h>", public, "<csignal>", public ] },
  14. { include: [ "<stdarg.h>", public, "<cstdarg>", public ] },
  15. { include: [ "<stddef.h>", public, "<cstddef>", public ] },
  16. { include: [ "<stdio.h>", public, "<cstdio>", public ] },
  17. { include: [ "<stdlib.h>", public, "<cstdlib>", public ] },
  18. { include: [ "<string.h>", public, "<cstring>", public ] },
  19. { include: [ "<time.h>", public, "<ctime>", public ] },
  20. { include: [ "<wchar.h>", public, "<cwchar>", public ] },
  21. { include: [ "<wctype.h>", public, "<cwctype>", public ] },
  22. # HACK: check whether this can be removed with next iwyu release.
  23. { include: [ "<bits/cxxabi_forced.h>", private, "<ctime>", public ] },
  24. { include: [ "<bits/shared_ptr.h>", private, "<memory>", public ] },
  25. { include: [ "<bits/std_function.h>", private, "<functional>", public ] },
  26. { include: [ "<bits/refwrap.h>", private, "<functional>", public ] },
  27. { include: [ "<bits/std_abs.h>", private, "<stdlib.h>", public ] },
  28. { include: [ "<bits/stdint-intn.h>", private, "<stdint.h>", public ] },
  29. { include: [ "<bits/stdint-uintn.h>", private, "<stdint.h>", public ] },
  30. { include: [ "<bits/string_view.tcc>", private, "<string_view>", private ] },
  31. { include: [ "<bits/time.h>", private, "<time.h>", public ] },
  32. { include: [ "<bits/types/clock_t.h>", private, "<time.h>", public ] },
  33. { include: [ "<bits/types/mbstate_t.h>", private, "<wchar.h>", public ] },
  34. { include: [ "<bits/types/struct_timespec.h>", private, "<time.h>", public ] },
  35. { include: [ "<bits/types/struct_timeval.h>", private, "<time.h>", public ] },
  36. { include: [ "<bits/types/struct_tm.h>", private, "<time.h>", public ] },
  37. { include: [ "<bits/types/time_t.h>", private, "<time.h>", public ] },
  38. # HACK: check whether this can be removed with next iwyu release.
  39. { symbol: [ "__GLIBC__", private, "<stdlib.h>", public ] },
  40. { symbol: [ "_Noreturn", private, "<stdlib.h>", public ] },
  41. # HACK: iwyu wrongly thinks that including <iosfwd> is sufficient.
  42. { symbol: [ "std::stringstream", private, "<sstream>", public ] },
  43. { symbol: [ "std::istringstream", private, "<sstream>", public ] },
  44. { symbol: [ "std::ostringstream", private, "<sstream>", public ] },
  45. # HACK: iwyu suggests <ext/alloc_traits.h> and <memory> each time vector[] is used.
  46. # https://github.com/include-what-you-use/include-what-you-use/issues/166
  47. { include: [ "<ext/alloc_traits.h>", private, "<vector>", public ] },
  48. { symbol: [ "std::allocator_traits<std::allocator<cmFileLock> >::value_type", private, "<vector>", public ] },
  49. { symbol: [ "std::allocator_traits<std::allocator<cmFileLockPool::ScopePool> >::value_type", private, "<vector>", public ] },
  50. { symbol: [ "std::allocator_traits<std::allocator<cmComputeComponentGraph::TarjanEntry> >::value_type", private, "<vector>", public ] },
  51. { symbol: [ "std::allocator_traits<std::allocator<cmFortranFile> >::value_type", private, "<vector>", public ] },
  52. { symbol: [ "std::allocator_traits<std::allocator<cmGraphEdgeList> >::value_type", private, "<vector>", public ] },
  53. { symbol: [ "std::allocator_traits<std::allocator<cmOrderDirectories::ConflictList> >::value_type", private, "<vector>", public ] },
  54. { symbol: [ "std::allocator_traits<std::allocator<cmStateSnapshot> >::value_type", private, "<vector>", public ] },
  55. { symbol: [ "std::allocator_traits<std::allocator<std::basic_string<char> > >::value_type", private, "<vector>", public ] },
  56. { symbol: [ "std::allocator_traits<std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::value_type", private, "<vector>", public ] },
  57. { symbol: [ "std::allocator_traits<std::allocator<std::vector<std::basic_string<char>, std::allocator<std::basic_string<char> > > > >::value_type", private, "<vector>", public ] },
  58. { 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 ] },
  59. { symbol: [ "std::allocator_traits<std::allocator<uv_stdio_container_s> >::value_type", private, "<vector>", public ] },
  60. # TODO: enable this block and remove some <utility> includes?
  61. #{ symbol: [ "std::pair", private, "<utility>", public ] },
  62. #{ symbol: [ "std::pair", private, "<map>", public ] },
  63. #{ symbol: [ "std::pair", private, "<set>", public ] },
  64. # HACK: iwyu wrongly thinks that <system_error> is needed for std::hash
  65. { symbol: [ "std::hash", private, "<functional>", public ] },
  66. # HACK: iwyu thinks we use a libstdc++ private type
  67. { symbol: [ "__gnu_cxx::size_t", private, "<cstddef>", public ] },
  68. # __decay_and_strip is used internally in the C++11 standard library.
  69. # IWYU does not classify it as internal and suggests to add <type_traits>.
  70. # To ignore it, we simply map it to a file that is included anyway.
  71. # Use 'CMake_IWYU_VERBOSE' to see the fully qualified names that need this.
  72. # TODO: Can this be simplified with an @-expression?
  73. #{ symbol: [ "@std::__decay_and_strip<.*>::__type", private, "\"cmConfigure.h\"", public ] },
  74. { symbol: [ "std::__decay_and_strip<int>::__type", private, "\"cmConfigure.h\"", public ] },
  75. { symbol: [ "std::__decay_and_strip<bool>::__type", private, "\"cmConfigure.h\"", public ] },
  76. { symbol: [ "std::__decay_and_strip<char const (&)[1]>::__type", private, "\"cmConfigure.h\"", public ] },
  77. { symbol: [ "std::__decay_and_strip<cmCommand *&>::__type", private, "\"cmConfigure.h\"", public ] },
  78. { symbol: [ "std::__decay_and_strip<cmGeneratorTarget *&>::__type", private, "\"cmConfigure.h\"", public ] },
  79. { symbol: [ "std::__decay_and_strip<cmFindCommon::PathLabel &>::__type", private, "\"cmConfigure.h\"", public ] },
  80. { symbol: [ "std::__decay_and_strip<cmSearchPath>::__type", private, "\"cmConfigure.h\"", public ] },
  81. { symbol: [ "std::__decay_and_strip<cm::string_view>::__type", private, "\"cmConfigure.h\"", public ] },
  82. { symbol: [ "std::__decay_and_strip<std::basic_string<char> &>::__type", private, "\"cmConfigure.h\"", public ] },
  83. { symbol: [ "std::__decay_and_strip<const std::basic_string<char> &>::__type", private, "\"cmConfigure.h\"", public ] },
  84. { symbol: [ "std::__decay_and_strip<cmFindPackageCommand::PathLabel &>::__type", private, "\"cmConfigure.h\"", public ] },
  85. { symbol: [ "std::__decay_and_strip<cmGlobalNinjaGenerator::TargetAlias &>::__type", private, "\"cmConfigure.h\"", public ] },
  86. { 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 ] },
  87. { 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 ] },
  88. { symbol: [ "std::__success_type<std::chrono::duration<double, std::ratio<1, 1> > >::type", private, "\"cmConfigure.h\"", public ] },
  89. { symbol: [ "std::__success_type<std::chrono::duration<long, std::ratio<1, 1000000000> > >::type", private, "\"cmConfigure.h\"", public ] },
  90. { symbol: [ "std::enable_if<true, std::chrono::duration<long, std::ratio<1, 1> > >::type", private, "\"cmConfigure.h\"", public ] },
  91. { symbol: [ "std::enable_if<true, std::chrono::duration<long, std::ratio<60, 1> > >::type", private, "\"cmConfigure.h\"", public ] },
  92. { symbol: [ "std::enable_if<true, std::chrono::duration<long, std::ratio<1, 1000> > >::type", private, "\"cmConfigure.h\"", public ] },
  93. { symbol: [ "__gnu_cxx::__enable_if<true, bool>::__type", private, "\"cmConfigure.h\"", public ] },
  94. { symbol: [ "std::remove_reference<std::basic_string<char, std::char_traits<char>, std::allocator<char> > &>::type", private, "\"cmConfigure.h\"", public ] },
  95. { symbol: [ "std::remove_reference<Defer &>::type", private, "\"cmConfigure.h\"", public ] },
  96. # Wrappers for 3rd-party libraries
  97. { include: [ "@<.*curl/curlver.h>", private, "<cm3p/curl/curl.h>", public ] },
  98. { include: [ "@<.*curl/system.h>", private, "<cm3p/curl/curl.h>", public ] },
  99. { include: [ "@<.*json/config.h>", private, "<cm3p/json/value.h>", public ] },
  100. { include: [ "@<.*json/forwards.h>", private, "<cm3p/json/value.h>", public ] },
  101. { include: [ "@<.*uv/.+\\.h>", private, "<cm3p/uv.h>", public ] },
  102. { include: [ "@<.*expat_external.h>", private, "<cm3p/expat.h>", public ] },
  103. { include: [ "@<.*zconf.h>", private, "<cm3p/zlib.h>", public ] },
  104. { include: [ "@<.*cm_zlib_mangle.h>", private, "<cm3p/zlib.h>", public ] },
  105. # # System symbols used by libuv
  106. { symbol: [ "ssize_t", private, "<cm3p/uv.h>", public ] },
  107. { symbol: [ "std::ifstream", private, "\"cmsys/FStream.hxx\"", public ] },
  108. { symbol: [ "std::ofstream", private, "\"cmsys/FStream.hxx\"", public ] },
  109. { symbol: [ "cmsys::ifstream", private, "\"cmsys/FStream.hxx\"", public ] },
  110. { symbol: [ "cmsys::ofstream", private, "\"cmsys/FStream.hxx\"", public ] },
  111. { include: [ "<istream>", public, "\"cmsys/FStream.hxx\"", public ] },
  112. { include: [ "<ostream>", public, "\"cmsys/FStream.hxx\"", public ] },
  113. { include: [ "<fstream>", public, "\"cmsys/FStream.hxx\"", public ] },
  114. { include: [ "<filesystem>", private, "<cm/filesystem>", public ] },
  115. { include: [ "<optional>", private, "<cm/optional>", public ] },
  116. { include: [ "<shared_mutex>", private, "<cm/shared_mutex>", public ] },
  117. { include: [ "<string_view>", private, "<cm/string_view>", public ] },
  118. # major and minor are used as macro arguments. Those are false matches.
  119. { symbol: [ "major", private, "\"cmVersion.h\"", public ] },
  120. { symbol: [ "minor", private, "\"cmVersion.h\"", public ] },
  121. { include: [ "<curses.h>", private, "\"cmCursesStandardIncludes.h\"", public ] },
  122. { include: [ "\"form.h\"", private, "\"cmCursesStandardIncludes.h\"", public ] },
  123. { include: [ "<form.h>", private, "\"cmCursesStandardIncludes.h\"", public ] },
  124. # Help IWYU understand our explicit instantiation for cmConstStack.
  125. { symbol: [ "cmConstStack::cmConstStack<T, Stack>", private, "\"cmConstStack.h\"", public ] },
  126. ]
  127. # vim: set ft=toml: