Commit 71fbebd1 authored by Brad King's avatar Brad King

IWYU: Fix handling of <memory> standard header

An old workaround for `std::allocator_traits<>::value_type` lints from
IWYU on `std::vector<>` usage breaks IWYU's handling of `<memory>`.
Convert the workaround to use the same approach we already use for a
workaround of `std::__decay_and_strip<>::::__type` lints.  Then update
the `<memory>` inclusions to follow the now-correct IWYU lints.
parent 4fc10431
......@@ -7,7 +7,7 @@
#include "cmsys/RegularExpression.hxx"
#include <algorithm>
#include <cstring>
#include <memory> // IWYU pragma: keep
#include <memory>
#include <utility>
#include "cmCPackComponentGroup.h"
......
......@@ -5,7 +5,6 @@
#include "cmsys/Encoding.hxx"
#include <iostream>
#include <map>
#include <memory> // IWYU pragma: keep
#include <sstream>
#include <stddef.h>
#include <string>
......
......@@ -6,7 +6,6 @@
#include "cmsys/Process.h"
#include "cmsys/RegularExpression.hxx"
#include <iostream>
#include <memory> // IWYU pragma: keep
#include <stdlib.h>
#include <string.h>
......
......@@ -29,11 +29,13 @@
#include <iostream>
#include <list>
#include <math.h>
#include <memory>
#include <sstream>
#include <stack>
#include <stdlib.h>
#include <unordered_map>
#include <utility>
#include <vector>
namespace cmsys {
class RegularExpression;
......
......@@ -5,6 +5,7 @@
#include "cmConfigure.h" // IWYU pragma: keep
#include <memory>
#include <set>
#include <stddef.h>
#include <string>
......@@ -12,7 +13,7 @@
#include "cmCTestTestHandler.h"
#include "cmDuration.h"
#include "cmProcess.h" // IWYU pragma: keep (for unique_ptr)
#include "cmProcess.h"
class cmCTest;
class cmCTestMultiProcessHandler;
......
......@@ -11,7 +11,7 @@
#include <functional>
#include <iomanip>
#include <iterator>
#include <memory> // IWYU pragma: keep
#include <memory>
#include <set>
#include <sstream>
#include <stdio.h>
......
......@@ -18,7 +18,7 @@
#include "cmXMLWriter.h"
#include <chrono>
#include <memory> // IWYU pragma: keep
#include <memory>
#include <sstream>
static const char* cmCTestUpdateHandlerUpdateStrings[] = {
......
......@@ -9,7 +9,7 @@
#include "cmLDConfigTool.h"
#include "cmStateTypes.h"
#include <memory> // IWYU pragma: keep
#include <memory>
#include <string>
#include <vector>
......
......@@ -8,7 +8,7 @@
#include "cmBinUtilsMacOSMachOGetRuntimeDependenciesTool.h"
#include "cmStateTypes.h"
#include <memory> // IWYU pragma: keep
#include <memory>
#include <string>
#include <vector>
......
......@@ -8,7 +8,7 @@
#include "cmBinUtilsWindowsPEGetRuntimeDependenciesTool.h"
#include "cmStateTypes.h"
#include <memory> // IWYU pragma: keep
#include <memory>
#include <string>
class cmRuntimeDependencyArchive;
......
......@@ -15,7 +15,7 @@
#include <ctype.h>
#include <iostream>
#include <map>
#include <memory> // IWYU pragma: keep
#include <memory>
#include <sstream>
#include <stdio.h>
#include <stdlib.h>
......
......@@ -10,7 +10,7 @@
#include <chrono>
#include <map>
#include <memory> // IWYU pragma: keep
#include <memory>
#include <sstream>
#include <string>
#include <time.h>
......
......@@ -10,6 +10,7 @@
#include "cmTargetLinkLibraryType.h"
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <string>
......
......@@ -8,7 +8,7 @@
#include "cmsys/FStream.hxx"
#include <string.h>
#include <memory> // IWYU pragma: keep
#include <memory>
static unsigned int const cmCryptoHashAlgoToId[] = {
/* clang-format needs this comment to break after the opening brace */
......
......@@ -5,7 +5,7 @@
#include "cmConfigure.h" // IWYU pragma: keep
#include <memory> // IWYU pragma: keep
#include <memory>
#include <stddef.h>
#include <string>
#include <vector>
......
......@@ -12,7 +12,7 @@
#include "cmStateTypes.h"
#include "cmSystemTools.h"
#include <memory> // IWYU pragma: keep
#include <memory>
#include <stddef.h>
#include <utility>
......
......@@ -6,7 +6,7 @@
#include "cm_kwiml.h"
#include "cmsys/FStream.hxx"
#include <map>
#include <memory> // IWYU pragma: keep
#include <memory>
#include <sstream>
#include <stddef.h>
#include <utility>
......
......@@ -4,10 +4,13 @@
#include "cm_static_string_view.hxx"
#include "cmsys/Process.h"
#include <algorithm>
#include <ctype.h> /* isspace */
#include <iostream>
#include <memory>
#include <stdio.h>
#include <vector>
#include "cmAlgorithms.h"
#include "cmArgumentParser.h"
......
......@@ -3,7 +3,6 @@
#include "cmExportBuildAndroidMKGenerator.h"
#include <algorithm>
#include <memory> // IWYU pragma: keep
#include <sstream>
#include <utility>
......
......@@ -20,7 +20,7 @@
#include "cmsys/FStream.hxx"
#include <assert.h>
#include <memory> // IWYU pragma: keep
#include <memory>
#include <sstream>
#include <string.h>
#include <utility>
......
......@@ -4,7 +4,7 @@
#include "cmsys/FStream.hxx"
#include <map>
#include <memory> // IWYU pragma: keep
#include <memory>
#include <utility>
#include "cmAlgorithms.h"
......
......@@ -13,7 +13,7 @@
#include "cmTarget.h"
#include <map>
#include <memory> // IWYU pragma: keep
#include <memory>
#include <utility>
cmExportTryCompileFileGenerator::cmExportTryCompileFileGenerator(
......
......@@ -10,7 +10,7 @@
#include "cm_jsoncpp_writer.h"
#include <map>
#include <memory> // IWYU pragma: keep
#include <memory>
#include <string>
#include <unordered_set>
#include <vector>
......
......@@ -31,6 +31,7 @@
#include <algorithm>
#include <cassert>
#include <map>
#include <memory>
#include <set>
#include <string>
#include <unordered_map>
......
......@@ -13,7 +13,7 @@
#include <cmath>
#include <ctype.h>
#include <map>
#include <memory> // IWYU pragma: keep
#include <memory>
#include <set>
#include <sstream>
#include <stdio.h>
......
......@@ -5,7 +5,7 @@
#include "cmConfigure.h" // IWYU pragma: keep
#include <memory> // IWYU pragma: keep
#include <memory>
#include <string>
/** \class cmFileTimes
......
......@@ -13,7 +13,7 @@
#include <deque>
#include <functional>
#include <iterator>
#include <memory> // IWYU pragma: keep
#include <memory>
#include <sstream>
#include <stdio.h>
#include <string.h>
......
......@@ -2,7 +2,7 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmForEachCommand.h"
#include <memory> // IWYU pragma: keep
#include <memory>
#include <sstream>
#include <stdio.h>
#include <stdlib.h>
......
......@@ -3,7 +3,7 @@
#include "cmGeneratorExpression.h"
#include "cmsys/RegularExpression.hxx"
#include <memory> // IWYU pragma: keep
#include <memory>
#include <utility>
#include "assert.h"
......
......@@ -8,7 +8,7 @@
#include "cmListFileCache.h"
#include <map>
#include <memory> // IWYU pragma: keep
#include <memory>
#include <set>
#include <string>
#include <utility>
......
......@@ -3,7 +3,7 @@
#include "cmGeneratorExpressionEvaluationFile.h"
#include "cmsys/FStream.hxx"
#include <memory> // IWYU pragma: keep
#include <memory>
#include <sstream>
#include <utility>
......
......@@ -6,7 +6,7 @@
#include "cmConfigure.h" // IWYU pragma: keep
#include <map>
#include <memory> // IWYU pragma: keep
#include <memory>
#include <string>
#include <vector>
......
......@@ -33,7 +33,7 @@
#include <errno.h>
#include <iterator>
#include <map>
#include <memory> // IWYU pragma: keep
#include <memory>
#include <set>
#include <sstream>
#include <stdlib.h>
......
......@@ -7,7 +7,7 @@
#include <assert.h>
#include <errno.h>
#include <iterator>
#include <memory> // IWYU pragma: keep
#include <memory>
#include <queue>
#include <sstream>
#include <stdio.h>
......
......@@ -22,9 +22,11 @@
#include "cmTarget.h"
#include <algorithm>
#include <memory>
#include <ostream>
#include <set>
#include <utility>
#include <vector>
cmGhsMultiTargetGenerator::cmGhsMultiTargetGenerator(cmGeneratorTarget* target)
: GeneratorTarget(target)
......
......@@ -7,6 +7,7 @@
#include <iosfwd>
#include <map>
#include <memory>
#include <set>
#include <string>
#include <unordered_map>
......
......@@ -9,7 +9,7 @@
#include <algorithm>
#include <ctype.h>
#include <iterator>
#include <memory> // IWYU pragma: keep
#include <memory>
#include <sstream>
#include <stdio.h>
......
......@@ -7,7 +7,7 @@
#include <iosfwd>
#include <map>
#include <memory> // IWYU pragma: keep
#include <memory>
#include <set>
#include <string>
#include <unordered_map>
......
......@@ -4,6 +4,7 @@
#include <algorithm>
#include <functional>
#include <memory>
#include <sstream>
#include <utility>
......
......@@ -5,7 +5,7 @@
#include "cmsys/RegularExpression.hxx"
#include <assert.h>
#include <iomanip>
#include <memory> // IWYU pragma: keep
#include <memory>
#include <sstream>
#include <stdio.h>
#include <string.h>
......
......@@ -4,7 +4,7 @@
#include <cstddef>
#include <iostream>
#include <memory> // IWYU pragma: keep
#include <memory>
#include <sstream>
#include <utility>
......
......@@ -11,7 +11,7 @@
#include "cmSystemTools.h"
#include "cmake.h"
#include <memory> // IWYU pragma: keep
#include <memory>
static std::string cmIfCommandError(
std::vector<cmExpandedCommandArgument> const& args)
......
......@@ -8,7 +8,7 @@
#include "cmMakefile.h"
#include "cmSystemTools.h"
#include <memory> // IWYU pragma: keep
#include <memory>
cmInstallDirectoryGenerator::cmInstallDirectoryGenerator(
std::vector<std::string> const& dirs, const char* dest,
......
......@@ -6,7 +6,7 @@
#include "cmInstallType.h"
#include "cmSystemTools.h"
#include <memory> // IWYU pragma: keep
#include <memory>
class cmLocalGenerator;
......
......@@ -2,6 +2,7 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmInstallScriptGenerator.h"
#include <memory>
#include <ostream>
#include <vector>
......
......@@ -4,6 +4,7 @@
#include <assert.h>
#include <map>
#include <memory>
#include <set>
#include <sstream>
#include <utility>
......
......@@ -8,7 +8,7 @@
#include "cmGeneratorExpression.h"
#include <map>
#include <memory> // IWYU pragma: keep
#include <memory>
#include <string>
#include <vector>
......
......@@ -31,6 +31,7 @@
#include <functional>
#include <limits>
#include <map>
#include <memory>
#include <set>
#include <string>
#include <unordered_map>
......
......@@ -7,12 +7,14 @@
#include <assert.h>
#include <functional>
#include <iterator>
#include <memory>
#include <set>
#include <sstream>
#include <stdexcept>
#include <stdio.h>
#include <stdlib.h> // required for atoi
#include <utility>
#include <vector>
#include "cmAlgorithms.h"
#include "cmGeneratorExpression.h"
......
......@@ -6,7 +6,7 @@
#include "cmConfigure.h" // IWYU pragma: keep
#include <iosfwd>
#include <memory> // IWYU pragma: keep
#include <memory>
#include <stddef.h>
#include <string>
#include <utility>
......
......@@ -26,22 +26,24 @@
#include "cmTestGenerator.h"
#include "cmVersion.h"
#include "cmake.h"
#include "cmsys/RegularExpression.hxx"
#if defined(CMAKE_BUILD_WITH_CMAKE)
# define CM_LG_ENCODE_OBJECT_NAMES
# include "cmCryptoHash.h"
#endif
#include "cmsys/RegularExpression.hxx"
#include <algorithm>
#include <assert.h>
#include <initializer_list>
#include <iterator>
#include <memory>
#include <sstream>
#include <stdio.h>
#include <string.h>
#include <unordered_set>
#include <utility>
#include <vector>
#if defined(__HAIKU__)
# include <FindDirectory.h>
......
......@@ -5,7 +5,7 @@
#include <algorithm>
#include <assert.h>
#include <iterator>
#include <memory> // IWYU pragma: keep
#include <memory>
#include <sstream>
#include <stdio.h>
#include <utility>
......
......@@ -5,7 +5,7 @@
#include "cmsys/FStream.hxx"
#include "cmsys/Terminal.h"
#include <algorithm>
#include <memory> // IWYU pragma: keep
#include <memory>
#include <sstream>
#include <stdio.h>
#include <utility>
......
......@@ -6,7 +6,7 @@
#include "cmConfigure.h" // IWYU pragma: keep
#include <map>
#include <memory> // IWYU pragma: keep
#include <memory>
#include <string>
#include "cmGlobalVisualStudioGenerator.h"
......
......@@ -9,7 +9,7 @@
#include <cstring>
#include <ctype.h>
#include <iterator>
#include <memory> // IWYU pragma: keep
#include <memory>
#include <sstream>
#include <stdio.h>
#include <stdlib.h>
......
......@@ -8,7 +8,7 @@
#include "cmsys/RegularExpression.hxx"
#include <deque>
#include <map>
#include <memory> // IWYU pragma: keep
#include <memory>
#include <set>
#include <stack>
#include <stddef.h>
......
......@@ -2,7 +2,7 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmMakefileExecutableTargetGenerator.h"
#include <memory> // IWYU pragma: keep
#include <memory>
#include <set>
#include <sstream>
#include <string>
......
......@@ -2,7 +2,7 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmMakefileLibraryTargetGenerator.h"
#include <memory> // IWYU pragma: keep
#include <memory>
#include <set>
#include <sstream>
#include <stddef.h>
......
......@@ -2,7 +2,7 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmMakefileTargetGenerator.h"
#include <memory> // IWYU pragma: keep
#include <memory>
#include <sstream>
#include <stdio.h>
#include <utility>
......
......@@ -7,6 +7,7 @@
#include <iosfwd>
#include <map>
#include <memory>
#include <set>
#include <string>
#include <vector>
......
......@@ -2,6 +2,7 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmMakefileUtilityTargetGenerator.h"
#include <memory>
#include <ostream>
#include <string>
#include <utility>
......
......@@ -6,7 +6,7 @@
#include <assert.h>
#include <iterator>
#include <map>
#include <memory> // IWYU pragma: keep
#include <memory>
#include <set>
#include <sstream>
#include <utility>
......
......@@ -8,7 +8,7 @@
#include <assert.h>
#include <iterator>
#include <map>
#include <memory> // IWYU pragma: keep
#include <memory>
#include <ostream>
#include <utility>
......
......@@ -13,7 +13,7 @@
#include "cmOSXBundleGenerator.h"
#include <map>
#include <memory> // IWYU pragma: keep
#include <memory>
#include <set>
#include <string>
#include <vector>
......
......@@ -13,6 +13,7 @@
#include <assert.h>
#include <functional>
#include <sstream>
#include <vector>
/*
Directory ordering computation.
......
......@@ -5,7 +5,7 @@
#include "cmConfigure.h" // IWYU pragma: keep
#include <memory> // IWYU pragma: keep
#include <memory>
#include <string>
#include <vector>
......
......@@ -8,7 +8,7 @@
#include "cmQtAutoGen.h"
#include <map>
#include <memory> // IWYU pragma: keep
#include <memory>
#include <string>
#include <unordered_map>
#include <vector>
......
......@@ -8,7 +8,7 @@
#include "cmQtAutoGen.h"
#include <map>
#include <memory> // IWYU pragma: keep
#include <memory>
#include <ostream>
#include <set>
#include <string>
......
......@@ -14,6 +14,8 @@
#include "cmSystemTools.h"
#include "cmake.h"
#include <memory>
cmQtAutoGenerator::Logger::Logger()
{
// Initialize logger
......
......@@ -14,7 +14,7 @@
#include <atomic>
#include <cstddef>
#include <map>
#include <memory> // IWYU pragma: keep
#include <memory>
#include <set>
#include <string>
#include <unordered_map>
......
......@@ -9,7 +9,7 @@
#include "cmsys/RegularExpression.hxx"
#include <map>
#include <memory> // IWYU pragma: keep
#include <memory>
#include <set>
#include <string>
#include <vector>
......
......@@ -10,7 +10,7 @@
#include "cmUVHandlePtr.h"
#include <memory> // IWYU pragma: keep
#include <memory>
#include <string>
#include <vector>
......
......@@ -6,6 +6,7 @@
#include "cmConfigure.h" // IWYU pragma: keep
#include <map>
#include <memory>
#include <set>