Browse Source

IWYU: Add workaround mapping for std::hash

When using GCC 8's standard library IWYU thinks that `<system_error>`
must be included to get `std::hash`.  Add a mapping for `<utility>`.
Brad King 7 years ago
parent
commit
276d3c7afe
2 changed files with 4 additions and 0 deletions
  1. 1 0
      Source/cmServerProtocol.cxx
  2. 3 0
      Utilities/IWYU/mapping.imp

+ 1 - 0
Source/cmServerProtocol.cxx

@@ -37,6 +37,7 @@
 #include <set>
 #include <string>
 #include <unordered_map>
+#include <utility>
 #include <vector>
 
 // Get rid of some windows macros:

+ 3 - 0
Utilities/IWYU/mapping.imp

@@ -52,6 +52,9 @@
   #{ 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, "<utility>", 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.