diff options
Diffstat (limited to 'Source')
134 files changed, 197 insertions, 1207 deletions
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 7b580e5..8ed7b2f 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -437,9 +437,6 @@ set(SRCS cmXMLWriter.h cmake.cxx cmake.h - cm_string_view.cxx - cm_string_view.hxx - cm_static_string_view.hxx cmCommand.cxx cmCommand.h @@ -681,13 +678,13 @@ set(SRCS cmWriteFileCommand.cxx cmWriteFileCommand.h + cm_static_string_view.hxx cm_get_date.h cm_get_date.c cm_utf8.h cm_utf8.c cm_codecvt.hxx cm_codecvt.cxx - cm_thread.hxx cmDuration.h cmDuration.cxx @@ -853,6 +850,7 @@ endforeach() # create a library used by the command line and the GUI add_library(CMakeLib ${SRCS}) target_link_libraries(CMakeLib cmsys + ${CMAKE_STD_LIBRARY} ${CMAKE_EXPAT_LIBRARIES} ${CMAKE_ZLIB_LIBRARIES} ${CMAKE_TAR_LIBRARIES} ${CMAKE_CURL_LIBRARIES} diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx index f784832..683f275 100644 --- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx +++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx @@ -11,8 +11,9 @@ #include "cmStringAlgorithms.h" #include "cmSystemTools.h" #include "cmUuid.h" -#include "cm_string_view.hxx" + #include <algorithm> +#include <cm/string_view> #include "cmWIXDirectoriesSourceWriter.h" #include "cmWIXFeaturesSourceWriter.h" diff --git a/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx b/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx index dd3caf9..7705d83 100644 --- a/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx +++ b/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx @@ -9,10 +9,10 @@ #include "cmSystemTools.h" #include "cmUuid.h" -#include "cm_sys_stat.h" - #include "cmCMakeToWixPath.h" +#include "cm_sys_stat.h" + cmWIXFilesSourceWriter::cmWIXFilesSourceWriter(cmCPackLog* logger, std::string const& filename, GuidType componentGuidType) diff --git a/Source/CPack/cmCPackDebGenerator.cxx b/Source/CPack/cmCPackDebGenerator.cxx index 0e64b5a..4f299f7 100644 --- a/Source/CPack/cmCPackDebGenerator.cxx +++ b/Source/CPack/cmCPackDebGenerator.cxx @@ -10,9 +10,11 @@ #include "cmGeneratedFileStream.h" #include "cmStringAlgorithms.h" #include "cmSystemTools.h" -#include "cm_sys_stat.h" #include "cmsys/Glob.hxx" + +#include "cm_sys_stat.h" + #include <cstring> #include <map> #include <ostream> diff --git a/Source/CPack/cmCPackExternalGenerator.cxx b/Source/CPack/cmCPackExternalGenerator.cxx index 5dc6ace..05e5c21 100644 --- a/Source/CPack/cmCPackExternalGenerator.cxx +++ b/Source/CPack/cmCPackExternalGenerator.cxx @@ -17,7 +17,7 @@ #include <utility> #include <vector> -#include "cm_memory.hxx" +#include <cm/memory> int cmCPackExternalGenerator::InitializeInternal() { diff --git a/Source/CPack/cmCPackExternalGenerator.h b/Source/CPack/cmCPackExternalGenerator.h index 176d6a9..b77e45b 100644 --- a/Source/CPack/cmCPackExternalGenerator.h +++ b/Source/CPack/cmCPackExternalGenerator.h @@ -4,6 +4,7 @@ #define cmCPackExternalGenerator_h #include "cmCPackGenerator.h" + #include "cm_sys_stat.h" #include <memory> diff --git a/Source/CPack/cmCPackGenerator.h b/Source/CPack/cmCPackGenerator.h index fc00b09..33026c1 100644 --- a/Source/CPack/cmCPackGenerator.h +++ b/Source/CPack/cmCPackGenerator.h @@ -10,9 +10,10 @@ #include <string> #include <vector> +#include "cm_sys_stat.h" + #include "cmCPackComponentGroup.h" #include "cmSystemTools.h" -#include "cm_sys_stat.h" class cmCPackLog; class cmGlobalGenerator; diff --git a/Source/CPack/cmCPackOSXX11Generator.cxx b/Source/CPack/cmCPackOSXX11Generator.cxx index 992299a..cd65694 100644 --- a/Source/CPack/cmCPackOSXX11Generator.cxx +++ b/Source/CPack/cmCPackOSXX11Generator.cxx @@ -4,13 +4,14 @@ #include <sstream> +#include "cm_sys_stat.h" + #include "cmCPackGenerator.h" #include "cmCPackLog.h" #include "cmDuration.h" #include "cmGeneratedFileStream.h" #include "cmStringAlgorithms.h" #include "cmSystemTools.h" -#include "cm_sys_stat.h" cmCPackOSXX11Generator::cmCPackOSXX11Generator() = default; diff --git a/Source/CPack/cmCPackSTGZGenerator.cxx b/Source/CPack/cmCPackSTGZGenerator.cxx index eb48c37..eb1e24c 100644 --- a/Source/CPack/cmCPackSTGZGenerator.cxx +++ b/Source/CPack/cmCPackSTGZGenerator.cxx @@ -8,11 +8,12 @@ #include <string> #include <vector> +#include "cm_sys_stat.h" + #include "cmArchiveWrite.h" #include "cmCPackGenerator.h" #include "cmCPackLog.h" #include "cmSystemTools.h" -#include "cm_sys_stat.h" cmCPackSTGZGenerator::cmCPackSTGZGenerator() : cmCPackArchiveGenerator(cmArchiveWrite::CompressGZip, "paxr", ".sh") diff --git a/Source/CTest/cmCTestBuildCommand.h b/Source/CTest/cmCTestBuildCommand.h index a62c301..14f70bf 100644 --- a/Source/CTest/cmCTestBuildCommand.h +++ b/Source/CTest/cmCTestBuildCommand.h @@ -12,7 +12,7 @@ #include <utility> #include <vector> -#include "cm_memory.hxx" +#include <cm/memory> class cmCTestBuildHandler; class cmCTestGenericHandler; diff --git a/Source/CTest/cmCTestCVS.cxx b/Source/CTest/cmCTestCVS.cxx index b9b90c8..5baeecd 100644 --- a/Source/CTest/cmCTestCVS.cxx +++ b/Source/CTest/cmCTestCVS.cxx @@ -7,10 +7,12 @@ #include "cmStringAlgorithms.h" #include "cmSystemTools.h" #include "cmXMLWriter.h" -#include "cm_string_view.hxx" #include "cmsys/FStream.hxx" #include "cmsys/RegularExpression.hxx" + +#include <cm/string_view> + #include <utility> cmCTestCVS::cmCTestCVS(cmCTest* ct, std::ostream& log) diff --git a/Source/CTest/cmCTestConfigureCommand.h b/Source/CTest/cmCTestConfigureCommand.h index 4677c83..36ca7d5 100644 --- a/Source/CTest/cmCTestConfigureCommand.h +++ b/Source/CTest/cmCTestConfigureCommand.h @@ -11,7 +11,7 @@ #include <string> #include <utility> -#include "cm_memory.hxx" +#include <cm/memory> class cmCTestGenericHandler; diff --git a/Source/CTest/cmCTestCoverageCommand.h b/Source/CTest/cmCTestCoverageCommand.h index 24b96c0..75aefdf 100644 --- a/Source/CTest/cmCTestCoverageCommand.h +++ b/Source/CTest/cmCTestCoverageCommand.h @@ -12,7 +12,7 @@ #include <string> #include <utility> -#include "cm_memory.hxx" +#include <cm/memory> class cmCTestGenericHandler; diff --git a/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.h b/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.h index 84250cb..4232b9e 100644 --- a/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.h +++ b/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.h @@ -12,7 +12,7 @@ #include <utility> #include <vector> -#include "cm_memory.hxx" +#include <cm/memory> class cmExecutionStatus; diff --git a/Source/CTest/cmCTestMemCheckCommand.h b/Source/CTest/cmCTestMemCheckCommand.h index 837a687..5dad4e7 100644 --- a/Source/CTest/cmCTestMemCheckCommand.h +++ b/Source/CTest/cmCTestMemCheckCommand.h @@ -7,7 +7,7 @@ #include <utility> -#include "cm_memory.hxx" +#include <cm/memory> #include "cmCTestTestCommand.h" #include "cmCommand.h" diff --git a/Source/CTest/cmCTestReadCustomFilesCommand.h b/Source/CTest/cmCTestReadCustomFilesCommand.h index db2ac5e..8199cbc 100644 --- a/Source/CTest/cmCTestReadCustomFilesCommand.h +++ b/Source/CTest/cmCTestReadCustomFilesCommand.h @@ -12,7 +12,7 @@ #include <utility> #include <vector> -#include "cm_memory.hxx" +#include <cm/memory> class cmExecutionStatus; diff --git a/Source/CTest/cmCTestRunScriptCommand.h b/Source/CTest/cmCTestRunScriptCommand.h index 6961f6e..d262a83 100644 --- a/Source/CTest/cmCTestRunScriptCommand.h +++ b/Source/CTest/cmCTestRunScriptCommand.h @@ -12,7 +12,7 @@ #include <utility> #include <vector> -#include "cm_memory.hxx" +#include <cm/memory> class cmExecutionStatus; diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx index 3629a50..d8a5923 100644 --- a/Source/CTest/cmCTestRunTest.cxx +++ b/Source/CTest/cmCTestRunTest.cxx @@ -20,7 +20,7 @@ #include <sstream> #include <utility> -#include "cm_memory.hxx" +#include <cm/memory> cmCTestRunTest::cmCTestRunTest(cmCTestMultiProcessHandler& multiHandler) : MultiTestHandler(multiHandler) diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx index 354e3c4..c988e3a 100644 --- a/Source/CTest/cmCTestScriptHandler.cxx +++ b/Source/CTest/cmCTestScriptHandler.cxx @@ -5,7 +5,7 @@ #include "cmsys/Directory.hxx" #include "cmsys/Process.h" -#include "cm_memory.hxx" +#include <cm/memory> #include "cmCTest.h" #include "cmCTestBuildCommand.h" diff --git a/Source/CTest/cmCTestSleepCommand.h b/Source/CTest/cmCTestSleepCommand.h index 7b17081..b98079d 100644 --- a/Source/CTest/cmCTestSleepCommand.h +++ b/Source/CTest/cmCTestSleepCommand.h @@ -12,7 +12,7 @@ #include <utility> #include <vector> -#include "cm_memory.hxx" +#include <cm/memory> class cmExecutionStatus; diff --git a/Source/CTest/cmCTestStartCommand.h b/Source/CTest/cmCTestStartCommand.h index 7c71f36..598c937 100644 --- a/Source/CTest/cmCTestStartCommand.h +++ b/Source/CTest/cmCTestStartCommand.h @@ -13,7 +13,7 @@ #include <utility> #include <vector> -#include "cm_memory.hxx" +#include <cm/memory> class cmExecutionStatus; diff --git a/Source/CTest/cmCTestSubmitCommand.cxx b/Source/CTest/cmCTestSubmitCommand.cxx index d16aac0..2e2cf1a 100644 --- a/Source/CTest/cmCTestSubmitCommand.cxx +++ b/Source/CTest/cmCTestSubmitCommand.cxx @@ -13,7 +13,7 @@ #include <sstream> #include <utility> -#include "cm_memory.hxx" +#include <cm/memory> class cmExecutionStatus; diff --git a/Source/CTest/cmCTestTestCommand.h b/Source/CTest/cmCTestTestCommand.h index d74136c..a9ba3ab 100644 --- a/Source/CTest/cmCTestTestCommand.h +++ b/Source/CTest/cmCTestTestCommand.h @@ -11,7 +11,7 @@ #include <string> #include <utility> -#include "cm_memory.hxx" +#include <cm/memory> class cmCTestGenericHandler; diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index 10f9f9b..ee0d8c8 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -2,7 +2,7 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmCTestTestHandler.h" -#include "cm_memory.hxx" +#include <cm/memory> #include "cmAlgorithms.h" #include "cmCTest.h" diff --git a/Source/CTest/cmCTestUpdateCommand.h b/Source/CTest/cmCTestUpdateCommand.h index 55c4b80..5b0e07e 100644 --- a/Source/CTest/cmCTestUpdateCommand.h +++ b/Source/CTest/cmCTestUpdateCommand.h @@ -11,7 +11,7 @@ #include <string> #include <utility> -#include "cm_memory.hxx" +#include <cm/memory> class cmCTestGenericHandler; diff --git a/Source/CTest/cmCTestUpdateHandler.cxx b/Source/CTest/cmCTestUpdateHandler.cxx index a6a3542..c4cb233 100644 --- a/Source/CTest/cmCTestUpdateHandler.cxx +++ b/Source/CTest/cmCTestUpdateHandler.cxx @@ -20,7 +20,7 @@ #include <chrono> #include <sstream> -#include "cm_memory.hxx" +#include <cm/memory> static const char* cmCTestUpdateHandlerUpdateStrings[] = { "Unknown", "CVS", "SVN", "BZR", "GIT", "HG", "P4" diff --git a/Source/CTest/cmCTestUploadCommand.h b/Source/CTest/cmCTestUploadCommand.h index 9e49769..39314f2 100644 --- a/Source/CTest/cmCTestUploadCommand.h +++ b/Source/CTest/cmCTestUploadCommand.h @@ -12,7 +12,7 @@ #include <string> #include <utility> -#include "cm_memory.hxx" +#include <cm/memory> class cmCTestGenericHandler; diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h index 60b746c..06ea9f6 100644 --- a/Source/cmAlgorithms.h +++ b/Source/cmAlgorithms.h @@ -238,81 +238,4 @@ typename Range::const_iterator cmFindNot(Range const& r, T const& t) return std::find_if(r.begin(), r.end(), [&t](T const& i) { return i != t; }); } -template <class Iter> -std::reverse_iterator<Iter> cmMakeReverseIterator(Iter it) -{ - return std::reverse_iterator<Iter>(it); -} - -namespace cm { - -#if __cplusplus >= 201703L || defined(_MSVC_LANG) && _MSVC_LANG >= 201703L - -using std::size; - -#else - -// std::size backport from C++17. -template <class C> -# if !defined(_MSC_VER) || _MSC_VER >= 1900 -constexpr -# endif - auto - size(C const& c) -> decltype(c.size()) -{ - return c.size(); -} - -template <typename T, size_t N> -# if !defined(_MSC_VER) || _MSC_VER >= 1900 -constexpr -# endif - std::size_t - size(const T (&)[N]) throw() -{ - return N; -} - -#endif - -template <typename T> -int isize(const T& t) -{ - return static_cast<int>(cm::size(t)); -} - -#if __cplusplus >= 201402L || defined(_MSVC_LANG) && _MSVC_LANG >= 201402L - -using std::cbegin; -using std::cend; - -#else - -// std::c{begin,end} backport from C++14 -template <class C> -# if defined(_MSC_VER) && _MSC_VER < 1900 -auto cbegin(C const& c) -# else -constexpr auto cbegin(C const& c) noexcept(noexcept(std::begin(c))) -# endif - -> decltype(std::begin(c)) -{ - return std::begin(c); -} - -template <class C> -# if defined(_MSC_VER) && _MSC_VER < 1900 -auto cend(C const& c) -# else -constexpr auto cend(C const& c) noexcept(noexcept(std::end(c))) -# endif - -> decltype(std::end(c)) -{ - return std::end(c); -} - -#endif - -} // namespace cm - #endif diff --git a/Source/cmArgumentParser.h b/Source/cmArgumentParser.h index 6cfe946..b6798bc 100644 --- a/Source/cmArgumentParser.h +++ b/Source/cmArgumentParser.h @@ -6,7 +6,7 @@ #include "cmConfigure.h" // IWYU pragma: keep #include "cm_static_string_view.hxx" -#include "cm_string_view.hxx" +#include <cm/string_view> #include <cassert> #include <functional> diff --git a/Source/cmBinUtilsLinuxELFLinker.cxx b/Source/cmBinUtilsLinuxELFLinker.cxx index 6316a29..a1125a9 100644 --- a/Source/cmBinUtilsLinuxELFLinker.cxx +++ b/Source/cmBinUtilsLinuxELFLinker.cxx @@ -15,7 +15,7 @@ #include <sstream> -#include "cm_memory.hxx" +#include <cm/memory> static std::string ReplaceOrigin(const std::string& rpath, const std::string& origin) diff --git a/Source/cmBinUtilsMacOSMachOLinker.cxx b/Source/cmBinUtilsMacOSMachOLinker.cxx index 7ff8584..b1f718b 100644 --- a/Source/cmBinUtilsMacOSMachOLinker.cxx +++ b/Source/cmBinUtilsMacOSMachOLinker.cxx @@ -12,7 +12,7 @@ #include <string> #include <vector> -#include "cm_memory.hxx" +#include <cm/memory> cmBinUtilsMacOSMachOLinker::cmBinUtilsMacOSMachOLinker( cmRuntimeDependencyArchive* archive) diff --git a/Source/cmBinUtilsWindowsPELinker.cxx b/Source/cmBinUtilsWindowsPELinker.cxx index 5a9ad66..bfafaeb 100644 --- a/Source/cmBinUtilsWindowsPELinker.cxx +++ b/Source/cmBinUtilsWindowsPELinker.cxx @@ -12,7 +12,7 @@ #include <sstream> #include <vector> -#include "cm_memory.hxx" +#include <cm/memory> #ifdef _WIN32 # include <windows.h> diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 5e17ce8..1031f40 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -29,7 +29,7 @@ # include <unistd.h> // IWYU pragma: keep #endif -#include "cm_memory.hxx" +#include <cm/memory> #include "cmAlgorithms.h" #include "cmCTestBuildAndTestHandler.h" diff --git a/Source/cmCommands.cxx b/Source/cmCommands.cxx index 38fcf5b..262590b 100644 --- a/Source/cmCommands.cxx +++ b/Source/cmCommands.cxx @@ -1,7 +1,7 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#include "cm_memory.hxx" +#include <cm/memory> #include "cmCommands.h" #include "cmPolicies.h" diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx index 08113de..ab4371a 100644 --- a/Source/cmComputeLinkDepends.cxx +++ b/Source/cmComputeLinkDepends.cxx @@ -22,7 +22,7 @@ #include <sstream> #include <utility> -#include "cm_memory.hxx" +#include <cm/memory> /* diff --git a/Source/cmCryptoHash.cxx b/Source/cmCryptoHash.cxx index f9f9581..ff683ad 100644 --- a/Source/cmCryptoHash.cxx +++ b/Source/cmCryptoHash.cxx @@ -6,7 +6,7 @@ #include "cm_rhash.h" #include "cmsys/FStream.hxx" -#include "cm_memory.hxx" +#include <cm/memory> static unsigned int const cmCryptoHashAlgoToId[] = { /* clang-format needs this comment to break after the opening brace */ diff --git a/Source/cmCryptoHash.h b/Source/cmCryptoHash.h index 145ff91..05552bd 100644 --- a/Source/cmCryptoHash.h +++ b/Source/cmCryptoHash.h @@ -5,7 +5,7 @@ #include "cmConfigure.h" // IWYU pragma: keep -#include "cm_string_view.hxx" +#include <cm/string_view> #include <cstddef> #include <memory> diff --git a/Source/cmCustomCommandLines.h b/Source/cmCustomCommandLines.h index 213aeb1..ead5792 100644 --- a/Source/cmCustomCommandLines.h +++ b/Source/cmCustomCommandLines.h @@ -9,7 +9,7 @@ #include <string> #include <vector> -#include "cm_string_view.hxx" // IWYU pragma: keep +#include <cm/string_view> // IWYU pragma: keep /** Data structure to represent a single command line. */ class cmCustomCommandLine : public std::vector<std::string> diff --git a/Source/cmDefinitions.cxx b/Source/cmDefinitions.cxx index 2a117c1..32f47b0 100644 --- a/Source/cmDefinitions.cxx +++ b/Source/cmDefinitions.cxx @@ -2,7 +2,7 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmDefinitions.h" -#include "cm_string_view.hxx" +#include <cm/string_view> #include <cassert> #include <functional> diff --git a/Source/cmDefinitions.h b/Source/cmDefinitions.h index 008821d..72e88b5 100644 --- a/Source/cmDefinitions.h +++ b/Source/cmDefinitions.h @@ -5,11 +5,12 @@ #include "cmConfigure.h" // IWYU pragma: keep -#include "cm_string_view.hxx" - #include "cmLinkedTree.h" + #include "cmString.hxx" +#include <cm/string_view> + #include <functional> #include <string> #include <unordered_map> diff --git a/Source/cmDependsJavaParserHelper.cxx b/Source/cmDependsJavaParserHelper.cxx index 63a96d0..18b49b8 100644 --- a/Source/cmDependsJavaParserHelper.cxx +++ b/Source/cmDependsJavaParserHelper.cxx @@ -5,8 +5,8 @@ #include "cmDependsJavaLexer.h" #include "cmSystemTools.h" -#include "cm_string_view.hxx" #include "cmsys/FStream.hxx" +#include <cm/string_view> #include <cstdio> #include <cstdlib> #include <cstring> diff --git a/Source/cmELF.cxx b/Source/cmELF.cxx index 12f996d..06b5511 100644 --- a/Source/cmELF.cxx +++ b/Source/cmELF.cxx @@ -4,8 +4,8 @@ #include "cmAlgorithms.h" #include "cm_kwiml.h" -#include "cm_memory.hxx" #include "cmsys/FStream.hxx" +#include <cm/memory> #include <cstddef> #include <map> #include <memory> diff --git a/Source/cmExportCommand.h b/Source/cmExportCommand.h index 50463af..819a3c3 100644 --- a/Source/cmExportCommand.h +++ b/Source/cmExportCommand.h @@ -8,7 +8,7 @@ #include <string> #include <vector> -#include "cm_memory.hxx" +#include <cm/memory> #include "cmCommand.h" diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx index e588f7b..f9a28cd 100644 --- a/Source/cmExportFileGenerator.cxx +++ b/Source/cmExportFileGenerator.cxx @@ -24,7 +24,7 @@ #include <sstream> #include <utility> -#include "cm_memory.hxx" +#include <cm/memory> static std::string cmExportFileGeneratorEscape(std::string const& str) { diff --git a/Source/cmExportLibraryDependenciesCommand.cxx b/Source/cmExportLibraryDependenciesCommand.cxx index bab394a..fd2401e 100644 --- a/Source/cmExportLibraryDependenciesCommand.cxx +++ b/Source/cmExportLibraryDependenciesCommand.cxx @@ -6,7 +6,7 @@ #include <map> #include <utility> -#include "cm_memory.hxx" +#include <cm/memory> #include "cmExecutionStatus.h" #include "cmGeneratedFileStream.h" diff --git a/Source/cmFSPermissions.h b/Source/cmFSPermissions.h index 7a6e708..fef72e6 100644 --- a/Source/cmFSPermissions.h +++ b/Source/cmFSPermissions.h @@ -5,10 +5,10 @@ #include "cmConfigure.h" // IWYU pragma: keep -#include "cm_sys_stat.h" - #include <string> +#include "cm_sys_stat.h" + namespace cmFSPermissions { // Table of permissions flags. diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 4701d29..c7a0e55 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -20,7 +20,9 @@ #include <utility> #include <vector> -#include "cm_memory.hxx" +#include <cm/memory> + +#include "cm_sys_stat.h" #include "cmAlgorithms.h" #include "cmArgumentParser.h" @@ -44,7 +46,6 @@ #include "cmSubcommandTable.h" #include "cmSystemTools.h" #include "cmTimestamp.h" -#include "cm_sys_stat.h" #include "cmake.h" #if !defined(CMAKE_BOOTSTRAP) diff --git a/Source/cmFileCopier.h b/Source/cmFileCopier.h index 263a365..8fc481c 100644 --- a/Source/cmFileCopier.h +++ b/Source/cmFileCopier.h @@ -6,9 +6,10 @@ #include "cmConfigure.h" // IWYU pragma: keep #include "cmFileTimeCache.h" -#include "cm_sys_stat.h" #include "cmsys/RegularExpression.hxx" +#include "cm_sys_stat.h" + #include <string> #include <vector> diff --git a/Source/cmFileTimes.cxx b/Source/cmFileTimes.cxx index 3824e9b..54ac4ed 100644 --- a/Source/cmFileTimes.cxx +++ b/Source/cmFileTimes.cxx @@ -2,11 +2,11 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmFileTimes.h" -#include "cm_sys_stat.h" - #include <utility> -#include "cm_memory.hxx" +#include <cm/memory> + +#include "cm_sys_stat.h" #if defined(_WIN32) # include "cmSystemTools.h" diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index fea7e08..17e9869 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -18,7 +18,7 @@ #include <sstream> #include <utility> -#include "cm_memory.hxx" +#include <cm/memory> #include "cmAlgorithms.h" #include "cmMakefile.h" diff --git a/Source/cmForEachCommand.cxx b/Source/cmForEachCommand.cxx index d563a1d..44392ba 100644 --- a/Source/cmForEachCommand.cxx +++ b/Source/cmForEachCommand.cxx @@ -6,9 +6,10 @@ #include <cstdlib> #include <utility> -#include "cm_memory.hxx" +#include <cm/memory> +#include <cm/string_view> + #include "cm_static_string_view.hxx" -#include "cm_string_view.hxx" #include "cmExecutionStatus.h" #include "cmFunctionBlocker.h" diff --git a/Source/cmFunctionBlocker.h b/Source/cmFunctionBlocker.h index 87bdccd..59bb892 100644 --- a/Source/cmFunctionBlocker.h +++ b/Source/cmFunctionBlocker.h @@ -7,7 +7,7 @@ #include <vector> -#include "cm_string_view.hxx" +#include <cm/string_view> #include "cmListFileCache.h" diff --git a/Source/cmFunctionCommand.cxx b/Source/cmFunctionCommand.cxx index fdc5e50..b3ddfe0 100644 --- a/Source/cmFunctionCommand.cxx +++ b/Source/cmFunctionCommand.cxx @@ -5,9 +5,10 @@ #include <sstream> #include <utility> -#include "cm_memory.hxx" +#include <cm/memory> +#include <cm/string_view> + #include "cm_static_string_view.hxx" -#include "cm_string_view.hxx" #include "cmAlgorithms.h" #include "cmExecutionStatus.h" diff --git a/Source/cmGeneratorExpressionEvaluationFile.h b/Source/cmGeneratorExpressionEvaluationFile.h index 06ebeac..c3bc4c8 100644 --- a/Source/cmGeneratorExpressionEvaluationFile.h +++ b/Source/cmGeneratorExpressionEvaluationFile.h @@ -10,9 +10,10 @@ #include <string> #include <vector> +#include "cm_sys_stat.h" + #include "cmGeneratorExpression.h" #include "cmPolicies.h" -#include "cm_sys_stat.h" class cmLocalGenerator; diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index 6cb7a96..d524867 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -29,12 +29,13 @@ #include "cmsys/RegularExpression.hxx" #include "cmsys/String.h" +#include <cm/iterator> + #include <algorithm> #include <cassert> #include <cerrno> #include <cstdlib> #include <cstring> -#include <iterator> #include <map> #include <memory> #include <set> diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index ce9699b..18ca478 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -17,6 +17,8 @@ #include <unordered_set> #include <utility> +#include <cm/string_view> + #include "cmAlgorithms.h" #include "cmComputeLinkInformation.h" #include "cmCustomCommand.h" @@ -42,7 +44,6 @@ #include "cmTarget.h" #include "cmTargetLinkLibraryType.h" #include "cmTargetPropertyComputer.h" -#include "cm_string_view.hxx" #include "cmake.h" class cmMessenger; diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 9ce6324..7bba874 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -12,7 +12,7 @@ #include <iterator> #include <sstream> -#include "cm_memory.hxx" +#include <cm/memory> #include "cmAlgorithms.h" #include "cmDocumentationEntry.h" diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index c7a0330..0b211b8 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -7,7 +7,7 @@ #include <sstream> #include <utility> -#include "cm_memory.hxx" +#include <cm/memory> #include "cmAlgorithms.h" #include "cmDocumentationEntry.h" diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index b355775..92316d3 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -11,10 +11,11 @@ #include "cmState.h" #include "cmStringAlgorithms.h" #include "cmUuid.h" -#include "cm_string_view.hxx" #include "cmake.h" #include "cmsys/Encoding.hxx" +#include <cm/string_view> + #include <assert.h> #include <vector> #include <windows.h> diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index a0ce740..61e8f58 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -10,7 +10,8 @@ #include <shellapi.h> #include <windows.h> -#include "cmAlgorithms.h" +#include <cm/iterator> + #include "cmCallVisualStudioMacro.h" #include "cmCustomCommand.h" #include "cmCustomCommandLines.h" diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 4d41fd7..643cc99 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -9,7 +9,7 @@ #include <iomanip> #include <sstream> -#include "cm_memory.hxx" +#include <cm/memory> #include "cmAlgorithms.h" #include "cmComputeLinkInformation.h" diff --git a/Source/cmIfCommand.cxx b/Source/cmIfCommand.cxx index f719041..b36d96b 100644 --- a/Source/cmIfCommand.cxx +++ b/Source/cmIfCommand.cxx @@ -2,9 +2,10 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmIfCommand.h" -#include "cm_memory.hxx" +#include <cm/memory> +#include <cm/string_view> + #include "cm_static_string_view.hxx" -#include "cm_string_view.hxx" #include "cmConditionEvaluator.h" #include "cmExecutionStatus.h" diff --git a/Source/cmIncludeDirectoryCommand.h b/Source/cmIncludeDirectoryCommand.h index 4df94eb..bcaae9d 100644 --- a/Source/cmIncludeDirectoryCommand.h +++ b/Source/cmIncludeDirectoryCommand.h @@ -8,7 +8,7 @@ #include <string> #include <vector> -#include "cm_memory.hxx" +#include <cm/memory> #include "cmCommand.h" diff --git a/Source/cmInstallCommand.h b/Source/cmInstallCommand.h index 28bf443..9ffb842 100644 --- a/Source/cmInstallCommand.h +++ b/Source/cmInstallCommand.h @@ -8,7 +8,7 @@ #include <string> #include <vector> -#include "cm_memory.hxx" +#include <cm/memory> #include "cmCommand.h" diff --git a/Source/cmLinkDirectoriesCommand.h b/Source/cmLinkDirectoriesCommand.h index 1a439de..489d90f 100644 --- a/Source/cmLinkDirectoriesCommand.h +++ b/Source/cmLinkDirectoriesCommand.h @@ -8,7 +8,7 @@ #include <string> #include <vector> -#include "cm_memory.hxx" +#include <cm/memory> #include "cmCommand.h" diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx index 826abf5..7bf35c3 100644 --- a/Source/cmListCommand.cxx +++ b/Source/cmListCommand.cxx @@ -16,7 +16,8 @@ #include <utility> #include <vector> -#include "cm_memory.hxx" +#include <cm/memory> + #include "cm_static_string_view.hxx" #include "cmAlgorithms.h" diff --git a/Source/cmLoadCacheCommand.h b/Source/cmLoadCacheCommand.h index 45e52f0..37f0372 100644 --- a/Source/cmLoadCacheCommand.h +++ b/Source/cmLoadCacheCommand.h @@ -9,7 +9,7 @@ #include <string> #include <vector> -#include "cm_memory.hxx" +#include <cm/memory> #include "cmCommand.h" diff --git a/Source/cmLoadCommandCommand.cxx b/Source/cmLoadCommandCommand.cxx index 6f5df46..1e02632 100644 --- a/Source/cmLoadCommandCommand.cxx +++ b/Source/cmLoadCommandCommand.cxx @@ -10,7 +10,7 @@ #include <utility> -#include "cm_memory.hxx" +#include <cm/memory> #include "cmCPluginAPI.cxx" #include "cmCPluginAPI.h" diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 31e2dc0..e059548 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -30,7 +30,6 @@ #include "cmTarget.h" #include "cmTestGenerator.h" #include "cmVersion.h" -#include "cm_string_view.hxx" #include "cmake.h" #include "cmsys/RegularExpression.hxx" @@ -39,6 +38,8 @@ # include "cmCryptoHash.h" #endif +#include <cm/string_view> + #include <algorithm> #include <cassert> #include <cstdio> diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 0be1de5..a7be04e 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -9,7 +9,7 @@ #include <sstream> #include <utility> -#include "cm_memory.hxx" +#include <cm/memory> #include "cmAlgorithms.h" #include "cmCustomCommand.h" // IWYU pragma: keep diff --git a/Source/cmMachO.cxx b/Source/cmMachO.cxx index bec3ad8..ee5eb00 100644 --- a/Source/cmMachO.cxx +++ b/Source/cmMachO.cxx @@ -9,7 +9,7 @@ #include <string> #include <vector> -#include "cm_memory.hxx" +#include <cm/memory> // Include the Mach-O format information system header. #include <mach-o/fat.h> diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx index af97761..ba9947a 100644 --- a/Source/cmMacroCommand.cxx +++ b/Source/cmMacroCommand.cxx @@ -5,9 +5,10 @@ #include <cstdio> #include <utility> -#include "cm_memory.hxx" +#include <cm/memory> +#include <cm/string_view> + #include "cm_static_string_view.hxx" -#include "cm_string_view.hxx" #include "cmAlgorithms.h" #include "cmExecutionStatus.h" diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index e6bb25c..34081ed 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -10,12 +10,11 @@ #include <cstdio> #include <cstdlib> #include <cstring> -#include <iterator> -#include <memory> #include <sstream> #include <utility> -#include "cm_memory.hxx" +#include <cm/iterator> +#include <cm/memory> #include "cmAlgorithms.h" #include "cmCommandArgumentParserHelper.h" diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 42a769a..db37477 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -17,7 +17,7 @@ #include <unordered_map> #include <vector> -#include "cm_string_view.hxx" +#include <cm/string_view> #include "cmAlgorithms.h" #include "cmListFileCache.h" diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx index e44ca7b..91bd47e 100644 --- a/Source/cmMakefileExecutableTargetGenerator.cxx +++ b/Source/cmMakefileExecutableTargetGenerator.cxx @@ -8,7 +8,7 @@ #include <utility> #include <vector> -#include "cm_memory.hxx" +#include <cm/memory> #include "cmAlgorithms.h" #include "cmGeneratedFileStream.h" diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index b37a933..faa0d67 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -8,7 +8,7 @@ #include <utility> #include <vector> -#include "cm_memory.hxx" +#include <cm/memory> #include "cmAlgorithms.h" #include "cmGeneratedFileStream.h" diff --git a/Source/cmMakefileUtilityTargetGenerator.cxx b/Source/cmMakefileUtilityTargetGenerator.cxx index d4045b3..47e2665 100644 --- a/Source/cmMakefileUtilityTargetGenerator.cxx +++ b/Source/cmMakefileUtilityTargetGenerator.cxx @@ -7,7 +7,7 @@ #include <utility> #include <vector> -#include "cm_memory.hxx" +#include <cm/memory> #include "cmGeneratedFileStream.h" #include "cmGeneratorTarget.h" diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index 97742c1..bd5abd1 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -10,7 +10,7 @@ #include <sstream> #include <utility> -#include "cm_memory.hxx" +#include <cm/memory> #include "cmAlgorithms.h" #include "cmCustomCommand.h" // IWYU pragma: keep diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 84a98fd..2ab5adf 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -11,7 +11,7 @@ #include <ostream> #include <utility> -#include "cm_memory.hxx" +#include <cm/memory> #include "cmAlgorithms.h" #include "cmComputeLinkInformation.h" diff --git a/Source/cmOutputConverter.h b/Source/cmOutputConverter.h index 671efe7..c2053c7 100644 --- a/Source/cmOutputConverter.h +++ b/Source/cmOutputConverter.h @@ -6,7 +6,8 @@ #include "cmConfigure.h" // IWYU pragma: keep #include "cmStateSnapshot.h" -#include "cm_string_view.hxx" + +#include <cm/string_view> #include <string> diff --git a/Source/cmParseArgumentsCommand.cxx b/Source/cmParseArgumentsCommand.cxx index 0b320b6..c802fb4 100644 --- a/Source/cmParseArgumentsCommand.cxx +++ b/Source/cmParseArgumentsCommand.cxx @@ -14,7 +14,7 @@ #include "cmRange.h" #include "cmStringAlgorithms.h" #include "cmSystemTools.h" -#include "cm_string_view.hxx" +#include <cm/string_view> static std::string EscapeArg(const std::string& arg) { diff --git a/Source/cmProjectCommand.h b/Source/cmProjectCommand.h index 8b9bcc8..ffbd330 100644 --- a/Source/cmProjectCommand.h +++ b/Source/cmProjectCommand.h @@ -8,7 +8,7 @@ #include <string> #include <vector> -#include "cm_memory.hxx" +#include <cm/memory> #include "cmCommand.h" diff --git a/Source/cmQtAutoGen.h b/Source/cmQtAutoGen.h index 71969ee..2a28c1e 100644 --- a/Source/cmQtAutoGen.h +++ b/Source/cmQtAutoGen.h @@ -5,7 +5,7 @@ #include "cmConfigure.h" // IWYU pragma: keep -#include "cm_string_view.hxx" +#include <cm/string_view> #include <memory> #include <string> diff --git a/Source/cmQtAutoGenGlobalInitializer.cxx b/Source/cmQtAutoGenGlobalInitializer.cxx index abc69d0..576a034 100644 --- a/Source/cmQtAutoGenGlobalInitializer.cxx +++ b/Source/cmQtAutoGenGlobalInitializer.cxx @@ -17,7 +17,7 @@ #include "cmSystemTools.h" #include "cmTarget.h" -#include "cm_memory.hxx" +#include <cm/memory> #include <utility> diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx index ad4e4d5..9045722 100644 --- a/Source/cmQtAutoGenInitializer.cxx +++ b/Source/cmQtAutoGenInitializer.cxx @@ -41,7 +41,7 @@ #include <utility> #include <vector> -#include "cm_memory.hxx" +#include <cm/memory> namespace { diff --git a/Source/cmQtAutoGenInitializer.h b/Source/cmQtAutoGenInitializer.h index bedda30..7ce9fad 100644 --- a/Source/cmQtAutoGenInitializer.h +++ b/Source/cmQtAutoGenInitializer.h @@ -6,7 +6,8 @@ #include "cmConfigure.h" // IWYU pragma: keep #include "cmGeneratedFileStream.h" #include "cmQtAutoGen.h" -#include "cm_string_view.hxx" + +#include <cm/string_view> #include <map> #include <memory> diff --git a/Source/cmQtAutoGenerator.cxx b/Source/cmQtAutoGenerator.cxx index 086b68c..eb829fa 100644 --- a/Source/cmQtAutoGenerator.cxx +++ b/Source/cmQtAutoGenerator.cxx @@ -2,7 +2,8 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmQtAutoGenerator.h" -#include "cm_memory.hxx" +#include <cm/memory> + #include "cmsys/FStream.hxx" #include "cmGlobalGenerator.h" diff --git a/Source/cmQtAutoGenerator.h b/Source/cmQtAutoGenerator.h index 371b25c..f60acb0 100644 --- a/Source/cmQtAutoGenerator.h +++ b/Source/cmQtAutoGenerator.h @@ -7,7 +7,8 @@ #include "cmFileTime.h" #include "cmQtAutoGen.h" -#include "cm_string_view.hxx" + +#include <cm/string_view> #include <mutex> #include <string> diff --git a/Source/cmQtAutoMocUic.cxx b/Source/cmQtAutoMocUic.cxx index 4e4875e..5cd1ba1 100644 --- a/Source/cmQtAutoMocUic.cxx +++ b/Source/cmQtAutoMocUic.cxx @@ -2,6 +2,12 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmQtAutoMocUic.h" +#include <algorithm> +#include <set> +#include <utility> + +#include <cm/memory> + #include "cmAlgorithms.h" #include "cmCryptoHash.h" #include "cmGeneratedFileStream.h" @@ -9,13 +15,9 @@ #include "cmQtAutoGen.h" #include "cmStringAlgorithms.h" #include "cmSystemTools.h" -#include "cm_memory.hxx" #include "cmake.h" #include "cmsys/FStream.hxx" -#include <algorithm> -#include <set> -#include <utility> #if defined(__APPLE__) # include <unistd.h> #endif diff --git a/Source/cmQtAutoMocUic.h b/Source/cmQtAutoMocUic.h index 43123f2..15b66ca 100644 --- a/Source/cmQtAutoMocUic.h +++ b/Source/cmQtAutoMocUic.h @@ -9,9 +9,10 @@ #include "cmQtAutoGen.h" #include "cmQtAutoGenerator.h" #include "cmWorkerPool.h" -#include "cm_string_view.hxx" #include "cmsys/RegularExpression.hxx" +#include <cm/string_view> + #include <atomic> #include <cstddef> #include <map> diff --git a/Source/cmQtAutoRcc.cxx b/Source/cmQtAutoRcc.cxx index cd3e034..1bf8ca4 100644 --- a/Source/cmQtAutoRcc.cxx +++ b/Source/cmQtAutoRcc.cxx @@ -11,7 +11,8 @@ #include "cmQtAutoGen.h" #include "cmStringAlgorithms.h" #include "cmSystemTools.h" -#include "cm_string_view.hxx" + +#include <cm/string_view> #include <algorithm> diff --git a/Source/cmRuntimeDependencyArchive.cxx b/Source/cmRuntimeDependencyArchive.cxx index 1b3f387..ed2e3e4 100644 --- a/Source/cmRuntimeDependencyArchive.cxx +++ b/Source/cmRuntimeDependencyArchive.cxx @@ -27,7 +27,7 @@ #include <utility> #include <vector> -#include "cm_memory.hxx" +#include <cm/memory> #if defined(_WIN32) static void AddVisualStudioPath(std::vector<std::string>& paths, diff --git a/Source/cmServer.cxx b/Source/cmServer.cxx index 9df1883..f150cf3 100644 --- a/Source/cmServer.cxx +++ b/Source/cmServer.cxx @@ -20,7 +20,8 @@ #include <mutex> #include <utility> -#include "cm_memory.hxx" +#include <cm/memory> +#include <cm/shared_mutex> void on_signal(uv_signal_t* signal, int signum) { diff --git a/Source/cmServer.h b/Source/cmServer.h index ab2ad23..9b12604 100644 --- a/Source/cmServer.h +++ b/Source/cmServer.h @@ -5,11 +5,12 @@ #include "cmConfigure.h" // IWYU pragma: keep #include "cm_jsoncpp_value.h" -#include "cm_thread.hxx" #include "cm_uv.h" #include "cmUVHandlePtr.h" +#include <cm/shared_mutex> + #include <memory> #include <string> #include <vector> diff --git a/Source/cmServerProtocol.cxx b/Source/cmServerProtocol.cxx index d576f36..f889129 100644 --- a/Source/cmServerProtocol.cxx +++ b/Source/cmServerProtocol.cxx @@ -23,7 +23,7 @@ #include <utility> #include <vector> -#include "cm_memory.hxx" +#include <cm/memory> // Get rid of some windows macros: #undef max diff --git a/Source/cmSetTargetPropertiesCommand.h b/Source/cmSetTargetPropertiesCommand.h index 7e4606e..e77b752 100644 --- a/Source/cmSetTargetPropertiesCommand.h +++ b/Source/cmSetTargetPropertiesCommand.h @@ -8,7 +8,7 @@ #include <string> #include <vector> -#include "cm_memory.hxx" +#include <cm/memory> #include "cmCommand.h" diff --git a/Source/cmSourceGroupCommand.h b/Source/cmSourceGroupCommand.h index 87a6114..6273d92 100644 --- a/Source/cmSourceGroupCommand.h +++ b/Source/cmSourceGroupCommand.h @@ -9,7 +9,7 @@ #include <string> #include <vector> -#include "cm_memory.hxx" +#include <cm/memory> #include "cmCommand.h" diff --git a/Source/cmState.cxx b/Source/cmState.cxx index 7463bf8..93ad2d7 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -9,7 +9,7 @@ #include <cstring> #include <utility> -#include "cm_memory.hxx" +#include <cm/memory> #include "cmCacheManager.h" #include "cmCommand.h" diff --git a/Source/cmStateDirectory.cxx b/Source/cmStateDirectory.cxx index ede00a0..1262f53 100644 --- a/Source/cmStateDirectory.cxx +++ b/Source/cmStateDirectory.cxx @@ -5,9 +5,10 @@ #include <algorithm> #include <cassert> -#include <iterator> #include <vector> +#include <cm/iterator> + #include "cmAlgorithms.h" #include "cmProperty.h" #include "cmPropertyMap.h" @@ -177,7 +178,7 @@ cmStringRange GetPropertyContent(T const& content, U contentEndPosition) { auto end = content.begin() + contentEndPosition; - auto rbegin = cmMakeReverseIterator(end); + auto rbegin = cm::make_reverse_iterator(end); rbegin = std::find(rbegin, content.rend(), cmPropertySentinal); return cmMakeRange(rbegin.base(), end); @@ -189,7 +190,7 @@ cmBacktraceRange GetPropertyBacktraces(T const& content, U const& backtraces, { auto entryEnd = content.begin() + contentEndPosition; - auto rbegin = cmMakeReverseIterator(entryEnd); + auto rbegin = cm::make_reverse_iterator(entryEnd); rbegin = std::find(rbegin, content.rend(), cmPropertySentinal); auto it = backtraces.begin() + std::distance(content.begin(), rbegin.base()); @@ -270,7 +271,7 @@ void cmStateDirectory::PrependIncludeDirectoriesEntry( this->Snapshot_.Position->IncludeDirectoryPosition; auto rend = this->DirectoryState->IncludeDirectories.rend(); - auto rbegin = cmMakeReverseIterator(entryEnd); + auto rbegin = cm::make_reverse_iterator(entryEnd); rbegin = std::find(rbegin, rend, cmPropertySentinal); auto entryIt = rbegin.base(); @@ -440,7 +441,7 @@ void cmStateDirectory::PrependLinkDirectoriesEntry( this->Snapshot_.Position->LinkDirectoriesPosition; auto rend = this->DirectoryState->LinkDirectories.rend(); - auto rbegin = cmMakeReverseIterator(entryEnd); + auto rbegin = cm::make_reverse_iterator(entryEnd); rbegin = std::find(rbegin, rend, cmPropertySentinal); auto entryIt = rbegin.base(); diff --git a/Source/cmStateSnapshot.cxx b/Source/cmStateSnapshot.cxx index 28d5170..645907c 100644 --- a/Source/cmStateSnapshot.cxx +++ b/Source/cmStateSnapshot.cxx @@ -5,10 +5,10 @@ #include <algorithm> #include <cassert> -#include <iterator> #include <string> -#include "cmAlgorithms.h" +#include <cm/iterator> + #include "cmDefinitions.h" #include "cmListFileCache.h" #include "cmPropertyMap.h" @@ -279,7 +279,7 @@ void InitializeContentFromParent(T& parentContent, T& thisContent, auto parentBegin = parentContent.begin(); auto parentEnd = parentContent.end(); - auto parentRbegin = cmMakeReverseIterator(parentEnd); + auto parentRbegin = cm::make_reverse_iterator(parentEnd); auto parentRend = parentContent.rend(); parentRbegin = std::find(parentRbegin, parentRend, cmPropertySentinal); auto parentIt = parentRbegin.base(); diff --git a/Source/cmStateSnapshot.h b/Source/cmStateSnapshot.h index da39127..021fd53 100644 --- a/Source/cmStateSnapshot.h +++ b/Source/cmStateSnapshot.h @@ -9,7 +9,7 @@ #include <string> #include <vector> -#include "cm_string_view.hxx" +#include <cm/string_view> #include "cmLinkedTree.h" #include "cmPolicies.h" diff --git a/Source/cmString.hxx b/Source/cmString.hxx index a401ad1..6223b78 100644 --- a/Source/cmString.hxx +++ b/Source/cmString.hxx @@ -6,7 +6,7 @@ #include "cmConfigure.h" // IWYU pragma: keep #include "cm_static_string_view.hxx" -#include "cm_string_view.hxx" +#include <cm/string_view> #include <algorithm> #include <cstddef> diff --git a/Source/cmStringAlgorithms.h b/Source/cmStringAlgorithms.h index cb6b8ba..6631e98 100644 --- a/Source/cmStringAlgorithms.h +++ b/Source/cmStringAlgorithms.h @@ -6,7 +6,9 @@ #include "cmConfigure.h" // IWYU pragma: keep #include "cmRange.h" -#include "cm_string_view.hxx" + +#include <cm/string_view> + #include <cctype> #include <cstring> #include <initializer_list> diff --git a/Source/cmStringCommand.cxx b/Source/cmStringCommand.cxx index 809d05e..28616c2 100644 --- a/Source/cmStringCommand.cxx +++ b/Source/cmStringCommand.cxx @@ -9,12 +9,12 @@ #include <cctype> #include <cstdio> #include <cstdlib> -#include <iterator> #include <memory> +#include <cm/iterator> + #include "cm_static_string_view.hxx" -#include "cmAlgorithms.h" #include "cmCryptoHash.h" #include "cmExecutionStatus.h" #include "cmGeneratorExpression.h" diff --git a/Source/cmSubcommandTable.h b/Source/cmSubcommandTable.h index 21342bb..6e39a1f 100644 --- a/Source/cmSubcommandTable.h +++ b/Source/cmSubcommandTable.h @@ -6,7 +6,8 @@ #include "cmConfigure.h" // IWYU pragma: keep #include "cm_static_string_view.hxx" -#include "cm_string_view.hxx" + +#include <cm/string_view> #include <initializer_list> #include <string> diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h index e7eef33..108215c 100644 --- a/Source/cmSystemTools.h +++ b/Source/cmSystemTools.h @@ -8,9 +8,9 @@ #include "cmCryptoHash.h" #include "cmDuration.h" #include "cmProcessOutput.h" -#include "cm_string_view.hxx" #include "cmsys/Process.h" #include "cmsys/SystemTools.hxx" // IWYU pragma: export +#include <cm/string_view> #include <cstddef> #include <functional> #include <string> diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index c56aa9d..1b88db6 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -12,7 +12,7 @@ #include <sstream> #include <unordered_set> -#include "cm_memory.hxx" +#include <cm/memory> #include "cmAlgorithms.h" #include "cmCustomCommand.h" diff --git a/Source/cmTargetCompileDefinitionsCommand.h b/Source/cmTargetCompileDefinitionsCommand.h index 25af21d..f85dc0a 100644 --- a/Source/cmTargetCompileDefinitionsCommand.h +++ b/Source/cmTargetCompileDefinitionsCommand.h @@ -8,7 +8,7 @@ #include <string> #include <vector> -#include "cm_memory.hxx" +#include <cm/memory> #include "cmCommand.h" #include "cmTargetPropCommandBase.h" diff --git a/Source/cmTargetCompileFeaturesCommand.h b/Source/cmTargetCompileFeaturesCommand.h index 07948fa..39597ca 100644 --- a/Source/cmTargetCompileFeaturesCommand.h +++ b/Source/cmTargetCompileFeaturesCommand.h @@ -8,7 +8,7 @@ #include <string> #include <vector> -#include "cm_memory.hxx" +#include <cm/memory> #include "cmCommand.h" #include "cmTargetPropCommandBase.h" diff --git a/Source/cmTargetCompileOptionsCommand.h b/Source/cmTargetCompileOptionsCommand.h index a571cfb..b328ba2 100644 --- a/Source/cmTargetCompileOptionsCommand.h +++ b/Source/cmTargetCompileOptionsCommand.h @@ -8,7 +8,7 @@ #include <string> #include <vector> -#include "cm_memory.hxx" +#include <cm/memory> #include "cmCommand.h" #include "cmTargetPropCommandBase.h" diff --git a/Source/cmTargetIncludeDirectoriesCommand.h b/Source/cmTargetIncludeDirectoriesCommand.h index 6defab2..f6481db 100644 --- a/Source/cmTargetIncludeDirectoriesCommand.h +++ b/Source/cmTargetIncludeDirectoriesCommand.h @@ -8,7 +8,7 @@ #include <string> #include <vector> -#include "cm_memory.hxx" +#include <cm/memory> #include "cmCommand.h" #include "cmTargetPropCommandBase.h" diff --git a/Source/cmTargetLinkDirectoriesCommand.h b/Source/cmTargetLinkDirectoriesCommand.h index a2fcfa9..a651d73 100644 --- a/Source/cmTargetLinkDirectoriesCommand.h +++ b/Source/cmTargetLinkDirectoriesCommand.h @@ -8,7 +8,7 @@ #include <string> #include <vector> -#include "cm_memory.hxx" +#include <cm/memory> #include "cmCommand.h" #include "cmTargetPropCommandBase.h" diff --git a/Source/cmTargetLinkLibrariesCommand.h b/Source/cmTargetLinkLibrariesCommand.h index 6698ce0..caf2cf4 100644 --- a/Source/cmTargetLinkLibrariesCommand.h +++ b/Source/cmTargetLinkLibrariesCommand.h @@ -8,7 +8,7 @@ #include <string> #include <vector> -#include "cm_memory.hxx" +#include <cm/memory> #include "cmCommand.h" #include "cmTargetLinkLibraryType.h" diff --git a/Source/cmTargetLinkOptionsCommand.h b/Source/cmTargetLinkOptionsCommand.h index 3710739..918a8d7 100644 --- a/Source/cmTargetLinkOptionsCommand.h +++ b/Source/cmTargetLinkOptionsCommand.h @@ -8,7 +8,7 @@ #include <string> #include <vector> -#include "cm_memory.hxx" +#include <cm/memory> #include "cmCommand.h" #include "cmTargetPropCommandBase.h" diff --git a/Source/cmTargetPrecompileHeadersCommand.h b/Source/cmTargetPrecompileHeadersCommand.h index 1ddf2af..7e4558e 100644 --- a/Source/cmTargetPrecompileHeadersCommand.h +++ b/Source/cmTargetPrecompileHeadersCommand.h @@ -8,7 +8,7 @@ #include <string> #include <vector> -#include "cm_memory.hxx" +#include <cm/memory> #include "cmCommand.h" diff --git a/Source/cmTargetSourcesCommand.h b/Source/cmTargetSourcesCommand.h index 90fd45f..1cff8c3 100644 --- a/Source/cmTargetSourcesCommand.h +++ b/Source/cmTargetSourcesCommand.h @@ -8,7 +8,7 @@ #include <string> #include <vector> -#include "cm_memory.hxx" +#include <cm/memory> #include "cmCommand.h" #include "cmTargetPropCommandBase.h" diff --git a/Source/cmTryCompileCommand.h b/Source/cmTryCompileCommand.h index ec9f8b8..e525e85 100644 --- a/Source/cmTryCompileCommand.h +++ b/Source/cmTryCompileCommand.h @@ -8,7 +8,7 @@ #include <string> #include <vector> -#include "cm_memory.hxx" +#include <cm/memory> #include "cmCommand.h" #include "cmCoreTryCompile.h" diff --git a/Source/cmTryRunCommand.h b/Source/cmTryRunCommand.h index bacfcdb..c53a694 100644 --- a/Source/cmTryRunCommand.h +++ b/Source/cmTryRunCommand.h @@ -8,7 +8,7 @@ #include <string> #include <vector> -#include "cm_memory.hxx" +#include <cm/memory> #include "cmCommand.h" #include "cmCoreTryCompile.h" diff --git a/Source/cmUVProcessChain.cxx b/Source/cmUVProcessChain.cxx index 2c37a64..3adc47a 100644 --- a/Source/cmUVProcessChain.cxx +++ b/Source/cmUVProcessChain.cxx @@ -13,7 +13,7 @@ #include <iterator> #include <utility> -#include "cm_memory.hxx" +#include <cm/memory> struct cmUVProcessChain::InternalData { diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index ba72294..4b83595 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -21,7 +21,7 @@ #include <iterator> #include <set> -#include "cm_memory.hxx" +#include <cm/memory> static void ConvertToWindowsSlash(std::string& s); diff --git a/Source/cmVisualStudioGeneratorOptions.cxx b/Source/cmVisualStudioGeneratorOptions.cxx index 3e423e9..1139aa9 100644 --- a/Source/cmVisualStudioGeneratorOptions.cxx +++ b/Source/cmVisualStudioGeneratorOptions.cxx @@ -1,5 +1,7 @@ #include "cmVisualStudioGeneratorOptions.h" +#include <cm/iterator> + #include "cmAlgorithms.h" #include "cmLocalVisualStudioGenerator.h" #include "cmOutputConverter.h" @@ -269,8 +271,8 @@ void cmVisualStudioGeneratorOptions::FixManifestUACFlags() } if (keyValue[1].front() == '\'' && keyValue[1].back() == '\'') { - keyValue[1] = - keyValue[1].substr(1, std::max(0, cm::isize(keyValue[1]) - 2)); + keyValue[1] = keyValue[1].substr( + 1, std::max(std::string::size_type(0), keyValue[1].length() - 2)); } if (keyValue[0] == "level") { diff --git a/Source/cmWhileCommand.cxx b/Source/cmWhileCommand.cxx index a396852..bd71546 100644 --- a/Source/cmWhileCommand.cxx +++ b/Source/cmWhileCommand.cxx @@ -2,9 +2,10 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmWhileCommand.h" -#include "cm_memory.hxx" +#include <cm/memory> +#include <cm/string_view> + #include "cm_static_string_view.hxx" -#include "cm_string_view.hxx" #include "cmConditionEvaluator.h" #include "cmExecutionStatus.h" diff --git a/Source/cmWorkerPool.cxx b/Source/cmWorkerPool.cxx index 5ac81df..9d279ab 100644 --- a/Source/cmWorkerPool.cxx +++ b/Source/cmWorkerPool.cxx @@ -17,7 +17,7 @@ #include <mutex> #include <thread> -#include "cm_memory.hxx" +#include <cm/memory> /** * @brief libuv pipe buffer class diff --git a/Source/cmWorkerPool.h b/Source/cmWorkerPool.h index bf07299..9179922 100644 --- a/Source/cmWorkerPool.h +++ b/Source/cmWorkerPool.h @@ -10,7 +10,7 @@ #include <utility> #include <vector> -#include "cm_memory.hxx" +#include <cm/memory> // -- Types class cmWorkerPoolInternal; diff --git a/Source/cmWriteFileCommand.cxx b/Source/cmWriteFileCommand.cxx index fdf07bb..264dd3f 100644 --- a/Source/cmWriteFileCommand.cxx +++ b/Source/cmWriteFileCommand.cxx @@ -2,13 +2,14 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmWriteFileCommand.h" +#include "cm_sys_stat.h" + #include "cmsys/FStream.hxx" #include "cmExecutionStatus.h" #include "cmMakefile.h" #include "cmStringAlgorithms.h" #include "cmSystemTools.h" -#include "cm_sys_stat.h" // cmLibraryCommand bool cmWriteFileCommand(std::vector<std::string> const& args, diff --git a/Source/cm_memory.hxx b/Source/cm_memory.hxx deleted file mode 100644 index 9f5e678..0000000 --- a/Source/cm_memory.hxx +++ /dev/null @@ -1,31 +0,0 @@ -/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying - file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cm_memory_hxx -#define cm_memory_hxx - -#include "cmConfigure.h" // IWYU pragma: keep - -#include <memory> // IWYU pragma: export -#if !defined(CMake_HAVE_CXX_MAKE_UNIQUE) -# include <utility> -#endif - -namespace cm { - -#if defined(CMake_HAVE_CXX_MAKE_UNIQUE) - -using std::make_unique; - -#else - -template <typename T, typename... Args> -std::unique_ptr<T> make_unique(Args&&... args) -{ - return std::unique_ptr<T>(new T(std::forward<Args>(args)...)); -} - -#endif - -} // namespace cm - -#endif diff --git a/Source/cm_optional.hxx b/Source/cm_optional.hxx deleted file mode 100644 index 295571d..0000000 --- a/Source/cm_optional.hxx +++ /dev/null @@ -1,343 +0,0 @@ -/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying - file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cm_optional_hxx -#define cm_optional_hxx - -#include "cmConfigure.h" // IWYU pragma: keep - -#if __cplusplus >= 201703L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) -# define CMake_HAVE_CXX_OPTIONAL -#endif - -#if defined(CMake_HAVE_CXX_OPTIONAL) -# include <optional> -#else -# include "cm_utility.hxx" -# include <memory> -# include <utility> -#endif - -namespace cm { - -#if defined(CMake_HAVE_CXX_OPTIONAL) - -using std::nullopt_t; -using std::nullopt; -using std::optional; -using std::bad_optional_access; -using std::make_optional; - -#else - -class bad_optional_access : public std::exception -{ - using std::exception::exception; -}; - -struct nullopt_t -{ - explicit constexpr nullopt_t(int) {} -}; - -constexpr nullopt_t nullopt{ 0 }; - -template <typename T> -class optional -{ -public: - using value_type = T; - - optional() noexcept = default; - optional(nullopt_t) noexcept; - optional(const optional& other); - optional(optional&& other) noexcept; - - template <typename... Args> - explicit optional(cm::in_place_t, Args&&... args); - - template < - typename U = T, - typename = typename std::enable_if< - std::is_constructible<T, U&&>::value && - !std::is_same<typename std::decay<U>::type, cm::in_place_t>::value && - !std::is_same<typename std::decay<U>::type, - cm::optional<T>>::value>::type> - optional(U&& v); - - ~optional(); - - optional& operator=(nullopt_t) noexcept; - optional& operator=(const optional& other); - optional& operator=(optional&& other) noexcept; - - template < - typename U = T, - typename = typename std::enable_if< - !std::is_same<typename std::decay<U>::type, cm::optional<T>>::value && - std::is_constructible<T, U>::value && std::is_assignable<T&, U>::value && - (!std::is_scalar<T>::value || - !std::is_same<typename std::decay<U>::type, T>::value)>::type> - optional& operator=(U&& v); - - const T* operator->() const; - T* operator->(); - const T& operator*() const&; - T& operator*() &; - const T&& operator*() const&&; - T&& operator*() &&; - - explicit operator bool() const noexcept; - bool has_value() const noexcept; - - T& value() &; - const T& value() const&; - - T&& value() &&; - const T&& value() const&&; - - template <typename U> - T value_or(U&& default_value) const&; - - template <typename U> - T value_or(U&& default_value) &&; - - void swap(optional& other) noexcept; - void reset() noexcept; - - template <typename... Args> - T& emplace(Args&&... args); - -private: - bool _has_value = false; - std::allocator<T> _allocator; - union _mem_union - { - T value; - - // Explicit constructor and destructor is required to make this work - _mem_union() noexcept {} - ~_mem_union() noexcept {} - } _mem; -}; - -template <typename T> -optional<typename std::decay<T>::type> make_optional(T&& value) -{ - return optional<typename std::decay<T>::type>(std::forward<T>(value)); -} - -template <typename T, class... Args> -optional<T> make_optional(Args&&... args) -{ - return optional<T>(in_place, std::forward<Args>(args)...); -} - -template <typename T> -optional<T>::optional(nullopt_t) noexcept -{ -} - -template <typename T> -optional<T>::optional(const optional& other) -{ - *this = other; -} - -template <typename T> -optional<T>::optional(optional&& other) noexcept -{ - *this = std::move(other); -} - -template <typename T> -template <typename... Args> -optional<T>::optional(cm::in_place_t, Args&&... args) -{ - this->emplace(std::forward<Args>(args)...); -} - -template <typename T> -template <typename U, typename> -optional<T>::optional(U&& v) -{ - this->emplace(std::forward<U>(v)); -} - -template <typename T> -optional<T>::~optional() -{ - this->reset(); -} - -template <typename T> -optional<T>& optional<T>::operator=(nullopt_t) noexcept -{ - this->reset(); - return *this; -} - -template <typename T> -optional<T>& optional<T>::operator=(const optional& other) -{ - if (other.has_value()) { - if (this->has_value()) { - this->value() = *other; - } else { - this->emplace(*other); - } - } else { - this->reset(); - } - return *this; -} - -template <typename T> -optional<T>& optional<T>::operator=(optional&& other) noexcept -{ - if (other.has_value()) { - if (this->has_value()) { - this->value() = std::move(*other); - } else { - this->emplace(std::move(*other)); - } - } else { - this->reset(); - } - return *this; -} - -template <typename T> -template <typename U, typename> -optional<T>& optional<T>::operator=(U&& v) -{ - if (this->has_value()) { - this->value() = v; - } else { - this->emplace(std::forward<U>(v)); - } - return *this; -} - -template <typename T> -const T* optional<T>::operator->() const -{ - return &**this; -} - -template <typename T> -T* optional<T>::operator->() -{ - return &**this; -} - -template <typename T> -const T& optional<T>::operator*() const& -{ - return this->_mem.value; -} - -template <typename T> -T& optional<T>::operator*() & -{ - return this->_mem.value; -} - -template <typename T> -const T&& optional<T>::operator*() const&& -{ - return std::move(**this); -} - -template <typename T> -T&& optional<T>::operator*() && -{ - return std::move(**this); -} - -template <typename T> -bool optional<T>::has_value() const noexcept -{ - return this->_has_value; -} - -template <typename T> -optional<T>::operator bool() const noexcept -{ - return this->has_value(); -} - -template <typename T> -T& optional<T>::value() & -{ - if (!this->has_value()) { - throw cm::bad_optional_access{}; - } - return **this; -} - -template <typename T> -const T& optional<T>::value() const& -{ - if (!this->has_value()) { - throw cm::bad_optional_access{}; - } - return **this; -} - -template <typename T> -template <typename U> -T optional<T>::value_or(U&& default_value) const& -{ - return bool(*this) ? **this : static_cast<T>(std::forward<U>(default_value)); -} - -template <typename T> -template <typename U> -T optional<T>::value_or(U&& default_value) && -{ - return bool(*this) ? std::move(**this) - : static_cast<T>(std::forward<U>(default_value)); -} - -template <typename T> -void optional<T>::swap(optional& other) noexcept -{ - if (this->has_value()) { - if (other.has_value()) { - using std::swap; - swap(**this, *other); - } else { - other.emplace(std::move(**this)); - this->reset(); - } - } else if (other.has_value()) { - this->emplace(std::move(*other)); - other.reset(); - } -} - -template <typename T> -void optional<T>::reset() noexcept -{ - if (this->has_value()) { - this->_has_value = false; - std::allocator_traits<std::allocator<T>>::destroy(this->_allocator, - &**this); - } -} - -template <typename T> -template <typename... Args> -T& optional<T>::emplace(Args&&... args) -{ - this->reset(); - std::allocator_traits<std::allocator<T>>::construct( - this->_allocator, &**this, std::forward<Args>(args)...); - this->_has_value = true; - return this->value(); -} - -#endif -} - -#endif diff --git a/Source/cm_static_string_view.hxx b/Source/cm_static_string_view.hxx index 1bef0c6..8351cd7 100644 --- a/Source/cm_static_string_view.hxx +++ b/Source/cm_static_string_view.hxx @@ -5,7 +5,7 @@ #include "cmConfigure.h" // IWYU pragma: keep -#include "cm_string_view.hxx" +#include <cm/string_view> #include <cstddef> diff --git a/Source/cm_string_view.cxx b/Source/cm_string_view.cxx deleted file mode 100644 index 61fa80e..0000000 --- a/Source/cm_string_view.cxx +++ /dev/null @@ -1,301 +0,0 @@ -/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying - file Copyright.txt or https://cmake.org/licensing for details. */ - -#include "cm_string_view.hxx" - -#ifndef CMake_HAVE_CXX_STRING_VIEW - -# include "cm_kwiml.h" - -# include <algorithm> -# include <ostream> -# include <stdexcept> - -namespace cm { - -string_view::const_reference string_view::at(size_type pos) const -{ - if (pos >= size_) { - throw std::out_of_range("Index out of range in string_view::at"); - } - return data_[pos]; -} - -string_view::size_type string_view::copy(char* dest, size_type count, - size_type pos) const -{ - if (pos > size_) { - throw std::out_of_range("Index out of range in string_view::copy"); - } - size_type const rcount = std::min(count, size_ - pos); - traits_type::copy(dest, data_ + pos, rcount); - return rcount; -} - -string_view string_view::substr(size_type pos, size_type count) const -{ - if (pos > size_) { - throw std::out_of_range("Index out of range in string_view::substr"); - } - size_type const rcount = std::min(count, size_ - pos); - return string_view(data_ + pos, rcount); -} - -int string_view::compare(string_view v) const noexcept -{ - size_type const rlen = std::min(size_, v.size_); - int c = traits_type::compare(data_, v.data_, rlen); - if (c == 0) { - if (size_ < v.size_) { - c = -1; - } else if (size_ > v.size_) { - c = 1; - } - } - return c; -} - -int string_view::compare(size_type pos1, size_type count1, string_view v) const -{ - return substr(pos1, count1).compare(v); -} - -int string_view::compare(size_type pos1, size_type count1, string_view v, - size_type pos2, size_type count2) const -{ - return substr(pos1, count1).compare(v.substr(pos2, count2)); -} - -int string_view::compare(const char* s) const -{ - return compare(string_view(s)); -} - -int string_view::compare(size_type pos1, size_type count1, const char* s) const -{ - return substr(pos1, count1).compare(string_view(s)); -} - -int string_view::compare(size_type pos1, size_type count1, const char* s, - size_type count2) const -{ - return substr(pos1, count1).compare(string_view(s, count2)); -} - -string_view::size_type string_view::find(string_view v, size_type pos) const - noexcept -{ - for (; pos + v.size_ <= size_; ++pos) { - if (std::char_traits<char>::compare(data_ + pos, v.data_, v.size_) == 0) { - return pos; - } - } - return npos; -} - -string_view::size_type string_view::find(char c, size_type pos) const noexcept -{ - return find(string_view(&c, 1), pos); -} - -string_view::size_type string_view::find(const char* s, size_type pos, - size_type count) const -{ - return find(string_view(s, count), pos); -} - -string_view::size_type string_view::find(const char* s, size_type pos) const -{ - return find(string_view(s), pos); -} - -string_view::size_type string_view::rfind(string_view v, size_type pos) const - noexcept -{ - if (size_ >= v.size_) { - for (pos = std::min(pos, size_ - v.size_) + 1; pos > 0;) { - --pos; - if (std::char_traits<char>::compare(data_ + pos, v.data_, v.size_) == - 0) { - return pos; - } - } - } - return npos; -} - -string_view::size_type string_view::rfind(char c, size_type pos) const noexcept -{ - return rfind(string_view(&c, 1), pos); -} - -string_view::size_type string_view::rfind(const char* s, size_type pos, - size_type count) const -{ - return rfind(string_view(s, count), pos); -} - -string_view::size_type string_view::rfind(const char* s, size_type pos) const -{ - return rfind(string_view(s), pos); -} - -string_view::size_type string_view::find_first_of(string_view v, - size_type pos) const noexcept -{ - for (; pos < size_; ++pos) { - if (traits_type::find(v.data_, v.size_, data_[pos])) { - return pos; - } - } - return npos; -} - -string_view::size_type string_view::find_first_of(char c, size_type pos) const - noexcept -{ - return find_first_of(string_view(&c, 1), pos); -} - -string_view::size_type string_view::find_first_of(const char* s, size_type pos, - size_type count) const -{ - return find_first_of(string_view(s, count), pos); -} - -string_view::size_type string_view::find_first_of(const char* s, - size_type pos) const -{ - return find_first_of(string_view(s), pos); -} - -string_view::size_type string_view::find_last_of(string_view v, - size_type pos) const noexcept -{ - if (size_ > 0) { - for (pos = std::min(pos, size_ - 1) + 1; pos > 0;) { - --pos; - if (traits_type::find(v.data_, v.size_, data_[pos])) { - return pos; - } - } - } - return npos; -} - -string_view::size_type string_view::find_last_of(char c, size_type pos) const - noexcept -{ - return find_last_of(string_view(&c, 1), pos); -} - -string_view::size_type string_view::find_last_of(const char* s, size_type pos, - size_type count) const -{ - return find_last_of(string_view(s, count), pos); -} - -string_view::size_type string_view::find_last_of(const char* s, - size_type pos) const -{ - return find_last_of(string_view(s), pos); -} - -string_view::size_type string_view::find_first_not_of(string_view v, - size_type pos) const - noexcept -{ - for (; pos < size_; ++pos) { - if (!traits_type::find(v.data_, v.size_, data_[pos])) { - return pos; - } - } - return npos; -} - -string_view::size_type string_view::find_first_not_of(char c, - size_type pos) const - noexcept -{ - return find_first_not_of(string_view(&c, 1), pos); -} - -string_view::size_type string_view::find_first_not_of(const char* s, - size_type pos, - size_type count) const -{ - return find_first_not_of(string_view(s, count), pos); -} - -string_view::size_type string_view::find_first_not_of(const char* s, - size_type pos) const -{ - return find_first_not_of(string_view(s), pos); -} - -string_view::size_type string_view::find_last_not_of(string_view v, - size_type pos) const - noexcept -{ - if (size_ > 0) { - for (pos = std::min(pos, size_ - 1) + 1; pos > 0;) { - --pos; - if (!traits_type::find(v.data_, v.size_, data_[pos])) { - return pos; - } - } - } - return npos; -} - -string_view::size_type string_view::find_last_not_of(char c, - size_type pos) const - noexcept -{ - return find_last_not_of(string_view(&c, 1), pos); -} - -string_view::size_type string_view::find_last_not_of(const char* s, - size_type pos, - size_type count) const -{ - return find_last_not_of(string_view(s, count), pos); -} - -string_view::size_type string_view::find_last_not_of(const char* s, - size_type pos) const -{ - return find_last_not_of(string_view(s), pos); -} - -std::ostream& operator<<(std::ostream& o, string_view v) -{ - return o.write(v.data(), v.size()); -} - -std::string& operator+=(std::string& s, string_view v) -{ - s.append(v.data(), v.size()); - return s; -} -} - -std::hash<cm::string_view>::result_type std::hash<cm::string_view>::operator()( - argument_type const& s) const noexcept -{ - // FNV-1a hash. - static KWIML_INT_uint64_t const fnv_offset_basis = 0xcbf29ce484222325; - static KWIML_INT_uint64_t const fnv_prime = 0x100000001b3; - KWIML_INT_uint64_t h = fnv_offset_basis; - for (char const& c : s) { - h = h ^ KWIML_INT_uint64_t(KWIML_INT_uint8_t(c)); - h = h * fnv_prime; - } - return result_type(h); -} -#else -// Avoid empty translation unit. -void cm_string_view_cxx() -{ -} -#endif diff --git a/Source/cm_string_view.hxx b/Source/cm_string_view.hxx deleted file mode 100644 index 04de797..0000000 --- a/Source/cm_string_view.hxx +++ /dev/null @@ -1,217 +0,0 @@ -/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying - file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cm_string_view_hxx -#define cm_string_view_hxx - -#include "cmConfigure.h" // IWYU pragma: keep - -#if __cplusplus >= 201703L || defined(_MSVC_LANG) && _MSVC_LANG >= 201703L -# define CMake_HAVE_CXX_STRING_VIEW -#endif - -#ifdef CMake_HAVE_CXX_STRING_VIEW -# include <string_view> -namespace cm { -using std::string_view; -} -#else -# include <cstddef> -# include <functional> -# include <iosfwd> -# include <iterator> -# include <string> - -namespace cm { - -class string_view -{ -public: - using traits_type = std::string::traits_type; - using value_type = char; - using pointer = char*; - using const_pointer = const char*; - using reference = char&; - using const_reference = char const&; - using const_iterator = const char*; - using iterator = const_iterator; - using const_reverse_iterator = std::reverse_iterator<const_iterator>; - using reverse_iterator = const_reverse_iterator; - using size_type = std::string::size_type; - using difference_type = std::string::difference_type; - - static size_type const npos = static_cast<size_type>(-1); - - string_view() noexcept = default; - string_view(string_view const&) noexcept = default; - - string_view(const char* s, size_t count) noexcept - : data_(s) - , size_(count) - { - } - - string_view(const char* s) noexcept - : data_(s) - , size_(traits_type::length(s)) - { - } - - // C++17 does not define this constructor. Instead it defines - // a conversion operator on std::string to create a string_view. - // Since this implementation is used in C++11, std::string does - // not have that conversion. - string_view(std::string const& s) noexcept - : data_(s.data()) - , size_(s.size()) - { - } - - // C++17 does not define this conversion. Instead it defines - // a constructor on std::string that can take a string_view. - // Since this implementation is used in C++11, std::string does - // not have that constructor. - explicit operator std::string() const { return std::string(data_, size_); } - - string_view& operator=(string_view const&) = default; - - const_iterator begin() const noexcept { return data_; } - const_iterator end() const noexcept { return data_ + size_; } - const_iterator cbegin() const noexcept { return begin(); } - const_iterator cend() const noexcept { return end(); } - - const_reverse_iterator rbegin() const noexcept - { - return const_reverse_iterator(end()); - } - const_reverse_iterator rend() const noexcept - { - return const_reverse_iterator(begin()); - } - const_reverse_iterator crbegin() const noexcept { return rbegin(); } - const_reverse_iterator crend() const noexcept { return rend(); } - - const_reference operator[](size_type pos) const noexcept - { - return data_[pos]; - } - const_reference at(size_type pos) const; - const_reference front() const noexcept { return data_[0]; } - const_reference back() const noexcept { return data_[size_ - 1]; } - const_pointer data() const noexcept { return data_; } - - size_type size() const noexcept { return size_; } - size_type length() const noexcept { return size_; } - size_type max_size() const noexcept { return npos - 1; } - bool empty() const noexcept { return size_ == 0; } - - void remove_prefix(size_type n) noexcept - { - data_ += n; - size_ -= n; - } - void remove_suffix(size_type n) noexcept { size_ -= n; } - void swap(string_view& v) noexcept - { - string_view tmp = v; - v = *this; - *this = tmp; - } - - size_type copy(char* dest, size_type count, size_type pos = 0) const; - string_view substr(size_type pos = 0, size_type count = npos) const; - - int compare(string_view v) const noexcept; - int compare(size_type pos1, size_type count1, string_view v) const; - int compare(size_type pos1, size_type count1, string_view v, size_type pos2, - size_type count2) const; - int compare(const char* s) const; - int compare(size_type pos1, size_type count1, const char* s) const; - int compare(size_type pos1, size_type count1, const char* s, - size_type count2) const; - - size_type find(string_view v, size_type pos = 0) const noexcept; - size_type find(char c, size_type pos = 0) const noexcept; - size_type find(const char* s, size_type pos, size_type count) const; - size_type find(const char* s, size_type pos = 0) const; - - size_type rfind(string_view v, size_type pos = npos) const noexcept; - size_type rfind(char c, size_type pos = npos) const noexcept; - size_type rfind(const char* s, size_type pos, size_type count) const; - size_type rfind(const char* s, size_type pos = npos) const; - - size_type find_first_of(string_view v, size_type pos = 0) const noexcept; - size_type find_first_of(char c, size_type pos = 0) const noexcept; - size_type find_first_of(const char* s, size_type pos, size_type count) const; - size_type find_first_of(const char* s, size_type pos = 0) const; - - size_type find_last_of(string_view v, size_type pos = npos) const noexcept; - size_type find_last_of(char c, size_type pos = npos) const noexcept; - size_type find_last_of(const char* s, size_type pos, size_type count) const; - size_type find_last_of(const char* s, size_type pos = npos) const; - - size_type find_first_not_of(string_view v, size_type pos = 0) const noexcept; - size_type find_first_not_of(char c, size_type pos = 0) const noexcept; - size_type find_first_not_of(const char* s, size_type pos, - size_type count) const; - size_type find_first_not_of(const char* s, size_type pos = 0) const; - - size_type find_last_not_of(string_view v, size_type pos = npos) const - noexcept; - size_type find_last_not_of(char c, size_type pos = npos) const noexcept; - size_type find_last_not_of(const char* s, size_type pos, - size_type count) const; - size_type find_last_not_of(const char* s, size_type pos = npos) const; - -private: - const char* data_ = nullptr; - size_type size_ = 0; -}; - -std::ostream& operator<<(std::ostream& o, string_view v); - -std::string& operator+=(std::string& s, string_view v); - -inline bool operator==(string_view l, string_view r) noexcept -{ - return l.compare(r) == 0; -} - -inline bool operator!=(string_view l, string_view r) noexcept -{ - return l.compare(r) != 0; -} - -inline bool operator<(string_view l, string_view r) noexcept -{ - return l.compare(r) < 0; -} - -inline bool operator<=(string_view l, string_view r) noexcept -{ - return l.compare(r) <= 0; -} - -inline bool operator>(string_view l, string_view r) noexcept -{ - return l.compare(r) > 0; -} - -inline bool operator>=(string_view l, string_view r) noexcept -{ - return l.compare(r) >= 0; -} -} - -namespace std { - -template <> -struct hash<cm::string_view> -{ - using argument_type = cm::string_view; - using result_type = size_t; - result_type operator()(argument_type const& s) const noexcept; -}; -} - -#endif -#endif diff --git a/Source/cm_sys_stat.h b/Source/cm_sys_stat.h index d3b9ef2..eb874c7 100644 --- a/Source/cm_sys_stat.h +++ b/Source/cm_sys_stat.h @@ -14,6 +14,6 @@ using gid_t = unsigned short; #include <sys/types.h> // include sys/stat.h after sys/types.h -#include <sys/stat.h> +#include <sys/stat.h> // IWYU pragma: export #endif diff --git a/Source/cm_thread.hxx b/Source/cm_thread.hxx deleted file mode 100644 index b1f0645..0000000 --- a/Source/cm_thread.hxx +++ /dev/null @@ -1,48 +0,0 @@ -/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying - file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef CM_THREAD_HXX -#define CM_THREAD_HXX - -#include "cmConfigure.h" // IWYU pragma: keep -#include "cm_uv.h" - -namespace cm { - -class shared_mutex -{ - uv_rwlock_t _M_; - -public: - shared_mutex() { uv_rwlock_init(&_M_); } - ~shared_mutex() { uv_rwlock_destroy(&_M_); } - - shared_mutex(shared_mutex const&) = delete; - shared_mutex& operator=(shared_mutex const&) = delete; - - void lock() { uv_rwlock_wrlock(&_M_); } - void unlock() { uv_rwlock_wrunlock(&_M_); } - - void lock_shared() { uv_rwlock_rdlock(&_M_); } - void unlock_shared() { uv_rwlock_rdunlock(&_M_); } -}; - -template <typename T> -class shared_lock -{ - T& _mutex; - -public: - shared_lock(T& m) - : _mutex(m) - { - _mutex.lock_shared(); - } - - ~shared_lock() { _mutex.unlock_shared(); } - - shared_lock(shared_lock const&) = delete; - shared_lock& operator=(shared_lock const&) = delete; -}; -} - -#endif diff --git a/Source/cm_utility.hxx b/Source/cm_utility.hxx deleted file mode 100644 index 99d7f8b..0000000 --- a/Source/cm_utility.hxx +++ /dev/null @@ -1,35 +0,0 @@ -/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying - file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cm_utility_hxx -#define cm_utility_hxx - -#include "cmConfigure.h" // IWYU pragma: keep - -#if __cplusplus >= 201703L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) -# define CMake_HAVE_CXX_IN_PLACE -#endif - -#if defined(CMake_HAVE_CXX_IN_PLACE) -# include <utility> -#endif - -namespace cm { - -#if defined(CMake_HAVE_CXX_IN_PLACE) - -using std::in_place_t; -using std::in_place; - -#else - -struct in_place_t -{ - explicit in_place_t() = default; -}; - -constexpr in_place_t in_place{}; - -#endif -} - -#endif diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 9a66805..96d903e 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -2,7 +2,13 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmake.h" -#include "cm_memory.hxx" +#include <cm/memory> +#include <cm/string_view> +#if defined(_WIN32) && !defined(__CYGWIN__) && !defined(CMAKE_BOOT_MINGW) +# include <cm/iterator> +#endif + +#include "cm_sys_stat.h" #include "cmAlgorithms.h" #include "cmCommands.h" @@ -28,8 +34,6 @@ #include "cmUtils.hxx" #include "cmVersionConfig.h" #include "cmWorkingDirectory.h" -#include "cm_string_view.hxx" -#include "cm_sys_stat.h" #if !defined(CMAKE_BOOTSTRAP) # include "cm_jsoncpp_writer.h" |