summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2018-08-09 11:52:02 (GMT)
committerKitware Robot <kwrobot@kitware.com>2018-08-09 11:52:39 (GMT)
commit1c773b5d3aae0ad2146b1076ae8e00166f49a849 (patch)
tree0da300e9e7c7b57e705fb6f100c6366113720ddd
parente1e9e0697bdf0741ef9cc36441b448697ff6d86b (diff)
parentaefb8559dca283b81d20a3f40afc8f39e6161ecb (diff)
downloadCMake-1c773b5d3aae0ad2146b1076ae8e00166f49a849.zip
CMake-1c773b5d3aae0ad2146b1076ae8e00166f49a849.tar.gz
CMake-1c773b5d3aae0ad2146b1076ae8e00166f49a849.tar.bz2
Merge topic 'iwyu-std-hash'
aefb8559dc IWYU: Fix workaround mapping for std::hash Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !2267
-rw-r--r--CMakeLists.txt3
-rw-r--r--Source/cmFindPackageCommand.h5
-rw-r--r--Source/cmServerProtocol.cxx1
-rw-r--r--Utilities/IWYU/mapping.imp2
4 files changed, 5 insertions, 6 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e20d770..1fcd8f8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -285,7 +285,8 @@ if(CMake_RUN_IWYU)
message(FATAL_ERROR "CMake_RUN_IWYU is ON but include-what-you-use is not found!")
endif()
set(CMAKE_CXX_INCLUDE_WHAT_YOU_USE
- "${IWYU_COMMAND};-Xiwyu;--mapping_file=${CMake_SOURCE_DIR}/Utilities/IWYU/mapping.imp;-w;-DCMAKE_IWYU")
+ "${IWYU_COMMAND};-Xiwyu;--mapping_file=${CMake_SOURCE_DIR}/Utilities/IWYU/mapping.imp;-w")
+ list(APPEND CMAKE_CXX_INCLUDE_WHAT_YOU_USE ${CMake_IWYU_OPTIONS})
endif()
diff --git a/Source/cmFindPackageCommand.h b/Source/cmFindPackageCommand.h
index d8c7ab3..48f17ef 100644
--- a/Source/cmFindPackageCommand.h
+++ b/Source/cmFindPackageCommand.h
@@ -7,6 +7,7 @@
#include "cm_kwiml.h"
#include <cstddef>
+#include <functional>
#include <map>
#include <set>
#include <string>
@@ -15,14 +16,12 @@
// IWYU insists we should forward-declare instead of including <functional>,
// but we cannot forward-declare reliably because some C++ standard libraries
// put the template in an inline namespace.
-#ifdef CMAKE_IWYU
+#ifdef CMAKE_IWYU_FORWARD_STD_HASH
/* clang-format off */
namespace std {
template <class T> struct hash;
}
/* clang-format on */
-#else
-# include <functional>
#endif
#include "cmFindCommon.h"
diff --git a/Source/cmServerProtocol.cxx b/Source/cmServerProtocol.cxx
index b05eac4..c267160 100644
--- a/Source/cmServerProtocol.cxx
+++ b/Source/cmServerProtocol.cxx
@@ -37,7 +37,6 @@
#include <set>
#include <string>
#include <unordered_map>
-#include <utility>
#include <vector>
// Get rid of some windows macros:
diff --git a/Utilities/IWYU/mapping.imp b/Utilities/IWYU/mapping.imp
index 77bb572..5af8b85 100644
--- a/Utilities/IWYU/mapping.imp
+++ b/Utilities/IWYU/mapping.imp
@@ -53,7 +53,7 @@
#{ symbol: [ "std::pair", private, "<set>", public ] },
# HACK: iwyu wrongly thinks that <system_error> is needed for std::hash
- { symbol: [ "std::hash", private, "<utility>", public ] },
+ { symbol: [ "std::hash", private, "<functional>", 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>.