From e6414421491c04855c02b15beab9cded38d140eb Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 23 Jan 2025 11:38:03 -0500 Subject: clang-format.bash: update to clang-format-18 The `.clang-format` configuration needs no changes to make the version 18 format close to what version 15 produced before. Issue: #26123 --- .clang-format | 2 +- .gitattributes | 2 +- Help/dev/source.rst | 2 +- Utilities/.gitattributes | 2 +- Utilities/Scripts/clang-format.bash | 8 ++++---- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.clang-format b/.clang-format index 813a84d..8cac3e1 100644 --- a/.clang-format +++ b/.clang-format @@ -1,5 +1,5 @@ --- -# This configuration requires clang-format version 15 exactly. +# This configuration requires clang-format version 18 exactly. BasedOnStyle: Mozilla AlignOperands: false AllowShortFunctionsOnASingleLine: InlineOnly diff --git a/.gitattributes b/.gitattributes index 5e2a546..7aac159 100644 --- a/.gitattributes +++ b/.gitattributes @@ -4,7 +4,7 @@ .editorconfig export-ignore # Custom attribute to mark sources as using our C code style. -[attr]our-c-style whitespace=tab-in-indent format.clang-format=15 +[attr]our-c-style whitespace=tab-in-indent format.clang-format=18 # Custom attribute to mark sources as generated. # Do not perform whitespace checks. Do not format. diff --git a/Help/dev/source.rst b/Help/dev/source.rst index 6bacd09..c3c55a3 100644 --- a/Help/dev/source.rst +++ b/Help/dev/source.rst @@ -9,7 +9,7 @@ See documentation on `CMake Development`_ for more information. C++ Code Style ============== -We use `clang-format`_ version **15** to define our style for C++ code in +We use `clang-format`_ version **18** to define our style for C++ code in the CMake source tree. See the `.clang-format`_ configuration file for our style settings. Use the `Utilities/Scripts/clang-format.bash`_ script to format source code. It automatically runs ``clang-format`` on the set of diff --git a/Utilities/.gitattributes b/Utilities/.gitattributes index c43b55d..b6c6212 100644 --- a/Utilities/.gitattributes +++ b/Utilities/.gitattributes @@ -5,4 +5,4 @@ SetupForDevelopment.sh export-ignore # Do not format third-party sources. /KWIML/** -format.clang-format /cm*/** -format.clang-format -/cmcurl/curltest.c format.clang-format=15 +/cmcurl/curltest.c format.clang-format=18 diff --git a/Utilities/Scripts/clang-format.bash b/Utilities/Scripts/clang-format.bash index 27ed40f..88d8f1e 100755 --- a/Utilities/Scripts/clang-format.bash +++ b/Utilities/Scripts/clang-format.bash @@ -78,7 +78,7 @@ test "$#" = 0 || die "$usage" # Find a default tool. tools=' - clang-format-15 + clang-format-18 clang-format ' if test "x$clang_format" = "x"; then @@ -96,8 +96,8 @@ if ! type -p "$clang_format" >/dev/null; then exit 1 fi -if ! "$clang_format" --version | grep 'clang-format version 15' >/dev/null 2>/dev/null; then - echo "clang-format version 15 is required (exactly)" +if ! "$clang_format" --version | grep 'clang-format version 18' >/dev/null 2>/dev/null; then + echo "clang-format version 18 is required (exactly)" exit 1 fi @@ -116,7 +116,7 @@ $git_ls | # Select sources with our attribute. git check-attr --stdin format.clang-format | - sed -n '/: format\.clang-format: \(set\|15\)$/ {s/:[^:]*:[^:]*$//p}' | + sed -n '/: format\.clang-format: \(set\|18\)$/ {s/:[^:]*:[^:]*$//p}' | # Update sources in-place. xargs -d '\n' "$clang_format" -i -- cgit v0.12 -- cgit v0.12 From b2ba64add9b48068948e1450153a9ea6923e3596 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Thu, 23 Jan 2025 11:40:59 -0500 Subject: Revise C++ coding style using clang-format-18 Run the `clang-format.bash` script to update all our C and C++ code to a new style defined by `.clang-format`. Use `clang-format` version 18. * If you reached this commit for a line in `git blame`, re-run the blame operation starting at the parent of this commit to see older history for the content. * See the parent commit for instructions to rebase a change across this style transition commit. Fixes: #26123 --- Modules/CXX-DetectStdlib.h | 2 +- Source/CPack/cmCPackNSISGenerator.cxx | 3 +-- Source/CTest/cmCTestCoverageHandler.cxx | 4 +--- Source/CursesDialog/cmCursesOptionsWidget.cxx | 2 +- Source/cmExportTryCompileFileGenerator.h | 2 +- Source/cmGlobalGenerator.cxx | 4 ++-- Source/cmJSONState.h | 4 ++-- Source/cmSystemTools.cxx | 2 +- Source/cmVersion.h | 2 +- .../target_link_libraries/cmp0022/onlyplainlib1.h | 2 +- .../target_link_libraries/cmp0022/onlyplainlib2.h | 3 ++- Tests/CMakeLib/testCTestBinPacker.cxx | 3 +-- Tests/CMakeLib/testCTestResourceAllocator.cxx | 12 +++++------- Tests/Complex/Executable/complex.cxx | 2 +- Tests/ComplexOneConfig/Executable/complex.cxx | 2 +- .../Export/install-RUNTIME_DEPENDENCY_SET/deplib.c | 3 ++- Tests/ExportImport/Import/install-RUNTIME_DEPENDENCIES/lib.c | 3 ++- Tests/ExportImport/Import/install-RUNTIME_DEPENDENCIES/mod.c | 3 ++- .../Import/install-RUNTIME_DEPENDENCIES/sublib1.c | 3 ++- .../Import/install-RUNTIME_DEPENDENCIES/sublib2.c | 3 ++- .../Import/install-RUNTIME_DEPENDENCY_SET/main.c | 6 ++++-- Tests/FindOpenACC/CTest/main.c | 2 +- Tests/FindOpenACC/CXXTest/main.cxx | 2 +- Tests/LibName/bar.c | 3 ++- Tests/LibName/foo.c | 3 ++- Tests/LibName/foobar.c | 3 ++- Tests/QtAutogen/AutogenOriginDependsOn/testGenLib.hpp | 2 +- Tests/QtAutogen/MocOnly/IncA.cpp | 2 +- Tests/QtAutogen/MocOnly/IncB.cpp | 2 +- Tests/QtAutogen/MocSkipSource/qItemC.cpp | 4 ++-- Tests/QtAutogen/MocSkipSource/qItemD.cpp | 4 ++-- Tests/QtAutogen/SameName/object.h | 2 +- Tests/QtAutogen/SameName/object.hh | 2 +- Tests/QtAutogen/SameName/object.hpp | 2 +- Tests/QtAutogen/SameName/object.hxx | 2 +- Tests/QtAutogen/UicInterface/klocalizedstring.h | 6 ++++-- Tests/QtAutogen/UicNoGui/MocOnly/main.cpp | 2 +- Tests/RunCMake/AutoExportDll/hello.cxx | 4 ++-- Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/lib1.c | 3 ++- Tests/RunCMake/VerifyHeaderSets/dir1/lib1.h | 3 ++- Tests/RunCMake/VerifyHeaderSets/dir2/lib2.h | 3 ++- Tests/StagingPrefix/Producer/bar.h | 2 +- Tests/StagingPrefix/Producer/foo.h | 2 +- Tests/UseSWIG/example.h | 4 ++-- Utilities/ClangTidyModule/Tests/cmake-use-cmstrlen-fixit.cxx | 2 +- Utilities/ClangTidyModule/Tests/cmake-use-cmstrlen.cxx | 2 +- Utilities/std/cm/bits/container_helpers.hxx | 2 +- Utilities/std/cmext/algorithm | 5 +++-- 48 files changed, 78 insertions(+), 67 deletions(-) diff --git a/Modules/CXX-DetectStdlib.h b/Modules/CXX-DetectStdlib.h index 0214dee..11cb93f 100644 --- a/Modules/CXX-DetectStdlib.h +++ b/Modules/CXX-DetectStdlib.h @@ -7,4 +7,4 @@ CMAKE-STDLIB-DETECT: libstdc++ #else CMAKE-STDLIB-DETECT: UNKNOWN #endif - // clang-format on + // clang-format on diff --git a/Source/CPack/cmCPackNSISGenerator.cxx b/Source/CPack/cmCPackNSISGenerator.cxx index 225e86f..fb0885f 100644 --- a/Source/CPack/cmCPackNSISGenerator.cxx +++ b/Source/CPack/cmCPackNSISGenerator.cxx @@ -551,8 +551,7 @@ int cmCPackNSISGenerator::InitializeInternal() } } else { cmCPackLogger(cmCPackLog::LOG_DEBUG, - "CPACK_CREATE_DESKTOP_LINKS: " - << "not set" << std::endl); + "CPACK_CREATE_DESKTOP_LINKS: " << "not set" << std::endl); } std::ostringstream str; diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx index 2e63fc8..bac1096 100644 --- a/Source/CTest/cmCTestCoverageHandler.cxx +++ b/Source/CTest/cmCTestCoverageHandler.cxx @@ -1733,9 +1733,7 @@ int cmCTestCoverageHandler::RunBullseyeCoverageBranch( "run covbr: " << std::endl, this->Quiet); if (!this->RunBullseyeCommand(cont, "covbr", nullptr, outputFile)) { - cmCTestLog(this->CTest, ERROR_MESSAGE, - "error running covbr for." - << "\n"); + cmCTestLog(this->CTest, ERROR_MESSAGE, "error running covbr for." << "\n"); return -1; } cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, diff --git a/Source/CursesDialog/cmCursesOptionsWidget.cxx b/Source/CursesDialog/cmCursesOptionsWidget.cxx index 8df32e2..5238e2d 100644 --- a/Source/CursesDialog/cmCursesOptionsWidget.cxx +++ b/Source/CursesDialog/cmCursesOptionsWidget.cxx @@ -6,7 +6,7 @@ #include "cmCursesWidget.h" #include "cmStateTypes.h" -#define ctrl(z) ((z)&037) +#define ctrl(z) ((z) & 037) cmCursesOptionsWidget::cmCursesOptionsWidget(int width, int height, int left, int top) diff --git a/Source/cmExportTryCompileFileGenerator.h b/Source/cmExportTryCompileFileGenerator.h index 20c331c..03994dc 100644 --- a/Source/cmExportTryCompileFileGenerator.h +++ b/Source/cmExportTryCompileFileGenerator.h @@ -31,7 +31,7 @@ public: protected: // Implement virtual methods from the superclass. void ComplainAboutDuplicateTarget( - std::string const& /*targetName*/) const override{}; + std::string const& /*targetName*/) const override {}; void ReportError(std::string const& errorMessage) const override; bool GenerateMainFile(std::ostream& os) override; diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index b44d62b..0232cba 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -830,7 +830,7 @@ void cmGlobalGenerator::EnableLanguage( // flag needTestLanguage[lang] = true; } // end if(!this->GetLanguageEnabled(lang) ) - } // end loop over languages + } // end loop over languages // **** Load the system specific information if not yet loaded if (!mf->GetDefinition("CMAKE_SYSTEM_SPECIFIC_INFORMATION_LOADED")) { @@ -939,7 +939,7 @@ void cmGlobalGenerator::EnableLanguage( cmSystemTools::RemoveFile(compilerLangFile); } } // end if in try compile - } // end need test language + } // end need test language // load linker configuration, if required if (mf->GetDefinition(cmStrCat("CMAKE_", lang, "_USE_LINKER_INFORMATION")) diff --git a/Source/cmJSONState.h b/Source/cmJSONState.h index 3223453..eb970fe 100644 --- a/Source/cmJSONState.h +++ b/Source/cmJSONState.h @@ -42,10 +42,10 @@ public: public: Error(Location loc, std::string errMsg) : location(loc) - , message(std::move(errMsg)){}; + , message(std::move(errMsg)) {}; Error(std::string errMsg) : location({ -1, -1 }) - , message(std::move(errMsg)){}; + , message(std::move(errMsg)) {}; std::string GetErrorMessage() const { std::string output = message; diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 972dd0e..d60690b 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -1503,7 +1503,7 @@ cmSystemTools::RenameResult cmSystemTools::RenameFile( { #ifdef _WIN32 # ifndef INVALID_FILE_ATTRIBUTES -# define INVALID_FILE_ATTRIBUTES ((DWORD)-1) +# define INVALID_FILE_ATTRIBUTES ((DWORD) - 1) # endif std::wstring const oldname_wstr = SystemTools::ConvertToWindowsExtendedPath(oldname); diff --git a/Source/cmVersion.h b/Source/cmVersion.h index 456428c..7773b02 100644 --- a/Source/cmVersion.h +++ b/Source/cmVersion.h @@ -26,6 +26,6 @@ public: and to encode dates until the year 10000 in the patch level. */ #define CMake_VERSION_ENCODE_BASE KWIML_INT_UINT64_C(100000000) #define CMake_VERSION_ENCODE(major, minor, patch) \ - ((((major)*1000u) * CMake_VERSION_ENCODE_BASE) + \ + ((((major) * 1000u) * CMake_VERSION_ENCODE_BASE) + \ (((minor) % 1000u) * CMake_VERSION_ENCODE_BASE) + \ (((patch) % CMake_VERSION_ENCODE_BASE))) diff --git a/Tests/CMakeCommands/target_link_libraries/cmp0022/onlyplainlib1.h b/Tests/CMakeCommands/target_link_libraries/cmp0022/onlyplainlib1.h index 2bc04ee..69a730e 100644 --- a/Tests/CMakeCommands/target_link_libraries/cmp0022/onlyplainlib1.h +++ b/Tests/CMakeCommands/target_link_libraries/cmp0022/onlyplainlib1.h @@ -3,7 +3,7 @@ struct #ifdef _WIN32 __declspec(dllexport) #endif - OnlyPlainLib1 + OnlyPlainLib1 { OnlyPlainLib1(); diff --git a/Tests/CMakeCommands/target_link_libraries/cmp0022/onlyplainlib2.h b/Tests/CMakeCommands/target_link_libraries/cmp0022/onlyplainlib2.h index 6f18d20..e144b63 100644 --- a/Tests/CMakeCommands/target_link_libraries/cmp0022/onlyplainlib2.h +++ b/Tests/CMakeCommands/target_link_libraries/cmp0022/onlyplainlib2.h @@ -4,4 +4,5 @@ #ifdef _WIN32 __declspec(dllexport) #endif - OnlyPlainLib1 onlyPlainLib2(); +OnlyPlainLib1 +onlyPlainLib2(); diff --git a/Tests/CMakeLib/testCTestBinPacker.cxx b/Tests/CMakeLib/testCTestBinPacker.cxx index 038ceea..7107428 100644 --- a/Tests/CMakeLib/testCTestBinPacker.cxx +++ b/Tests/CMakeLib/testCTestBinPacker.cxx @@ -16,8 +16,7 @@ struct ExpectedPackResult std::vector ExpectedBlockAllocations; }; -static const std::vector expectedResults -{ +static const std::vector expectedResults{ /* clang-format off */ { { 2, 2, 2, 2 }, diff --git a/Tests/CMakeLib/testCTestResourceAllocator.cxx b/Tests/CMakeLib/testCTestResourceAllocator.cxx index 3a2e524..9f7538d 100644 --- a/Tests/CMakeLib/testCTestResourceAllocator.cxx +++ b/Tests/CMakeLib/testCTestResourceAllocator.cxx @@ -7,14 +7,12 @@ #include "cmCTestResourceSpec.h" #include "cmJSONState.h" -static const cmCTestResourceSpec spec{ - { { - /* clang-format off */ +static const cmCTestResourceSpec spec{ { { + /* clang-format off */ { "gpus", { { "0", 4 }, { "1", 8 }, { "2", 0 }, { "3", 8 } }, }, - /* clang-format on */ - } }, - cmJSONState() -}; + /* clang-format on */ + } }, + cmJSONState() }; static bool testInitializeFromResourceSpec() { diff --git a/Tests/Complex/Executable/complex.cxx b/Tests/Complex/Executable/complex.cxx index 0e2463a..c0ce0bb 100644 --- a/Tests/Complex/Executable/complex.cxx +++ b/Tests/Complex/Executable/complex.cxx @@ -19,7 +19,7 @@ extern "C" { #include #if !defined(S_ISDIR) -# define S_ISDIR(mode) ((mode)&_S_IFDIR) +# define S_ISDIR(mode) ((mode) & _S_IFDIR) #endif #ifdef COMPLEX_TEST_LINK_STATIC diff --git a/Tests/ComplexOneConfig/Executable/complex.cxx b/Tests/ComplexOneConfig/Executable/complex.cxx index 1c2a316..f959211 100644 --- a/Tests/ComplexOneConfig/Executable/complex.cxx +++ b/Tests/ComplexOneConfig/Executable/complex.cxx @@ -19,7 +19,7 @@ extern "C" { #include #if !defined(S_ISDIR) -# define S_ISDIR(mode) ((mode)&_S_IFDIR) +# define S_ISDIR(mode) ((mode) & _S_IFDIR) #endif #ifdef COMPLEX_TEST_LINK_STATIC diff --git a/Tests/ExportImport/Export/install-RUNTIME_DEPENDENCY_SET/deplib.c b/Tests/ExportImport/Export/install-RUNTIME_DEPENDENCY_SET/deplib.c index e5da196..4063cde 100644 --- a/Tests/ExportImport/Export/install-RUNTIME_DEPENDENCY_SET/deplib.c +++ b/Tests/ExportImport/Export/install-RUNTIME_DEPENDENCY_SET/deplib.c @@ -1,7 +1,8 @@ #ifdef _WIN32 __declspec(dllimport) #endif - extern void dep1(void); +extern void +dep1(void); #ifdef _WIN32 __declspec(dllexport) diff --git a/Tests/ExportImport/Import/install-RUNTIME_DEPENDENCIES/lib.c b/Tests/ExportImport/Import/install-RUNTIME_DEPENDENCIES/lib.c index 9a64887..ff542d3 100644 --- a/Tests/ExportImport/Import/install-RUNTIME_DEPENDENCIES/lib.c +++ b/Tests/ExportImport/Import/install-RUNTIME_DEPENDENCIES/lib.c @@ -1,7 +1,8 @@ #ifdef _WIN32 __declspec(dllimport) #endif - extern void dep8(void); +extern void +dep8(void); #ifdef _WIN32 __declspec(dllexport) diff --git a/Tests/ExportImport/Import/install-RUNTIME_DEPENDENCIES/mod.c b/Tests/ExportImport/Import/install-RUNTIME_DEPENDENCIES/mod.c index d001299..ab4a878 100644 --- a/Tests/ExportImport/Import/install-RUNTIME_DEPENDENCIES/mod.c +++ b/Tests/ExportImport/Import/install-RUNTIME_DEPENDENCIES/mod.c @@ -1,7 +1,8 @@ #ifdef _WIN32 __declspec(dllimport) #endif - extern void dep9(void); +extern void +dep9(void); #ifdef _WIN32 __declspec(dllexport) diff --git a/Tests/ExportImport/Import/install-RUNTIME_DEPENDENCIES/sublib1.c b/Tests/ExportImport/Import/install-RUNTIME_DEPENDENCIES/sublib1.c index f17b902..c763116 100644 --- a/Tests/ExportImport/Import/install-RUNTIME_DEPENDENCIES/sublib1.c +++ b/Tests/ExportImport/Import/install-RUNTIME_DEPENDENCIES/sublib1.c @@ -1,7 +1,8 @@ #ifdef _WIN32 __declspec(dllimport) #endif - extern void dep6(void); +extern void +dep6(void); #ifdef _WIN32 __declspec(dllexport) diff --git a/Tests/ExportImport/Import/install-RUNTIME_DEPENDENCIES/sublib2.c b/Tests/ExportImport/Import/install-RUNTIME_DEPENDENCIES/sublib2.c index 61b5c83..5c303fe 100644 --- a/Tests/ExportImport/Import/install-RUNTIME_DEPENDENCIES/sublib2.c +++ b/Tests/ExportImport/Import/install-RUNTIME_DEPENDENCIES/sublib2.c @@ -1,7 +1,8 @@ #ifdef _WIN32 __declspec(dllimport) #endif - extern void dep7(void); +extern void +dep7(void); #ifdef _WIN32 __declspec(dllexport) diff --git a/Tests/ExportImport/Import/install-RUNTIME_DEPENDENCY_SET/main.c b/Tests/ExportImport/Import/install-RUNTIME_DEPENDENCY_SET/main.c index b359498..caeda76 100644 --- a/Tests/ExportImport/Import/install-RUNTIME_DEPENDENCY_SET/main.c +++ b/Tests/ExportImport/Import/install-RUNTIME_DEPENDENCY_SET/main.c @@ -1,11 +1,13 @@ #ifdef _WIN32 __declspec(dllimport) #endif - extern void dep3(void); +extern void +dep3(void); #ifdef _WIN32 __declspec(dllimport) #endif - extern void dep4(void); +extern void +dep4(void); int main(void) { diff --git a/Tests/FindOpenACC/CTest/main.c b/Tests/FindOpenACC/CTest/main.c index 6c005c1..20c6be1 100644 --- a/Tests/FindOpenACC/CTest/main.c +++ b/Tests/FindOpenACC/CTest/main.c @@ -26,7 +26,7 @@ int main(void) b[i] = (float)(1000 * i); } /* compute on the GPU */ -#pragma acc data copyin(a [0:n], b [0:n]) copyout(r [0:n]) +#pragma acc data copyin(a[0 : n], b[0 : n]) copyout(r[0 : n]) { vecaddgpu(r, a, b, n); } diff --git a/Tests/FindOpenACC/CXXTest/main.cxx b/Tests/FindOpenACC/CXXTest/main.cxx index 14b912b..f8c613a 100644 --- a/Tests/FindOpenACC/CXXTest/main.cxx +++ b/Tests/FindOpenACC/CXXTest/main.cxx @@ -25,7 +25,7 @@ int main(int, char*[]) auto a_ptr = a.data(); auto b_ptr = b.data(); auto r_ptr = r.data(); -#pragma acc data copyin(a_ptr [0:n], b_ptr [0:n]) copyout(r_ptr [0:n]) +#pragma acc data copyin(a_ptr[0 : n], b_ptr[0 : n]) copyout(r_ptr[0 : n]) { vecaddgpu(r_ptr, a_ptr, b_ptr, n); } diff --git a/Tests/LibName/bar.c b/Tests/LibName/bar.c index b1c5cf2..62a9298 100644 --- a/Tests/LibName/bar.c +++ b/Tests/LibName/bar.c @@ -2,6 +2,7 @@ __declspec(dllexport) #endif - extern void foo(void) +extern void +foo(void) { } diff --git a/Tests/LibName/foo.c b/Tests/LibName/foo.c index 1bdb58b..9b51156 100644 --- a/Tests/LibName/foo.c +++ b/Tests/LibName/foo.c @@ -1,7 +1,8 @@ #ifdef _WIN32 __declspec(dllimport) #endif - extern void foo(void); +extern void +foo(void); #ifdef _WIN32 __declspec(dllexport) #endif diff --git a/Tests/LibName/foobar.c b/Tests/LibName/foobar.c index fa7d3e9..e7e78b3 100644 --- a/Tests/LibName/foobar.c +++ b/Tests/LibName/foobar.c @@ -1,7 +1,8 @@ #ifdef _WIN32 __declspec(dllimport) #endif - extern void bar(); +extern void +bar(); int main(void) { diff --git a/Tests/QtAutogen/AutogenOriginDependsOn/testGenLib.hpp b/Tests/QtAutogen/AutogenOriginDependsOn/testGenLib.hpp index 55457d2..3bacc5b 100644 --- a/Tests/QtAutogen/AutogenOriginDependsOn/testGenLib.hpp +++ b/Tests/QtAutogen/AutogenOriginDependsOn/testGenLib.hpp @@ -11,7 +11,7 @@ class LObject : public QObject Q_OBJECT public: Q_SLOT - void aSlot(){}; + void aSlot() {}; }; #endif diff --git a/Tests/QtAutogen/MocOnly/IncA.cpp b/Tests/QtAutogen/MocOnly/IncA.cpp index 94610cd..7c5d3f1 100644 --- a/Tests/QtAutogen/MocOnly/IncA.cpp +++ b/Tests/QtAutogen/MocOnly/IncA.cpp @@ -8,7 +8,7 @@ class IncAPrivate : public QObject { Q_OBJECT public: - IncAPrivate(){}; + IncAPrivate() {}; }; IncA::IncA() diff --git a/Tests/QtAutogen/MocOnly/IncB.cpp b/Tests/QtAutogen/MocOnly/IncB.cpp index bd441a9..6eb62cf 100644 --- a/Tests/QtAutogen/MocOnly/IncB.cpp +++ b/Tests/QtAutogen/MocOnly/IncB.cpp @@ -6,7 +6,7 @@ class IncBPrivate : public QObject { Q_OBJECT public: - IncBPrivate(){}; + IncBPrivate() {}; }; IncB::IncB() diff --git a/Tests/QtAutogen/MocSkipSource/qItemC.cpp b/Tests/QtAutogen/MocSkipSource/qItemC.cpp index 622f282..464b652 100644 --- a/Tests/QtAutogen/MocSkipSource/qItemC.cpp +++ b/Tests/QtAutogen/MocSkipSource/qItemC.cpp @@ -4,8 +4,8 @@ class QItemC_Local : public QObject { Q_OBJECT public: - QItemC_Local(){}; - ~QItemC_Local(){}; + QItemC_Local() {}; + ~QItemC_Local() {}; }; void QItemC::go() diff --git a/Tests/QtAutogen/MocSkipSource/qItemD.cpp b/Tests/QtAutogen/MocSkipSource/qItemD.cpp index fe0f4e4..ed4e81f 100644 --- a/Tests/QtAutogen/MocSkipSource/qItemD.cpp +++ b/Tests/QtAutogen/MocSkipSource/qItemD.cpp @@ -4,8 +4,8 @@ class QItemD_Local : public QObject { Q_OBJECT public: - QItemD_Local(){}; - ~QItemD_Local(){}; + QItemD_Local() {}; + ~QItemD_Local() {}; }; void QItemD::go() diff --git a/Tests/QtAutogen/SameName/object.h b/Tests/QtAutogen/SameName/object.h index 8662094..3e81af2 100644 --- a/Tests/QtAutogen/SameName/object.h +++ b/Tests/QtAutogen/SameName/object.h @@ -7,7 +7,7 @@ class Object_h : public QObject { Q_OBJECT Q_SLOT - void go(){}; + void go() {}; }; #endif diff --git a/Tests/QtAutogen/SameName/object.hh b/Tests/QtAutogen/SameName/object.hh index 3e16f83..4db2b5a 100644 --- a/Tests/QtAutogen/SameName/object.hh +++ b/Tests/QtAutogen/SameName/object.hh @@ -7,7 +7,7 @@ class Object_hh : public QObject { Q_OBJECT Q_SLOT - void go(){}; + void go() {}; }; #endif diff --git a/Tests/QtAutogen/SameName/object.hpp b/Tests/QtAutogen/SameName/object.hpp index 035050e..498befd 100644 --- a/Tests/QtAutogen/SameName/object.hpp +++ b/Tests/QtAutogen/SameName/object.hpp @@ -7,7 +7,7 @@ class Object_hpp : public QObject { Q_OBJECT Q_SLOT - void go(){}; + void go() {}; }; #endif diff --git a/Tests/QtAutogen/SameName/object.hxx b/Tests/QtAutogen/SameName/object.hxx index c3c050f..b2a963c 100644 --- a/Tests/QtAutogen/SameName/object.hxx +++ b/Tests/QtAutogen/SameName/object.hxx @@ -7,7 +7,7 @@ class Object_hxx : public QObject { Q_OBJECT Q_SLOT - void go(){}; + void go() {}; }; #endif diff --git a/Tests/QtAutogen/UicInterface/klocalizedstring.h b/Tests/QtAutogen/UicInterface/klocalizedstring.h index 6129599..795d736 100644 --- a/Tests/QtAutogen/UicInterface/klocalizedstring.h +++ b/Tests/QtAutogen/UicInterface/klocalizedstring.h @@ -7,11 +7,13 @@ #ifdef _WIN32 __declspec(dllexport) #endif - QString tr2xi18n(const char* text, const char* comment = 0); +QString +tr2xi18n(const char* text, const char* comment = 0); #ifdef _WIN32 __declspec(dllexport) #endif - QString tr2i18n(const char* text, const char* comment = 0); +QString +tr2i18n(const char* text, const char* comment = 0); #endif diff --git a/Tests/QtAutogen/UicNoGui/MocOnly/main.cpp b/Tests/QtAutogen/UicNoGui/MocOnly/main.cpp index 3091845..faa8c14 100644 --- a/Tests/QtAutogen/UicNoGui/MocOnly/main.cpp +++ b/Tests/QtAutogen/UicNoGui/MocOnly/main.cpp @@ -4,7 +4,7 @@ class LocalObject : public QObject { Q_OBJECT public: - LocalObject(){}; + LocalObject() {}; }; void mocOnly() diff --git a/Tests/RunCMake/AutoExportDll/hello.cxx b/Tests/RunCMake/AutoExportDll/hello.cxx index 35ccbb7..2dc0c98 100644 --- a/Tests/RunCMake/AutoExportDll/hello.cxx +++ b/Tests/RunCMake/AutoExportDll/hello.cxx @@ -10,8 +10,8 @@ void hello() { printf("hello"); } -void Hello::operator delete[](void*){}; -void Hello::operator delete(void*){}; +void Hello::operator delete[](void*) {}; +void Hello::operator delete(void*) {}; #ifdef HELLO_VFTABLE HelloVFTable::HelloVFTable() diff --git a/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/lib1.c b/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/lib1.c index 524b5b2..c939c08 100644 --- a/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/lib1.c +++ b/Tests/RunCMake/GenEx-TARGET_RUNTIME_DLLS/lib1.c @@ -1,7 +1,8 @@ #ifdef _WIN32 __declspec(dllimport) #endif - extern void lib2(void); +extern void +lib2(void); #ifdef _WIN32 __declspec(dllexport) diff --git a/Tests/RunCMake/VerifyHeaderSets/dir1/lib1.h b/Tests/RunCMake/VerifyHeaderSets/dir1/lib1.h index 69c37ed..064c4f5 100644 --- a/Tests/RunCMake/VerifyHeaderSets/dir1/lib1.h +++ b/Tests/RunCMake/VerifyHeaderSets/dir1/lib1.h @@ -1,4 +1,5 @@ #ifdef _WIN32 __declspec(dllimport) #endif - extern void lib1(void); +extern void +lib1(void); diff --git a/Tests/RunCMake/VerifyHeaderSets/dir2/lib2.h b/Tests/RunCMake/VerifyHeaderSets/dir2/lib2.h index fa24a9a..aa4d09f 100644 --- a/Tests/RunCMake/VerifyHeaderSets/dir2/lib2.h +++ b/Tests/RunCMake/VerifyHeaderSets/dir2/lib2.h @@ -1,4 +1,5 @@ #ifdef _WIN32 __declspec(dllimport) #endif - extern void lib2(void); +extern void +lib2(void); diff --git a/Tests/StagingPrefix/Producer/bar.h b/Tests/StagingPrefix/Producer/bar.h index a56bd5d..d93a76c 100644 --- a/Tests/StagingPrefix/Producer/bar.h +++ b/Tests/StagingPrefix/Producer/bar.h @@ -3,7 +3,7 @@ class #ifdef _WIN32 __declspec(dllexport) #endif - Bar + Bar { public: int bar(); diff --git a/Tests/StagingPrefix/Producer/foo.h b/Tests/StagingPrefix/Producer/foo.h index 17b4f77..f6b2fa4 100644 --- a/Tests/StagingPrefix/Producer/foo.h +++ b/Tests/StagingPrefix/Producer/foo.h @@ -3,7 +3,7 @@ class #ifdef _WIN32 __declspec(dllexport) #endif - Foo + Foo { public: int foo(); diff --git a/Tests/UseSWIG/example.h b/Tests/UseSWIG/example.h index 366deb0..6cde757 100644 --- a/Tests/UseSWIG/example.h +++ b/Tests/UseSWIG/example.h @@ -19,7 +19,7 @@ private: public: Circle(double r) - : radius(r){}; + : radius(r) {}; virtual double area(void); virtual double perimeter(void); }; @@ -31,7 +31,7 @@ private: public: Square(double w) - : width(w){}; + : width(w) {}; virtual double area(void); virtual double perimeter(void); }; diff --git a/Utilities/ClangTidyModule/Tests/cmake-use-cmstrlen-fixit.cxx b/Utilities/ClangTidyModule/Tests/cmake-use-cmstrlen-fixit.cxx index cde0086..919fa0c 100644 --- a/Utilities/ClangTidyModule/Tests/cmake-use-cmstrlen-fixit.cxx +++ b/Utilities/ClangTidyModule/Tests/cmake-use-cmstrlen-fixit.cxx @@ -1,7 +1,7 @@ #include template -constexpr size_t cmStrLen(const char (&/*str*/)[N]) +constexpr size_t cmStrLen(const char (& /*str*/)[N]) { return N - 1; } diff --git a/Utilities/ClangTidyModule/Tests/cmake-use-cmstrlen.cxx b/Utilities/ClangTidyModule/Tests/cmake-use-cmstrlen.cxx index 205bc9c..7b8f3d0 100644 --- a/Utilities/ClangTidyModule/Tests/cmake-use-cmstrlen.cxx +++ b/Utilities/ClangTidyModule/Tests/cmake-use-cmstrlen.cxx @@ -1,7 +1,7 @@ #include template -constexpr size_t cmStrLen(const char (&/*str*/)[N]) +constexpr size_t cmStrLen(const char (& /*str*/)[N]) { return N - 1; } diff --git a/Utilities/std/cm/bits/container_helpers.hxx b/Utilities/std/cm/bits/container_helpers.hxx index abcdacb..6399fc2 100644 --- a/Utilities/std/cm/bits/container_helpers.hxx +++ b/Utilities/std/cm/bits/container_helpers.hxx @@ -221,7 +221,7 @@ inline auto data(C& c) -> decltype(c.data()) # else inline constexpr auto data(C& c) noexcept(noexcept(c.data())) # endif - -> decltype(c.data()) + -> decltype(c.data()) { return c.data(); } diff --git a/Utilities/std/cmext/algorithm b/Utilities/std/cmext/algorithm index 46377f4..f9f6006 100644 --- a/Utilities/std/cmext/algorithm +++ b/Utilities/std/cmext/algorithm @@ -212,8 +212,9 @@ bool contains(Iterator first, Iterator last, Key const& key) #if defined(__SUNPRO_CC) template -auto contains(Range const& range, Key const& key, detail::overload_selector<1>) - -> decltype(range.find(key) != range.end()) +auto contains(Range const& range, Key const& key, + detail::overload_selector<1>) -> decltype(range.find(key) != + range.end()) #else template < typename Range, typename Key, -- cgit v0.12 From 08f1cae4e8c838ddec3845ee3b1053758c648046 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 23 Jan 2025 11:48:20 -0500 Subject: clang-format: Enforce "east const" qualifier placement Issue: #26123 --- .clang-format | 1 + 1 file changed, 1 insertion(+) diff --git a/.clang-format b/.clang-format index 8cac3e1..84b96ab 100644 --- a/.clang-format +++ b/.clang-format @@ -16,6 +16,7 @@ BraceWrapping: BreakBeforeBraces: Custom ColumnLimit: 79 IndentPPDirectives: AfterHash +QualifierAlignment: Right SortUsingDeclarations: false SpaceAfterTemplateKeyword: true IncludeBlocks: Regroup -- cgit v0.12 -- cgit v0.12 From 0b96ae1f6a9cfa412c04ff0a6e90c0f155616b8e Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Thu, 23 Jan 2025 11:54:40 -0500 Subject: Revise C++ coding style using clang-format with "east const" Run the `clang-format.bash` script to update all our C and C++ code to a new style defined by `.clang-format`, now with "east const" enforcement. Use `clang-format` version 18. * If you reached this commit for a line in `git blame`, re-run the blame operation starting at the parent of this commit to see older history for the content. * See the parent commit for instructions to rebase a change across this style transition commit. Issue: #26123 --- Help/guide/importing-exporting/Downstream/main.cc | 4 +- .../DownstreamComponents/main.cc | 6 +- Help/guide/tutorial/Adding a Library.rst | 2 +- .../tutorial/Complete/MathFunctions/MakeTable.cxx | 2 +- Help/guide/tutorial/Complete/tutorial.cxx | 4 +- Help/guide/tutorial/Step1/tutorial.cxx | 4 +- .../tutorial/Step10/MathFunctions/MakeTable.cxx | 2 +- Help/guide/tutorial/Step10/tutorial.cxx | 4 +- .../tutorial/Step11/MathFunctions/MakeTable.cxx | 2 +- Help/guide/tutorial/Step11/tutorial.cxx | 4 +- .../tutorial/Step12/MathFunctions/MakeTable.cxx | 2 +- Help/guide/tutorial/Step12/tutorial.cxx | 4 +- Help/guide/tutorial/Step2/tutorial.cxx | 4 +- Help/guide/tutorial/Step3/tutorial.cxx | 4 +- Help/guide/tutorial/Step4/tutorial.cxx | 4 +- Help/guide/tutorial/Step5/tutorial.cxx | 4 +- Help/guide/tutorial/Step6/tutorial.cxx | 4 +- Help/guide/tutorial/Step7/tutorial.cxx | 4 +- .../tutorial/Step8/MathFunctions/MakeTable.cxx | 2 +- Help/guide/tutorial/Step8/tutorial.cxx | 4 +- .../tutorial/Step9/MathFunctions/MakeTable.cxx | 2 +- Help/guide/tutorial/Step9/tutorial.cxx | 4 +- Modules/CMakeCompilerABI.h | 2 +- Modules/CMakeCompilerCUDAArch.h | 2 +- Modules/FindMPI/test_mpi.c | 2 +- Source/CPack/IFW/cmCPackIFWCommon.cxx | 18 +- Source/CPack/IFW/cmCPackIFWCommon.h | 18 +- Source/CPack/IFW/cmCPackIFWGenerator.cxx | 34 +- Source/CPack/IFW/cmCPackIFWGenerator.h | 20 +- Source/CPack/IFW/cmCPackIFWInstaller.cxx | 16 +- Source/CPack/IFW/cmCPackIFWInstaller.h | 4 +- Source/CPack/IFW/cmCPackIFWPackage.cxx | 10 +- Source/CPack/IFW/cmCPackIFWPackage.h | 8 +- Source/CPack/IFW/cmCPackIFWRepository.cxx | 12 +- Source/CPack/WiX/cmCMakeToWixPath.cxx | 4 +- Source/CPack/WiX/cmCMakeToWixPath.h | 2 +- Source/CPack/WiX/cmCPackWIXGenerator.cxx | 2 +- Source/CPack/WiX/cmCPackWIXGenerator.h | 6 +- Source/CPack/WiX/cmWIXAccessControlList.cxx | 2 +- Source/CPack/WiX/cmWIXFeaturesSourceWriter.h | 4 +- Source/CPack/WiX/cmWIXPatch.cxx | 12 +- Source/CPack/WiX/cmWIXPatch.h | 4 +- Source/CPack/WiX/cmWIXPatchParser.cxx | 20 +- Source/CPack/WiX/cmWIXPatchParser.h | 14 +- Source/CPack/cmCPackArchiveGenerator.cxx | 14 +- Source/CPack/cmCPackArchiveGenerator.h | 6 +- Source/CPack/cmCPackBundleGenerator.cxx | 8 +- Source/CPack/cmCPackBundleGenerator.h | 4 +- Source/CPack/cmCPackComponentGroup.cxx | 4 +- Source/CPack/cmCPackComponentGroup.h | 4 +- Source/CPack/cmCPackCygwinBinaryGenerator.cxx | 2 +- Source/CPack/cmCPackCygwinBinaryGenerator.h | 2 +- Source/CPack/cmCPackCygwinSourceGenerator.cxx | 6 +- Source/CPack/cmCPackCygwinSourceGenerator.h | 4 +- Source/CPack/cmCPackDebGenerator.cxx | 62 +- Source/CPack/cmCPackDebGenerator.h | 8 +- Source/CPack/cmCPackDragNDropGenerator.cxx | 36 +- Source/CPack/cmCPackDragNDropGenerator.h | 12 +- Source/CPack/cmCPackExternalGenerator.cxx | 20 +- Source/CPack/cmCPackExternalGenerator.h | 28 +- Source/CPack/cmCPackFreeBSDGenerator.cxx | 44 +- Source/CPack/cmCPackFreeBSDGenerator.h | 2 +- Source/CPack/cmCPackGenerator.cxx | 106 ++-- Source/CPack/cmCPackGenerator.h | 98 ++-- Source/CPack/cmCPackGeneratorFactory.cxx | 4 +- Source/CPack/cmCPackGeneratorFactory.h | 8 +- Source/CPack/cmCPackInnoSetupGenerator.cxx | 126 ++--- Source/CPack/cmCPackInnoSetupGenerator.h | 20 +- Source/CPack/cmCPackLog.cxx | 4 +- Source/CPack/cmCPackLog.h | 20 +- Source/CPack/cmCPackNSISGenerator.cxx | 14 +- Source/CPack/cmCPackNSISGenerator.h | 6 +- Source/CPack/cmCPackNuGetGenerator.cxx | 4 +- Source/CPack/cmCPackNuGetGenerator.h | 2 +- Source/CPack/cmCPackPKGGenerator.cxx | 40 +- Source/CPack/cmCPackPKGGenerator.h | 34 +- Source/CPack/cmCPackProductBuildGenerator.cxx | 10 +- Source/CPack/cmCPackProductBuildGenerator.h | 14 +- Source/CPack/cmCPackRPMGenerator.cxx | 10 +- Source/CPack/cmCPackRPMGenerator.h | 10 +- Source/CPack/cmCPackSTGZGenerator.cxx | 4 +- Source/CPack/cpack.cxx | 30 +- Source/CTest/cmCTestBZR.cxx | 34 +- Source/CTest/cmCTestBinPacker.cxx | 34 +- Source/CTest/cmCTestBinPacker.h | 8 +- Source/CTest/cmCTestBuildAndTest.cxx | 12 +- Source/CTest/cmCTestBuildCommand.cxx | 4 +- Source/CTest/cmCTestBuildHandler.cxx | 42 +- Source/CTest/cmCTestBuildHandler.h | 10 +- Source/CTest/cmCTestCVS.cxx | 8 +- Source/CTest/cmCTestCVS.h | 2 +- Source/CTest/cmCTestConfigureCommand.cxx | 6 +- Source/CTest/cmCTestCoverageHandler.cxx | 26 +- Source/CTest/cmCTestCoverageHandler.h | 4 +- Source/CTest/cmCTestCurl.cxx | 6 +- Source/CTest/cmCTestCurl.h | 4 +- .../CTest/cmCTestEmptyBinaryDirectoryCommand.cxx | 4 +- Source/CTest/cmCTestGIT.cxx | 42 +- Source/CTest/cmCTestGenericHandler.cxx | 4 +- Source/CTest/cmCTestGenericHandler.h | 4 +- Source/CTest/cmCTestGlobalVC.cxx | 6 +- Source/CTest/cmCTestGlobalVC.h | 2 +- Source/CTest/cmCTestHG.cxx | 18 +- Source/CTest/cmCTestHandlerCommand.cxx | 4 +- Source/CTest/cmCTestLaunch.cxx | 12 +- Source/CTest/cmCTestLaunch.h | 14 +- Source/CTest/cmCTestLaunchReporter.cxx | 6 +- Source/CTest/cmCTestLaunchReporter.h | 6 +- Source/CTest/cmCTestMemCheckHandler.cxx | 42 +- Source/CTest/cmCTestMemCheckHandler.h | 16 +- Source/CTest/cmCTestMultiProcessHandler.cxx | 22 +- Source/CTest/cmCTestMultiProcessHandler.h | 2 +- Source/CTest/cmCTestP4.cxx | 14 +- Source/CTest/cmCTestP4.h | 4 +- Source/CTest/cmCTestResourceAllocator.cxx | 18 +- Source/CTest/cmCTestResourceAllocator.h | 12 +- Source/CTest/cmCTestResourceGroupsLexerHelper.cxx | 4 +- Source/CTest/cmCTestResourceGroupsLexerHelper.h | 4 +- Source/CTest/cmCTestResourceSpec.cxx | 24 +- Source/CTest/cmCTestResourceSpec.h | 32 +- Source/CTest/cmCTestRunTest.cxx | 6 +- Source/CTest/cmCTestRunTest.h | 10 +- Source/CTest/cmCTestSVN.cxx | 24 +- Source/CTest/cmCTestScriptHandler.cxx | 16 +- Source/CTest/cmCTestScriptHandler.h | 14 +- Source/CTest/cmCTestStartCommand.cxx | 4 +- Source/CTest/cmCTestSubmitHandler.cxx | 18 +- Source/CTest/cmCTestSubmitHandler.h | 8 +- Source/CTest/cmCTestTestHandler.cxx | 98 ++-- Source/CTest/cmCTestTestHandler.h | 44 +- Source/CTest/cmCTestTestMeasurementXMLParser.cxx | 8 +- Source/CTest/cmCTestTestMeasurementXMLParser.h | 6 +- Source/CTest/cmCTestUpdateCommand.cxx | 2 +- Source/CTest/cmCTestVC.cxx | 12 +- Source/CTest/cmCTestVC.h | 8 +- Source/CTest/cmParseCacheCoverage.cxx | 2 +- Source/CTest/cmParseCacheCoverage.h | 2 +- Source/CTest/cmParseCoberturaCoverage.cxx | 8 +- Source/CTest/cmParseCoberturaCoverage.h | 2 +- Source/CTest/cmParseDelphiCoverage.cxx | 4 +- Source/CTest/cmParseDelphiCoverage.h | 4 +- Source/CTest/cmParseGTMCoverage.cxx | 2 +- Source/CTest/cmParseGTMCoverage.h | 2 +- Source/CTest/cmParseJacocoCoverage.cxx | 6 +- Source/CTest/cmParseJacocoCoverage.h | 2 +- Source/CTest/cmParseMumpsCoverage.cxx | 4 +- Source/CTest/cmParseMumpsCoverage.h | 2 +- Source/CTest/cmParsePHPCoverage.cxx | 4 +- Source/CTest/cmParsePHPCoverage.h | 4 +- Source/CTest/cmProcess.cxx | 10 +- Source/CTest/cmProcess.h | 6 +- Source/CTest/cmUVJobServerClient.cxx | 14 +- Source/Checks/cm_cxx_filesystem.cxx | 2 +- Source/CursesDialog/ccmake.cxx | 14 +- .../CursesDialog/cmCursesCacheEntryComposite.cxx | 6 +- Source/CursesDialog/cmCursesCacheEntryComposite.h | 6 +- Source/CursesDialog/cmCursesForm.cxx | 4 +- Source/CursesDialog/cmCursesForm.h | 4 +- Source/CursesDialog/cmCursesLabelWidget.cxx | 2 +- Source/CursesDialog/cmCursesLabelWidget.h | 2 +- Source/CursesDialog/cmCursesLongMessageForm.cxx | 4 +- Source/CursesDialog/cmCursesLongMessageForm.h | 4 +- Source/CursesDialog/cmCursesMainForm.cxx | 38 +- Source/CursesDialog/cmCursesMainForm.h | 18 +- Source/CursesDialog/cmCursesOptionsWidget.cxx | 2 +- Source/CursesDialog/cmCursesOptionsWidget.h | 2 +- Source/CursesDialog/cmCursesStringWidget.cxx | 6 +- Source/CursesDialog/cmCursesStringWidget.h | 6 +- Source/CursesDialog/cmCursesWidget.cxx | 4 +- Source/CursesDialog/cmCursesWidget.h | 4 +- Source/QtDialog/AddCacheEntry.cxx | 16 +- Source/QtDialog/AddCacheEntry.h | 10 +- Source/QtDialog/CMakeSetup.cxx | 10 +- Source/QtDialog/CMakeSetupDialog.cxx | 48 +- Source/QtDialog/CMakeSetupDialog.h | 36 +- Source/QtDialog/EnvironmentDialog.cxx | 20 +- Source/QtDialog/EnvironmentDialog.h | 12 +- Source/QtDialog/FirstConfigure.cxx | 42 +- Source/QtDialog/FirstConfigure.h | 34 +- Source/QtDialog/QCMake.cxx | 34 +- Source/QtDialog/QCMake.h | 48 +- Source/QtDialog/QCMakeCacheView.cxx | 50 +- Source/QtDialog/QCMakeCacheView.h | 36 +- Source/QtDialog/QCMakePreset.cxx | 12 +- Source/QtDialog/QCMakePreset.h | 12 +- Source/QtDialog/QCMakePresetComboBox.cxx | 6 +- Source/QtDialog/QCMakePresetComboBox.h | 8 +- Source/QtDialog/QCMakePresetItemModel.cxx | 14 +- Source/QtDialog/QCMakePresetItemModel.h | 14 +- Source/QtDialog/QCMakeWidgets.cxx | 8 +- Source/QtDialog/QCMakeWidgets.h | 10 +- Source/QtDialog/RegexExplorer.cxx | 6 +- Source/QtDialog/RegexExplorer.h | 2 +- Source/bindexplib.cxx | 24 +- Source/bindexplib.h | 4 +- Source/cmAddCustomCommandCommand.cxx | 2 +- Source/cmAddCustomTargetCommand.cxx | 2 +- Source/cmAddSubDirectoryCommand.cxx | 4 +- Source/cmAlgorithms.h | 4 +- Source/cmArchiveWrite.cxx | 26 +- Source/cmArchiveWrite.h | 14 +- Source/cmBase32.cxx | 12 +- Source/cmBase32.h | 4 +- Source/cmBinUtilsLinker.cxx | 2 +- Source/cmBinUtilsLinker.h | 2 +- ...mBinUtilsLinuxELFGetRuntimeDependenciesTool.cxx | 2 +- .../cmBinUtilsLinuxELFGetRuntimeDependenciesTool.h | 2 +- Source/cmBinUtilsLinuxELFLinker.cxx | 10 +- ...lsLinuxELFObjdumpGetRuntimeDependenciesTool.cxx | 6 +- ...inUtilsMacOSMachOGetRuntimeDependenciesTool.cxx | 2 +- ...mBinUtilsMacOSMachOGetRuntimeDependenciesTool.h | 2 +- Source/cmBinUtilsMacOSMachOLinker.cxx | 6 +- Source/cmBinUtilsMacOSMachOLinker.h | 2 +- ...lsMacOSMachOOToolGetRuntimeDependenciesTool.cxx | 8 +- ...sWindowsPEDumpbinGetRuntimeDependenciesTool.cxx | 4 +- ...ilsWindowsPEDumpbinGetRuntimeDependenciesTool.h | 2 +- ...BinUtilsWindowsPEGetRuntimeDependenciesTool.cxx | 2 +- ...cmBinUtilsWindowsPEGetRuntimeDependenciesTool.h | 4 +- ...sWindowsPEObjdumpGetRuntimeDependenciesTool.cxx | 4 +- ...ilsWindowsPEObjdumpGetRuntimeDependenciesTool.h | 2 +- Source/cmBlockCommand.cxx | 12 +- Source/cmBuildDatabase.cxx | 6 +- Source/cmBuildOptions.h | 4 +- Source/cmCMakeHostSystemInformationCommand.cxx | 16 +- Source/cmCMakeLanguageCommand.cxx | 4 +- Source/cmCMakePath.cxx | 4 +- Source/cmCMakePath.h | 138 ++--- Source/cmCMakePathCommand.cxx | 98 ++-- Source/cmCMakePkgConfigCommand.cxx | 26 +- Source/cmCMakePresetsErrors.cxx | 88 +-- Source/cmCMakePresetsErrors.h | 74 +-- Source/cmCMakePresetsGraph.cxx | 138 ++--- Source/cmCMakePresetsGraph.h | 54 +- Source/cmCMakePresetsGraphInternal.h | 58 +- Source/cmCMakePresetsGraphReadJSON.cxx | 46 +- Source/cmCMakePresetsGraphReadJSONBuildPresets.cxx | 8 +- ...cmCMakePresetsGraphReadJSONConfigurePresets.cxx | 16 +- .../cmCMakePresetsGraphReadJSONPackagePresets.cxx | 2 +- Source/cmCMakePresetsGraphReadJSONTestPresets.cxx | 14 +- .../cmCMakePresetsGraphReadJSONWorkflowPresets.cxx | 4 +- Source/cmCPackPropertiesGenerator.cxx | 2 +- Source/cmCPackPropertiesGenerator.h | 2 +- Source/cmCTest.cxx | 112 ++-- Source/cmCTest.h | 76 +-- Source/cmCacheManager.cxx | 60 +- Source/cmCacheManager.h | 62 +- Source/cmCallVisualStudioMacro.cxx | 24 +- Source/cmCallVisualStudioMacro.h | 6 +- Source/cmCommandLineArgument.h | 18 +- Source/cmCommonTargetGenerator.cxx | 44 +- Source/cmCommonTargetGenerator.h | 28 +- Source/cmComputeComponentGraph.cxx | 2 +- Source/cmComputeComponentGraph.h | 2 +- Source/cmComputeLinkDepends.cxx | 70 +-- Source/cmComputeLinkDepends.h | 14 +- Source/cmComputeLinkInformation.cxx | 52 +- Source/cmComputeLinkInformation.h | 20 +- Source/cmComputeTargetDepends.cxx | 14 +- Source/cmComputeTargetDepends.h | 8 +- Source/cmConditionEvaluator.cxx | 62 +- Source/cmConditionEvaluator.h | 14 +- Source/cmConfigureFileCommand.cxx | 2 +- Source/cmConfigureLog.cxx | 4 +- Source/cmCoreTryCompile.cxx | 50 +- Source/cmCoreTryCompile.h | 6 +- Source/cmCreateTestSourceList.cxx | 2 +- Source/cmCryptoHash.cxx | 6 +- Source/cmCryptoHash.h | 6 +- Source/cmCurl.cxx | 6 +- Source/cmCurl.h | 6 +- Source/cmCustomCommand.cxx | 39 +- Source/cmCustomCommand.h | 38 +- Source/cmCustomCommandGenerator.cxx | 24 +- Source/cmCustomCommandGenerator.h | 18 +- Source/cmDebugTools.h | 2 +- Source/cmDebuggerAdapter.cxx | 34 +- Source/cmDebuggerBreakpointManager.cxx | 10 +- Source/cmDebuggerExceptionManager.cxx | 6 +- Source/cmDebuggerThread.h | 2 +- Source/cmDebuggerThreadManager.cxx | 4 +- Source/cmDebuggerThreadManager.h | 2 +- Source/cmDebuggerVariables.cxx | 4 +- Source/cmDebuggerVariables.h | 4 +- Source/cmDebuggerVariablesHelper.cxx | 2 +- Source/cmDefinePropertyCommand.cxx | 4 +- Source/cmDefinitions.cxx | 12 +- Source/cmDefinitions.h | 12 +- Source/cmDepends.cxx | 14 +- Source/cmDepends.h | 16 +- Source/cmDependsC.cxx | 16 +- Source/cmDependsC.h | 14 +- Source/cmDependsCompiler.cxx | 28 +- Source/cmDependsCompiler.h | 10 +- Source/cmDependsFortran.cxx | 36 +- Source/cmDependsFortran.h | 16 +- Source/cmDependsJava.cxx | 6 +- Source/cmDependsJava.h | 6 +- Source/cmDependsJavaParserHelper.cxx | 28 +- Source/cmDependsJavaParserHelper.h | 36 +- Source/cmDocumentation.cxx | 36 +- Source/cmDocumentation.h | 22 +- Source/cmDocumentationEntry.h | 2 +- Source/cmDocumentationFormatter.cxx | 32 +- Source/cmDocumentationSection.h | 10 +- Source/cmDuration.cxx | 6 +- Source/cmDuration.h | 6 +- Source/cmDynamicLoader.cxx | 14 +- Source/cmDynamicLoader.h | 2 +- Source/cmDyndepCollation.cxx | 2 +- Source/cmELF.cxx | 22 +- Source/cmELF.h | 10 +- Source/cmExecProgramCommand.cxx | 8 +- Source/cmExecuteProcessCommand.cxx | 10 +- Source/cmExecutionStatus.h | 2 +- Source/cmExpandedCommandArgument.cxx | 2 +- Source/cmExpandedCommandArgument.h | 2 +- Source/cmExperimental.cxx | 2 +- Source/cmExperimental.h | 2 +- Source/cmExportCommand.cxx | 10 +- Source/cmExportPackageInfoGenerator.cxx | 2 +- Source/cmExportSet.cxx | 10 +- Source/cmExportSet.h | 14 +- Source/cmExprParserHelper.cxx | 4 +- Source/cmExprParserHelper.h | 10 +- Source/cmExternalMakefileProjectGenerator.cxx | 6 +- Source/cmExternalMakefileProjectGenerator.h | 16 +- Source/cmExtraCodeBlocksGenerator.cxx | 62 +- Source/cmExtraCodeBlocksGenerator.h | 26 +- Source/cmExtraCodeLiteGenerator.cxx | 54 +- Source/cmExtraCodeLiteGenerator.h | 44 +- Source/cmExtraEclipseCDT4Generator.cxx | 96 ++-- Source/cmExtraEclipseCDT4Generator.h | 40 +- Source/cmExtraKateGenerator.cxx | 62 +- Source/cmExtraKateGenerator.h | 28 +- Source/cmExtraSublimeTextGenerator.cxx | 52 +- Source/cmExtraSublimeTextGenerator.h | 24 +- Source/cmFLTKWrapUICommand.cxx | 4 +- Source/cmFSPermissions.h | 44 +- Source/cmFileAPI.cxx | 4 +- Source/cmFileAPI.h | 2 +- Source/cmFileAPICMakeFiles.cxx | 2 +- Source/cmFileAPICodemodel.cxx | 34 +- Source/cmFileAPICommand.cxx | 12 +- Source/cmFileAPIToolchains.cxx | 10 +- Source/cmFileCommand.cxx | 94 ++-- Source/cmFileCopier.cxx | 30 +- Source/cmFileCopier.h | 24 +- Source/cmFileInstaller.cxx | 16 +- Source/cmFileInstaller.h | 12 +- Source/cmFileLock.cxx | 6 +- Source/cmFileLock.h | 4 +- Source/cmFileLockPool.cxx | 26 +- Source/cmFileLockPool.h | 16 +- Source/cmFileLockResult.cxx | 6 +- Source/cmFileLockUnix.cxx | 2 +- Source/cmFileLockWin32.cxx | 2 +- Source/cmFilePathChecksum.h | 2 +- Source/cmFileSet.cxx | 20 +- Source/cmFileSet.h | 24 +- Source/cmFileTime.h | 4 +- Source/cmFileTimeCache.h | 4 +- Source/cmFindBase.cxx | 20 +- Source/cmFindBase.h | 4 +- Source/cmFindCommon.cxx | 20 +- Source/cmFindCommon.h | 4 +- Source/cmFindLibraryCommand.cxx | 12 +- Source/cmFindLibraryCommand.h | 4 +- Source/cmFindPackageCommand.cxx | 126 ++--- Source/cmFindPackageCommand.h | 18 +- Source/cmFindProgramCommand.cxx | 2 +- Source/cmForEachCommand.cxx | 12 +- Source/cmFortranParser.h | 40 +- Source/cmFortranParserImpl.cxx | 38 +- Source/cmFunctionBlocker.cxx | 2 +- Source/cmGccDepfileLexerHelper.cxx | 4 +- Source/cmGccDepfileLexerHelper.h | 4 +- Source/cmGccDepfileReader.cxx | 2 +- Source/cmGccDepfileReader.h | 2 +- Source/cmGeneratedFileStream.cxx | 4 +- Source/cmGeneratedFileStream.h | 2 +- Source/cmGeneratorExpression.cxx | 66 +-- Source/cmGeneratorExpression.h | 28 +- Source/cmGeneratorExpressionContext.cxx | 2 +- Source/cmGeneratorExpressionContext.h | 2 +- Source/cmGeneratorExpressionDAGChecker.cxx | 16 +- Source/cmGeneratorExpressionDAGChecker.h | 16 +- Source/cmGeneratorExpressionEvaluationFile.cxx | 12 +- Source/cmGeneratorExpressionEvaluationFile.h | 20 +- Source/cmGeneratorExpressionEvaluator.cxx | 22 +- Source/cmGeneratorExpressionEvaluator.h | 14 +- Source/cmGeneratorExpressionLexer.cxx | 8 +- Source/cmGeneratorExpressionLexer.h | 6 +- Source/cmGeneratorExpressionNode.cxx | 623 ++++++++++----------- Source/cmGeneratorExpressionNode.h | 16 +- Source/cmGeneratorExpressionParser.cxx | 2 +- Source/cmGeneratorExpressionParser.h | 2 +- Source/cmGeneratorTarget.cxx | 364 ++++++------ Source/cmGeneratorTarget.h | 366 ++++++------ Source/cmGeneratorTarget_CompatibleInterface.cxx | 138 ++--- Source/cmGeneratorTarget_IncludeDirectories.cxx | 26 +- Source/cmGeneratorTarget_Link.cxx | 60 +- Source/cmGeneratorTarget_LinkDirectories.cxx | 4 +- Source/cmGeneratorTarget_Options.cxx | 60 +- Source/cmGeneratorTarget_Sources.cxx | 4 +- Source/cmGeneratorTarget_TargetPropertyEntry.cxx | 20 +- Source/cmGeneratorTarget_TransitiveProperty.cxx | 6 +- Source/cmGetCMakePropertyCommand.cxx | 2 +- Source/cmGetPropertyCommand.cxx | 108 ++-- Source/cmGetSourceFilePropertyCommand.cxx | 4 +- Source/cmGhsMultiGpj.cxx | 4 +- Source/cmGhsMultiGpj.h | 2 +- Source/cmGhsMultiTargetGenerator.cxx | 52 +- Source/cmGhsMultiTargetGenerator.h | 24 +- Source/cmGlobCacheEntry.h | 10 +- Source/cmGlobVerificationManager.cxx | 12 +- Source/cmGlobVerificationManager.h | 24 +- Source/cmGlobalBorlandMakefileGenerator.cxx | 8 +- Source/cmGlobalBorlandMakefileGenerator.h | 8 +- Source/cmGlobalCommonGenerator.cxx | 12 +- Source/cmGlobalCommonGenerator.h | 10 +- Source/cmGlobalGenerator.cxx | 256 ++++----- Source/cmGlobalGenerator.h | 162 +++--- Source/cmGlobalGeneratorFactory.h | 4 +- Source/cmGlobalGhsMultiGenerator.cxx | 26 +- Source/cmGlobalGhsMultiGenerator.h | 16 +- Source/cmGlobalJOMMakefileGenerator.cxx | 8 +- Source/cmGlobalJOMMakefileGenerator.h | 8 +- Source/cmGlobalNMakeMakefileGenerator.cxx | 8 +- Source/cmGlobalNMakeMakefileGenerator.h | 8 +- Source/cmGlobalNinjaGenerator.cxx | 132 ++--- Source/cmGlobalNinjaGenerator.h | 188 +++---- Source/cmGlobalUnixMakefileGenerator3.cxx | 52 +- Source/cmGlobalUnixMakefileGenerator3.h | 46 +- Source/cmGlobalVisualStudio10Generator.cxx | 42 +- Source/cmGlobalVisualStudio10Generator.h | 28 +- Source/cmGlobalVisualStudio11Generator.cxx | 12 +- Source/cmGlobalVisualStudio11Generator.h | 2 +- Source/cmGlobalVisualStudio12Generator.cxx | 8 +- Source/cmGlobalVisualStudio12Generator.h | 2 +- Source/cmGlobalVisualStudio14Generator.cxx | 24 +- Source/cmGlobalVisualStudio14Generator.h | 8 +- Source/cmGlobalVisualStudio71Generator.cxx | 22 +- Source/cmGlobalVisualStudio71Generator.h | 20 +- Source/cmGlobalVisualStudio7Generator.cxx | 38 +- Source/cmGlobalVisualStudio7Generator.h | 48 +- Source/cmGlobalVisualStudio8Generator.cxx | 20 +- Source/cmGlobalVisualStudio8Generator.h | 16 +- Source/cmGlobalVisualStudioGenerator.cxx | 52 +- Source/cmGlobalVisualStudioGenerator.h | 22 +- Source/cmGlobalVisualStudioVersionedGenerator.cxx | 40 +- Source/cmGlobalVisualStudioVersionedGenerator.h | 6 +- Source/cmGlobalWatcomWMakeGenerator.cxx | 8 +- Source/cmGlobalWatcomWMakeGenerator.h | 8 +- Source/cmGlobalXCodeGenerator.cxx | 262 ++++----- Source/cmGlobalXCodeGenerator.h | 118 ++-- Source/cmGraphVizWriter.cxx | 54 +- Source/cmGraphVizWriter.h | 18 +- Source/cmHexFileConverter.cxx | 14 +- Source/cmHexFileConverter.h | 6 +- Source/cmIDEOptions.cxx | 12 +- Source/cmIDEOptions.h | 10 +- Source/cmIncludeCommand.cxx | 4 +- Source/cmIncludeDirectoryCommand.cxx | 4 +- Source/cmInstallCommand.cxx | 150 ++--- Source/cmInstallCommandArguments.cxx | 28 +- Source/cmInstallCommandArguments.h | 28 +- Source/cmInstallCxxModuleBmiGenerator.cxx | 2 +- Source/cmInstallCxxModuleBmiGenerator.h | 2 +- Source/cmInstallDirectoryGenerator.cxx | 6 +- Source/cmInstallDirectoryGenerator.h | 4 +- Source/cmInstallExportGenerator.h | 6 +- Source/cmInstallFileSetGenerator.cxx | 4 +- Source/cmInstallFileSetGenerator.h | 4 +- Source/cmInstallFilesCommand.cxx | 10 +- Source/cmInstallFilesGenerator.cxx | 4 +- Source/cmInstallFilesGenerator.h | 2 +- Source/cmInstallGenerator.cxx | 20 +- Source/cmInstallGenerator.h | 22 +- .../cmInstallGetRuntimeDependenciesGenerator.cxx | 28 +- Source/cmInstallGetRuntimeDependenciesGenerator.h | 10 +- .../cmInstallImportedRuntimeArtifactsGenerator.cxx | 8 +- .../cmInstallImportedRuntimeArtifactsGenerator.h | 2 +- Source/cmInstallProgramsCommand.cxx | 10 +- Source/cmInstallRuntimeDependencySet.cxx | 12 +- Source/cmInstallRuntimeDependencySet.h | 22 +- Source/cmInstallRuntimeDependencySetGenerator.cxx | 22 +- Source/cmInstallRuntimeDependencySetGenerator.h | 30 +- Source/cmInstallScriptGenerator.cxx | 2 +- Source/cmInstallScriptGenerator.h | 2 +- Source/cmInstallScriptHandler.cxx | 4 +- Source/cmInstallScriptHandler.h | 2 +- Source/cmInstallSubdirectoryGenerator.cxx | 2 +- Source/cmInstallTargetGenerator.cxx | 46 +- Source/cmInstallTargetGenerator.h | 28 +- Source/cmInstalledFile.cxx | 22 +- Source/cmInstalledFile.h | 28 +- Source/cmInstrumentation.cxx | 30 +- Source/cmInstrumentation.h | 26 +- Source/cmInstrumentationCommand.cxx | 8 +- Source/cmInstrumentationQuery.cxx | 22 +- Source/cmInstrumentationQuery.h | 6 +- Source/cmJSONHelpers.cxx | 26 +- Source/cmJSONHelpers.h | 86 +-- Source/cmJSONState.cxx | 12 +- Source/cmJSONState.h | 10 +- Source/cmLDConfigLDConfigTool.cxx | 2 +- Source/cmLinkItem.cxx | 6 +- Source/cmLinkItem.h | 4 +- Source/cmLinkItemGraphVisitor.cxx | 4 +- Source/cmLinkLineComputer.cxx | 4 +- Source/cmLinkLineDeviceComputer.cxx | 6 +- Source/cmLinkLineDeviceComputer.h | 2 +- Source/cmList.cxx | 88 +-- Source/cmList.h | 66 +-- Source/cmListCommand.cxx | 76 +-- Source/cmListFileCache.cxx | 36 +- Source/cmListFileCache.h | 14 +- Source/cmListFileLexer.h | 6 +- Source/cmLoadCacheCommand.cxx | 12 +- Source/cmLocalGenerator.cxx | 362 ++++++------ Source/cmLocalGenerator.h | 182 +++--- Source/cmLocalNinjaGenerator.cxx | 38 +- Source/cmLocalNinjaGenerator.h | 24 +- Source/cmLocalUnixMakefileGenerator3.cxx | 82 +-- Source/cmLocalUnixMakefileGenerator3.h | 50 +- Source/cmLocalVisualStudio10Generator.cxx | 10 +- Source/cmLocalVisualStudio10Generator.h | 6 +- Source/cmLocalVisualStudio7Generator.cxx | 136 ++--- Source/cmLocalVisualStudio7Generator.h | 56 +- Source/cmLocalVisualStudioGenerator.cxx | 10 +- Source/cmLocalVisualStudioGenerator.h | 10 +- Source/cmLocalXCodeGenerator.cxx | 10 +- Source/cmLocalXCodeGenerator.h | 2 +- Source/cmMachO.cxx | 30 +- Source/cmMachO.h | 2 +- Source/cmMakefile.cxx | 314 +++++------ Source/cmMakefile.h | 244 ++++---- Source/cmMakefileExecutableTargetGenerator.cxx | 14 +- Source/cmMakefileExecutableTargetGenerator.h | 2 +- Source/cmMakefileLibraryTargetGenerator.cxx | 18 +- Source/cmMakefileLibraryTargetGenerator.h | 10 +- Source/cmMakefileProfilingData.cxx | 10 +- Source/cmMakefileProfilingData.h | 8 +- Source/cmMakefileTargetGenerator.cxx | 116 ++-- Source/cmMakefileTargetGenerator.h | 38 +- Source/cmMakefileUtilityTargetGenerator.cxx | 2 +- Source/cmMarkAsAdvancedCommand.cxx | 2 +- Source/cmMathCommand.cxx | 10 +- Source/cmMessageCommand.cxx | 4 +- Source/cmMessageMetadata.h | 2 +- Source/cmMessenger.cxx | 10 +- Source/cmNewLineStyle.cxx | 2 +- Source/cmNewLineStyle.h | 2 +- Source/cmNinjaNormalTargetGenerator.cxx | 88 +-- Source/cmNinjaNormalTargetGenerator.h | 64 +-- Source/cmNinjaTargetGenerator.cxx | 158 +++--- Source/cmNinjaTargetGenerator.h | 106 ++-- Source/cmNinjaUtilityTargetGenerator.cxx | 6 +- Source/cmNinjaUtilityTargetGenerator.h | 2 +- Source/cmOSXBundleGenerator.cxx | 18 +- Source/cmOSXBundleGenerator.h | 24 +- Source/cmOptionCommand.cxx | 6 +- Source/cmOrderDirectories.cxx | 12 +- Source/cmOrderDirectories.h | 8 +- Source/cmOutputConverter.cxx | 4 +- Source/cmOutputConverter.h | 2 +- Source/cmParseArgumentsCommand.cxx | 16 +- Source/cmPathLabel.cxx | 4 +- Source/cmPathLabel.h | 8 +- Source/cmPkgConfigParser.cxx | 16 +- Source/cmPkgConfigParser.h | 18 +- Source/cmPkgConfigResolver.cxx | 78 +-- Source/cmPkgConfigResolver.h | 60 +- Source/cmPlistParser.cxx | 2 +- Source/cmPlistParser.h | 2 +- Source/cmPolicies.cxx | 10 +- Source/cmPolicies.h | 2 +- Source/cmProcessOutput.cxx | 6 +- Source/cmProcessOutput.h | 2 +- Source/cmProcessTools.cxx | 10 +- Source/cmProcessTools.h | 14 +- Source/cmProjectCommand.cxx | 8 +- Source/cmPropertyDefinition.cxx | 8 +- Source/cmPropertyDefinition.h | 18 +- Source/cmPropertyMap.cxx | 10 +- Source/cmPropertyMap.h | 10 +- Source/cmQtAutoGen.cxx | 8 +- Source/cmQtAutoGenGlobalInitializer.cxx | 8 +- Source/cmQtAutoGenInitializer.cxx | 28 +- Source/cmQtAutoGenInitializer.h | 2 +- Source/cmQtAutoMocUic.cxx | 40 +- Source/cmRulePlaceholderExpander.cxx | 2 +- Source/cmRulePlaceholderExpander.h | 92 +-- Source/cmRuntimeDependencyArchive.cxx | 64 +-- Source/cmRuntimeDependencyArchive.h | 40 +- Source/cmScanDepFormat.cxx | 2 +- Source/cmScriptGenerator.cxx | 14 +- Source/cmScriptGenerator.h | 10 +- Source/cmSearchPath.cxx | 26 +- Source/cmSearchPath.h | 30 +- Source/cmSetCommand.cxx | 2 +- Source/cmSetDirectoryPropertiesCommand.cxx | 2 +- Source/cmSetPropertyCommand.cxx | 160 +++--- Source/cmSetPropertyCommand.h | 2 +- Source/cmSetSourceFilesPropertiesCommand.cxx | 8 +- Source/cmSetTargetPropertiesCommand.cxx | 2 +- Source/cmSetTestsPropertiesCommand.cxx | 2 +- Source/cmSourceFile.cxx | 36 +- Source/cmSourceFile.h | 42 +- Source/cmSourceFileLocation.cxx | 10 +- Source/cmSourceFileLocation.h | 10 +- Source/cmSourceGroup.cxx | 30 +- Source/cmSourceGroup.h | 26 +- Source/cmSourceGroupCommand.cxx | 62 +- Source/cmStandardLevelResolver.cxx | 40 +- Source/cmStandardLevelResolver.h | 18 +- Source/cmState.cxx | 100 ++-- Source/cmState.h | 66 +-- Source/cmStateDirectory.cxx | 16 +- Source/cmStateDirectory.h | 12 +- Source/cmStatePrivate.h | 2 +- Source/cmStateSnapshot.cxx | 12 +- Source/cmStateSnapshot.h | 18 +- Source/cmStateTypes.h | 2 +- Source/cmString.cxx | 6 +- Source/cmString.hxx | 66 +-- Source/cmStringAlgorithms.cxx | 12 +- Source/cmStringAlgorithms.h | 18 +- Source/cmStringCommand.cxx | 128 ++--- Source/cmStringReplaceHelper.cxx | 6 +- Source/cmStringReplaceHelper.h | 8 +- Source/cmSystemTools.cxx | 210 +++---- Source/cmSystemTools.h | 96 ++-- Source/cmTarget.cxx | 144 ++--- Source/cmTarget.h | 48 +- Source/cmTargetCompileDefinitionsCommand.cxx | 6 +- Source/cmTargetCompileFeaturesCommand.cxx | 6 +- Source/cmTargetCompileOptionsCommand.cxx | 6 +- Source/cmTargetIncludeDirectoriesCommand.cxx | 14 +- Source/cmTargetLinkDirectoriesCommand.cxx | 10 +- Source/cmTargetLinkLibrariesCommand.cxx | 10 +- Source/cmTargetLinkOptionsCommand.cxx | 6 +- Source/cmTargetPrecompileHeadersCommand.cxx | 10 +- Source/cmTargetPropCommandBase.cxx | 14 +- Source/cmTargetPropCommandBase.h | 12 +- Source/cmTargetPropertyComputer.h | 6 +- Source/cmTargetSourcesCommand.cxx | 28 +- Source/cmTargetTraceDependencies.cxx | 4 +- Source/cmTargetTraceDependencies.h | 2 +- Source/cmTest.cxx | 12 +- Source/cmTest.h | 14 +- Source/cmTestGenerator.cxx | 30 +- Source/cmTestGenerator.h | 8 +- Source/cmTimestamp.cxx | 16 +- Source/cmTimestamp.h | 6 +- Source/cmTransformDepfile.cxx | 22 +- Source/cmTransformDepfile.h | 4 +- Source/cmTryCompileCommand.cxx | 2 +- Source/cmTryRunCommand.cxx | 12 +- Source/cmUVHandlePtr.cxx | 2 +- Source/cmUVHandlePtr.h | 2 +- Source/cmUVProcessChain.cxx | 20 +- Source/cmUVProcessChain.h | 10 +- Source/cmUVStream.h | 2 +- Source/cmUVStreambuf.h | 4 +- Source/cmUuid.cxx | 6 +- Source/cmUuid.h | 4 +- Source/cmVSSetupHelper.cxx | 10 +- Source/cmVSSetupHelper.h | 8 +- Source/cmValue.h | 38 +- Source/cmVariableWatch.cxx | 14 +- Source/cmVariableWatch.h | 18 +- Source/cmVariableWatchCommand.cxx | 10 +- Source/cmVersion.cxx | 2 +- Source/cmVersion.h | 2 +- Source/cmVisualStudio10TargetGenerator.cxx | 274 ++++----- Source/cmVisualStudio10TargetGenerator.h | 32 +- Source/cmVisualStudioGeneratorOptions.cxx | 18 +- Source/cmVisualStudioGeneratorOptions.h | 14 +- Source/cmVisualStudioSlnData.cxx | 18 +- Source/cmVisualStudioSlnData.h | 28 +- Source/cmVisualStudioSlnParser.cxx | 70 +-- Source/cmVisualStudioSlnParser.h | 24 +- Source/cmVisualStudioWCEPlatformParser.cxx | 26 +- Source/cmVisualStudioWCEPlatformParser.h | 18 +- Source/cmWindowsRegistry.cxx | 32 +- Source/cmWindowsRegistry.h | 6 +- Source/cmWorkerPool.cxx | 10 +- Source/cmWorkingDirectory.h | 4 +- Source/cmXCOFF.cxx | 14 +- Source/cmXCOFF.h | 2 +- Source/cmXCode21Object.cxx | 4 +- Source/cmXCodeObject.cxx | 20 +- Source/cmXCodeObject.h | 32 +- Source/cmXCodeScheme.cxx | 54 +- Source/cmXCodeScheme.h | 68 +-- Source/cmXMLParser.cxx | 30 +- Source/cmXMLParser.h | 36 +- Source/cmXMLSafe.cxx | 4 +- Source/cmXMLSafe.h | 2 +- Source/cmXMLWriter.cxx | 12 +- Source/cmXMLWriter.h | 36 +- Source/cmXcFramework.cxx | 12 +- Source/cmXcFramework.h | 10 +- Source/cm_codecvt.cxx | 10 +- Source/cm_codecvt.hxx | 8 +- Source/cm_get_date.h | 2 +- Source/cm_utf8.c | 8 +- Source/cm_utf8.h | 4 +- Source/cmake.cxx | 224 ++++---- Source/cmake.h | 128 ++--- Source/cmakemain.cxx | 44 +- Source/cmcldeps.cxx | 16 +- Source/cmcmd.cxx | 72 +-- Source/cmcmd.h | 8 +- Source/ctest.cxx | 6 +- Tests/BuildDepends/Project/generator.cxx | 4 +- Tests/BuildDepends/Project/zot.cxx | 6 +- Tests/BuildDepends/Project/zot_macro_dir.cxx | 2 +- Tests/BuildDepends/Project/zot_macro_tgt.cxx | 2 +- Tests/BuildDepends/Project/zot_pch.cxx | 2 +- Tests/BundleGeneratorTest/Executable.cxx | 2 +- Tests/BundleGeneratorTest/Library.cxx | 2 +- Tests/BundleTest/BundleLib.cxx | 2 +- Tests/CMakeGUI/CMakeGUITest.cxx | 4 +- Tests/CMakeGUI/QCMakeCacheModelTest.cxx | 2 +- Tests/CMakeLib/run_compile_commands.cxx | 6 +- Tests/CMakeLib/testAssert.cxx | 4 +- Tests/CMakeLib/testCMFilesystemPath.cxx | 2 +- Tests/CMakeLib/testCTestBinPacker.cxx | 6 +- Tests/CMakeLib/testCTestResourceAllocator.cxx | 176 +++--- Tests/CMakeLib/testCTestResourceGroups.cxx | 4 +- Tests/CMakeLib/testCTestResourceSpec.cxx | 6 +- Tests/CMakeLib/testCommon.h | 2 +- Tests/CMakeLib/testDebugger.h | 4 +- Tests/CMakeLib/testDebuggerAdapter.cxx | 8 +- Tests/CMakeLib/testDebuggerAdapterPipe.cxx | 10 +- Tests/CMakeLib/testDebuggerBreakpointManager.cxx | 4 +- Tests/CMakeLib/testDebuggerNamedPipe.cxx | 8 +- Tests/CMakeLib/testDebuggerThread.cxx | 4 +- Tests/CMakeLib/testDocumentationFormatter.cxx | 6 +- Tests/CMakeLib/testEncoding.cxx | 2 +- Tests/CMakeLib/testGccDepfileReader.cxx | 28 +- Tests/CMakeLib/testJSONHelpers.cxx | 16 +- Tests/CMakeLib/testList.cxx | 2 +- Tests/CMakeLib/testOptional.cxx | 96 ++-- Tests/CMakeLib/testString.cxx | 64 +-- Tests/CMakeLib/testUTF8.cxx | 8 +- Tests/CMakeLib/testUVJobServerClient.cxx | 4 +- Tests/CMakeLib/testUVProcessChain.cxx | 52 +- Tests/CMakeLib/testUVStreambuf.cxx | 10 +- Tests/CMakeLib/testVisualStudioSlnParser.cxx | 10 +- Tests/CMakeLib/testXMLSafe.cxx | 4 +- Tests/CTestConfig/CTestConfig.cxx | 2 +- Tests/CTestTest/SmallAndFast/echoargs.c | 2 +- .../SmallAndFast/intentional_compile_warning.cxx | 2 +- Tests/CTestTestCrash/crash.cxx | 2 +- Tests/CTestTestParallel/lockFile.c | 2 +- Tests/CompileDefinitions/compiletest.cpp | 4 +- Tests/CompileFeatures/cxx_deleted_functions.cpp | 4 +- Tests/CompileFeatures/cxx_raw_string_literals.cpp | 2 +- Tests/CompileFeatures/cxx_relaxed_constexpr.cpp | 2 +- Tests/CompileFeatures/cxx_unrestricted_unions.cpp | 2 +- Tests/Complex/Executable/complex.cxx | 8 +- Tests/ComplexOneConfig/Executable/complex.cxx | 8 +- Tests/Cuda/Complex/file2.cu | 6 +- Tests/Cuda/ProperDeviceLibraries/main.cu | 2 +- Tests/Cuda/SharedRuntimePlusToolkit/nppif.cpp | 26 +- Tests/Cuda/StaticRuntimePlusToolkit/nppif.cpp | 26 +- Tests/CudaOnly/CUBIN/main.cu | 2 +- Tests/CudaOnly/Fatbin/main.cu | 2 +- Tests/CudaOnly/OptixIR/main.cu | 4 +- Tests/CudaOnly/ResolveDeviceSymbols/file2.cu | 4 +- Tests/CudaOnly/SeparateCompilation/file2.cu | 6 +- Tests/CudaOnly/SharedRuntimePlusToolkit/nppif.cu | 26 +- Tests/CudaOnly/StaticRuntimePlusToolkit/nppif.cu | 26 +- Tests/CustomCommand/wrapper.cxx | 2 +- Tests/ExportImport/Export/testExe1.c | 2 +- Tests/ExportImport/Export/testExe3.c | 2 +- Tests/ExportImport/Export/testExe4.c | 2 +- Tests/FindGTK2/atk/main.c | 2 +- Tests/FindGTK2/gdk_pixbuf/main.c | 8 +- Tests/FindHDF5/Test/test_C.c | 2 +- Tests/FindHDF5/Test/test_CXX.cxx | 2 +- Tests/FindICU/Test/main.cpp | 2 +- Tests/FindIconv/Test/main.cxx | 6 +- Tests/FindLibLZMA/Test/main.c | 4 +- Tests/FindMatlab/matlab_wrapper1.cpp | 4 +- Tests/FindMatlab/matlab_wrapper2.cpp | 4 +- Tests/FindMatlab/matlab_wrapper_failure.cpp | 4 +- Tests/FindOpenACC/CXXTest/main.cxx | 2 +- Tests/FindOpenSP/Test/main.cxx | 6 +- Tests/FindProtobuf/Test/main-desc.cxx | 8 +- Tests/FindPython/TEST_spam.c | 2 +- Tests/FindPython/spam.c | 2 +- Tests/FindVulkan/Test/main-SPIRV-Tools.c | 4 +- .../FindVulkan/Test/main-dynamicVulkanLoading.cpp | 2 +- Tests/FindVulkan/Test/main-glslang.cxx | 8 +- Tests/FindX11/Test/main.c | 2 +- Tests/Fuzzing/xml_parser_fuzzer.cc | 2 +- .../GhsMultiIntegrityDDInt/App/Main.c | 2 +- Tests/ISPC/ObjectGenex/main.cxx | 2 +- Tests/MathTest/MathTestExec.cxx | 2 +- Tests/OutDir/OutDir.c | 4 +- Tests/PerConfig/pcShared.c | 2 +- Tests/PerConfig/pcStatic.c | 2 +- Tests/PerConfig/perconfig.c | 2 +- Tests/Plugin/include/DynamicLoader.hxx | 4 +- Tests/Plugin/src/DynamicLoader.cxx | 28 +- Tests/Qt4Deploy/testdeploy.cpp | 2 +- Tests/QtAutogen/Complex/calwidget.cpp | 6 +- Tests/QtAutogen/Complex/calwidget.h | 4 +- Tests/QtAutogen/Complex/codeeditor.cpp | 2 +- Tests/QtAutogen/Complex/codeeditor.h | 2 +- .../QtAutogen/RerunMocPlugin/MocPlugin/StyleA.cpp | 2 +- .../QtAutogen/RerunMocPlugin/MocPlugin/StyleA.hpp | 2 +- .../QtAutogen/RerunMocPlugin/MocPlugin/StyleB.cpp | 2 +- .../QtAutogen/RerunMocPlugin/MocPlugin/StyleB.hpp | 2 +- .../QtAutogen/RerunMocPlugin/MocPlugin/StyleC.cpp | 2 +- .../QtAutogen/RerunMocPlugin/MocPlugin/StyleC.hpp | 2 +- .../QtAutogen/RerunMocPlugin/MocPlugin/StyleD.cpp | 2 +- .../QtAutogen/RerunMocPlugin/MocPlugin/StyleD.hpp | 2 +- .../QtAutogen/RerunMocPlugin/MocPlugin/StyleE.cpp | 2 +- .../RerunMocPlugin/MocPlugin/StyleEInclude.hpp | 2 +- Tests/QtAutogen/UicInterface/klocalizedstring.cpp | 4 +- Tests/QtAutogen/UicInterface/klocalizedstring.h | 4 +- Tests/RunCMake/Autogen_common/exe_common.h | 2 +- .../CTestResourceAllocation/ctresalloc.cxx | 12 +- .../CrosscompilingEmulator/emulator_unexpected.c | 2 +- Tests/RunCMake/FindMatlab/matlab_wrapper1.cpp | 4 +- .../GenerateExportHeader/exportheader_test.cpp | 2 +- Tests/RunCMake/GoogleTest/fake_gtest.cpp | 8 +- Tests/RunCMake/GoogleTest/flush_script_test.cpp | 6 +- Tests/RunCMake/GoogleTest/test_launcher.c | 8 +- Tests/RunCMake/NinjaMultiConfig/generator.c | 12 +- Tests/RunCMake/NinjaMultiConfig/generatorlib.c | 4 +- Tests/RunCMake/NinjaMultiConfig/generatorobj.c | 4 +- Tests/RunCMake/detect_jobserver.c | 8 +- Tests/RunCMake/exit_code.c | 8 +- Tests/RunCMake/exit_crash.c | 4 +- Tests/RunCMake/pseudo_emulator.c | 2 +- Tests/RunCMake/pseudo_emulator_custom_command.c | 8 +- .../RunCMake/pseudo_emulator_custom_command_arg.c | 6 +- Tests/RunCMake/showIncludes.c | 2 +- Tests/SubDir/Executable/test.cxx | 2 +- Tests/SubDirSpaces/Executable Sources/test.cxx | 2 +- Tests/SubDirSpaces/Executable/test.cxx | 2 +- Tests/SwiftMixPCH/CMain.c | 2 +- Tests/SystemInformation/DumpInformation.cxx | 8 +- Tests/TestsWorkingDirectory/main.c | 10 +- Tests/VSResource/main.cpp | 2 +- .../VSWinStorePhone/Direct3DApp1/CubeRenderer.cpp | 2 +- .../VSWinStorePhone/Direct3DApp1/Direct3DBase.cpp | 2 +- Tests/Wrapping/Wrap.c | 2 +- Tests/Wrapping/qtwrappingmain.cxx | 2 +- Tests/iOSNavApp/TotalFunction.c | 2 +- Tests/iOSNavApp/TotalFunction.h | 2 +- .../OstringstreamUseCmstrcatCheck.cxx | 6 +- .../OstringstreamUseCmstrcatCheck.h | 2 +- .../StringConcatenationUseCmstrcatCheck.cxx | 20 +- .../StringConcatenationUseCmstrcatCheck.h | 10 +- .../Tests/cmake-use-cmstrlen-fixit.cxx | 4 +- .../ClangTidyModule/Tests/cmake-use-cmstrlen.cxx | 4 +- .../ClangTidyModule/UseBespokeEnumClassCheck.cxx | 4 +- .../ClangTidyModule/UseBespokeEnumClassCheck.h | 2 +- Utilities/ClangTidyModule/UseCmstrlenCheck.cxx | 12 +- Utilities/ClangTidyModule/UseCmstrlenCheck.h | 2 +- Utilities/ClangTidyModule/UseCmsysFstreamCheck.cxx | 8 +- Utilities/ClangTidyModule/UseCmsysFstreamCheck.h | 2 +- Utilities/ClangTidyModule/UsePragmaOnceCheck.cxx | 24 +- Utilities/ClangTidyModule/UsePragmaOnceCheck.h | 2 +- Utilities/cmcurl/curltest.c | 10 +- Utilities/std/cm/bits/container_helpers.hxx | 68 +-- Utilities/std/cm/bits/fs_path.cxx | 48 +- Utilities/std/cm/bits/string_view.cxx | 30 +- Utilities/std/cm/deque | 2 +- Utilities/std/cm/filesystem | 160 +++--- Utilities/std/cm/iomanip | 20 +- Utilities/std/cm/list | 2 +- Utilities/std/cm/optional | 86 +-- Utilities/std/cm/string | 2 +- Utilities/std/cm/string_view | 40 +- Utilities/std/cm/vector | 2 +- Utilities/std/cmext/algorithm | 2 +- Utilities/std/cmext/enum_set | 56 +- Utilities/std/cmext/iterator | 8 +- Utilities/std/cmext/string_view | 4 +- 887 files changed, 9693 insertions(+), 9695 deletions(-) diff --git a/Help/guide/importing-exporting/Downstream/main.cc b/Help/guide/importing-exporting/Downstream/main.cc index 8574373..1102364 100644 --- a/Help/guide/importing-exporting/Downstream/main.cc +++ b/Help/guide/importing-exporting/Downstream/main.cc @@ -12,10 +12,10 @@ int main(int argc, char* argv[]) } // convert input to double - const double inputValue = std::stod(argv[1]); + double const inputValue = std::stod(argv[1]); // calculate square root - const double sqrt = MathFunctions::sqrt(inputValue); + double const sqrt = MathFunctions::sqrt(inputValue); std::cout << "The square root of " << inputValue << " is " << sqrt << std::endl; diff --git a/Help/guide/importing-exporting/DownstreamComponents/main.cc b/Help/guide/importing-exporting/DownstreamComponents/main.cc index f5e8fa6..a53037e 100644 --- a/Help/guide/importing-exporting/DownstreamComponents/main.cc +++ b/Help/guide/importing-exporting/DownstreamComponents/main.cc @@ -13,15 +13,15 @@ int main(int argc, char* argv[]) } // convert input to double - const double inputValue = std::stod(argv[1]); + double const inputValue = std::stod(argv[1]); // calculate square root - const double sqrt = MathFunctions::sqrt(inputValue); + double const sqrt = MathFunctions::sqrt(inputValue); std::cout << "The square root of " << inputValue << " is " << sqrt << std::endl; // calculate sum - const double sum = MathFunctions::add(inputValue, inputValue); + double const sum = MathFunctions::add(inputValue, inputValue); std::cout << inputValue << " + " << inputValue << " = " << sum << std::endl; return 0; diff --git a/Help/guide/tutorial/Adding a Library.rst b/Help/guide/tutorial/Adding a Library.rst index cfcfc67..8f39da3 100644 --- a/Help/guide/tutorial/Adding a Library.rst +++ b/Help/guide/tutorial/Adding a Library.rst @@ -194,7 +194,7 @@ Lastly, replace ``sqrt`` with the wrapper function ``mathfunctions::sqrt``. :caption: TODO 6: tutorial.cxx :name: CMakeLists.txt-option :language: cmake - :start-after: const double inputValue = std::stod(argv[1]); + :start-after: double const inputValue = std::stod(argv[1]); :end-before: std::cout .. raw:: html diff --git a/Help/guide/tutorial/Complete/MathFunctions/MakeTable.cxx b/Help/guide/tutorial/Complete/MathFunctions/MakeTable.cxx index ee58556..f85b278 100644 --- a/Help/guide/tutorial/Complete/MathFunctions/MakeTable.cxx +++ b/Help/guide/tutorial/Complete/MathFunctions/MakeTable.cxx @@ -11,7 +11,7 @@ int main(int argc, char* argv[]) } std::ofstream fout(argv[1], std::ios_base::out); - const bool fileOpen = fout.is_open(); + bool const fileOpen = fout.is_open(); if (fileOpen) { fout << "double sqrtTable[] = {" << std::endl; for (int i = 0; i < 10; ++i) { diff --git a/Help/guide/tutorial/Complete/tutorial.cxx b/Help/guide/tutorial/Complete/tutorial.cxx index a4f44d5..78641b1 100644 --- a/Help/guide/tutorial/Complete/tutorial.cxx +++ b/Help/guide/tutorial/Complete/tutorial.cxx @@ -16,9 +16,9 @@ int main(int argc, char* argv[]) } // convert input to double - const double inputValue = std::stod(argv[1]); + double const inputValue = std::stod(argv[1]); - const double outputValue = mathfunctions::sqrt(inputValue); + double const outputValue = mathfunctions::sqrt(inputValue); std::cout << "The square root of " << inputValue << " is " << outputValue << std::endl; diff --git a/Help/guide/tutorial/Step1/tutorial.cxx b/Help/guide/tutorial/Step1/tutorial.cxx index 64d0916..18077b6 100644 --- a/Help/guide/tutorial/Step1/tutorial.cxx +++ b/Help/guide/tutorial/Step1/tutorial.cxx @@ -17,10 +17,10 @@ int main(int argc, char* argv[]) // convert input to double // TODO 4: Replace atof(argv[1]) with std::stod(argv[1]) - const double inputValue = atof(argv[1]); + double const inputValue = atof(argv[1]); // calculate square root - const double outputValue = sqrt(inputValue); + double const outputValue = sqrt(inputValue); std::cout << "The square root of " << inputValue << " is " << outputValue << std::endl; return 0; diff --git a/Help/guide/tutorial/Step10/MathFunctions/MakeTable.cxx b/Help/guide/tutorial/Step10/MathFunctions/MakeTable.cxx index ee58556..f85b278 100644 --- a/Help/guide/tutorial/Step10/MathFunctions/MakeTable.cxx +++ b/Help/guide/tutorial/Step10/MathFunctions/MakeTable.cxx @@ -11,7 +11,7 @@ int main(int argc, char* argv[]) } std::ofstream fout(argv[1], std::ios_base::out); - const bool fileOpen = fout.is_open(); + bool const fileOpen = fout.is_open(); if (fileOpen) { fout << "double sqrtTable[] = {" << std::endl; for (int i = 0; i < 10; ++i) { diff --git a/Help/guide/tutorial/Step10/tutorial.cxx b/Help/guide/tutorial/Step10/tutorial.cxx index 37a0333..ca5110c 100644 --- a/Help/guide/tutorial/Step10/tutorial.cxx +++ b/Help/guide/tutorial/Step10/tutorial.cxx @@ -17,9 +17,9 @@ int main(int argc, char* argv[]) } // convert input to double - const double inputValue = std::stod(argv[1]); + double const inputValue = std::stod(argv[1]); - const double outputValue = mathfunctions::sqrt(inputValue); + double const outputValue = mathfunctions::sqrt(inputValue); std::cout << "The square root of " << inputValue << " is " << outputValue << std::endl; diff --git a/Help/guide/tutorial/Step11/MathFunctions/MakeTable.cxx b/Help/guide/tutorial/Step11/MathFunctions/MakeTable.cxx index ee58556..f85b278 100644 --- a/Help/guide/tutorial/Step11/MathFunctions/MakeTable.cxx +++ b/Help/guide/tutorial/Step11/MathFunctions/MakeTable.cxx @@ -11,7 +11,7 @@ int main(int argc, char* argv[]) } std::ofstream fout(argv[1], std::ios_base::out); - const bool fileOpen = fout.is_open(); + bool const fileOpen = fout.is_open(); if (fileOpen) { fout << "double sqrtTable[] = {" << std::endl; for (int i = 0; i < 10; ++i) { diff --git a/Help/guide/tutorial/Step11/tutorial.cxx b/Help/guide/tutorial/Step11/tutorial.cxx index 37a0333..ca5110c 100644 --- a/Help/guide/tutorial/Step11/tutorial.cxx +++ b/Help/guide/tutorial/Step11/tutorial.cxx @@ -17,9 +17,9 @@ int main(int argc, char* argv[]) } // convert input to double - const double inputValue = std::stod(argv[1]); + double const inputValue = std::stod(argv[1]); - const double outputValue = mathfunctions::sqrt(inputValue); + double const outputValue = mathfunctions::sqrt(inputValue); std::cout << "The square root of " << inputValue << " is " << outputValue << std::endl; diff --git a/Help/guide/tutorial/Step12/MathFunctions/MakeTable.cxx b/Help/guide/tutorial/Step12/MathFunctions/MakeTable.cxx index ee58556..f85b278 100644 --- a/Help/guide/tutorial/Step12/MathFunctions/MakeTable.cxx +++ b/Help/guide/tutorial/Step12/MathFunctions/MakeTable.cxx @@ -11,7 +11,7 @@ int main(int argc, char* argv[]) } std::ofstream fout(argv[1], std::ios_base::out); - const bool fileOpen = fout.is_open(); + bool const fileOpen = fout.is_open(); if (fileOpen) { fout << "double sqrtTable[] = {" << std::endl; for (int i = 0; i < 10; ++i) { diff --git a/Help/guide/tutorial/Step12/tutorial.cxx b/Help/guide/tutorial/Step12/tutorial.cxx index a4f44d5..78641b1 100644 --- a/Help/guide/tutorial/Step12/tutorial.cxx +++ b/Help/guide/tutorial/Step12/tutorial.cxx @@ -16,9 +16,9 @@ int main(int argc, char* argv[]) } // convert input to double - const double inputValue = std::stod(argv[1]); + double const inputValue = std::stod(argv[1]); - const double outputValue = mathfunctions::sqrt(inputValue); + double const outputValue = mathfunctions::sqrt(inputValue); std::cout << "The square root of " << inputValue << " is " << outputValue << std::endl; diff --git a/Help/guide/tutorial/Step2/tutorial.cxx b/Help/guide/tutorial/Step2/tutorial.cxx index 7a2a595..b4063c8 100644 --- a/Help/guide/tutorial/Step2/tutorial.cxx +++ b/Help/guide/tutorial/Step2/tutorial.cxx @@ -17,12 +17,12 @@ int main(int argc, char* argv[]) } // convert input to double - const double inputValue = std::stod(argv[1]); + double const inputValue = std::stod(argv[1]); // TODO 6: Replace sqrt with mathfunctions::sqrt // calculate square root - const double outputValue = sqrt(inputValue); + double const outputValue = sqrt(inputValue); std::cout << "The square root of " << inputValue << " is " << outputValue << std::endl; return 0; diff --git a/Help/guide/tutorial/Step3/tutorial.cxx b/Help/guide/tutorial/Step3/tutorial.cxx index a3a2bdc..48be3c6 100644 --- a/Help/guide/tutorial/Step3/tutorial.cxx +++ b/Help/guide/tutorial/Step3/tutorial.cxx @@ -17,9 +17,9 @@ int main(int argc, char* argv[]) } // convert input to double - const double inputValue = std::stod(argv[1]); + double const inputValue = std::stod(argv[1]); - const double outputValue = mathfunctions::sqrt(inputValue); + double const outputValue = mathfunctions::sqrt(inputValue); std::cout << "The square root of " << inputValue << " is " << outputValue << std::endl; diff --git a/Help/guide/tutorial/Step4/tutorial.cxx b/Help/guide/tutorial/Step4/tutorial.cxx index a3a2bdc..48be3c6 100644 --- a/Help/guide/tutorial/Step4/tutorial.cxx +++ b/Help/guide/tutorial/Step4/tutorial.cxx @@ -17,9 +17,9 @@ int main(int argc, char* argv[]) } // convert input to double - const double inputValue = std::stod(argv[1]); + double const inputValue = std::stod(argv[1]); - const double outputValue = mathfunctions::sqrt(inputValue); + double const outputValue = mathfunctions::sqrt(inputValue); std::cout << "The square root of " << inputValue << " is " << outputValue << std::endl; diff --git a/Help/guide/tutorial/Step5/tutorial.cxx b/Help/guide/tutorial/Step5/tutorial.cxx index a3a2bdc..48be3c6 100644 --- a/Help/guide/tutorial/Step5/tutorial.cxx +++ b/Help/guide/tutorial/Step5/tutorial.cxx @@ -17,9 +17,9 @@ int main(int argc, char* argv[]) } // convert input to double - const double inputValue = std::stod(argv[1]); + double const inputValue = std::stod(argv[1]); - const double outputValue = mathfunctions::sqrt(inputValue); + double const outputValue = mathfunctions::sqrt(inputValue); std::cout << "The square root of " << inputValue << " is " << outputValue << std::endl; diff --git a/Help/guide/tutorial/Step6/tutorial.cxx b/Help/guide/tutorial/Step6/tutorial.cxx index a3a2bdc..48be3c6 100644 --- a/Help/guide/tutorial/Step6/tutorial.cxx +++ b/Help/guide/tutorial/Step6/tutorial.cxx @@ -17,9 +17,9 @@ int main(int argc, char* argv[]) } // convert input to double - const double inputValue = std::stod(argv[1]); + double const inputValue = std::stod(argv[1]); - const double outputValue = mathfunctions::sqrt(inputValue); + double const outputValue = mathfunctions::sqrt(inputValue); std::cout << "The square root of " << inputValue << " is " << outputValue << std::endl; diff --git a/Help/guide/tutorial/Step7/tutorial.cxx b/Help/guide/tutorial/Step7/tutorial.cxx index a3a2bdc..48be3c6 100644 --- a/Help/guide/tutorial/Step7/tutorial.cxx +++ b/Help/guide/tutorial/Step7/tutorial.cxx @@ -17,9 +17,9 @@ int main(int argc, char* argv[]) } // convert input to double - const double inputValue = std::stod(argv[1]); + double const inputValue = std::stod(argv[1]); - const double outputValue = mathfunctions::sqrt(inputValue); + double const outputValue = mathfunctions::sqrt(inputValue); std::cout << "The square root of " << inputValue << " is " << outputValue << std::endl; diff --git a/Help/guide/tutorial/Step8/MathFunctions/MakeTable.cxx b/Help/guide/tutorial/Step8/MathFunctions/MakeTable.cxx index ee58556..f85b278 100644 --- a/Help/guide/tutorial/Step8/MathFunctions/MakeTable.cxx +++ b/Help/guide/tutorial/Step8/MathFunctions/MakeTable.cxx @@ -11,7 +11,7 @@ int main(int argc, char* argv[]) } std::ofstream fout(argv[1], std::ios_base::out); - const bool fileOpen = fout.is_open(); + bool const fileOpen = fout.is_open(); if (fileOpen) { fout << "double sqrtTable[] = {" << std::endl; for (int i = 0; i < 10; ++i) { diff --git a/Help/guide/tutorial/Step8/tutorial.cxx b/Help/guide/tutorial/Step8/tutorial.cxx index a3a2bdc..48be3c6 100644 --- a/Help/guide/tutorial/Step8/tutorial.cxx +++ b/Help/guide/tutorial/Step8/tutorial.cxx @@ -17,9 +17,9 @@ int main(int argc, char* argv[]) } // convert input to double - const double inputValue = std::stod(argv[1]); + double const inputValue = std::stod(argv[1]); - const double outputValue = mathfunctions::sqrt(inputValue); + double const outputValue = mathfunctions::sqrt(inputValue); std::cout << "The square root of " << inputValue << " is " << outputValue << std::endl; diff --git a/Help/guide/tutorial/Step9/MathFunctions/MakeTable.cxx b/Help/guide/tutorial/Step9/MathFunctions/MakeTable.cxx index ee58556..f85b278 100644 --- a/Help/guide/tutorial/Step9/MathFunctions/MakeTable.cxx +++ b/Help/guide/tutorial/Step9/MathFunctions/MakeTable.cxx @@ -11,7 +11,7 @@ int main(int argc, char* argv[]) } std::ofstream fout(argv[1], std::ios_base::out); - const bool fileOpen = fout.is_open(); + bool const fileOpen = fout.is_open(); if (fileOpen) { fout << "double sqrtTable[] = {" << std::endl; for (int i = 0; i < 10; ++i) { diff --git a/Help/guide/tutorial/Step9/tutorial.cxx b/Help/guide/tutorial/Step9/tutorial.cxx index a3a2bdc..48be3c6 100644 --- a/Help/guide/tutorial/Step9/tutorial.cxx +++ b/Help/guide/tutorial/Step9/tutorial.cxx @@ -17,9 +17,9 @@ int main(int argc, char* argv[]) } // convert input to double - const double inputValue = std::stod(argv[1]); + double const inputValue = std::stod(argv[1]); - const double outputValue = mathfunctions::sqrt(inputValue); + double const outputValue = mathfunctions::sqrt(inputValue); std::cout << "The square root of " << inputValue << " is " << outputValue << std::endl; diff --git a/Modules/CMakeCompilerABI.h b/Modules/CMakeCompilerABI.h index c5ce4dd..ec0d785 100644 --- a/Modules/CMakeCompilerABI.h +++ b/Modules/CMakeCompilerABI.h @@ -1,7 +1,7 @@ /* Size of a pointer-to-data in bytes. */ #define SIZEOF_DPTR (sizeof(void*)) -const char info_sizeof_dptr[] = { +char const info_sizeof_dptr[] = { /* clang-format off */ 'I', 'N', 'F', 'O', ':', 's', 'i', 'z', 'e', 'o', 'f', '_', 'd', 'p', 't', 'r', '[', ('0' + ((SIZEOF_DPTR / 10) % 10)), ('0' + (SIZEOF_DPTR % 10)), ']', diff --git a/Modules/CMakeCompilerCUDAArch.h b/Modules/CMakeCompilerCUDAArch.h index dcb030f..080c495 100644 --- a/Modules/CMakeCompilerCUDAArch.h +++ b/Modules/CMakeCompilerCUDAArch.h @@ -11,7 +11,7 @@ static bool cmakeCompilerCUDAArch() } bool found = false; - const char* sep = ""; + char const* sep = ""; for (int device = 0; device < count; ++device) { cudaDeviceProp prop; if (cudaGetDeviceProperties(&prop, device) == cudaSuccess) { diff --git a/Modules/FindMPI/test_mpi.c b/Modules/FindMPI/test_mpi.c index 36b5dfd..1489c50 100644 --- a/Modules/FindMPI/test_mpi.c +++ b/Modules/FindMPI/test_mpi.c @@ -7,7 +7,7 @@ #endif #if defined(MPI_VERSION) && defined(MPI_SUBVERSION) -static const char mpiver_str[] = { 'I', 'N', +static char const mpiver_str[] = { 'I', 'N', 'F', 'O', ':', 'M', 'P', 'I', diff --git a/Source/CPack/IFW/cmCPackIFWCommon.cxx b/Source/CPack/IFW/cmCPackIFWCommon.cxx index 4a868ae..0f1283d 100644 --- a/Source/CPack/IFW/cmCPackIFWCommon.cxx +++ b/Source/CPack/IFW/cmCPackIFWCommon.cxx @@ -20,29 +20,29 @@ cmCPackIFWCommon::cmCPackIFWCommon() { } -cmValue cmCPackIFWCommon::GetOption(const std::string& op) const +cmValue cmCPackIFWCommon::GetOption(std::string const& op) const { return this->Generator ? this->Generator->cmCPackGenerator::GetOption(op) : nullptr; } -bool cmCPackIFWCommon::IsOn(const std::string& op) const +bool cmCPackIFWCommon::IsOn(std::string const& op) const { return this->Generator && this->Generator->cmCPackGenerator::IsOn(op); } -bool cmCPackIFWCommon::IsSetToOff(const std::string& op) const +bool cmCPackIFWCommon::IsSetToOff(std::string const& op) const { return this->Generator && this->Generator->cmCPackGenerator::IsSetToOff(op); } -bool cmCPackIFWCommon::IsSetToEmpty(const std::string& op) const +bool cmCPackIFWCommon::IsSetToEmpty(std::string const& op) const { return this->Generator && this->Generator->cmCPackGenerator::IsSetToEmpty(op); } -bool cmCPackIFWCommon::IsVersionLess(const char* version) const +bool cmCPackIFWCommon::IsVersionLess(char const* version) const { if (!this->Generator) { return false; @@ -52,7 +52,7 @@ bool cmCPackIFWCommon::IsVersionLess(const char* version) const cmSystemTools::OP_LESS, this->Generator->FrameworkVersion, version); } -bool cmCPackIFWCommon::IsVersionGreater(const char* version) const +bool cmCPackIFWCommon::IsVersionGreater(char const* version) const { if (!this->Generator) { return false; @@ -62,7 +62,7 @@ bool cmCPackIFWCommon::IsVersionGreater(const char* version) const cmSystemTools::OP_GREATER, this->Generator->FrameworkVersion, version); } -bool cmCPackIFWCommon::IsVersionEqual(const char* version) const +bool cmCPackIFWCommon::IsVersionEqual(char const* version) const { if (!this->Generator) { return false; @@ -73,7 +73,7 @@ bool cmCPackIFWCommon::IsVersionEqual(const char* version) const } void cmCPackIFWCommon::ExpandListArgument( - const std::string& arg, std::map& argsOut) + std::string const& arg, std::map& argsOut) { cmList args{ arg }; if (args.empty()) { @@ -94,7 +94,7 @@ void cmCPackIFWCommon::ExpandListArgument( } void cmCPackIFWCommon::ExpandListArgument( - const std::string& arg, std::multimap& argsOut) + std::string const& arg, std::multimap& argsOut) { cmList args{ arg }; if (args.empty()) { diff --git a/Source/CPack/IFW/cmCPackIFWCommon.h b/Source/CPack/IFW/cmCPackIFWCommon.h index f2e6b88..8782f2a 100644 --- a/Source/CPack/IFW/cmCPackIFWCommon.h +++ b/Source/CPack/IFW/cmCPackIFWCommon.h @@ -28,32 +28,32 @@ public: public: // Internal implementation - cmValue GetOption(const std::string& op) const; - bool IsOn(const std::string& op) const; - bool IsSetToOff(const std::string& op) const; - bool IsSetToEmpty(const std::string& op) const; + cmValue GetOption(std::string const& op) const; + bool IsOn(std::string const& op) const; + bool IsSetToOff(std::string const& op) const; + bool IsSetToEmpty(std::string const& op) const; /** * Compare \a version with QtIFW framework version */ - bool IsVersionLess(const char* version) const; + bool IsVersionLess(char const* version) const; /** * Compare \a version with QtIFW framework version */ - bool IsVersionGreater(const char* version) const; + bool IsVersionGreater(char const* version) const; /** * Compare \a version with QtIFW framework version */ - bool IsVersionEqual(const char* version) const; + bool IsVersionEqual(char const* version) const; /** Expand the list argument containing the map of the key-value pairs. * If the number of elements is odd, then the first value is used as the * default value with an empty key. * Any values with the same keys will be permanently overwritten. */ - static void ExpandListArgument(const std::string& arg, + static void ExpandListArgument(std::string const& arg, std::map& argsOut); /** Expand the list argument containing the multimap of the key-value pairs. @@ -61,7 +61,7 @@ public: * default value with an empty key. */ static void ExpandListArgument( - const std::string& arg, std::multimap& argsOut); + std::string const& arg, std::multimap& argsOut); cmCPackIFWGenerator* Generator; diff --git a/Source/CPack/IFW/cmCPackIFWGenerator.cxx b/Source/CPack/IFW/cmCPackIFWGenerator.cxx index 5824a24..b56e001 100644 --- a/Source/CPack/IFW/cmCPackIFWGenerator.cxx +++ b/Source/CPack/IFW/cmCPackIFWGenerator.cxx @@ -116,7 +116,7 @@ std::vector cmCPackIFWGenerator::BuildRepogenCommand() return ifwCmd; } -int cmCPackIFWGenerator::RunRepogen(const std::string& ifwTmpFile) +int cmCPackIFWGenerator::RunRepogen(std::string const& ifwTmpFile) { if (this->Installer.RemoteRepositories.empty()) { return 1; @@ -274,7 +274,7 @@ std::vector cmCPackIFWGenerator::BuildBinaryCreatorCommand() return ifwCmd; } -int cmCPackIFWGenerator::RunBinaryCreator(const std::string& ifwTmpFile) +int cmCPackIFWGenerator::RunBinaryCreator(std::string const& ifwTmpFile) { std::vector ifwCmd = this->BuildBinaryCreatorCommand(); cmCPackIFWLogger(VERBOSE, @@ -303,9 +303,9 @@ int cmCPackIFWGenerator::RunBinaryCreator(const std::string& ifwTmpFile) return 1; } -const char* cmCPackIFWGenerator::GetPackagingInstallPrefix() +char const* cmCPackIFWGenerator::GetPackagingInstallPrefix() { - const char* defPrefix = this->cmCPackGenerator::GetPackagingInstallPrefix(); + char const* defPrefix = this->cmCPackGenerator::GetPackagingInstallPrefix(); std::string tmpPref = defPrefix ? defPrefix : ""; @@ -318,7 +318,7 @@ const char* cmCPackIFWGenerator::GetPackagingInstallPrefix() return this->GetOption("CPACK_IFW_PACKAGING_INSTALL_PREFIX")->c_str(); } -const char* cmCPackIFWGenerator::GetOutputExtension() +char const* cmCPackIFWGenerator::GetOutputExtension() { return this->OutputExtension.c_str(); } @@ -327,9 +327,9 @@ int cmCPackIFWGenerator::InitializeInternal() { // Search Qt Installer Framework tools - const std::string BinCreatorOpt = "CPACK_IFW_BINARYCREATOR_EXECUTABLE"; - const std::string RepoGenOpt = "CPACK_IFW_REPOGEN_EXECUTABLE"; - const std::string FrameworkVersionOpt = "CPACK_IFW_FRAMEWORK_VERSION"; + std::string const BinCreatorOpt = "CPACK_IFW_BINARYCREATOR_EXECUTABLE"; + std::string const RepoGenOpt = "CPACK_IFW_REPOGEN_EXECUTABLE"; + std::string const FrameworkVersionOpt = "CPACK_IFW_FRAMEWORK_VERSION"; if (!this->IsSet(BinCreatorOpt) || !this->IsSet(RepoGenOpt) || !this->IsSet(FrameworkVersionOpt)) { @@ -462,10 +462,10 @@ int cmCPackIFWGenerator::InitializeInternal() } std::string cmCPackIFWGenerator::GetComponentInstallSuffix( - const std::string& componentName) + std::string const& componentName) { - const std::string prefix = "packages/"; - const std::string suffix = "/data"; + std::string const prefix = "packages/"; + std::string const suffix = "/data"; if (this->componentPackageMethod == this->ONE_PACKAGE) { return cmStrCat(prefix, this->GetRootPackageName(), suffix); @@ -476,10 +476,10 @@ std::string cmCPackIFWGenerator::GetComponentInstallSuffix( } std::string cmCPackIFWGenerator::GetComponentInstallDirNameSuffix( - const std::string& componentName) + std::string const& componentName) { - const std::string prefix = "packages/"; - const std::string suffix = "/data"; + std::string const prefix = "packages/"; + std::string const suffix = "/data"; if (this->componentPackageMethod == this->ONE_PACKAGE) { return cmStrCat(prefix, this->GetRootPackageName(), suffix); @@ -492,7 +492,7 @@ std::string cmCPackIFWGenerator::GetComponentInstallDirNameSuffix( } cmCPackComponent* cmCPackIFWGenerator::GetComponent( - const std::string& projectName, const std::string& componentName) + std::string const& projectName, std::string const& componentName) { auto cit = this->Components.find(componentName); if (cit != this->Components.end()) { @@ -537,7 +537,7 @@ cmCPackComponent* cmCPackIFWGenerator::GetComponent( } cmCPackComponentGroup* cmCPackIFWGenerator::GetComponentGroup( - const std::string& projectName, const std::string& groupName) + std::string const& projectName, std::string const& groupName) { cmCPackComponentGroup* group = this->cmCPackGenerator::GetComponentGroup(projectName, groupName); @@ -682,7 +682,7 @@ cmCPackIFWPackage* cmCPackIFWGenerator::GetComponentPackage( } cmCPackIFWRepository* cmCPackIFWGenerator::GetRepository( - const std::string& repositoryName) + std::string const& repositoryName) { auto rit = this->Repositories.find(repositoryName); if (rit != this->Repositories.end()) { diff --git a/Source/CPack/IFW/cmCPackIFWGenerator.h b/Source/CPack/IFW/cmCPackIFWGenerator.h index 8a16d6a..dc15932 100644 --- a/Source/CPack/IFW/cmCPackIFWGenerator.h +++ b/Source/CPack/IFW/cmCPackIFWGenerator.h @@ -59,18 +59,18 @@ protected: */ int InitializeInternal() override; int PackageFiles() override; - const char* GetPackagingInstallPrefix() override; + char const* GetPackagingInstallPrefix() override; /** * @brief Target binary extension * @return Executable suffix or disk image format */ - const char* GetOutputExtension() override; + char const* GetOutputExtension() override; std::string GetComponentInstallSuffix( - const std::string& componentName) override; + std::string const& componentName) override; std::string GetComponentInstallDirNameSuffix( - const std::string& componentName) override; + std::string const& componentName) override; /** * @brief Get Component @@ -81,8 +81,8 @@ protected: * * @return Pointer to component */ - cmCPackComponent* GetComponent(const std::string& projectName, - const std::string& componentName) override; + cmCPackComponent* GetComponent(std::string const& projectName, + std::string const& componentName) override; /** * @brief Get group of component @@ -94,7 +94,7 @@ protected: * @return Pointer to component group */ cmCPackComponentGroup* GetComponentGroup( - const std::string& projectName, const std::string& groupName) override; + std::string const& projectName, std::string const& groupName) override; enum cmCPackGenerator::CPackSetDestdirSupport SupportsSetDestdir() const override; @@ -114,7 +114,7 @@ protected: cmCPackIFWPackage* GetGroupPackage(cmCPackComponentGroup* group) const; cmCPackIFWPackage* GetComponentPackage(cmCPackComponent* component) const; - cmCPackIFWRepository* GetRepository(const std::string& repositoryName); + cmCPackIFWRepository* GetRepository(std::string const& repositoryName); protected: // Data @@ -143,10 +143,10 @@ protected: private: std::vector BuildRepogenCommand(); - int RunRepogen(const std::string& ifwTmpFile); + int RunRepogen(std::string const& ifwTmpFile); std::vector BuildBinaryCreatorCommand(); - int RunBinaryCreator(const std::string& ifwTmpFile); + int RunBinaryCreator(std::string const& ifwTmpFile); std::string RepoGen; std::string BinCreator; diff --git a/Source/CPack/IFW/cmCPackIFWInstaller.cxx b/Source/CPack/IFW/cmCPackIFWInstaller.cxx index f2d7f1c..0d9da19 100644 --- a/Source/CPack/IFW/cmCPackIFWInstaller.cxx +++ b/Source/CPack/IFW/cmCPackIFWInstaller.cxx @@ -23,7 +23,7 @@ cmCPackIFWInstaller::cmCPackIFWInstaller() = default; void cmCPackIFWInstaller::printSkippedOptionWarning( - const std::string& optionName, const std::string& optionValue) + std::string const& optionName, std::string const& optionValue) { cmCPackIFWLogger( WARNING, @@ -293,7 +293,7 @@ void cmCPackIFWInstaller::ConfigureFromOptions() this->GetOption("CPACK_IFW_PACKAGE_RESOURCES")) { this->Resources.clear(); cmExpandList(optIFW_PACKAGE_RESOURCES, this->Resources); - for (const auto& file : this->Resources) { + for (auto const& file : this->Resources) { if (!cmSystemTools::FileExists(file)) { // The warning will say skipped, but there will later be a hard error // when the binarycreator tool tries to read the missing file. @@ -308,7 +308,7 @@ void cmCPackIFWInstaller::ConfigureFromOptions() this->ProductImages.clear(); cmExpandList(productImages, this->ProductImages); - auto erase_missing_file_pred = [this](const std::string& file) -> bool { + auto erase_missing_file_pred = [this](std::string const& file) -> bool { if (!cmSystemTools::FileExists(file)) { this->printSkippedOptionWarning("CPACK_IFW_PACKAGE_PRODUCT_IMAGES", file); @@ -396,7 +396,7 @@ public: std::string path, basePath; protected: - void StartElement(const std::string& name, const char** /*atts*/) override + void StartElement(std::string const& name, char const** /*atts*/) override { this->file = name == "file"; if (this->file) { @@ -404,7 +404,7 @@ protected: } } - void CharacterDataHandler(const char* data, int length) override + void CharacterDataHandler(char const* data, int length) override { if (this->file) { std::string content(data, data + length); @@ -417,7 +417,7 @@ protected: } } - void EndElement(const std::string& /*name*/) override {} + void EndElement(std::string const& /*name*/) override {} }; void cmCPackIFWInstaller::GenerateInstallerFile() @@ -621,7 +621,7 @@ void cmCPackIFWInstaller::GenerateInstallerFile() // RunProgramArguments if (!this->RunProgramArguments.empty()) { xout.StartElement("RunProgramArguments"); - for (const auto& arg : this->RunProgramArguments) { + for (auto const& arg : this->RunProgramArguments) { xout.Element("Argument", arg); } xout.EndElement(); @@ -640,7 +640,7 @@ void cmCPackIFWInstaller::GenerateInstallerFile() // Product images (copy to config dir) if (!this->IsVersionLess("4.0") && !this->ProductImages.empty()) { xout.StartElement("ProductImages"); - const bool hasProductImageUrl = !this->ProductImageUrls.empty(); + bool const hasProductImageUrl = !this->ProductImageUrls.empty(); for (size_t i = 0; i < this->ProductImages.size(); ++i) { xout.StartElement("ProductImage"); auto const& srcImg = this->ProductImages[i]; diff --git a/Source/CPack/IFW/cmCPackIFWInstaller.h b/Source/CPack/IFW/cmCPackIFWInstaller.h index fb980d7..6a933ad 100644 --- a/Source/CPack/IFW/cmCPackIFWInstaller.h +++ b/Source/CPack/IFW/cmCPackIFWInstaller.h @@ -158,6 +158,6 @@ public: std::string Directory; protected: - void printSkippedOptionWarning(const std::string& optionName, - const std::string& optionValue); + void printSkippedOptionWarning(std::string const& optionName, + std::string const& optionValue); }; diff --git a/Source/CPack/IFW/cmCPackIFWPackage.cxx b/Source/CPack/IFW/cmCPackIFWPackage.cxx index 083f1ef..b134ac9 100644 --- a/Source/CPack/IFW/cmCPackIFWPackage.cxx +++ b/Source/CPack/IFW/cmCPackIFWPackage.cxx @@ -32,7 +32,7 @@ cmCPackIFWPackage::CompareStruct::CompareStruct() cmCPackIFWPackage::DependenceStruct::DependenceStruct() = default; cmCPackIFWPackage::DependenceStruct::DependenceStruct( - const std::string& dependence) + std::string const& dependence) { // Preferred format is name and version are separated by a colon (:), but // note that this is only supported with QtIFW 3.1 or later. Backward @@ -51,7 +51,7 @@ cmCPackIFWPackage::DependenceStruct::DependenceStruct( return; } - const auto versionPart = + auto const versionPart = cm::string_view(dependence.data() + pos, dependence.size() - pos); if (cmHasLiteralPrefix(versionPart, "<=")) { @@ -339,7 +339,7 @@ int cmCPackIFWPackage::ConfigureFromGroup(cmCPackComponentGroup* group) return this->ConfigureFromPrefix(prefix); } -int cmCPackIFWPackage::ConfigureFromGroup(const std::string& groupName) +int cmCPackIFWPackage::ConfigureFromGroup(std::string const& groupName) { // Group configuration @@ -373,7 +373,7 @@ int cmCPackIFWPackage::ConfigureFromGroup(const std::string& groupName) } // Common options for components and groups -int cmCPackIFWPackage::ConfigureFromPrefix(const std::string& prefix) +int cmCPackIFWPackage::ConfigureFromPrefix(std::string const& prefix) { // Temporary variable for full option name std::string option; @@ -635,7 +635,7 @@ void cmCPackIFWPackage::GeneratePackageFile() } // Dependencies - const bool hyphensInNamesUnsupported = this->Generator && + bool const hyphensInNamesUnsupported = this->Generator && !this->Generator->FrameworkVersion.empty() && this->IsVersionLess("3.1"); bool warnUnsupportedNames = false; std::set compDepSet; diff --git a/Source/CPack/IFW/cmCPackIFWPackage.h b/Source/CPack/IFW/cmCPackIFWPackage.h index 350f6b2..759529e 100644 --- a/Source/CPack/IFW/cmCPackIFWPackage.h +++ b/Source/CPack/IFW/cmCPackIFWPackage.h @@ -44,14 +44,14 @@ public: struct DependenceStruct { DependenceStruct(); - explicit DependenceStruct(const std::string& dependence); + explicit DependenceStruct(std::string const& dependence); std::string Name; CompareStruct Compare; std::string NameWithCompare() const; - bool operator<(const DependenceStruct& other) const + bool operator<(DependenceStruct const& other) const { return this->Name < other.Name; } @@ -132,8 +132,8 @@ public: int ConfigureFromOptions(); int ConfigureFromComponent(cmCPackComponent* component); int ConfigureFromGroup(cmCPackComponentGroup* group); - int ConfigureFromGroup(const std::string& groupName); - int ConfigureFromPrefix(const std::string& prefix); + int ConfigureFromGroup(std::string const& groupName); + int ConfigureFromPrefix(std::string const& prefix); void GeneratePackageFile(); diff --git a/Source/CPack/IFW/cmCPackIFWRepository.cxx b/Source/CPack/IFW/cmCPackIFWRepository.cxx index 0f9490b..6b98eab 100644 --- a/Source/CPack/IFW/cmCPackIFWRepository.cxx +++ b/Source/CPack/IFW/cmCPackIFWRepository.cxx @@ -124,22 +124,22 @@ public: bool patched = false; protected: - void StartElement(const std::string& name, const char** atts) override + void StartElement(std::string const& name, char const** atts) override { this->xout.StartElement(name); this->StartFragment(atts); } - void StartFragment(const char** atts) + void StartFragment(char const** atts) { for (size_t i = 0; atts[i]; i += 2) { - const char* key = atts[i]; - const char* value = atts[i + 1]; + char const* key = atts[i]; + char const* value = atts[i + 1]; this->xout.Attribute(key, value); } } - void EndElement(const std::string& name) override + void EndElement(std::string const& name) override { if (name == "Updates" && !this->patched) { this->repository->WriteRepositoryUpdates(this->xout); @@ -155,7 +155,7 @@ protected: } } - void CharacterDataHandler(const char* data, int length) override + void CharacterDataHandler(char const* data, int length) override { std::string content(data, data + length); if (content.empty() || content == " " || content == " " || diff --git a/Source/CPack/WiX/cmCMakeToWixPath.cxx b/Source/CPack/WiX/cmCMakeToWixPath.cxx index 8738501..7d6e880 100644 --- a/Source/CPack/WiX/cmCMakeToWixPath.cxx +++ b/Source/CPack/WiX/cmCMakeToWixPath.cxx @@ -9,7 +9,7 @@ #ifdef __CYGWIN__ # include -std::string CMakeToWixPath(const std::string& cygpath) +std::string CMakeToWixPath(std::string const& cygpath) { std::vector winpath_chars; ssize_t winpath_size; @@ -32,7 +32,7 @@ std::string CMakeToWixPath(const std::string& cygpath) return cmTrimWhitespace(winpath_chars.data()); } #else -std::string CMakeToWixPath(const std::string& path) +std::string CMakeToWixPath(std::string const& path) { return path; } diff --git a/Source/CPack/WiX/cmCMakeToWixPath.h b/Source/CPack/WiX/cmCMakeToWixPath.h index 074cc8e..0700bfa 100644 --- a/Source/CPack/WiX/cmCMakeToWixPath.h +++ b/Source/CPack/WiX/cmCMakeToWixPath.h @@ -6,4 +6,4 @@ #include -std::string CMakeToWixPath(const std::string& cygpath); +std::string CMakeToWixPath(std::string const& cygpath); diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx index 1e2d202..dacf0ed 100644 --- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx +++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx @@ -1224,7 +1224,7 @@ std::string cmCPackWIXGenerator::CreateHashedId( cmCryptoHash sha1(cmCryptoHash::AlgoSHA1); std::string const hash = sha1.HashString(path); - const size_t maxFileNameLength = 52; + size_t const maxFileNameLength = 52; std::string identifier = cmStrCat(cm::string_view(hash).substr(0, 7), '_', cm::string_view(normalizedFilename).substr(0, maxFileNameLength)); diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.h b/Source/CPack/WiX/cmCPackWIXGenerator.h index 63530d4..66b93cd 100644 --- a/Source/CPack/WiX/cmCPackWIXGenerator.h +++ b/Source/CPack/WiX/cmCPackWIXGenerator.h @@ -24,8 +24,8 @@ public: cmCPackTypeMacro(cmCPackWIXGenerator, cmCPackGenerator); cmCPackWIXGenerator(); - cmCPackWIXGenerator(const cmCPackWIXGenerator&) = delete; - const cmCPackWIXGenerator& operator=(const cmCPackWIXGenerator&) = delete; + cmCPackWIXGenerator(cmCPackWIXGenerator const&) = delete; + cmCPackWIXGenerator const& operator=(cmCPackWIXGenerator const&) = delete; ~cmCPackWIXGenerator(); protected: @@ -33,7 +33,7 @@ protected: int PackageFiles() override; - const char* GetOutputExtension() override { return ".msi"; } + char const* GetOutputExtension() override { return ".msi"; } enum CPackSetDestdirSupport SupportsSetDestdir() const override { diff --git a/Source/CPack/WiX/cmWIXAccessControlList.cxx b/Source/CPack/WiX/cmWIXAccessControlList.cxx index 5d0df06..2a3cae0 100644 --- a/Source/CPack/WiX/cmWIXAccessControlList.cxx +++ b/Source/CPack/WiX/cmWIXAccessControlList.cxx @@ -72,7 +72,7 @@ void cmWIXAccessControlList::ReportError(std::string const& entry, bool cmWIXAccessControlList::IsBooleanAttribute(std::string const& name) { - static const char* validAttributes[] = { + static char const* validAttributes[] = { /* clang-format needs this comment to break after the opening brace */ "Append", "ChangePermission", diff --git a/Source/CPack/WiX/cmWIXFeaturesSourceWriter.h b/Source/CPack/WiX/cmWIXFeaturesSourceWriter.h index 95de8fe..0a51c6d 100644 --- a/Source/CPack/WiX/cmWIXFeaturesSourceWriter.h +++ b/Source/CPack/WiX/cmWIXFeaturesSourceWriter.h @@ -19,10 +19,10 @@ public: void CreateCMakePackageRegistryEntry(std::string const& package, std::string const& upgradeGuid); - void EmitFeatureForComponentGroup(const cmCPackComponentGroup& group, + void EmitFeatureForComponentGroup(cmCPackComponentGroup const& group, cmWIXPatch& patch); - void EmitFeatureForComponent(const cmCPackComponent& component, + void EmitFeatureForComponent(cmCPackComponent const& component, cmWIXPatch& patch); void EmitComponentRef(std::string const& id); diff --git a/Source/CPack/WiX/cmWIXPatch.cxx b/Source/CPack/WiX/cmWIXPatch.cxx index c65449c..2682a6f 100644 --- a/Source/CPack/WiX/cmWIXPatch.cxx +++ b/Source/CPack/WiX/cmWIXPatch.cxx @@ -30,7 +30,7 @@ void cmWIXPatch::ApplyFragment(std::string const& id, return; } - const cmWIXPatchElement& fragment = i->second; + cmWIXPatchElement const& fragment = i->second; for (auto const& attr : fragment.attributes) { writer.AddAttribute(attr.first, attr.second); } @@ -39,22 +39,22 @@ void cmWIXPatch::ApplyFragment(std::string const& id, Fragments.erase(i); } -void cmWIXPatch::ApplyElementChildren(const cmWIXPatchElement& element, +void cmWIXPatch::ApplyElementChildren(cmWIXPatchElement const& element, cmWIXSourceWriter& writer) { - for (const auto& node : element.children) { + for (auto const& node : element.children) { switch (node->type()) { case cmWIXPatchNode::ELEMENT: - ApplyElement(dynamic_cast(*node), writer); + ApplyElement(dynamic_cast(*node), writer); break; case cmWIXPatchNode::TEXT: - writer.AddTextNode(dynamic_cast(*node).text); + writer.AddTextNode(dynamic_cast(*node).text); break; } } } -void cmWIXPatch::ApplyElement(const cmWIXPatchElement& element, +void cmWIXPatch::ApplyElement(cmWIXPatchElement const& element, cmWIXSourceWriter& writer) { writer.BeginElement(element.name); diff --git a/Source/CPack/WiX/cmWIXPatch.h b/Source/CPack/WiX/cmWIXPatch.h index c78722d..bb4f6c3 100644 --- a/Source/CPack/WiX/cmWIXPatch.h +++ b/Source/CPack/WiX/cmWIXPatch.h @@ -22,10 +22,10 @@ public: bool CheckForUnappliedFragments(); private: - void ApplyElementChildren(const cmWIXPatchElement& element, + void ApplyElementChildren(cmWIXPatchElement const& element, cmWIXSourceWriter& writer); - void ApplyElement(const cmWIXPatchElement& element, + void ApplyElement(cmWIXPatchElement const& element, cmWIXSourceWriter& writer); cmCPackLog* Logger; diff --git a/Source/CPack/WiX/cmWIXPatchParser.cxx b/Source/CPack/WiX/cmWIXPatchParser.cxx index 136eaac..7501e7e 100644 --- a/Source/CPack/WiX/cmWIXPatchParser.cxx +++ b/Source/CPack/WiX/cmWIXPatchParser.cxx @@ -35,7 +35,7 @@ cmWIXPatchParser::cmWIXPatchParser(fragment_map_t& fragments, { } -void cmWIXPatchParser::StartElement(const std::string& name, const char** atts) +void cmWIXPatchParser::StartElement(std::string const& name, char const** atts) { if (State == BEGIN_DOCUMENT) { if (name == "CPackWiXPatch"_s) { @@ -69,13 +69,13 @@ void cmWIXPatchParser::StartElement(const std::string& name, const char** atts) } } -void cmWIXPatchParser::StartFragment(const char** attributes) +void cmWIXPatchParser::StartFragment(char const** attributes) { cmWIXPatchElement* new_element = nullptr; /* find the id of for fragment */ for (size_t i = 0; attributes[i]; i += 2) { - const std::string key = attributes[i]; - const std::string value = attributes[i + 1]; + std::string const key = attributes[i]; + std::string const value = attributes[i + 1]; if (key == "Id"_s) { if (Fragments.find(value) != Fragments.end()) { @@ -94,8 +94,8 @@ void cmWIXPatchParser::StartFragment(const char** attributes) ReportValidationError("No 'Id' specified for 'CPackWixFragment' element"); } else { for (size_t i = 0; attributes[i]; i += 2) { - const std::string key = attributes[i]; - const std::string value = attributes[i + 1]; + std::string const key = attributes[i]; + std::string const value = attributes[i + 1]; if (key != "Id"_s) { new_element->attributes[key] = value; @@ -104,7 +104,7 @@ void cmWIXPatchParser::StartFragment(const char** attributes) } } -void cmWIXPatchParser::EndElement(const std::string& name) +void cmWIXPatchParser::EndElement(std::string const& name) { if (State == INSIDE_FRAGMENT) { if (name == "CPackWiXFragment"_s) { @@ -116,9 +116,9 @@ void cmWIXPatchParser::EndElement(const std::string& name) } } -void cmWIXPatchParser::CharacterDataHandler(const char* data, int length) +void cmWIXPatchParser::CharacterDataHandler(char const* data, int length) { - const char* whitespace = "\x20\x09\x0d\x0a"; + char const* whitespace = "\x20\x09\x0d\x0a"; if (State == INSIDE_FRAGMENT) { cmWIXPatchElement& parent = *ElementStack.back(); @@ -137,7 +137,7 @@ void cmWIXPatchParser::CharacterDataHandler(const char* data, int length) } } -void cmWIXPatchParser::ReportError(int line, int column, const char* msg) +void cmWIXPatchParser::ReportError(int line, int column, char const* msg) { cmCPackLogger(cmCPackLog::LOG_ERROR, "Error while processing XML patch file at " diff --git a/Source/CPack/WiX/cmWIXPatchParser.h b/Source/CPack/WiX/cmWIXPatchParser.h index 70a21bc..7110e72 100644 --- a/Source/CPack/WiX/cmWIXPatchParser.h +++ b/Source/CPack/WiX/cmWIXPatchParser.h @@ -35,8 +35,8 @@ struct cmWIXPatchElement : cmWIXPatchNode cmWIXPatchElement(); - cmWIXPatchElement(const cmWIXPatchElement&) = delete; - const cmWIXPatchElement& operator=(const cmWIXPatchElement&) = delete; + cmWIXPatchElement(cmWIXPatchElement const&) = delete; + cmWIXPatchElement const& operator=(cmWIXPatchElement const&) = delete; ~cmWIXPatchElement(); @@ -59,15 +59,15 @@ public: cmWIXPatchParser(fragment_map_t& Fragments, cmCPackLog* logger); private: - virtual void StartElement(const std::string& name, const char** atts); + virtual void StartElement(std::string const& name, char const** atts); - void StartFragment(const char** attributes); + void StartFragment(char const** attributes); - virtual void EndElement(const std::string& name); + virtual void EndElement(std::string const& name); - virtual void CharacterDataHandler(const char* data, int length); + virtual void CharacterDataHandler(char const* data, int length); - virtual void ReportError(int line, int column, const char* msg); + virtual void ReportError(int line, int column, char const* msg); void ReportValidationError(std::string const& message); diff --git a/Source/CPack/cmCPackArchiveGenerator.cxx b/Source/CPack/cmCPackArchiveGenerator.cxx index bb1545b..1d95e78 100644 --- a/Source/CPack/cmCPackArchiveGenerator.cxx +++ b/Source/CPack/cmCPackArchiveGenerator.cxx @@ -45,8 +45,8 @@ private: * @return DeduplicateStatus indicating whether to add, skip, or flag an * error for the file. */ - DeduplicateStatus CompareFile(const std::string& path, - const std::string& localTopLevel) + DeduplicateStatus CompareFile(std::string const& path, + std::string const& localTopLevel) { auto fileItr = this->Files.find(path); if (fileItr != this->Files.end()) { @@ -65,7 +65,7 @@ private: * @param path The path of the folder to compare. * @return DeduplicateStatus indicating whether to add or skip the folder. */ - DeduplicateStatus CompareFolder(const std::string& path) + DeduplicateStatus CompareFolder(std::string const& path) { if (this->Folders.find(path) != this->Folders.end()) { return DeduplicateStatus::Skip; @@ -82,7 +82,7 @@ private: * @return DeduplicateStatus indicating whether to add, skip, or flag an * error for the symlink. */ - DeduplicateStatus CompareSymlink(const std::string& path) + DeduplicateStatus CompareSymlink(std::string const& path) { auto symlinkItr = this->Symlink.find(path); std::string symlinkValue; @@ -112,8 +112,8 @@ public: * @return DeduplicateStatus indicating the action to take for the given * path. */ - DeduplicateStatus IsDeduplicate(const std::string& path, - const std::string& localTopLevel) + DeduplicateStatus IsDeduplicate(std::string const& path, + std::string const& localTopLevel) { DeduplicateStatus status; if (cmSystemTools::FileIsDirectory(path)) { @@ -186,7 +186,7 @@ cmCPackArchiveGenerator::cmCPackArchiveGenerator( cmCPackArchiveGenerator::~cmCPackArchiveGenerator() = default; std::string cmCPackArchiveGenerator::GetArchiveComponentFileName( - const std::string& component, bool isGroupName) + std::string const& component, bool isGroupName) { std::string componentUpper(cmSystemTools::UpperCase(component)); std::string packageFileName; diff --git a/Source/CPack/cmCPackArchiveGenerator.h b/Source/CPack/cmCPackArchiveGenerator.h index b8a1afa..4f89b6c 100644 --- a/Source/CPack/cmCPackArchiveGenerator.h +++ b/Source/CPack/cmCPackArchiveGenerator.h @@ -44,7 +44,7 @@ public: private: // get archive component filename - std::string GetArchiveComponentFileName(const std::string& component, + std::string GetArchiveComponentFileName(std::string const& component, bool isGroupName); class Deduplicator; @@ -82,9 +82,9 @@ protected: int PackageComponentsAllInOne(); private: - const char* GetNameOfClass() override { return "cmCPackArchiveGenerator"; } + char const* GetNameOfClass() override { return "cmCPackArchiveGenerator"; } - const char* GetOutputExtension() override + char const* GetOutputExtension() override { return this->OutputExtension.c_str(); } diff --git a/Source/CPack/cmCPackBundleGenerator.cxx b/Source/CPack/cmCPackBundleGenerator.cxx index 37be798..f6c852b 100644 --- a/Source/CPack/cmCPackBundleGenerator.cxx +++ b/Source/CPack/cmCPackBundleGenerator.cxx @@ -27,7 +27,7 @@ int cmCPackBundleGenerator::InitializeInternal() } if (this->GetOption("CPACK_BUNDLE_APPLE_CERT_APP")) { - const std::string codesign_path = cmSystemTools::FindProgram( + std::string const codesign_path = cmSystemTools::FindProgram( "codesign", std::vector(), false); if (codesign_path.empty()) { @@ -41,7 +41,7 @@ int cmCPackBundleGenerator::InitializeInternal() return this->Superclass::InitializeInternal(); } -const char* cmCPackBundleGenerator::GetPackagingInstallPrefix() +char const* cmCPackBundleGenerator::GetPackagingInstallPrefix() { this->InstallPrefix = cmStrCat('/', this->GetOption("CPACK_BUNDLE_NAME"), ".app/Contents/Resources"); @@ -176,7 +176,7 @@ bool cmCPackBundleGenerator::SupportsComponentInstallation() const return false; } -int cmCPackBundleGenerator::SignBundle(const std::string& src_dir) +int cmCPackBundleGenerator::SignBundle(std::string const& src_dir) { cmValue cpack_apple_cert_app = this->GetOption("CPACK_BUNDLE_APPLE_CERT_APP"); @@ -189,7 +189,7 @@ int cmCPackBundleGenerator::SignBundle(const std::string& src_dir) cmStrCat(src_dir, '/', this->GetOption("CPACK_BUNDLE_NAME"), ".app"); // A list of additional files to sign, ie. frameworks and plugins. - const std::string sign_parameter = + std::string const sign_parameter = this->GetOption("CPACK_BUNDLE_APPLE_CODESIGN_PARAMETER") ? *this->GetOption("CPACK_BUNDLE_APPLE_CODESIGN_PARAMETER") : "--deep -f"; diff --git a/Source/CPack/cmCPackBundleGenerator.h b/Source/CPack/cmCPackBundleGenerator.h index 072d14f..96d10b0 100644 --- a/Source/CPack/cmCPackBundleGenerator.h +++ b/Source/CPack/cmCPackBundleGenerator.h @@ -24,9 +24,9 @@ public: protected: int InitializeInternal() override; - const char* GetPackagingInstallPrefix() override; + char const* GetPackagingInstallPrefix() override; int ConstructBundle(); - int SignBundle(const std::string& src_dir); + int SignBundle(std::string const& src_dir); int PackageFiles() override; bool SupportsComponentInstallation() const override; diff --git a/Source/CPack/cmCPackComponentGroup.cxx b/Source/CPack/cmCPackComponentGroup.cxx index 4305c7e..078b09f 100644 --- a/Source/CPack/cmCPackComponentGroup.cxx +++ b/Source/CPack/cmCPackComponentGroup.cxx @@ -8,7 +8,7 @@ #include "cmSystemTools.h" unsigned long cmCPackComponent::GetInstalledSize( - const std::string& installDir) const + std::string const& installDir) const { if (this->TotalSize != 0) { return this->TotalSize; @@ -23,7 +23,7 @@ unsigned long cmCPackComponent::GetInstalledSize( } unsigned long cmCPackComponent::GetInstalledSizeInKbytes( - const std::string& installDir) const + std::string const& installDir) const { unsigned long result = (this->GetInstalledSize(installDir) + 512) / 1024; return result ? result : 1; diff --git a/Source/CPack/cmCPackComponentGroup.h b/Source/CPack/cmCPackComponentGroup.h index 6a47b6d..98915d7 100644 --- a/Source/CPack/cmCPackComponentGroup.h +++ b/Source/CPack/cmCPackComponentGroup.h @@ -94,11 +94,11 @@ public: /// Get the total installed size of all of the files in this /// component, in bytes. installDir is the directory into which the /// component was installed. - unsigned long GetInstalledSize(const std::string& installDir) const; + unsigned long GetInstalledSize(std::string const& installDir) const; /// Identical to GetInstalledSize, but returns the result in /// kilobytes. - unsigned long GetInstalledSizeInKbytes(const std::string& installDir) const; + unsigned long GetInstalledSizeInKbytes(std::string const& installDir) const; private: mutable unsigned long TotalSize = 0; diff --git a/Source/CPack/cmCPackCygwinBinaryGenerator.cxx b/Source/CPack/cmCPackCygwinBinaryGenerator.cxx index fcb79a2..e6d9a10 100644 --- a/Source/CPack/cmCPackCygwinBinaryGenerator.cxx +++ b/Source/CPack/cmCPackCygwinBinaryGenerator.cxx @@ -55,7 +55,7 @@ int cmCPackCygwinBinaryGenerator::PackageFiles() return this->Superclass::PackageFiles(); } -const char* cmCPackCygwinBinaryGenerator::GetOutputExtension() +char const* cmCPackCygwinBinaryGenerator::GetOutputExtension() { this->OutputExtension = "-"; cmValue patchNumber = this->GetOption("CPACK_CYGWIN_PATCH_NUMBER"); diff --git a/Source/CPack/cmCPackCygwinBinaryGenerator.h b/Source/CPack/cmCPackCygwinBinaryGenerator.h index ca8e0b5..ccab607 100644 --- a/Source/CPack/cmCPackCygwinBinaryGenerator.h +++ b/Source/CPack/cmCPackCygwinBinaryGenerator.h @@ -21,6 +21,6 @@ public: protected: int InitializeInternal() override; int PackageFiles() override; - const char* GetOutputExtension() override; + char const* GetOutputExtension() override; std::string OutputExtension; }; diff --git a/Source/CPack/cmCPackCygwinSourceGenerator.cxx b/Source/CPack/cmCPackCygwinSourceGenerator.cxx index 2844d90..107ce38 100644 --- a/Source/CPack/cmCPackCygwinSourceGenerator.cxx +++ b/Source/CPack/cmCPackCygwinSourceGenerator.cxx @@ -48,7 +48,7 @@ int cmCPackCygwinSourceGenerator::PackageFiles() // Now create a tar file that contains the above .tar.bz2 file // and the CPACK_CYGWIN_PATCH_FILE and CPACK_TOPLEVEL_DIRECTORY // files - const std::string& compressOutFile = packageDirFileName; + std::string const& compressOutFile = packageDirFileName; // at this point compressOutFile is the full path to // _CPack_Package/.../package-2.5.0.tar.bz2 // we want to create a tar _CPack_Package/.../package-2.5.0-1-src.tar.bz2 @@ -135,14 +135,14 @@ int cmCPackCygwinSourceGenerator::PackageFiles() return 1; } -const char* cmCPackCygwinSourceGenerator::GetPackagingInstallPrefix() +char const* cmCPackCygwinSourceGenerator::GetPackagingInstallPrefix() { this->InstallPrefix = cmStrCat('/', this->GetOption("CPACK_PACKAGE_FILE_NAME")); return this->InstallPrefix.c_str(); } -const char* cmCPackCygwinSourceGenerator::GetOutputExtension() +char const* cmCPackCygwinSourceGenerator::GetOutputExtension() { this->OutputExtension = "-"; cmValue patch = this->GetOption("CPACK_CYGWIN_PATCH_NUMBER"); diff --git a/Source/CPack/cmCPackCygwinSourceGenerator.h b/Source/CPack/cmCPackCygwinSourceGenerator.h index 2207bde..2746a77 100644 --- a/Source/CPack/cmCPackCygwinSourceGenerator.h +++ b/Source/CPack/cmCPackCygwinSourceGenerator.h @@ -19,10 +19,10 @@ public: ~cmCPackCygwinSourceGenerator() override; protected: - const char* GetPackagingInstallPrefix() override; + char const* GetPackagingInstallPrefix() override; int InitializeInternal() override; int PackageFiles() override; - const char* GetOutputExtension() override; + char const* GetOutputExtension() override; std::string InstallPrefix; std::string OutputExtension; }; diff --git a/Source/CPack/cmCPackDebGenerator.cxx b/Source/CPack/cmCPackDebGenerator.cxx index 14346b4..13093d1 100644 --- a/Source/CPack/cmCPackDebGenerator.cxx +++ b/Source/CPack/cmCPackDebGenerator.cxx @@ -51,23 +51,23 @@ private: bool generateDeb() const; cmCPackLog* Logger; - const std::string OutputName; - const std::string WorkDir; + std::string const OutputName; + std::string const WorkDir; std::string CompressionSuffix; - const std::string TopLevelDir; - const std::string TemporaryDir; - const std::string DebianArchiveType; + std::string const TopLevelDir; + std::string const TemporaryDir; + std::string const DebianArchiveType; long NumThreads; - const std::map ControlValues; - const bool GenShLibs; - const std::string ShLibsFilename; - const bool GenPostInst; - const std::string PostInst; - const bool GenPostRm; - const std::string PostRm; + std::map const ControlValues; + bool const GenShLibs; + std::string const ShLibsFilename; + bool const GenPostInst; + std::string const PostInst; + bool const GenPostRm; + std::string const PostRm; cmValue ControlExtra; - const bool PermissionStrictPolicy; - const std::vector PackageFiles; + bool const PermissionStrictPolicy; + std::vector const PackageFiles; cmArchiveWrite::Compress TarCompressionType; }; @@ -154,7 +154,7 @@ bool DebGenerator::generate() const void DebGenerator::generateDebianBinaryFile() const { // debian-binary file - const std::string dbfilename = this->WorkDir + "/debian-binary"; + std::string const dbfilename = this->WorkDir + "/debian-binary"; cmGeneratedFileStream out; out.Open(dbfilename, false, true); out << "2.0\n"; // required for valid debian package @@ -342,9 +342,9 @@ bool DebGenerator::generateControlTar(std::string const& md5Filename) const and https://lintian.debian.org/tags/control-file-has-bad-permissions.html */ - const mode_t permission644 = 0644; - const mode_t permissionExecute = 0111; - const mode_t permission755 = permission644 | permissionExecute; + mode_t const permission644 = 0644; + mode_t const permissionExecute = 0111; + mode_t const permission755 = permission644 | permissionExecute; // for md5sum and control (that we have generated here), we use 644 // (RW-R--R--) @@ -420,7 +420,7 @@ bool DebGenerator::generateControlTar(std::string const& md5Filename) const if (this->ControlExtra) { // permissions are now controlled by the original file permissions - static const char* strictFiles[] = { "config", "postinst", "postrm", + static char const* strictFiles[] = { "config", "postinst", "postrm", "preinst", "prerm" }; std::set setStrictFiles( strictFiles, strictFiles + sizeof(strictFiles) / sizeof(strictFiles[0])); @@ -501,7 +501,7 @@ bool DebGenerator::generateDeb() const return true; } -std::vector findFilesIn(const std::string& path) +std::vector findFilesIn(std::string const& path) { cmsys::Glob gl; std::string findExpr = path + "/*"; @@ -614,7 +614,7 @@ int cmCPackDebGenerator::PackageComponents(bool ignoreGroup) //---------------------------------------------------------------------- int cmCPackDebGenerator::PackageComponentsAllInOne( - const std::string& compInstDirName) + std::string const& compInstDirName) { /* Reset package file name list it will be populated during the * component packaging run*/ @@ -684,12 +684,12 @@ int cmCPackDebGenerator::PackageFiles() bool cmCPackDebGenerator::createDebPackages() { - auto make_package = [this](const std::string& path, - const char* const output_var, + auto make_package = [this](std::string const& path, + char const* const output_var, bool (cmCPackDebGenerator::*creator)()) -> bool { try { this->packageFiles = findFilesIn(path); - } catch (const std::runtime_error& ex) { + } catch (std::runtime_error const& ex) { cmCPackLogger(cmCPackLog::LOG_ERROR, ex.what() << std::endl); return false; } @@ -805,12 +805,12 @@ bool cmCPackDebGenerator::createDeb() controlValues["Multi-Arch"] = *debian_pkg_multiarch; } - const std::string strGenWDIR(this->GetOption("GEN_WDIR")); - const std::string shlibsfilename = strGenWDIR + "/shlibs"; + std::string const strGenWDIR(this->GetOption("GEN_WDIR")); + std::string const shlibsfilename = strGenWDIR + "/shlibs"; cmValue debian_pkg_shlibs = this->GetOption("GEN_CPACK_DEBIAN_PACKAGE_SHLIBS"); - const bool gen_shibs = this->IsOn("CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS") && + bool const gen_shibs = this->IsOn("CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS") && cmNonempty(debian_pkg_shlibs); if (gen_shibs) { cmGeneratedFileStream out; @@ -819,8 +819,8 @@ bool cmCPackDebGenerator::createDeb() out << '\n'; } - const std::string postinst = strGenWDIR + "/postinst"; - const std::string postrm = strGenWDIR + "/postrm"; + std::string const postinst = strGenWDIR + "/postinst"; + std::string const postrm = strGenWDIR + "/postrm"; if (this->IsOn("GEN_CPACK_DEBIAN_GENERATE_POSTINST")) { cmGeneratedFileStream out; out.Open(postinst, false, true); @@ -915,7 +915,7 @@ bool cmCPackDebGenerator::SupportsComponentInstallation() const } std::string cmCPackDebGenerator::GetComponentInstallSuffix( - const std::string& componentName) + std::string const& componentName) { if (this->componentPackageMethod == ONE_PACKAGE_PER_COMPONENT) { return componentName; @@ -935,7 +935,7 @@ std::string cmCPackDebGenerator::GetComponentInstallSuffix( } std::string cmCPackDebGenerator::GetComponentInstallDirNameSuffix( - const std::string& componentName) + std::string const& componentName) { return this->GetSanitizedDirOrFileName( this->GetComponentInstallSuffix(componentName)); diff --git a/Source/CPack/cmCPackDebGenerator.h b/Source/CPack/cmCPackDebGenerator.h index 2a8c194..4203eaa 100644 --- a/Source/CPack/cmCPackDebGenerator.h +++ b/Source/CPack/cmCPackDebGenerator.h @@ -55,14 +55,14 @@ protected: * Special case of component install where all * components will be put in a single installer. */ - int PackageComponentsAllInOne(const std::string& compInstDirName); + int PackageComponentsAllInOne(std::string const& compInstDirName); int PackageFiles() override; - const char* GetOutputExtension() override { return ".deb"; } + char const* GetOutputExtension() override { return ".deb"; } bool SupportsComponentInstallation() const override; std::string GetComponentInstallSuffix( - const std::string& componentName) override; + std::string const& componentName) override; std::string GetComponentInstallDirNameSuffix( - const std::string& componentName) override; + std::string const& componentName) override; private: bool createDebPackages(); diff --git a/Source/CPack/cmCPackDragNDropGenerator.cxx b/Source/CPack/cmCPackDragNDropGenerator.cxx index 038104e..cc8ebbe 100644 --- a/Source/CPack/cmCPackDragNDropGenerator.cxx +++ b/Source/CPack/cmCPackDragNDropGenerator.cxx @@ -35,7 +35,7 @@ # include #endif -static const uint16_t DefaultLpic[] = { +static uint16_t const DefaultLpic[] = { /* clang-format off */ 0x0002, 0x0011, 0x0003, 0x0001, 0x0000, 0x0000, 0x0002, 0x0000, 0x0008, 0x0003, 0x0000, 0x0001, 0x0004, 0x0000, 0x0004, 0x0005, @@ -47,7 +47,7 @@ static const uint16_t DefaultLpic[] = { /* clang-format on */ }; -static const std::vector DefaultMenu = { +static std::vector const DefaultMenu = { { "English", "Agree", "Disagree", "Print", "Save...", // NOLINTNEXTLINE(bugprone-suspicious-missing-comma) "You agree to the License Agreement terms when " @@ -75,7 +75,7 @@ int cmCPackDragNDropGenerator::InitializeInternal() paths.emplace_back("/Applications/Xcode.app/Contents/Developer/Tools"); paths.emplace_back("/Developer/Tools"); - const std::string hdiutil_path = + std::string const hdiutil_path = cmSystemTools::FindProgram("hdiutil", std::vector(), false); if (hdiutil_path.empty()) { cmCPackLogger(cmCPackLog::LOG_ERROR, @@ -84,7 +84,7 @@ int cmCPackDragNDropGenerator::InitializeInternal() } this->SetOptionIfNotSet("CPACK_COMMAND_HDIUTIL", hdiutil_path); - const std::string setfile_path = + std::string const setfile_path = cmSystemTools::FindProgram("SetFile", paths, false); if (setfile_path.empty()) { cmCPackLogger(cmCPackLog::LOG_ERROR, @@ -93,7 +93,7 @@ int cmCPackDragNDropGenerator::InitializeInternal() } this->SetOptionIfNotSet("CPACK_COMMAND_SETFILE", setfile_path); - const std::string rez_path = cmSystemTools::FindProgram("Rez", paths, false); + std::string const rez_path = cmSystemTools::FindProgram("Rez", paths, false); if (rez_path.empty()) { cmCPackLogger(cmCPackLog::LOG_ERROR, "Cannot locate Rez command" << std::endl); @@ -166,7 +166,7 @@ int cmCPackDragNDropGenerator::InitializeInternal() return this->Superclass::InitializeInternal(); } -const char* cmCPackDragNDropGenerator::GetOutputExtension() +char const* cmCPackDragNDropGenerator::GetOutputExtension() { return ".dmg"; } @@ -266,22 +266,22 @@ bool cmCPackDragNDropGenerator::RunCommand(std::string const& command, return true; } -int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir, - const std::string& output_file) +int cmCPackDragNDropGenerator::CreateDMG(std::string const& src_dir, + std::string const& output_file) { // Get optional arguments ... cmValue cpack_package_icon = this->GetOption("CPACK_PACKAGE_ICON"); - const std::string cpack_dmg_volume_name = + std::string const cpack_dmg_volume_name = this->GetOption("CPACK_DMG_VOLUME_NAME") ? *this->GetOption("CPACK_DMG_VOLUME_NAME") : *this->GetOption("CPACK_PACKAGE_FILE_NAME"); - const std::string cpack_dmg_format = this->GetOption("CPACK_DMG_FORMAT") + std::string const cpack_dmg_format = this->GetOption("CPACK_DMG_FORMAT") ? *this->GetOption("CPACK_DMG_FORMAT") : "UDZO"; - const std::string cpack_dmg_filesystem = + std::string const cpack_dmg_filesystem = this->GetOption("CPACK_DMG_FILESYSTEM") ? *this->GetOption("CPACK_DMG_FILESYSTEM") : "HFS+"; @@ -302,7 +302,7 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir, cmValue cpack_dmg_ds_store_setup_script = this->GetOption("CPACK_DMG_DS_STORE_SETUP_SCRIPT"); - const bool cpack_dmg_disable_applications_symlink = + bool const cpack_dmg_disable_applications_symlink = this->IsOn("CPACK_DMG_DISABLE_APPLICATIONS_SYMLINK"); // only put license on dmg if is user provided @@ -372,7 +372,7 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir, // Make sure the background file type is the same as the custom image // and that the file is hidden so it doesn't show up. if (!cpack_dmg_background_image->empty()) { - const std::string extension = + std::string const extension = cmSystemTools::GetFilenameLastExtension(cpack_dmg_background_image); std::ostringstream package_background_source; package_background_source << cpack_dmg_background_image; @@ -709,7 +709,7 @@ bool cmCPackDragNDropGenerator::SupportsComponentInstallation() const } std::string cmCPackDragNDropGenerator::GetComponentInstallSuffix( - const std::string& componentName) + std::string const& componentName) { // we want to group components together that go in the same dmg package std::string package_file_name = this->GetOption("CPACK_PACKAGE_FILE_NAME"); @@ -749,7 +749,7 @@ std::string cmCPackDragNDropGenerator::GetComponentInstallSuffix( } std::string cmCPackDragNDropGenerator::GetComponentInstallDirNameSuffix( - const std::string& componentName) + std::string const& componentName) { return this->GetSanitizedDirOrFileName( this->GetComponentInstallSuffix(componentName)); @@ -814,7 +814,7 @@ void cmCPackDragNDropGenerator::WriteRezDict(cmXMLWriter& xml, bool cmCPackDragNDropGenerator::WriteLicense(RezDoc& rez, size_t licenseNumber, std::string licenseLanguage, - const std::string& licenseFile, + std::string const& licenseFile, std::string* error) { if (!licenseFile.empty() && !singleLicense) { @@ -919,11 +919,11 @@ bool cmCPackDragNDropGenerator::ReadFile(std::string const& file, return true; } -bool cmCPackDragNDropGenerator::BreakLongLine(const std::string& line, +bool cmCPackDragNDropGenerator::BreakLongLine(std::string const& line, std::vector& lines, std::string* error) { - const size_t max_line_length = 255; + size_t const max_line_length = 255; size_t line_length = max_line_length; for (size_t i = 0; i < line.size(); i += line_length) { line_length = max_line_length; diff --git a/Source/CPack/cmCPackDragNDropGenerator.h b/Source/CPack/cmCPackDragNDropGenerator.h index 249f73e..b078f4b 100644 --- a/Source/CPack/cmCPackDragNDropGenerator.h +++ b/Source/CPack/cmCPackDragNDropGenerator.h @@ -27,7 +27,7 @@ public: protected: int InitializeInternal() override; - const char* GetOutputExtension() override; + char const* GetOutputExtension() override; int PackageFiles() override; bool SupportsComponentInstallation() const override; @@ -36,11 +36,11 @@ protected: bool RunCommand(std::string const& command, std::string* output = nullptr); std::string GetComponentInstallSuffix( - const std::string& componentName) override; + std::string const& componentName) override; std::string GetComponentInstallDirNameSuffix( - const std::string& componentName) override; + std::string const& componentName) override; - int CreateDMG(const std::string& src_dir, const std::string& output_file); + int CreateDMG(std::string const& src_dir, std::string const& output_file); private: std::string slaDirectory; @@ -73,11 +73,11 @@ private: bool WriteLicense(RezDoc& rez, size_t licenseNumber, std::string licenseLanguage, - const std::string& licenseFile, std::string* error); + std::string const& licenseFile, std::string* error); void EncodeLicense(RezDict& dict, std::vector const& lines); void EncodeMenu(RezDict& dict, std::vector const& lines); bool ReadFile(std::string const& file, std::vector& lines, std::string* error); - bool BreakLongLine(const std::string& line, std::vector& lines, + bool BreakLongLine(std::string const& line, std::vector& lines, std::string* error); }; diff --git a/Source/CPack/cmCPackExternalGenerator.cxx b/Source/CPack/cmCPackExternalGenerator.cxx index 76cb876..9b4cc55 100644 --- a/Source/CPack/cmCPackExternalGenerator.cxx +++ b/Source/CPack/cmCPackExternalGenerator.cxx @@ -95,7 +95,7 @@ bool cmCPackExternalGenerator::SupportsComponentInstallation() const } int cmCPackExternalGenerator::InstallProjectViaInstallCommands( - bool setDestDir, const std::string& tempInstallDirectory) + bool setDestDir, std::string const& tempInstallDirectory) { if (this->StagingEnabled()) { return this->cmCPackGenerator::InstallProjectViaInstallCommands( @@ -106,7 +106,7 @@ int cmCPackExternalGenerator::InstallProjectViaInstallCommands( } int cmCPackExternalGenerator::InstallProjectViaInstallScript( - bool setDestDir, const std::string& tempInstallDirectory) + bool setDestDir, std::string const& tempInstallDirectory) { if (this->StagingEnabled()) { return this->cmCPackGenerator::InstallProjectViaInstallScript( @@ -117,8 +117,8 @@ int cmCPackExternalGenerator::InstallProjectViaInstallScript( } int cmCPackExternalGenerator::InstallProjectViaInstalledDirectories( - bool setDestDir, const std::string& tempInstallDirectory, - const mode_t* default_dir_mode) + bool setDestDir, std::string const& tempInstallDirectory, + mode_t const* default_dir_mode) { if (this->StagingEnabled()) { return this->cmCPackGenerator::InstallProjectViaInstalledDirectories( @@ -129,8 +129,8 @@ int cmCPackExternalGenerator::InstallProjectViaInstalledDirectories( } int cmCPackExternalGenerator::RunPreinstallTarget( - const std::string& installProjectName, const std::string& installDirectory, - cmGlobalGenerator* globalGenerator, const std::string& buildConfig) + std::string const& installProjectName, std::string const& installDirectory, + cmGlobalGenerator* globalGenerator, std::string const& buildConfig) { if (this->StagingEnabled()) { return this->cmCPackGenerator::RunPreinstallTarget( @@ -141,10 +141,10 @@ int cmCPackExternalGenerator::RunPreinstallTarget( } int cmCPackExternalGenerator::InstallCMakeProject( - bool setDestDir, const std::string& installDirectory, - const std::string& baseTempInstallDirectory, const mode_t* default_dir_mode, - const std::string& component, bool componentInstall, - const std::string& installSubDirectory, const std::string& buildConfig, + bool setDestDir, std::string const& installDirectory, + std::string const& baseTempInstallDirectory, mode_t const* default_dir_mode, + std::string const& component, bool componentInstall, + std::string const& installSubDirectory, std::string const& buildConfig, std::string& absoluteDestFiles) { if (this->StagingEnabled()) { diff --git a/Source/CPack/cmCPackExternalGenerator.h b/Source/CPack/cmCPackExternalGenerator.h index dfd13e8..66ae7b9 100644 --- a/Source/CPack/cmCPackExternalGenerator.h +++ b/Source/CPack/cmCPackExternalGenerator.h @@ -22,7 +22,7 @@ class cmCPackExternalGenerator : public cmCPackGenerator public: cmCPackTypeMacro(cmCPackExternalGenerator, cmCPackGenerator); - const char* GetOutputExtension() override { return ".json"; } + char const* GetOutputExtension() override { return ".json"; } protected: int InitializeInternal() override; @@ -32,23 +32,23 @@ protected: bool SupportsComponentInstallation() const override; int InstallProjectViaInstallCommands( - bool setDestDir, const std::string& tempInstallDirectory) override; + bool setDestDir, std::string const& tempInstallDirectory) override; int InstallProjectViaInstallScript( - bool setDestDir, const std::string& tempInstallDirectory) override; + bool setDestDir, std::string const& tempInstallDirectory) override; int InstallProjectViaInstalledDirectories( - bool setDestDir, const std::string& tempInstallDirectory, - const mode_t* default_dir_mode) override; + bool setDestDir, std::string const& tempInstallDirectory, + mode_t const* default_dir_mode) override; - int RunPreinstallTarget(const std::string& installProjectName, - const std::string& installDirectory, + int RunPreinstallTarget(std::string const& installProjectName, + std::string const& installDirectory, cmGlobalGenerator* globalGenerator, - const std::string& buildConfig) override; - int InstallCMakeProject(bool setDestDir, const std::string& installDirectory, - const std::string& baseTempInstallDirectory, - const mode_t* default_dir_mode, - const std::string& component, bool componentInstall, - const std::string& installSubDirectory, - const std::string& buildConfig, + std::string const& buildConfig) override; + int InstallCMakeProject(bool setDestDir, std::string const& installDirectory, + std::string const& baseTempInstallDirectory, + mode_t const* default_dir_mode, + std::string const& component, bool componentInstall, + std::string const& installSubDirectory, + std::string const& buildConfig, std::string& absoluteDestFiles) override; private: diff --git a/Source/CPack/cmCPackFreeBSDGenerator.cxx b/Source/CPack/cmCPackFreeBSDGenerator.cxx index 6beb644..9dd3f0c 100644 --- a/Source/CPack/cmCPackFreeBSDGenerator.cxx +++ b/Source/CPack/cmCPackFreeBSDGenerator.cxx @@ -22,8 +22,8 @@ #include "cmWorkingDirectory.h" // Suffix used to tell libpkg what compression to use -static const char FreeBSDPackageCompression[] = "txz"; -static const char FreeBSDPackageSuffix_17[] = ".pkg"; +static char const FreeBSDPackageCompression[] = "txz"; +static char const FreeBSDPackageSuffix_17[] = ".pkg"; cmCPackFreeBSDGenerator::cmCPackFreeBSDGenerator() : cmCPackArchiveGenerator(cmArchiveWrite::CompressXZ, "paxr", @@ -55,8 +55,8 @@ public: : d(nullptr) { } - PkgCreate(const std::string& output_dir, const std::string& toplevel_dir, - const std::string& manifest_name) + PkgCreate(std::string const& output_dir, std::string const& toplevel_dir, + std::string const& manifest_name) : d(pkg_create_new()) , manifest(manifest_name) @@ -106,9 +106,9 @@ private: class EscapeQuotes { public: - const std::string& value; + std::string const& value; - EscapeQuotes(const std::string& s) + EscapeQuotes(std::string const& s) : value(s) { } @@ -116,7 +116,7 @@ public: // Output a string as "string" with escaping applied. cmGeneratedFileStream& operator<<(cmGeneratedFileStream& s, - const EscapeQuotes& v) + EscapeQuotes const& v) { s << '"'; for (char c : v.value) { @@ -179,7 +179,7 @@ class ManifestKeyValue : public ManifestKey public: std::string value; - ManifestKeyValue(const std::string& k, std::string v) + ManifestKeyValue(std::string const& k, std::string v) : ManifestKey(k) , value(std::move(v)) { @@ -198,18 +198,18 @@ public: using VList = std::vector; VList value; - ManifestKeyListValue(const std::string& k) + ManifestKeyListValue(std::string const& k) : ManifestKey(k) { } - ManifestKeyListValue& operator<<(const std::string& v) + ManifestKeyListValue& operator<<(std::string const& v) { value.push_back(v); return *this; } - ManifestKeyListValue& operator<<(const std::vector& v) + ManifestKeyListValue& operator<<(std::vector const& v) { for (std::string const& e : v) { (*this) << e; @@ -237,7 +237,7 @@ public: class ManifestKeyDepsValue : public ManifestKeyListValue { public: - ManifestKeyDepsValue(const std::string& k) + ManifestKeyDepsValue(std::string const& k) : ManifestKeyListValue(k) { } @@ -254,7 +254,7 @@ public: // Write one of the key-value classes (above) to the stream @p s cmGeneratedFileStream& operator<<(cmGeneratedFileStream& s, - const ManifestKey& v) + ManifestKey const& v) { s << '"' << v.key << "\": "; v.write_value(s); @@ -264,7 +264,7 @@ cmGeneratedFileStream& operator<<(cmGeneratedFileStream& s, // Look up variable; if no value is set, returns an empty string; // basically a wrapper that handles the nullptr return from GetOption(). -std::string cmCPackFreeBSDGenerator::var_lookup(const char* var_name) +std::string cmCPackFreeBSDGenerator::var_lookup(char const* var_name) { cmValue pv = this->GetOption(var_name); if (!pv) { @@ -312,7 +312,7 @@ void cmCPackFreeBSDGenerator::write_manifest_fields( // Package only actual files; others are ignored (in particular, // intermediate subdirectories are ignored). -static bool ignore_file(const std::string& filename) +static bool ignore_file(std::string const& filename) { struct stat statbuf; return stat(filename.c_str(), &statbuf) < 0 || @@ -325,8 +325,8 @@ static bool ignore_file(const std::string& filename) // to paths relative to @p toplevel, with a leading / (since the paths // in FreeBSD package files are supposed to be absolute). void write_manifest_files(cmGeneratedFileStream& s, - const std::string& toplevel, - const std::vector& files) + std::string const& toplevel, + std::vector const& files) { s << "\"files\": {\n"; for (std::string const& file : files) { @@ -405,7 +405,7 @@ int cmCPackFreeBSDGenerator::PackageFiles() return 0; } - const std::string output_dir = cmSystemTools::GetFilenamePath(toplevel); + std::string const output_dir = cmSystemTools::GetFilenamePath(toplevel); PkgCreate package(output_dir, toplevel, manifestname); if (package.isValid()) { if (!package.Create()) { @@ -431,17 +431,17 @@ int cmCPackFreeBSDGenerator::PackageFiles() } } - const std::string packageFileName = + std::string const packageFileName = var_lookup("CPACK_PACKAGE_FILE_NAME") + FreeBSDPackageSuffix_17; if (packageFileNames.size() == 1 && !packageFileName.empty() && packageFileNames[0] != packageFileName) { // Since libpkg always writes -., // if there is a CPACK_PACKAGE_FILE_NAME set, we need to // rename, and then re-set the name. - const std::string sourceFile = packageFileNames[0]; - const std::string packageSubDirectory = + std::string const sourceFile = packageFileNames[0]; + std::string const packageSubDirectory = cmSystemTools::GetParentDirectory(sourceFile); - const std::string targetFileName = + std::string const targetFileName = packageSubDirectory + '/' + packageFileName; if (cmSystemTools::RenameFile(sourceFile, targetFileName)) { this->packageFileNames.clear(); diff --git a/Source/CPack/cmCPackFreeBSDGenerator.h b/Source/CPack/cmCPackFreeBSDGenerator.h index eed8053..22440fa 100644 --- a/Source/CPack/cmCPackFreeBSDGenerator.h +++ b/Source/CPack/cmCPackFreeBSDGenerator.h @@ -29,6 +29,6 @@ public: int PackageFiles() override; protected: - std::string var_lookup(const char* var_name); + std::string var_lookup(char const* var_name); void write_manifest_fields(cmGeneratedFileStream&); }; diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index 82116b3..477a66d 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -50,7 +50,7 @@ cmCPackGenerator::~cmCPackGenerator() this->MakefileMap = nullptr; } -void cmCPackGenerator::DisplayVerboseOutput(const std::string& msg, +void cmCPackGenerator::DisplayVerboseOutput(std::string const& msg, float /*unused*/) { cmCPackLogger(cmCPackLog::LOG_VERBOSE, msg << std::endl); @@ -227,7 +227,7 @@ int cmCPackGenerator::InstallProject() this->GetOption("CPACK_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS"); if (cmNonempty(default_dir_install_permissions)) { cmList items{ default_dir_install_permissions }; - for (const auto& arg : items) { + for (auto const& arg : items) { if (!cmFSPermissions::stringToModeT(arg, default_dir_mode_v)) { cmCPackLogger(cmCPackLog::LOG_ERROR, "Invalid permission value '" @@ -275,8 +275,8 @@ int cmCPackGenerator::InstallProject() // Run pre-build actions cmValue preBuildScripts = this->GetOption("CPACK_PRE_BUILD_SCRIPTS"); if (preBuildScripts) { - const cmList scripts{ preBuildScripts }; - for (const auto& script : scripts) { + cmList const scripts{ preBuildScripts }; + for (auto const& script : scripts) { cmCPackLogger(cmCPackLog::LOG_OUTPUT, "Executing pre-build script: " << script << std::endl); @@ -297,7 +297,7 @@ int cmCPackGenerator::InstallProject() } int cmCPackGenerator::InstallProjectViaInstallCommands( - bool setDestDir, const std::string& tempInstallDirectory) + bool setDestDir, std::string const& tempInstallDirectory) { (void)setDestDir; cmValue installCommands = this->GetOption("CPACK_INSTALL_COMMANDS"); @@ -333,8 +333,8 @@ int cmCPackGenerator::InstallProjectViaInstallCommands( } int cmCPackGenerator::InstallProjectViaInstalledDirectories( - bool setDestDir, const std::string& tempInstallDirectory, - const mode_t* default_dir_mode) + bool setDestDir, std::string const& tempInstallDirectory, + mode_t const* default_dir_mode) { (void)setDestDir; (void)tempInstallDirectory; @@ -362,7 +362,7 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories( return 0; } cmList::iterator it; - const std::string& tempDir = tempInstallDirectory; + std::string const& tempDir = tempInstallDirectory; for (it = installDirectoriesList.begin(); it != installDirectoriesList.end(); ++it) { std::vector> symlinkedFiles; @@ -470,7 +470,7 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories( } int cmCPackGenerator::InstallProjectViaInstallScript( - bool setDestDir, const std::string& tempInstallDirectory) + bool setDestDir, std::string const& tempInstallDirectory) { cmValue cmakeScripts = this->GetOption("CPACK_INSTALL_SCRIPTS"); { @@ -537,8 +537,8 @@ int cmCPackGenerator::InstallProjectViaInstallScript( } int cmCPackGenerator::InstallProjectViaInstallCMakeProjects( - bool setDestDir, const std::string& baseTempInstallDirectory, - const mode_t* default_dir_mode) + bool setDestDir, std::string const& baseTempInstallDirectory, + mode_t const* default_dir_mode) { cmValue cmakeProjects = this->GetOption("CPACK_INSTALL_CMAKE_PROJECTS"); cmValue cmakeGenerator = this->GetOption("CPACK_CMAKE_GENERATOR"); @@ -679,11 +679,11 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects( } int cmCPackGenerator::RunPreinstallTarget( - const std::string& installProjectName, const std::string& installDirectory, - cmGlobalGenerator* globalGenerator, const std::string& buildConfig) + std::string const& installProjectName, std::string const& installDirectory, + cmGlobalGenerator* globalGenerator, std::string const& buildConfig) { // Does this generator require pre-install? - if (const char* preinstall = globalGenerator->GetPreinstallTargetName()) { + if (char const* preinstall = globalGenerator->GetPreinstallTargetName()) { std::string buildCommand = globalGenerator->GenerateCMakeBuildCommand( preinstall, buildConfig, "", "", false); cmCPackLogger(cmCPackLog::LOG_DEBUG, @@ -717,10 +717,10 @@ int cmCPackGenerator::RunPreinstallTarget( } int cmCPackGenerator::InstallCMakeProject( - bool setDestDir, const std::string& installDirectory, - const std::string& baseTempInstallDirectory, const mode_t* default_dir_mode, - const std::string& component, bool componentInstall, - const std::string& installSubDirectory, const std::string& buildConfig, + bool setDestDir, std::string const& installDirectory, + std::string const& baseTempInstallDirectory, mode_t const* default_dir_mode, + std::string const& component, bool componentInstall, + std::string const& installSubDirectory, std::string const& buildConfig, std::string& absoluteDestFiles) { std::string tempInstallDirectory = baseTempInstallDirectory; @@ -736,7 +736,7 @@ int cmCPackGenerator::InstallCMakeProject( cm.SetHomeOutputDirectory(""); cm.GetCurrentSnapshot().SetDefaultDefinitions(); cm.AddCMakePaths(); - cm.SetProgressCallback([this](const std::string& msg, float prog) { + cm.SetProgressCallback([this](std::string const& msg, float prog) { this->DisplayVerboseOutput(msg, prog); }); cm.SetTrace(this->Trace); @@ -998,7 +998,7 @@ bool cmCPackGenerator::GenerateChecksumFile(cmCryptoHash& crypto, return true; } -bool cmCPackGenerator::CopyPackageFile(const std::string& srcFilePath, +bool cmCPackGenerator::CopyPackageFile(std::string const& srcFilePath, cm::string_view filename) const { std::string destFilePath = @@ -1021,7 +1021,7 @@ bool cmCPackGenerator::CopyPackageFile(const std::string& srcFilePath, return true; } -bool cmCPackGenerator::ReadListFile(const char* moduleName) +bool cmCPackGenerator::ReadListFile(char const* moduleName) { bool retval; std::string fullPath = this->MakefileMap->GetModulesFile(moduleName); @@ -1032,7 +1032,7 @@ bool cmCPackGenerator::ReadListFile(const char* moduleName) } template -void cmCPackGenerator::StoreOptionIfNotSet(const std::string& op, +void cmCPackGenerator::StoreOptionIfNotSet(std::string const& op, ValueType value) { cmValue def = this->MakefileMap->GetDefinition(op); @@ -1042,18 +1042,18 @@ void cmCPackGenerator::StoreOptionIfNotSet(const std::string& op, this->StoreOption(op, value); } -void cmCPackGenerator::SetOptionIfNotSet(const std::string& op, - const char* value) +void cmCPackGenerator::SetOptionIfNotSet(std::string const& op, + char const* value) { this->StoreOptionIfNotSet(op, value); } -void cmCPackGenerator::SetOptionIfNotSet(const std::string& op, cmValue value) +void cmCPackGenerator::SetOptionIfNotSet(std::string const& op, cmValue value) { this->StoreOptionIfNotSet(op, value); } template -void cmCPackGenerator::StoreOption(const std::string& op, ValueType value) +void cmCPackGenerator::StoreOption(std::string const& op, ValueType value) { if (!value) { this->MakefileMap->RemoveDefinition(op); @@ -1065,11 +1065,11 @@ void cmCPackGenerator::StoreOption(const std::string& op, ValueType value) this->MakefileMap->AddDefinition(op, value); } -void cmCPackGenerator::SetOption(const std::string& op, const char* value) +void cmCPackGenerator::SetOption(std::string const& op, char const* value) { this->StoreOption(op, value); } -void cmCPackGenerator::SetOption(const std::string& op, cmValue value) +void cmCPackGenerator::SetOption(std::string const& op, cmValue value) { this->StoreOption(op, value); } @@ -1186,8 +1186,8 @@ int cmCPackGenerator::DoPackage() this->MakefileMap->AddDefinition( "CPACK_PACKAGE_FILES", cmList::to_string(this->packageFileNames)); - const cmList scripts{ postBuildScripts }; - for (const auto& script : scripts) { + cmList const scripts{ postBuildScripts }; + for (auto const& script : scripts) { cmCPackLogger(cmCPackLog::LOG_OUTPUT, "Executing post-build script: " << script << std::endl); @@ -1230,7 +1230,7 @@ int cmCPackGenerator::DoPackage() return 1; } -int cmCPackGenerator::Initialize(const std::string& name, cmMakefile* mf) +int cmCPackGenerator::Initialize(std::string const& name, cmMakefile* mf) { this->MakefileMap = mf; this->Name = name; @@ -1313,12 +1313,12 @@ int cmCPackGenerator::InitializeInternal() return 1; } -bool cmCPackGenerator::IsSet(const std::string& name) const +bool cmCPackGenerator::IsSet(std::string const& name) const { return this->MakefileMap->IsSet(name); } -cmValue cmCPackGenerator::GetOptionIfSet(const std::string& name) const +cmValue cmCPackGenerator::GetOptionIfSet(std::string const& name) const { cmValue ret = this->MakefileMap->GetDefinition(name); if (!ret || ret->empty() || cmIsNOTFOUND(*ret)) { @@ -1327,12 +1327,12 @@ cmValue cmCPackGenerator::GetOptionIfSet(const std::string& name) const return ret; } -bool cmCPackGenerator::IsOn(const std::string& name) const +bool cmCPackGenerator::IsOn(std::string const& name) const { return this->GetOption(name).IsOn(); } -bool cmCPackGenerator::IsSetToOff(const std::string& op) const +bool cmCPackGenerator::IsSetToOff(std::string const& op) const { cmValue ret = this->MakefileMap->GetDefinition(op); if (cmNonempty(ret)) { @@ -1341,7 +1341,7 @@ bool cmCPackGenerator::IsSetToOff(const std::string& op) const return false; } -bool cmCPackGenerator::IsSetToEmpty(const std::string& op) const +bool cmCPackGenerator::IsSetToEmpty(std::string const& op) const { cmValue ret = this->MakefileMap->GetDefinition(op); if (ret) { @@ -1350,7 +1350,7 @@ bool cmCPackGenerator::IsSetToEmpty(const std::string& op) const return false; } -cmValue cmCPackGenerator::GetOption(const std::string& op) const +cmValue cmCPackGenerator::GetOption(std::string const& op) const { cmValue ret = this->MakefileMap->GetDefinition(op); if (!ret) { @@ -1370,7 +1370,7 @@ int cmCPackGenerator::PackageFiles() return 0; } -const char* cmCPackGenerator::GetInstallPath() +char const* cmCPackGenerator::GetInstallPath() { if (!this->InstallPath.empty()) { return this->InstallPath.c_str(); @@ -1403,7 +1403,7 @@ const char* cmCPackGenerator::GetInstallPath() return this->InstallPath.c_str(); } -const char* cmCPackGenerator::GetPackagingInstallPrefix() +char const* cmCPackGenerator::GetPackagingInstallPrefix() { cmCPackLogger(cmCPackLog::LOG_DEBUG, "GetPackagingInstallPrefix: '" @@ -1434,15 +1434,15 @@ std::string cmCPackGenerator::FindTemplate(cm::string_view name, return ffile; } -bool cmCPackGenerator::ConfigureString(const std::string& inString, +bool cmCPackGenerator::ConfigureString(std::string const& inString, std::string& outString) { this->MakefileMap->ConfigureString(inString, outString, true, false); return true; } -bool cmCPackGenerator::ConfigureFile(const std::string& inName, - const std::string& outName, +bool cmCPackGenerator::ConfigureFile(std::string const& inName, + std::string const& outName, bool copyOnly /* = false */) { return this->MakefileMap->ConfigureFile(inName, outName, copyOnly, true, @@ -1537,7 +1537,7 @@ int cmCPackGenerator::PrepareGroupingKind() this->componentPackageMethod = method; } - const char* method_names[] = { "ALL_COMPONENTS_IN_ONE", "IGNORE", + char const* method_names[] = { "ALL_COMPONENTS_IN_ONE", "IGNORE", "ONE_PER_GROUP", "UNKNOWN" }; cmCPackLogger(cmCPackLog::LOG_VERBOSE, @@ -1550,7 +1550,7 @@ int cmCPackGenerator::PrepareGroupingKind() } std::string cmCPackGenerator::GetSanitizedDirOrFileName( - const std::string& name, bool isFullName) const + std::string const& name, bool isFullName) const { if (isFullName) { #ifdef _WIN32 @@ -1577,10 +1577,10 @@ std::string cmCPackGenerator::GetSanitizedDirOrFileName( } #ifndef _WIN32 - constexpr const char* prohibited_chars = "<>\"/\\|?*`"; + constexpr char const* prohibited_chars = "<>\"/\\|?*`"; #else // Note: Windows also excludes the colon. - constexpr const char* prohibited_chars = "<>\"/\\|?*`:"; + constexpr char const* prohibited_chars = "<>\"/\\|?*`:"; #endif // Given name contains non-supported character? // Then return its MD5 hash. @@ -1594,21 +1594,21 @@ std::string cmCPackGenerator::GetSanitizedDirOrFileName( } std::string cmCPackGenerator::GetComponentInstallSuffix( - const std::string& componentName) + std::string const& componentName) { return componentName; } std::string cmCPackGenerator::GetComponentInstallDirNameSuffix( - const std::string& componentName) + std::string const& componentName) { return this->GetSanitizedDirOrFileName( this->GetComponentInstallSuffix(componentName)); } std::string cmCPackGenerator::GetComponentPackageFileName( - const std::string& initialPackageFileName, - const std::string& groupOrComponentName, bool isGroupName) + std::string const& initialPackageFileName, + std::string const& groupOrComponentName, bool isGroupName) { /* @@ -1667,7 +1667,7 @@ bool cmCPackGenerator::WantsComponentInstallation() const } cmCPackInstallationType* cmCPackGenerator::GetInstallationType( - const std::string& projectName, const std::string& name) + std::string const& projectName, std::string const& name) { (void)projectName; bool hasInstallationType = this->InstallationTypes.count(name) != 0; @@ -1691,7 +1691,7 @@ cmCPackInstallationType* cmCPackGenerator::GetInstallationType( } cmCPackComponent* cmCPackGenerator::GetComponent( - const std::string& projectName, const std::string& name) + std::string const& projectName, std::string const& name) { bool hasComponent = this->Components.count(name) != 0; cmCPackComponent* component = &this->Components[name]; @@ -1760,7 +1760,7 @@ cmCPackComponent* cmCPackGenerator::GetComponent( } cmCPackComponentGroup* cmCPackGenerator::GetComponentGroup( - const std::string& projectName, const std::string& name) + std::string const& projectName, std::string const& name) { (void)projectName; std::string macroPrefix = diff --git a/Source/CPack/cmCPackGenerator.h b/Source/CPack/cmCPackGenerator.h index 30e8451..6294552 100644 --- a/Source/CPack/cmCPackGenerator.h +++ b/Source/CPack/cmCPackGenerator.h @@ -31,7 +31,7 @@ class cmMakefile; class cmCPackGenerator { public: - virtual const char* GetNameOfClass() = 0; + virtual char const* GetNameOfClass() = 0; /** * If verbose then more information is printed out */ @@ -79,7 +79,7 @@ public: /** * Initialize generator */ - int Initialize(const std::string& name, cmMakefile* mf); + int Initialize(std::string const& name, cmMakefile* mf); /** * Construct generator @@ -88,33 +88,33 @@ public: virtual ~cmCPackGenerator(); //! Set and get the options - void SetOption(const std::string& op, const char* value); - void SetOption(const std::string& op, const std::string& value) + void SetOption(std::string const& op, char const* value); + void SetOption(std::string const& op, std::string const& value) { this->SetOption(op, cmValue(value)); } - void SetOption(const std::string& op, cmValue value); - void SetOptionIfNotSet(const std::string& op, const char* value); - void SetOptionIfNotSet(const std::string& op, const std::string& value) + void SetOption(std::string const& op, cmValue value); + void SetOptionIfNotSet(std::string const& op, char const* value); + void SetOptionIfNotSet(std::string const& op, std::string const& value) { this->SetOptionIfNotSet(op, cmValue(value)); } - void SetOptionIfNotSet(const std::string& op, cmValue value); - cmValue GetOption(const std::string& op) const; + void SetOptionIfNotSet(std::string const& op, cmValue value); + cmValue GetOption(std::string const& op) const; std::vector GetOptions() const; - bool IsSet(const std::string& name) const; - cmValue GetOptionIfSet(const std::string& name) const; - bool IsOn(const std::string& name) const; - bool IsSetToOff(const std::string& op) const; - bool IsSetToEmpty(const std::string& op) const; + bool IsSet(std::string const& name) const; + cmValue GetOptionIfSet(std::string const& name) const; + bool IsOn(std::string const& name) const; + bool IsSetToOff(std::string const& op) const; + bool IsSetToEmpty(std::string const& op) const; //! Set the logger void SetLogger(cmCPackLog* log) { this->Logger = log; } //! Display verbose information via logger - void DisplayVerboseOutput(const std::string& msg, float progress); + void DisplayVerboseOutput(std::string const& msg, float progress); - bool ReadListFile(const char* moduleName); + bool ReadListFile(char const* moduleName); protected: /** @@ -132,8 +132,8 @@ protected: cmInstalledFile const* GetInstalledFile(std::string const& name) const; - virtual const char* GetOutputExtension() { return ".cpack"; } - virtual const char* GetOutputPostfix() { return nullptr; } + virtual char const* GetOutputExtension() { return ".cpack"; } + virtual char const* GetOutputPostfix() { return nullptr; } /** * Prepare requested grouping kind from CPACK_xxx vars @@ -154,7 +154,7 @@ protected: * directory or file. (Defaults to true.) * @return the sanitized name. */ - virtual std::string GetSanitizedDirOrFileName(const std::string& name, + virtual std::string GetSanitizedDirOrFileName(std::string const& name, bool isFullName = true) const; /** @@ -168,7 +168,7 @@ protected: * default is "componentName" */ virtual std::string GetComponentInstallSuffix( - const std::string& componentName); + std::string const& componentName); /** * The value that GetComponentInstallSuffix returns, but sanitized. @@ -178,7 +178,7 @@ protected: * default is "componentName". */ virtual std::string GetComponentInstallDirNameSuffix( - const std::string& componentName); + std::string const& componentName); /** * CPack specific generator may mangle CPACK_PACKAGE_FILE_NAME @@ -190,8 +190,8 @@ protected: * false otherwise */ virtual std::string GetComponentPackageFileName( - const std::string& initialPackageFileName, - const std::string& groupOrComponentName, bool isGroupName); + std::string const& initialPackageFileName, + std::string const& groupOrComponentName, bool isGroupName); /** * Package the list of files and/or components which @@ -203,44 +203,44 @@ protected: * the list of packages generated by the specific generator. */ virtual int PackageFiles(); - virtual const char* GetInstallPath(); - virtual const char* GetPackagingInstallPrefix(); + virtual char const* GetInstallPath(); + virtual char const* GetPackagingInstallPrefix(); bool GenerateChecksumFile(cmCryptoHash& crypto, cm::string_view filename) const; - bool CopyPackageFile(const std::string& srcFilePath, + bool CopyPackageFile(std::string const& srcFilePath, cm::string_view filename) const; std::string FindTemplate(cm::string_view name, cm::optional alt = cm::nullopt); - virtual bool ConfigureFile(const std::string& inName, - const std::string& outName, + virtual bool ConfigureFile(std::string const& inName, + std::string const& outName, bool copyOnly = false); - virtual bool ConfigureString(const std::string& input, std::string& output); + virtual bool ConfigureString(std::string const& input, std::string& output); virtual int InitializeInternal(); //! Run install commands if specified virtual int InstallProjectViaInstallCommands( - bool setDestDir, const std::string& tempInstallDirectory); + bool setDestDir, std::string const& tempInstallDirectory); virtual int InstallProjectViaInstallScript( - bool setDestDir, const std::string& tempInstallDirectory); + bool setDestDir, std::string const& tempInstallDirectory); virtual int InstallProjectViaInstalledDirectories( - bool setDestDir, const std::string& tempInstallDirectory, - const mode_t* default_dir_mode); + bool setDestDir, std::string const& tempInstallDirectory, + mode_t const* default_dir_mode); virtual int InstallProjectViaInstallCMakeProjects( - bool setDestDir, const std::string& tempInstallDirectory, - const mode_t* default_dir_mode); + bool setDestDir, std::string const& tempInstallDirectory, + mode_t const* default_dir_mode); - virtual int RunPreinstallTarget(const std::string& installProjectName, - const std::string& installDirectory, + virtual int RunPreinstallTarget(std::string const& installProjectName, + std::string const& installDirectory, cmGlobalGenerator* globalGenerator, - const std::string& buildConfig); + std::string const& buildConfig); virtual int InstallCMakeProject( - bool setDestDir, const std::string& installDirectory, - const std::string& baseTempInstallDirectory, - const mode_t* default_dir_mode, const std::string& component, - bool componentInstall, const std::string& installSubDirectory, - const std::string& buildConfig, std::string& absoluteDestFiles); + bool setDestDir, std::string const& installDirectory, + std::string const& baseTempInstallDirectory, + mode_t const* default_dir_mode, std::string const& component, + bool componentInstall, std::string const& installSubDirectory, + std::string const& buildConfig, std::string& absoluteDestFiles); /** * The various level of support of @@ -291,11 +291,11 @@ protected: */ virtual bool WantsComponentInstallation() const; virtual cmCPackInstallationType* GetInstallationType( - const std::string& projectName, const std::string& name); - virtual cmCPackComponent* GetComponent(const std::string& projectName, - const std::string& name); + std::string const& projectName, std::string const& name); + virtual cmCPackComponent* GetComponent(std::string const& projectName, + std::string const& name); virtual cmCPackComponentGroup* GetComponentGroup( - const std::string& projectName, const std::string& name); + std::string const& projectName, std::string const& name); cmSystemTools::OutputOption GeneratorVerbose; std::string Name; @@ -370,9 +370,9 @@ protected: private: template - void StoreOption(const std::string& op, ValueType value); + void StoreOption(std::string const& op, ValueType value); template - void StoreOptionIfNotSet(const std::string& op, ValueType value); + void StoreOptionIfNotSet(std::string const& op, ValueType value); }; #define cmCPackTypeMacro(klass, superclass) \ diff --git a/Source/CPack/cmCPackGeneratorFactory.cxx b/Source/CPack/cmCPackGeneratorFactory.cxx index 6ca48bf..b3410e7 100644 --- a/Source/CPack/cmCPackGeneratorFactory.cxx +++ b/Source/CPack/cmCPackGeneratorFactory.cxx @@ -133,7 +133,7 @@ cmCPackGeneratorFactory::cmCPackGeneratorFactory() } std::unique_ptr cmCPackGeneratorFactory::NewGenerator( - const std::string& name) + std::string const& name) { auto it = this->GeneratorCreators.find(name); if (it == this->GeneratorCreators.end()) { @@ -148,7 +148,7 @@ std::unique_ptr cmCPackGeneratorFactory::NewGenerator( } void cmCPackGeneratorFactory::RegisterGenerator( - const std::string& name, const char* generatorDescription, + std::string const& name, char const* generatorDescription, CreateGeneratorCall* createGenerator) { if (!createGenerator) { diff --git a/Source/CPack/cmCPackGeneratorFactory.h b/Source/CPack/cmCPackGeneratorFactory.h index 52c1b5c..0efd7a5 100644 --- a/Source/CPack/cmCPackGeneratorFactory.h +++ b/Source/CPack/cmCPackGeneratorFactory.h @@ -23,18 +23,18 @@ public: cmCPackGeneratorFactory(); //! Get the generator - std::unique_ptr NewGenerator(const std::string& name); + std::unique_ptr NewGenerator(std::string const& name); using CreateGeneratorCall = cmCPackGenerator*(); - void RegisterGenerator(const std::string& name, - const char* generatorDescription, + void RegisterGenerator(std::string const& name, + char const* generatorDescription, CreateGeneratorCall* createGenerator); void SetLogger(cmCPackLog* logger) { this->Logger = logger; } using DescriptionsMap = std::map; - const DescriptionsMap& GetGeneratorsList() const + DescriptionsMap const& GetGeneratorsList() const { return this->GeneratorDescriptions; } diff --git a/Source/CPack/cmCPackInnoSetupGenerator.cxx b/Source/CPack/cmCPackInnoSetupGenerator.cxx index df99e15..19020fb 100644 --- a/Source/CPack/cmCPackInnoSetupGenerator.cxx +++ b/Source/CPack/cmCPackInnoSetupGenerator.cxx @@ -46,7 +46,7 @@ int cmCPackInnoSetupGenerator::InitializeInternal() #endif SetOptionIfNotSet("CPACK_INNOSETUP_EXECUTABLE", "ISCC"); - const std::string& isccPath = cmSystemTools::FindProgram( + std::string const& isccPath = cmSystemTools::FindProgram( GetOption("CPACK_INNOSETUP_EXECUTABLE"), path, false); if (isccPath.empty()) { @@ -58,7 +58,7 @@ int cmCPackInnoSetupGenerator::InitializeInternal() return 0; } - const std::string isccCmd = + std::string const isccCmd = cmStrCat(QuotePath(isccPath, PathType::Native), "/?"); cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Test Inno Setup version: " << isccCmd << std::endl); @@ -76,8 +76,8 @@ int cmCPackInnoSetupGenerator::InitializeInternal() return 0; } - const int isccVersion = atoi(vRex.match(1).c_str()); - const int minIsccVersion = 6; + int const isccVersion = atoi(vRex.match(1).c_str()); + int const minIsccVersion = 6; cmCPackLogger(cmCPackLog::LOG_DEBUG, "Inno Setup Version: " << isccVersion << std::endl); @@ -98,8 +98,8 @@ int cmCPackInnoSetupGenerator::PackageFiles() { // Includes if (cmValue v = GetOptionIfSet("CPACK_INNOSETUP_EXTRA_SCRIPTS")) { - const cmList extraScripts(*v); - for (const std::string& i : extraScripts) { + cmList const extraScripts(*v); + for (std::string const& i : extraScripts) { includeDirectives.emplace_back(cmStrCat( "#include ", QuotePath(cmSystemTools::CollapseFullPath(i, toplevel)))); } @@ -107,7 +107,7 @@ int cmCPackInnoSetupGenerator::PackageFiles() // [Languages] section SetOptionIfNotSet("CPACK_INNOSETUP_LANGUAGES", "english"); - const cmList languages(GetOption("CPACK_INNOSETUP_LANGUAGES")); + cmList const languages(GetOption("CPACK_INNOSETUP_LANGUAGES")); for (std::string i : languages) { cmCPackInnoSetupKeyValuePairs params; @@ -133,8 +133,8 @@ int cmCPackInnoSetupGenerator::PackageFiles() // [Code] section if (cmValue v = GetOptionIfSet("CPACK_INNOSETUP_CODE_FILES")) { - const cmList codeFiles(*v); - for (const std::string& i : codeFiles) { + cmList const codeFiles(*v); + for (std::string const& i : codeFiles) { codeIncludes.emplace_back(cmStrCat( "#include ", QuotePath(cmSystemTools::CollapseFullPath(i, toplevel)))); } @@ -288,9 +288,9 @@ bool cmCPackInnoSetupGenerator::ProcessSetupSection() * Handle custom directives (they have higher priority than other variables, * so they have to be processed after all other variables) */ - for (const std::string& i : GetOptions()) { + for (std::string const& i : GetOptions()) { if (cmHasPrefix(i, "CPACK_INNOSETUP_SETUP_")) { - const std::string& directive = + std::string const& directive = i.substr(cmStrLen("CPACK_INNOSETUP_SETUP_")); setupDirectives[directive] = GetOption(i); } @@ -304,7 +304,7 @@ bool cmCPackInnoSetupGenerator::ProcessFiles() std::map customFileInstructions; if (cmValue v = GetOptionIfSet("CPACK_INNOSETUP_CUSTOM_INSTALL_INSTRUCTIONS")) { - const cmList instructions(*v); + cmList const instructions(*v); if (instructions.size() % 2 != 0) { cmCPackLogger(cmCPackLog::LOG_ERROR, "CPACK_INNOSETUP_CUSTOM_INSTALL_INSTRUCTIONS should " @@ -314,18 +314,18 @@ bool cmCPackInnoSetupGenerator::ProcessFiles() } for (auto it = instructions.begin(); it != instructions.end(); ++it) { - const std::string& key = + std::string const& key = QuotePath(cmSystemTools::CollapseFullPath(*it, toplevel)); customFileInstructions[key] = *(++it); } } - const std::string& iconsPrefix = + std::string const& iconsPrefix = toplevelProgramFolder ? "{autoprograms}\\" : "{group}\\"; std::map icons; if (cmValue v = GetOptionIfSet("CPACK_PACKAGE_EXECUTABLES")) { - const cmList executables(*v); + cmList const executables(*v); if (executables.size() % 2 != 0) { cmCPackLogger(cmCPackLog::LOG_ERROR, "CPACK_PACKAGE_EXECUTABLES should should contain pairs of " @@ -335,7 +335,7 @@ bool cmCPackInnoSetupGenerator::ProcessFiles() } for (auto it = executables.begin(); it != executables.end(); ++it) { - const std::string& key = *it; + std::string const& key = *it; icons[key] = *(++it); } } @@ -350,7 +350,7 @@ bool cmCPackInnoSetupGenerator::ProcessFiles() cmExpandList(*v, runExecutables); } - for (const std::string& i : files) { + for (std::string const& i : files) { cmCPackInnoSetupKeyValuePairs params; std::string toplevelDirectory; @@ -358,12 +358,12 @@ bool cmCPackInnoSetupGenerator::ProcessFiles() cmCPackComponent* component = nullptr; std::string componentParam; if (!Components.empty()) { - const std::string& fileName = cmSystemTools::RelativePath(toplevel, i); - const std::string::size_type pos = fileName.find('/'); + std::string const& fileName = cmSystemTools::RelativePath(toplevel, i); + std::string::size_type const pos = fileName.find('/'); // Use the custom component install directory if we have one if (pos != std::string::npos) { - const std::string& componentName = fileName.substr(0, pos); + std::string const& componentName = fileName.substr(0, pos); component = &Components[componentName]; toplevelDirectory = @@ -420,10 +420,10 @@ bool cmCPackInnoSetupGenerator::ProcessFiles() params["DestDir"] = QuotePath(destDir); if (component && component->IsDownloaded) { - const std::string& archiveName = + std::string const& archiveName = cmSystemTools::GetFilenameWithoutLastExtension( component->ArchiveFile); - const std::string& relativePath = + std::string const& relativePath = cmSystemTools::RelativePath(toplevelDirectory, i); params["Source"] = @@ -444,9 +444,9 @@ bool cmCPackInnoSetupGenerator::ProcessFiles() fileInstructions.push_back(ISKeyValueLine(params)); // Icon - const std::string& name = + std::string const& name = cmSystemTools::GetFilenameWithoutLastExtension(i); - const std::string& extension = + std::string const& extension = cmSystemTools::GetFilenameLastExtension(i); if ((extension == ".exe" || extension == ".com") && // only .exe, .com icons.count(name)) { @@ -504,7 +504,7 @@ bool cmCPackInnoSetupGenerator::ProcessFiles() "^(mailto:|(ftps?|https?|news)://).*$"); if (cmValue v = GetOptionIfSet("CPACK_INNOSETUP_MENU_LINKS")) { - const cmList menuIcons(*v); + cmList const menuIcons(*v); if (menuIcons.size() % 2 != 0) { cmCPackLogger(cmCPackLog::LOG_ERROR, "CPACK_INNOSETUP_MENU_LINKS should " @@ -514,8 +514,8 @@ bool cmCPackInnoSetupGenerator::ProcessFiles() } for (auto it = menuIcons.begin(); it != menuIcons.end(); ++it) { - const std::string& target = *it; - const std::string& label = *(++it); + std::string const& target = *it; + std::string const& label = *(++it); cmCPackInnoSetupKeyValuePairs params; params["Name"] = QuotePath(cmStrCat(iconsPrefix, label)); @@ -524,7 +524,7 @@ bool cmCPackInnoSetupGenerator::ProcessFiles() } else { std::string dir = "{app}"; std::string componentName; - for (const auto& i : Components) { + for (auto const& i : Components) { if (cmSystemTools::FileExists(cmSystemTools::CollapseFullPath( cmStrCat(i.second.Name, '\\', target), toplevel))) { dir = CustomComponentInstallDirectory(&i.second); @@ -684,10 +684,10 @@ bool cmCPackInnoSetupGenerator::ProcessComponents() } SetOptionIfNotSet("CPACK_INNOSETUP_VERIFY_DOWNLOADS", "ON"); - const bool verifyDownloads = + bool const verifyDownloads = GetOption("CPACK_INNOSETUP_VERIFY_DOWNLOADS").IsOn(); - const std::string& urlPrefix = + std::string const& urlPrefix = cmHasSuffix(GetOption("CPACK_DOWNLOAD_SITE").GetCStr(), '/') ? GetOption("CPACK_DOWNLOAD_SITE") : cmStrCat(GetOption("CPACK_DOWNLOAD_SITE"), '/'); @@ -722,7 +722,7 @@ bool cmCPackInnoSetupGenerator::ProcessComponents() SetOption("CPACK_INNOSETUP_DOWNLOAD_COMPONENTS_INTERNAL", cmJoin(archiveComponents, ", ")); - static const std::string& downloadLines = + static std::string const& downloadLines = "#define protected CPackDownloadCount " "@CPACK_INNOSETUP_DOWNLOAD_COUNT_INTERNAL@\n" "#dim protected CPackDownloadUrls[CPackDownloadCount] " @@ -742,7 +742,7 @@ bool cmCPackInnoSetupGenerator::ProcessComponents() } // Add the required script - const std::string& componentsScriptTemplate = + std::string const& componentsScriptTemplate = FindTemplate("ISComponents.pas"); if (componentsScriptTemplate.empty()) { cmCPackLogger(cmCPackLog::LOG_ERROR, @@ -759,8 +759,8 @@ bool cmCPackInnoSetupGenerator::ProcessComponents() bool cmCPackInnoSetupGenerator::ConfigureISScript() { - const std::string& isScriptTemplate = FindTemplate("ISScript.template.in"); - const std::string& isScriptFile = + std::string const& isScriptTemplate = FindTemplate("ISScript.template.in"); + std::string const& isScriptFile = cmStrCat(GetOption("CPACK_TOPLEVEL_DIRECTORY"), "/ISScript.iss"); if (isScriptTemplate.empty()) { @@ -772,12 +772,12 @@ bool cmCPackInnoSetupGenerator::ConfigureISScript() // Create internal variables std::vector setupSection; - for (const auto& i : setupDirectives) { + for (auto const& i : setupDirectives) { setupSection.emplace_back(cmStrCat(i.first, '=', TranslateBool(i.second))); } // Also create comments if the sections are empty - const std::string& defaultMessage = + std::string const& defaultMessage = "; CPack didn't find any entries for this section"; if (!IsSetToEmpty("CPACK_CREATE_DESKTOP_LINKS")) { @@ -837,28 +837,28 @@ bool cmCPackInnoSetupGenerator::ConfigureISScript() bool cmCPackInnoSetupGenerator::Compile() { - const std::string& isScriptFile = + std::string const& isScriptFile = cmStrCat(GetOption("CPACK_TOPLEVEL_DIRECTORY"), "/ISScript.iss"); - const std::string& isccLogFile = + std::string const& isccLogFile = cmStrCat(GetOption("CPACK_TOPLEVEL_DIRECTORY"), "/ISCCOutput.log"); std::vector isccArgs; // Custom defines - for (const std::string& i : GetOptions()) { + for (std::string const& i : GetOptions()) { if (cmHasPrefix(i, "CPACK_INNOSETUP_DEFINE_")) { - const std::string& name = i.substr(cmStrLen("CPACK_INNOSETUP_DEFINE_")); + std::string const& name = i.substr(cmStrLen("CPACK_INNOSETUP_DEFINE_")); isccArgs.push_back( cmStrCat("\"/D", name, '=', TranslateBool(GetOption(i)), '"')); } } if (cmValue v = GetOptionIfSet("CPACK_INNOSETUP_EXECUTABLE_ARGUMENTS")) { - const cmList args(*v); + cmList const args(*v); isccArgs.insert(isccArgs.end(), args.begin(), args.end()); } - const std::string& isccCmd = + std::string const& isccCmd = cmStrCat(QuotePath(GetOption("CPACK_INSTALLER_PROGRAM"), PathType::Native), ' ', cmJoin(isccArgs, " "), ' ', QuotePath(isScriptFile)); @@ -866,7 +866,7 @@ bool cmCPackInnoSetupGenerator::Compile() std::string output; int retVal = 1; - const bool res = cmSystemTools::RunSingleCommand( + bool const res = cmSystemTools::RunSingleCommand( isccCmd, &output, &output, &retVal, nullptr, this->GeneratorVerbose, cmDuration::zero()); @@ -885,11 +885,11 @@ bool cmCPackInnoSetupGenerator::Compile() } bool cmCPackInnoSetupGenerator::BuildDownloadedComponentArchive( - cmCPackComponent* component, const std::string& uploadDirectory, + cmCPackComponent* component, std::string const& uploadDirectory, std::string* hash) { // Remove the old archive, if one exists - const std::string& archiveFile = + std::string const& archiveFile = uploadDirectory + '/' + component->ArchiveFile; cmCPackLogger(cmCPackLog::LOG_OUTPUT, "- Building downloaded component archive: " << archiveFile @@ -922,16 +922,16 @@ bool cmCPackInnoSetupGenerator::BuildDownloadedComponentArchive( } // The directory where this component's files reside - const std::string& dirName = + std::string const& dirName = cmStrCat(GetOption("CPACK_TEMPORARY_DIRECTORY"), '/', component->Name); // Build the list of files to go into this archive - const std::string& zipListFileName = + std::string const& zipListFileName = cmStrCat(GetOption("CPACK_TEMPORARY_DIRECTORY"), "/winZip.filelist"); - const bool needQuotesInFile = GetOption("CPACK_ZIP_NEED_QUOTES").IsOn(); + bool const needQuotesInFile = GetOption("CPACK_ZIP_NEED_QUOTES").IsOn(); { // the scope is needed for cmGeneratedFileStream cmGeneratedFileStream out(zipListFileName); - for (const std::string& i : component->Files) { + for (std::string const& i : component->Files) { out << (needQuotesInFile ? Quote(i) : i) << std::endl; } } @@ -943,7 +943,7 @@ bool cmCPackInnoSetupGenerator::BuildDownloadedComponentArchive( zipListFileName.c_str()); std::string output; int retVal = -1; - const bool res = cmSystemTools::RunSingleCommand( + bool const res = cmSystemTools::RunSingleCommand( cmd, &output, &output, &retVal, dirName.c_str(), this->GeneratorVerbose, cmDuration::zero()); if (!res || retVal) { @@ -967,12 +967,12 @@ bool cmCPackInnoSetupGenerator::BuildDownloadedComponentArchive( } #ifdef _WIN32 - const std::string& hashCmd = + std::string const& hashCmd = cmStrCat("certutil -hashfile ", QuotePath(archiveFile), " SHA256"); std::string hashOutput; int hashRetVal = -1; - const bool hashRes = cmSystemTools::RunSingleCommand( + bool const hashRes = cmSystemTools::RunSingleCommand( hashCmd, &hashOutput, &hashOutput, &hashRetVal, nullptr, this->GeneratorVerbose, cmDuration::zero()); if (!hashRes || hashRetVal) { @@ -993,7 +993,7 @@ bool cmCPackInnoSetupGenerator::BuildDownloadedComponentArchive( return true; } -cmValue cmCPackInnoSetupGenerator::RequireOption(const std::string& key) +cmValue cmCPackInnoSetupGenerator::RequireOption(std::string const& key) { cmValue value = GetOption(key); @@ -1006,7 +1006,7 @@ cmValue cmCPackInnoSetupGenerator::RequireOption(const std::string& key) } std::string cmCPackInnoSetupGenerator::CustomComponentInstallDirectory( - const cmCPackComponent* component) + cmCPackComponent const* component) { cmValue outputDir = GetOption( cmStrCat("CPACK_INNOSETUP_", component->Name, "_INSTALL_DIRECTORY")); @@ -1036,7 +1036,7 @@ std::string cmCPackInnoSetupGenerator::CustomComponentInstallDirectory( return "{app}"; } -std::string cmCPackInnoSetupGenerator::TranslateBool(const std::string& value) +std::string cmCPackInnoSetupGenerator::TranslateBool(std::string const& value) { if (value.empty()) { return value; @@ -1056,13 +1056,13 @@ std::string cmCPackInnoSetupGenerator::TranslateBool(const std::string& value) } std::string cmCPackInnoSetupGenerator::ISKeyValueLine( - const cmCPackInnoSetupKeyValuePairs& params) + cmCPackInnoSetupKeyValuePairs const& params) { /* * To simplify readability of the generated code, the keys are sorted. * Unknown keys are ignored to avoid errors during compilation. */ - static const char* const availableKeys[] = { + static char const* const availableKeys[] = { "Source", "DestDir", "Name", "Filename", "Description", "GroupDescription", "MessagesFile", "Types", "ExternalSize", "BeforeInstall", "Flags", "Components", @@ -1070,7 +1070,7 @@ std::string cmCPackInnoSetupGenerator::ISKeyValueLine( }; std::vector keys; - for (const char* i : availableKeys) { + for (char const* i : availableKeys) { if (params.count(i)) { keys.emplace_back(cmStrCat(i, ": ", params.at(i))); } @@ -1080,13 +1080,13 @@ std::string cmCPackInnoSetupGenerator::ISKeyValueLine( } std::string cmCPackInnoSetupGenerator::CreateRecursiveComponentPath( - cmCPackComponentGroup* group, const std::string& path) + cmCPackComponentGroup* group, std::string const& path) { if (!group) { return path; } - const std::string& newPath = + std::string const& newPath = path.empty() ? group->Name : cmStrCat(group->Name, '\\', path); return CreateRecursiveComponentPath(group->ParentGroup, newPath); } @@ -1114,7 +1114,7 @@ void cmCPackInnoSetupGenerator::CreateRecursiveComponentGroups( } } -std::string cmCPackInnoSetupGenerator::Quote(const std::string& string) +std::string cmCPackInnoSetupGenerator::Quote(std::string const& string) { if (cmHasPrefix(string, '"') && cmHasSuffix(string, '"')) { return Quote(string.substr(1, string.length() - 2)); @@ -1126,7 +1126,7 @@ std::string cmCPackInnoSetupGenerator::Quote(const std::string& string) return cmStrCat('"', nString, '"'); } -std::string cmCPackInnoSetupGenerator::QuotePath(const std::string& path, +std::string cmCPackInnoSetupGenerator::QuotePath(std::string const& path, PathType type) { #ifdef _WIN32 @@ -1140,7 +1140,7 @@ std::string cmCPackInnoSetupGenerator::QuotePath(const std::string& path, } std::string cmCPackInnoSetupGenerator::PrepareForConstant( - const std::string& string) + std::string const& string) { std::string nString = string; diff --git a/Source/CPack/cmCPackInnoSetupGenerator.h b/Source/CPack/cmCPackInnoSetupGenerator.h index e057e6c..fc79776 100644 --- a/Source/CPack/cmCPackInnoSetupGenerator.h +++ b/Source/CPack/cmCPackInnoSetupGenerator.h @@ -37,7 +37,7 @@ protected: int InitializeInternal() override; int PackageFiles() override; - inline const char* GetOutputExtension() override { return ".exe"; } + inline char const* GetOutputExtension() override { return ".exe"; } inline cmCPackGenerator::CPackSetDestdirSupport SupportsSetDestdir() const override @@ -63,22 +63,22 @@ private: bool Compile(); bool BuildDownloadedComponentArchive(cmCPackComponent* component, - const std::string& uploadDirectory, + std::string const& uploadDirectory, std::string* hash); /** * Returns the option's value or an empty string if the option isn't set. */ - cmValue RequireOption(const std::string& key); + cmValue RequireOption(std::string const& key); std::string CustomComponentInstallDirectory( - const cmCPackComponent* component); + cmCPackComponent const* component); /** * Translates boolean expressions into "yes" or "no", as required in * Inno Setup (only if "CPACK_INNOSETUP_USE_CMAKE_BOOL_FORMAT" is on). */ - std::string TranslateBool(const std::string& value); + std::string TranslateBool(std::string const& value); /** * Creates a typical line of key and value pairs using the given map. @@ -86,10 +86,10 @@ private: * (e.g.: Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; * GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked) */ - std::string ISKeyValueLine(const cmCPackInnoSetupKeyValuePairs& params); + std::string ISKeyValueLine(cmCPackInnoSetupKeyValuePairs const& params); std::string CreateRecursiveComponentPath(cmCPackComponentGroup* group, - const std::string& path = ""); + std::string const& path = ""); void CreateRecursiveComponentGroups(cmCPackComponentGroup* group); @@ -97,8 +97,8 @@ private: * These functions add quotes if the given value hasn't already quotes. * Paths are converted into the format used by Windows before. */ - std::string Quote(const std::string& string); - std::string QuotePath(const std::string& path, + std::string Quote(std::string const& string); + std::string QuotePath(std::string const& path, PathType type = PathType::Windows); /** @@ -106,7 +106,7 @@ private: * '|' '}' ',' '%' '"' * Required for Inno Setup constants like {cm:...} */ - std::string PrepareForConstant(const std::string& string); + std::string PrepareForConstant(std::string const& string); std::vector includeDirectives; cmCPackInnoSetupKeyValuePairs setupDirectives; diff --git a/Source/CPack/cmCPackLog.cxx b/Source/CPack/cmCPackLog.cxx index d37531b..812a694 100644 --- a/Source/CPack/cmCPackLog.cxx +++ b/Source/CPack/cmCPackLog.cxx @@ -23,7 +23,7 @@ void cmCPackLog::SetLogOutputStream(std::ostream* os) this->LogOutput = os; } -bool cmCPackLog::SetLogOutputFile(const char* fname) +bool cmCPackLog::SetLogOutputFile(char const* fname) { this->LogOutputStream.reset(); if (fname) { @@ -38,7 +38,7 @@ bool cmCPackLog::SetLogOutputFile(const char* fname) return this->LogOutput != nullptr; } -void cmCPackLog::Log(int tag, const char* file, int line, const char* msg, +void cmCPackLog::Log(int tag, char const* file, int line, char const* msg, size_t length) { // By default no logging diff --git a/Source/CPack/cmCPackLog.h b/Source/CPack/cmCPackLog.h index 347b0f7..d0f073d 100644 --- a/Source/CPack/cmCPackLog.h +++ b/Source/CPack/cmCPackLog.h @@ -26,8 +26,8 @@ public: cmCPackLog(); ~cmCPackLog(); - cmCPackLog(const cmCPackLog&) = delete; - cmCPackLog& operator=(const cmCPackLog&) = delete; + cmCPackLog(cmCPackLog const&) = delete; + cmCPackLog& operator=(cmCPackLog const&) = delete; enum cm_log_tags { @@ -40,19 +40,19 @@ public: }; //! Various signatures for logging. - void Log(const char* file, int line, const char* msg) + void Log(char const* file, int line, char const* msg) { this->Log(LOG_OUTPUT, file, line, msg); } - void Log(const char* file, int line, const char* msg, size_t length) + void Log(char const* file, int line, char const* msg, size_t length) { this->Log(LOG_OUTPUT, file, line, msg, length); } - void Log(int tag, const char* file, int line, const char* msg) + void Log(int tag, char const* file, int line, char const* msg) { this->Log(tag, file, line, msg, strlen(msg)); } - void Log(int tag, const char* file, int line, const char* msg, + void Log(int tag, char const* file, int line, char const* msg, size_t length); //! Set Verbose @@ -84,7 +84,7 @@ public: //! Set the log output file. The cmCPackLog will try to create file. If it // cannot, it will report an error. - bool SetLogOutputFile(const char* fname); + bool SetLogOutputFile(char const* fname); //! Set the various prefixes for the logging. SetPrefix sets the generic // prefix that overwrites missing ones. @@ -121,17 +121,17 @@ private: class cmCPackLogWrite { public: - cmCPackLogWrite(const char* data, size_t length) + cmCPackLogWrite(char const* data, size_t length) : Data(data) , Length(length) { } - const char* Data; + char const* Data; std::streamsize Length; }; -inline std::ostream& operator<<(std::ostream& os, const cmCPackLogWrite& c) +inline std::ostream& operator<<(std::ostream& os, cmCPackLogWrite const& c) { os.write(c.Data, c.Length); os.flush(); diff --git a/Source/CPack/cmCPackNSISGenerator.cxx b/Source/CPack/cmCPackNSISGenerator.cxx index fb0885f..9c0398c 100644 --- a/Source/CPack/cmCPackNSISGenerator.cxx +++ b/Source/CPack/cmCPackNSISGenerator.cxx @@ -67,7 +67,7 @@ int cmCPackNSISGenerator::PackageFiles() std::string outputDir = "$INSTDIR"; std::string fileN = cmSystemTools::RelativePath(this->toplevel, file); if (!this->Components.empty()) { - const std::string::size_type pos = fileN.find('/'); + std::string::size_type const pos = fileN.find('/'); // Use the custom component install directory if we have one if (pos != std::string::npos) { @@ -111,7 +111,7 @@ int cmCPackNSISGenerator::PackageFiles() } std::replace(fileN.begin(), fileN.end(), '/', '\\'); - const std::string componentOutputDir = + std::string const componentOutputDir = this->CustomComponentInstallDirectory(componentName); dstr << " RMDir \"" << componentOutputDir << "\\" << fileN << "\"" @@ -212,7 +212,7 @@ int cmCPackNSISGenerator::PackageFiles() if (cmValue wantedPosition = this->GetOptionIfSet("CPACK_NSIS_BRANDING_TEXT_TRIM_POSITION")) { if (!wantedPosition->empty()) { - const std::set possiblePositions{ "CENTER", "LEFT", + std::set const possiblePositions{ "CENTER", "LEFT", "RIGHT" }; if (possiblePositions.find(*wantedPosition) == possiblePositions.end()) { @@ -629,7 +629,7 @@ void cmCPackNSISGenerator::CreateMenuLinks(std::ostream& str, cmList::iterator it; for (it = cpackMenuLinksList.begin(); it != cpackMenuLinksList.end(); ++it) { std::string sourceName = *it; - const bool url = urlRegex.find(sourceName); + bool const url = urlRegex.find(sourceName); // Convert / to \ in filenames, but not in urls: // @@ -666,12 +666,12 @@ void cmCPackNSISGenerator::CreateMenuLinks(std::ostream& str, } bool cmCPackNSISGenerator::GetListOfSubdirectories( - const char* topdir, std::vector& dirs) + char const* topdir, std::vector& dirs) { cmsys::Directory dir; dir.Load(topdir); for (unsigned long i = 0; i < dir.GetNumberOfFiles(); ++i) { - const char* fileName = dir.GetFile(i); + char const* fileName = dir.GetFile(i); if (strcmp(fileName, ".") != 0 && strcmp(fileName, "..") != 0) { std::string const fullPath = std::string(topdir).append("/").append(fileName); @@ -727,7 +727,7 @@ std::string cmCPackNSISGenerator::CreateComponentDescription( componentCode += " SectionIn" + out.str() + "\n"; } - const std::string componentOutputDir = + std::string const componentOutputDir = this->CustomComponentInstallDirectory(component->Name); componentCode += cmStrCat(" SetOutPath \"", componentOutputDir, "\"\n"); diff --git a/Source/CPack/cmCPackNSISGenerator.h b/Source/CPack/cmCPackNSISGenerator.h index ded02de..b6bb2c7 100644 --- a/Source/CPack/cmCPackNSISGenerator.h +++ b/Source/CPack/cmCPackNSISGenerator.h @@ -41,10 +41,10 @@ protected: int InitializeInternal() override; void CreateMenuLinks(std::ostream& str, std::ostream& deleteStr); int PackageFiles() override; - const char* GetOutputExtension() override { return ".exe"; } - const char* GetOutputPostfix() override { return "win32"; } + char const* GetOutputExtension() override { return ".exe"; } + char const* GetOutputPostfix() override { return "win32"; } - bool GetListOfSubdirectories(const char* dir, + bool GetListOfSubdirectories(char const* dir, std::vector& dirs); enum cmCPackGenerator::CPackSetDestdirSupport SupportsSetDestdir() diff --git a/Source/CPack/cmCPackNuGetGenerator.cxx b/Source/CPack/cmCPackNuGetGenerator.cxx index 196aaf1..ec83268 100644 --- a/Source/CPack/cmCPackNuGetGenerator.cxx +++ b/Source/CPack/cmCPackNuGetGenerator.cxx @@ -129,8 +129,8 @@ void cmCPackNuGetGenerator::AddGeneratedPackageNames() return; } // add the generated packages to package file names list - const std::string& fileNames = *files_list; - const char sep = ';'; + std::string const& fileNames = *files_list; + char const sep = ';'; std::string::size_type pos1 = 0; std::string::size_type pos2 = fileNames.find(sep, pos1 + 1); while (pos2 != std::string::npos) { diff --git a/Source/CPack/cmCPackNuGetGenerator.h b/Source/CPack/cmCPackNuGetGenerator.h index 609ec79..f8deb8e 100644 --- a/Source/CPack/cmCPackNuGetGenerator.h +++ b/Source/CPack/cmCPackNuGetGenerator.h @@ -20,7 +20,7 @@ protected: bool SupportsComponentInstallation() const override; int PackageFiles() override; - const char* GetOutputExtension() override { return ".nupkg"; } + char const* GetOutputExtension() override { return ".nupkg"; } bool SupportsAbsoluteDestination() const override { return false; } /** * The method used to prepare variables when component diff --git a/Source/CPack/cmCPackPKGGenerator.cxx b/Source/CPack/cmCPackPKGGenerator.cxx index 6208195..cf21ae9 100644 --- a/Source/CPack/cmCPackPKGGenerator.cxx +++ b/Source/CPack/cmCPackPKGGenerator.cxx @@ -35,7 +35,7 @@ int cmCPackPKGGenerator::InitializeInternal() } std::string cmCPackPKGGenerator::GetPackageName( - const cmCPackComponent& component) + cmCPackComponent const& component) { if (component.ArchiveFile.empty()) { std::string packagesDir = @@ -48,8 +48,8 @@ std::string cmCPackPKGGenerator::GetPackageName( return cmStrCat(component.ArchiveFile, ".pkg"); } -void cmCPackPKGGenerator::CreateBackground(const char* themeName, - const char* metapackageFile, +void cmCPackPKGGenerator::CreateBackground(char const* themeName, + char const* metapackageFile, cm::string_view genName, cmXMLWriter& xout) { @@ -107,8 +107,8 @@ void cmCPackPKGGenerator::CreateBackground(const char* themeName, xout.EndElement(); } -void cmCPackPKGGenerator::WriteDistributionFile(const char* metapackageFile, - const char* genName) +void cmCPackPKGGenerator::WriteDistributionFile(char const* metapackageFile, + char const* genName) { std::string distributionTemplate = this->FindTemplate("CPack.distribution.dist.in"); @@ -206,7 +206,7 @@ void cmCPackPKGGenerator::WriteDistributionFile(const char* metapackageFile, } void cmCPackPKGGenerator::CreateChoiceOutline( - const cmCPackComponentGroup& group, cmXMLWriter& xout) + cmCPackComponentGroup const& group, cmXMLWriter& xout) { xout.StartElement("line"); xout.Attribute("choice", cmStrCat(group.Name, "Choice")); @@ -223,7 +223,7 @@ void cmCPackPKGGenerator::CreateChoiceOutline( xout.EndElement(); } -void cmCPackPKGGenerator::CreateChoice(const cmCPackComponentGroup& group, +void cmCPackPKGGenerator::CreateChoice(cmCPackComponentGroup const& group, cmXMLWriter& xout) { xout.StartElement("choice"); @@ -238,7 +238,7 @@ void cmCPackPKGGenerator::CreateChoice(const cmCPackComponentGroup& group, xout.EndElement(); } -void cmCPackPKGGenerator::CreateChoice(const cmCPackComponent& component, +void cmCPackPKGGenerator::CreateChoice(cmCPackComponent const& component, cmXMLWriter& xout) { std::string packageId; @@ -278,7 +278,7 @@ void cmCPackPKGGenerator::CreateChoice(const cmCPackComponent& component, // on (B and A), while selecting something that depends on C--either D // or E--will automatically cause C to get selected. std::ostringstream selected("my.choice.selected", std::ios_base::ate); - std::set visited; + std::set visited; AddDependencyAttributes(component, visited, selected); visited.clear(); AddReverseDependencyAttributes(component, visited, selected); @@ -350,8 +350,8 @@ void cmCPackPKGGenerator::CreateDomains(cmXMLWriter& xout) } void cmCPackPKGGenerator::AddDependencyAttributes( - const cmCPackComponent& component, - std::set& visited, std::ostringstream& out) + cmCPackComponent const& component, + std::set& visited, std::ostringstream& out) { if (visited.find(&component) != visited.end()) { return; @@ -365,8 +365,8 @@ void cmCPackPKGGenerator::AddDependencyAttributes( } void cmCPackPKGGenerator::AddReverseDependencyAttributes( - const cmCPackComponent& component, - std::set& visited, std::ostringstream& out) + cmCPackComponent const& component, + std::set& visited, std::ostringstream& out) { if (visited.find(&component) != visited.end()) { return; @@ -379,8 +379,8 @@ void cmCPackPKGGenerator::AddReverseDependencyAttributes( } } -bool cmCPackPKGGenerator::CopyCreateResourceFile(const std::string& name, - const std::string& dirName) +bool cmCPackPKGGenerator::CopyCreateResourceFile(std::string const& name, + std::string const& dirName) { std::string uname = cmSystemTools::UpperCase(name); std::string cpackVar = cmStrCat("CPACK_RESOURCE_FILE_", uname); @@ -426,8 +426,8 @@ bool cmCPackPKGGenerator::CopyCreateResourceFile(const std::string& name, return true; } -bool cmCPackPKGGenerator::CopyResourcePlistFile(const std::string& name, - const char* outName) +bool cmCPackPKGGenerator::CopyResourcePlistFile(std::string const& name, + char const* outName) { if (!outName) { outName = name.c_str(); @@ -451,9 +451,9 @@ bool cmCPackPKGGenerator::CopyResourcePlistFile(const std::string& name, return true; } -int cmCPackPKGGenerator::CopyInstallScript(const std::string& resdir, - const std::string& script, - const std::string& name) +int cmCPackPKGGenerator::CopyInstallScript(std::string const& resdir, + std::string const& script, + std::string const& name) { std::string dst = cmStrCat(resdir, '/', name); cmSystemTools::CopyFileAlways(script, dst); diff --git a/Source/CPack/cmCPackPKGGenerator.h b/Source/CPack/cmCPackPKGGenerator.h index 256b334..603f6cc 100644 --- a/Source/CPack/cmCPackPKGGenerator.h +++ b/Source/CPack/cmCPackPKGGenerator.h @@ -34,61 +34,61 @@ public: protected: int InitializeInternal() override; - const char* GetOutputPostfix() override { return "darwin"; } + char const* GetOutputPostfix() override { return "darwin"; } // Copies or creates the resource file with the given name to the // package or package staging directory dirName. The variable // CPACK_RESOURCE_FILE_${NAME} (where ${NAME} is the uppercased // version of name) specifies the input file to use for this file, // which will be configured via ConfigureFile. - bool CopyCreateResourceFile(const std::string& name, - const std::string& dirName); - bool CopyResourcePlistFile(const std::string& name, - const char* outName = nullptr); + bool CopyCreateResourceFile(std::string const& name, + std::string const& dirName); + bool CopyResourcePlistFile(std::string const& name, + char const* outName = nullptr); - int CopyInstallScript(const std::string& resdir, const std::string& script, - const std::string& name); + int CopyInstallScript(std::string const& resdir, std::string const& script, + std::string const& name); // Retrieve the name of package file that will be generated for this // component. The name is just the file name with extension, and // does not include the subdirectory. - std::string GetPackageName(const cmCPackComponent& component); + std::string GetPackageName(cmCPackComponent const& component); // Writes a distribution.dist file, which turns a metapackage into a // full-fledged distribution. This file is used to describe // inter-component dependencies. metapackageFile is the name of the // metapackage for the distribution. Only valid for a // component-based install. - void WriteDistributionFile(const char* metapackageFile, const char* genName); + void WriteDistributionFile(char const* metapackageFile, char const* genName); // Subroutine of WriteDistributionFile that writes out the // dependency attributes for inter-component dependencies. - void AddDependencyAttributes(const cmCPackComponent& component, - std::set& visited, + void AddDependencyAttributes(cmCPackComponent const& component, + std::set& visited, std::ostringstream& out); // Subroutine of WriteDistributionFile that writes out the // reverse dependency attributes for inter-component dependencies. void AddReverseDependencyAttributes( - const cmCPackComponent& component, - std::set& visited, std::ostringstream& out); + cmCPackComponent const& component, + std::set& visited, std::ostringstream& out); // Generates XML that encodes the hierarchy of component groups and // their components in a form that can be used by distribution // metapackages. - void CreateChoiceOutline(const cmCPackComponentGroup& group, + void CreateChoiceOutline(cmCPackComponentGroup const& group, cmXMLWriter& xout); /// Create the "choice" XML element to describe a component group /// for the installer GUI. - void CreateChoice(const cmCPackComponentGroup& group, cmXMLWriter& xout); + void CreateChoice(cmCPackComponentGroup const& group, cmXMLWriter& xout); /// Create the "choice" XML element to describe a component for the /// installer GUI. - void CreateChoice(const cmCPackComponent& component, cmXMLWriter& xout); + void CreateChoice(cmCPackComponent const& component, cmXMLWriter& xout); /// Creates a background in the distribution XML. - void CreateBackground(const char* themeName, const char* metapackageFile, + void CreateBackground(char const* themeName, char const* metapackageFile, cm::string_view genName, cmXMLWriter& xout); /// Create the "domains" XML element to indicate where the product can diff --git a/Source/CPack/cmCPackProductBuildGenerator.cxx b/Source/CPack/cmCPackProductBuildGenerator.cxx index b5b70dc..5d57e2f 100644 --- a/Source/CPack/cmCPackProductBuildGenerator.cxx +++ b/Source/CPack/cmCPackProductBuildGenerator.cxx @@ -148,7 +148,7 @@ int cmCPackProductBuildGenerator::InitializeInternal() return this->Superclass::InitializeInternal(); } -bool cmCPackProductBuildGenerator::RunProductBuild(const std::string& command) +bool cmCPackProductBuildGenerator::RunProductBuild(std::string const& command) { std::string tmpFile = cmStrCat(this->GetOption("CPACK_TOPLEVEL_DIRECTORY"), "/ProductBuildOutput.log"); @@ -175,8 +175,8 @@ bool cmCPackProductBuildGenerator::RunProductBuild(const std::string& command) } bool cmCPackProductBuildGenerator::GenerateComponentPackage( - const std::string& packageFileDir, const std::string& packageFileName, - const std::string& packageDir, const cmCPackComponent* component) + std::string const& packageFileDir, std::string const& packageFileName, + std::string const& packageDir, cmCPackComponent const* component) { std::string packageFile = cmStrCat(packageFileDir, '/', packageFileName); @@ -184,7 +184,7 @@ bool cmCPackProductBuildGenerator::GenerateComponentPackage( "- Building component package: " << packageFile << std::endl); - const char* comp_name = component ? component->Name.c_str() : nullptr; + char const* comp_name = component ? component->Name.c_str() : nullptr; cmValue preflight = this->GetComponentScript("PREFLIGHT", comp_name); cmValue postflight = this->GetComponentScript("POSTFLIGHT", comp_name); @@ -267,7 +267,7 @@ bool cmCPackProductBuildGenerator::GenerateComponentPackage( } cmValue cmCPackProductBuildGenerator::GetComponentScript( - const char* script, const char* component_name) + char const* script, char const* component_name) { std::string scriptname = cmStrCat("CPACK_", script, '_'); if (component_name) { diff --git a/Source/CPack/cmCPackProductBuildGenerator.h b/Source/CPack/cmCPackProductBuildGenerator.h index 31cfafa..6462cf5 100644 --- a/Source/CPack/cmCPackProductBuildGenerator.h +++ b/Source/CPack/cmCPackProductBuildGenerator.h @@ -30,21 +30,21 @@ public: protected: int InitializeInternal() override; int PackageFiles() override; - const char* GetOutputExtension() override { return ".pkg"; } + char const* GetOutputExtension() override { return ".pkg"; } // Run ProductBuild with the given command line, which will (if // successful) produce the given package file. Returns true if // ProductBuild succeeds, false otherwise. - bool RunProductBuild(const std::string& command); + bool RunProductBuild(std::string const& command); // Generate a package in the file packageFile for the given // component. All of the files within this component are stored in // the directory packageDir. Returns true if successful, false // otherwise. - bool GenerateComponentPackage(const std::string& packageFileDir, - const std::string& packageFileName, - const std::string& packageDir, - const cmCPackComponent* component); + bool GenerateComponentPackage(std::string const& packageFileDir, + std::string const& packageFileName, + std::string const& packageDir, + cmCPackComponent const* component); - cmValue GetComponentScript(const char* script, const char* script_component); + cmValue GetComponentScript(char const* script, char const* script_component); }; diff --git a/Source/CPack/cmCPackRPMGenerator.cxx b/Source/CPack/cmCPackRPMGenerator.cxx index a4f4dac..d998770 100644 --- a/Source/CPack/cmCPackRPMGenerator.cxx +++ b/Source/CPack/cmCPackRPMGenerator.cxx @@ -49,7 +49,7 @@ void cmCPackRPMGenerator::AddGeneratedPackageNames() { // add the generated packages to package file names list std::string fileNames(this->GetOption("GEN_CPACK_OUTPUT_FILES")); - const char sep = ';'; + char const sep = ';'; std::string::size_type pos1 = 0; std::string::size_type pos2 = fileNames.find(sep, pos1 + 1); while (pos2 != std::string::npos) { @@ -107,7 +107,7 @@ int cmCPackRPMGenerator::PackageOnePack(std::string const& initialToplevel, } std::string cmCPackRPMGenerator::GetSanitizedDirOrFileName( - const std::string& name, bool isFullName) const + std::string const& name, bool isFullName) const { auto sanitizedName = this->cmCPackGenerator::GetSanitizedDirOrFileName(name, isFullName); @@ -363,7 +363,7 @@ int cmCPackRPMGenerator::PackageComponents(bool ignoreGroup) } int cmCPackRPMGenerator::PackageComponentsAllInOne( - const std::string& compInstDirName) + std::string const& compInstDirName) { int retval = 1; /* Reset package file name list it will be populated during the @@ -445,7 +445,7 @@ bool cmCPackRPMGenerator::SupportsComponentInstallation() const } std::string cmCPackRPMGenerator::GetComponentInstallSuffix( - const std::string& componentName) + std::string const& componentName) { if (this->componentPackageMethod == ONE_PACKAGE_PER_COMPONENT) { return componentName; @@ -465,7 +465,7 @@ std::string cmCPackRPMGenerator::GetComponentInstallSuffix( } std::string cmCPackRPMGenerator::GetComponentInstallDirNameSuffix( - const std::string& componentName) + std::string const& componentName) { return this->GetSanitizedDirOrFileName( this->GetComponentInstallSuffix(componentName)); diff --git a/Source/CPack/cmCPackRPMGenerator.h b/Source/CPack/cmCPackRPMGenerator.h index 0e23503..dde36cf 100644 --- a/Source/CPack/cmCPackRPMGenerator.h +++ b/Source/CPack/cmCPackRPMGenerator.h @@ -59,15 +59,15 @@ protected: * Special case of component install where all * components will be put in a single installer. */ - int PackageComponentsAllInOne(const std::string& compInstDirName); - const char* GetOutputExtension() override { return ".rpm"; } - std::string GetSanitizedDirOrFileName(const std::string& name, + int PackageComponentsAllInOne(std::string const& compInstDirName); + char const* GetOutputExtension() override { return ".rpm"; } + std::string GetSanitizedDirOrFileName(std::string const& name, bool isFullName = true) const override; bool SupportsComponentInstallation() const override; std::string GetComponentInstallSuffix( - const std::string& componentName) override; + std::string const& componentName) override; std::string GetComponentInstallDirNameSuffix( - const std::string& componentName) override; + std::string const& componentName) override; void AddGeneratedPackageNames(); }; diff --git a/Source/CPack/cmCPackSTGZGenerator.cxx b/Source/CPack/cmCPackSTGZGenerator.cxx index 2673fee..6c83b59 100644 --- a/Source/CPack/cmCPackSTGZGenerator.cxx +++ b/Source/CPack/cmCPackSTGZGenerator.cxx @@ -81,7 +81,7 @@ int cmCPackSTGZGenerator::GenerateHeader(std::ostream* os) } this->SetOptionIfNotSet("CPACK_RESOURCE_FILE_LICENSE_CONTENT", licenseText); - const char headerLengthTag[] = "###CPACK_HEADER_LENGTH###"; + char const headerLengthTag[] = "###CPACK_HEADER_LENGTH###"; // Create the header std::string inFile = this->GetOption("CPACK_STGZ_HEADER_FILE"); @@ -96,7 +96,7 @@ int cmCPackSTGZGenerator::GenerateHeader(std::ostream* os) this->ConfigureString(packageHeaderText, res); // Count the lines - const char* ptr = res.c_str(); + char const* ptr = res.c_str(); while (*ptr) { if (*ptr == '\n') { counter++; diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx index 9979dfa..f688b52 100644 --- a/Source/CPack/cpack.cxx +++ b/Source/CPack/cpack.cxx @@ -39,14 +39,14 @@ #include "cmake.h" namespace { -const cmDocumentationEntry cmDocumentationName = { +cmDocumentationEntry const cmDocumentationName = { {}, " cpack - Packaging driver provided by CMake." }; -const cmDocumentationEntry cmDocumentationUsage = { {}, " cpack [options]" }; +cmDocumentationEntry const cmDocumentationUsage = { {}, " cpack [options]" }; -const cmDocumentationEntry cmDocumentationOptions[14] = { +cmDocumentationEntry const cmDocumentationOptions[14] = { { "-G ", "Override/define CPACK_GENERATOR" }, { "-C ", "Specify the project configuration" }, { "-D =", "Set a CPack variable." }, @@ -63,22 +63,22 @@ const cmDocumentationEntry cmDocumentationOptions[14] = { { "--list-presets", "List available package presets" } }; -void cpackProgressCallback(const std::string& message, float /*unused*/) +void cpackProgressCallback(std::string const& message, float /*unused*/) { std::cout << "-- " << message << '\n'; } std::vector makeGeneratorDocs( - const cmCPackGeneratorFactory& gf) + cmCPackGeneratorFactory const& gf) { - const auto& generators = gf.GetGeneratorsList(); + auto const& generators = gf.GetGeneratorsList(); std::vector docs; docs.reserve(generators.size()); std::transform( generators.cbegin(), generators.cend(), std::back_inserter(docs), - [](const std::decay::type::value_type& gen) { + [](std::decay::type::value_type const& gen) { return cmDocumentationEntry{ gen.first, gen.second }; }); return docs; @@ -139,27 +139,27 @@ int main(int argc, char const* const* argv) std::map definitions; - auto const verboseLambda = [&log](const std::string&, cmake*, + auto const verboseLambda = [&log](std::string const&, cmake*, cmMakefile*) -> bool { log.SetVerbose(true); cmCPack_Log(&log, cmCPackLog::LOG_OUTPUT, "Enable Verbose\n"); return true; }; - auto const debugLambda = [&log](const std::string&, cmake*, + auto const debugLambda = [&log](std::string const&, cmake*, cmMakefile*) -> bool { log.SetDebug(true); cmCPack_Log(&log, cmCPackLog::LOG_OUTPUT, "Enable Debug\n"); return true; }; - auto const traceLambda = [](const std::string&, cmake* state, + auto const traceLambda = [](std::string const&, cmake* state, cmMakefile*) -> bool { state->SetTrace(true); return true; }; - auto const traceExpandLambda = [](const std::string&, cmake* state, + auto const traceExpandLambda = [](std::string const&, cmake* state, cmMakefile*) -> bool { state->SetTrace(true); state->SetTraceExpand(true); @@ -209,7 +209,7 @@ int main(int argc, char const* const* argv) CommandArgument::setToTrue(listPresets) }, CommandArgument{ "-D", CommandArgument::Values::One, CommandArgument::RequiresSeparator::No, - [&log, &definitions](const std::string& arg, cmake*, + [&log, &definitions](std::string const& arg, cmake*, cmMakefile*) -> bool { std::string value = arg; size_t pos = value.find_first_of('='); @@ -255,12 +255,12 @@ int main(int argc, char const* const* argv) // Set up presets if (!preset.empty() || listPresets) { - const auto workingDirectory = cmSystemTools::GetLogicalWorkingDirectory(); + auto const workingDirectory = cmSystemTools::GetLogicalWorkingDirectory(); auto const presetGeneratorsPresent = - [&generators](const cmCMakePresetsGraph::PackagePreset& p) { + [&generators](cmCMakePresetsGraph::PackagePreset const& p) { return std::all_of(p.Generators.begin(), p.Generators.end(), - [&generators](const std::string& gen) { + [&generators](std::string const& gen) { return generators.GetGeneratorsList().count( gen) != 0; }); diff --git a/Source/CTest/cmCTestBZR.cxx b/Source/CTest/cmCTestBZR.cxx index acbc98e..d5a14cf 100644 --- a/Source/CTest/cmCTestBZR.cxx +++ b/Source/CTest/cmCTestBZR.cxx @@ -21,10 +21,10 @@ #include "cmXMLParser.h" static int cmBZRXMLParserUnknownEncodingHandler(void* /*unused*/, - const XML_Char* name, + XML_Char const* name, XML_Encoding* info) { - static const int latin1[] = { + static int const latin1[] = { 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, @@ -86,7 +86,7 @@ cmCTestBZR::~cmCTestBZR() = default; class cmCTestBZR::InfoParser : public cmCTestVC::LineParser { public: - InfoParser(cmCTestBZR* bzr, const char* prefix) + InfoParser(cmCTestBZR* bzr, char const* prefix) : BZR(bzr) { this->SetLog(&bzr->Log, prefix); @@ -114,7 +114,7 @@ private: class cmCTestBZR::RevnoParser : public cmCTestVC::LineParser { public: - RevnoParser(cmCTestBZR* bzr, const char* prefix, std::string& rev) + RevnoParser(cmCTestBZR* bzr, char const* prefix, std::string& rev) : Rev(rev) { this->SetLog(&bzr->Log, prefix); @@ -179,7 +179,7 @@ class cmCTestBZR::LogParser , private cmXMLParser { public: - LogParser(cmCTestBZR* bzr, const char* prefix) + LogParser(cmCTestBZR* bzr, char const* prefix) : OutputLogger(bzr->Log, prefix) , BZR(bzr) , EmailRegex("(.*) <([A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+)>") @@ -211,14 +211,14 @@ private: cmsys::RegularExpression EmailRegex; - bool ProcessChunk(const char* data, int length) override + bool ProcessChunk(char const* data, int length) override { this->OutputLogger::ProcessChunk(data, length); this->ParseChunk(data, length); return true; } - void StartElement(const std::string& name, const char** /*atts*/) override + void StartElement(std::string const& name, char const** /*atts*/) override { this->CData.clear(); if (name == "log") { @@ -243,12 +243,12 @@ private: } } - void CharacterDataHandler(const char* data, int length) override + void CharacterDataHandler(char const* data, int length) override { cm::append(this->CData, data, data + length); } - void EndElement(const std::string& name) override + void EndElement(std::string const& name) override { if (name == "log") { this->BZR->DoRevision(this->Rev, this->Changes); @@ -278,7 +278,7 @@ private: this->CData.clear(); } - void ReportError(int /*line*/, int /*column*/, const char* msg) override + void ReportError(int /*line*/, int /*column*/, char const* msg) override { this->BZR->Log << "Error parsing bzr log xml: " << msg << "\n"; } @@ -287,7 +287,7 @@ private: class cmCTestBZR::UpdateParser : public cmCTestVC::LineParser { public: - UpdateParser(cmCTestBZR* bzr, const char* prefix) + UpdateParser(cmCTestBZR* bzr, char const* prefix) : BZR(bzr) { this->SetLog(&bzr->Log, prefix); @@ -298,12 +298,12 @@ private: cmCTestBZR* BZR; cmsys::RegularExpression RegexUpdate; - bool ProcessChunk(const char* first, int length) override + bool ProcessChunk(char const* first, int length) override { bool last_is_new_line = (*first == '\r' || *first == '\n'); - const char* const last = first + length; - for (const char* c = first; c != last; ++c) { + char const* const last = first + length; + for (char const* c = first; c != last; ++c) { if (*c == '\r' || *c == '\n') { if (!last_is_new_line) { // Log this line. @@ -346,8 +346,8 @@ private: } cmSystemTools::ConvertToUnixSlashes(path); - const std::string dir = cmSystemTools::GetFilenamePath(path); - const std::string name = cmSystemTools::GetFilenameName(path); + std::string const dir = cmSystemTools::GetFilenamePath(path); + std::string const name = cmSystemTools::GetFilenameName(path); if (c0 == 'C') { this->BZR->Dirs[dir][name].Status = PathConflicting; @@ -420,7 +420,7 @@ bool cmCTestBZR::LoadRevisions() class cmCTestBZR::StatusParser : public cmCTestVC::LineParser { public: - StatusParser(cmCTestBZR* bzr, const char* prefix) + StatusParser(cmCTestBZR* bzr, char const* prefix) : BZR(bzr) { this->SetLog(&bzr->Log, prefix); diff --git a/Source/CTest/cmCTestBinPacker.cxx b/Source/CTest/cmCTestBinPacker.cxx index 6eb45fa..1166e54 100644 --- a/Source/CTest/cmCTestBinPacker.cxx +++ b/Source/CTest/cmCTestBinPacker.cxx @@ -6,14 +6,14 @@ #include bool cmCTestBinPackerAllocation::operator==( - const cmCTestBinPackerAllocation& other) const + cmCTestBinPackerAllocation const& other) const { return this->ProcessIndex == other.ProcessIndex && this->SlotsNeeded == other.SlotsNeeded && this->Id == other.Id; } bool cmCTestBinPackerAllocation::operator!=( - const cmCTestBinPackerAllocation& other) const + cmCTestBinPackerAllocation const& other) const { return !(*this == other); } @@ -35,8 +35,8 @@ namespace { */ template bool AllocateCTestResources( - const std::map& resources, - const std::vector& resourcesSorted, std::size_t currentIndex, + std::map const& resources, + std::vector const& resourcesSorted, std::size_t currentIndex, std::vector& allocations) { // Iterate through all large enough resources until we find a solution @@ -83,7 +83,7 @@ bool AllocateCTestResources( template bool AllocateCTestResources( - const std::map& resources, + std::map const& resources, std::vector& allocations) { // Sort the resource requirements in descending order by slots needed @@ -115,27 +115,27 @@ class RoundRobinAllocationStrategy { public: static void InitialSort( - const std::map& resources, + std::map const& resources, std::vector& resourcesSorted); static void IncrementalSort( - const std::map& resources, + std::map const& resources, std::vector& resourcesSorted, std::size_t lastAllocatedIndex); }; void RoundRobinAllocationStrategy::InitialSort( - const std::map& resources, + std::map const& resources, std::vector& resourcesSorted) { std::stable_sort( resourcesSorted.rbegin(), resourcesSorted.rend(), - [&resources](const std::string& id1, const std::string& id2) { + [&resources](std::string const& id1, std::string const& id2) { return resources.at(id1).Free() < resources.at(id2).Free(); }); } void RoundRobinAllocationStrategy::IncrementalSort( - const std::map& resources, + std::map const& resources, std::vector& resourcesSorted, std::size_t lastAllocatedIndex) { auto tmp = resourcesSorted[lastAllocatedIndex]; @@ -153,27 +153,27 @@ class BlockAllocationStrategy { public: static void InitialSort( - const std::map& resources, + std::map const& resources, std::vector& resourcesSorted); static void IncrementalSort( - const std::map& resources, + std::map const& resources, std::vector& resourcesSorted, std::size_t lastAllocatedIndex); }; void BlockAllocationStrategy::InitialSort( - const std::map& resources, + std::map const& resources, std::vector& resourcesSorted) { std::stable_sort( resourcesSorted.rbegin(), resourcesSorted.rend(), - [&resources](const std::string& id1, const std::string& id2) { + [&resources](std::string const& id1, std::string const& id2) { return resources.at(id1).Free() < resources.at(id2).Free(); }); } void BlockAllocationStrategy::IncrementalSort( - const std::map&, + std::map const&, std::vector& resourcesSorted, std::size_t lastAllocatedIndex) { auto tmp = resourcesSorted[lastAllocatedIndex]; @@ -187,7 +187,7 @@ void BlockAllocationStrategy::IncrementalSort( } bool cmAllocateCTestResourcesRoundRobin( - const std::map& resources, + std::map const& resources, std::vector& allocations) { return AllocateCTestResources(resources, @@ -195,7 +195,7 @@ bool cmAllocateCTestResourcesRoundRobin( } bool cmAllocateCTestResourcesBlock( - const std::map& resources, + std::map const& resources, std::vector& allocations) { return AllocateCTestResources(resources, diff --git a/Source/CTest/cmCTestBinPacker.h b/Source/CTest/cmCTestBinPacker.h index e56a437..a632b59 100644 --- a/Source/CTest/cmCTestBinPacker.h +++ b/Source/CTest/cmCTestBinPacker.h @@ -15,14 +15,14 @@ struct cmCTestBinPackerAllocation int SlotsNeeded; std::string Id; - bool operator==(const cmCTestBinPackerAllocation& other) const; - bool operator!=(const cmCTestBinPackerAllocation& other) const; + bool operator==(cmCTestBinPackerAllocation const& other) const; + bool operator!=(cmCTestBinPackerAllocation const& other) const; }; bool cmAllocateCTestResourcesRoundRobin( - const std::map& resources, + std::map const& resources, std::vector& allocations); bool cmAllocateCTestResourcesBlock( - const std::map& resources, + std::map const& resources, std::vector& allocations); diff --git a/Source/CTest/cmCTestBuildAndTest.cxx b/Source/CTest/cmCTestBuildAndTest.cxx index a142445..8c083d0 100644 --- a/Source/CTest/cmCTestBuildAndTest.cxx +++ b/Source/CTest/cmCTestBuildAndTest.cxx @@ -47,7 +47,7 @@ bool cmCTestBuildAndTest::RunCMake(cmake* cm) args.push_back("-T" + this->BuildGeneratorToolset); } - const char* config = nullptr; + char const* config = nullptr; if (!this->CTest->GetConfigType().empty()) { config = this->CTest->GetConfigType().c_str(); } @@ -136,7 +136,7 @@ public: : CM(cm) { cmSystemTools::SetMessageCallback( - [](const std::string& msg, const cmMessageMetadata& /* unused */) { + [](std::string const& msg, cmMessageMetadata const& /* unused */) { std::cout << msg << std::endl; }); @@ -145,7 +145,7 @@ public: cmSystemTools::SetStderrCallback( [](std::string const& m) { std::cout << m << std::flush; }); - this->CM.SetProgressCallback([](const std::string& msg, float prog) { + this->CM.SetProgressCallback([](std::string const& msg, float prog) { if (prog < 0) { std::cout << msg << std::endl; } @@ -160,10 +160,10 @@ public: cmSystemTools::SetMessageCallback(nullptr); } - cmCTestBuildAndTestCaptureRAII(const cmCTestBuildAndTestCaptureRAII&) = + cmCTestBuildAndTestCaptureRAII(cmCTestBuildAndTestCaptureRAII const&) = delete; cmCTestBuildAndTestCaptureRAII& operator=( - const cmCTestBuildAndTestCaptureRAII&) = delete; + cmCTestBuildAndTestCaptureRAII const&) = delete; }; int cmCTestBuildAndTest::Run() @@ -247,7 +247,7 @@ int cmCTestBuildAndTest::Run() return 1; } } - const char* config = nullptr; + char const* config = nullptr; if (!this->CTest->GetConfigType().empty()) { config = this->CTest->GetConfigType().c_str(); } diff --git a/Source/CTest/cmCTestBuildCommand.cxx b/Source/CTest/cmCTestBuildCommand.cxx index c85188c..21a9ed8 100644 --- a/Source/CTest/cmCTestBuildCommand.cxx +++ b/Source/CTest/cmCTestBuildCommand.cxx @@ -65,10 +65,10 @@ std::unique_ptr cmCTestBuildCommand::InitializeHandler( : cmNonempty(ctestBuildConfiguration) ? *ctestBuildConfiguration : this->CTest->GetConfigType(); - const std::string& cmakeBuildAdditionalFlags = cmNonempty(args.Flags) + std::string const& cmakeBuildAdditionalFlags = cmNonempty(args.Flags) ? args.Flags : mf.GetSafeDefinition("CTEST_BUILD_FLAGS"); - const std::string& cmakeBuildTarget = cmNonempty(args.Target) + std::string const& cmakeBuildTarget = cmNonempty(args.Target) ? args.Target : mf.GetSafeDefinition("CTEST_BUILD_TARGET"); diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx index c3e5222..a830bef 100644 --- a/Source/CTest/cmCTestBuildHandler.cxx +++ b/Source/CTest/cmCTestBuildHandler.cxx @@ -33,7 +33,7 @@ #include "cmValue.h" #include "cmXMLWriter.h" -static const char* cmCTestErrorMatches[] = { +static char const* cmCTestErrorMatches[] = { "^[Bb]us [Ee]rror", // noqa: spellcheck disable-line "^[Ss]egmentation [Vv]iolation", "^[Ss]egmentation [Ff]ault", @@ -93,7 +93,7 @@ static const char* cmCTestErrorMatches[] = { nullptr }; -static const char* cmCTestErrorExceptions[] = { +static char const* cmCTestErrorExceptions[] = { "instantiated from ", "candidates are:", ": warning", @@ -109,7 +109,7 @@ static const char* cmCTestErrorExceptions[] = { nullptr }; -static const char* cmCTestWarningMatches[] = { +static char const* cmCTestWarningMatches[] = { "([^ :]+):([0-9]+): warning:", "([^ :]+):([0-9]+): note:", "^cc[^C]*CC: WARNING File = ([^,]+), Line = ([0-9]+)", @@ -135,7 +135,7 @@ static const char* cmCTestWarningMatches[] = { nullptr }; -static const char* cmCTestWarningExceptions[] = { +static char const* cmCTestWarningExceptions[] = { R"(/usr/.*/X11/Xlib\.h:[0-9]+: war.*: ANSI C\+\+ forbids declaration)", R"(/usr/.*/X11/Xutil\.h:[0-9]+: war.*: ANSI C\+\+ forbids declaration)", R"(/usr/.*/X11/XResource\.h:[0-9]+: war.*: ANSI C\+\+ forbids declaration)", @@ -157,7 +157,7 @@ static const char* cmCTestWarningExceptions[] = { struct cmCTestBuildCompileErrorWarningRex { - const char* RegularExpressionString; + char const* RegularExpressionString; int FileIndex; int LineIndex; }; @@ -281,7 +281,7 @@ int cmCTestBuildHandler::ProcessHandler() return -1; } - const std::string& buildDirectory = + std::string const& buildDirectory = this->CTest->GetCTestConfiguration("BuildDirectory"); if (buildDirectory.empty()) { cmCTestLog(this->CTest, ERROR_MESSAGE, @@ -501,7 +501,7 @@ void cmCTestBuildHandler::GenerateXMLLaunched(cmXMLWriter& xml) launchDir.Load(this->CTestLaunchDir); unsigned long n = launchDir.GetNumberOfFiles(); for (unsigned long i = 0; i < n; ++i) { - const char* fname = launchDir.GetFile(i); + char const* fname = launchDir.GetFile(i); if (this->IsLaunchedErrorFile(fname) && numErrorsAllowed) { numErrorsAllowed--; fragments.insert(this->CTestLaunchDir + '/' + fname); @@ -611,14 +611,14 @@ void cmCTestBuildHandler::GenerateXMLFooter(cmXMLWriter& xml, this->CTest->EndXML(xml); } -bool cmCTestBuildHandler::IsLaunchedErrorFile(const char* fname) +bool cmCTestBuildHandler::IsLaunchedErrorFile(char const* fname) { // error-{hash}.xml return (cmHasLiteralPrefix(fname, "error-") && cmHasLiteralSuffix(fname, ".xml")); } -bool cmCTestBuildHandler::IsLaunchedWarningFile(const char* fname) +bool cmCTestBuildHandler::IsLaunchedWarningFile(char const* fname) { // warning-{hash}.xml return (cmHasLiteralPrefix(fname, "warning-") && @@ -635,15 +635,15 @@ class cmCTestBuildHandler::LaunchHelper public: LaunchHelper(cmCTestBuildHandler* handler); ~LaunchHelper(); - LaunchHelper(const LaunchHelper&) = delete; - LaunchHelper& operator=(const LaunchHelper&) = delete; + LaunchHelper(LaunchHelper const&) = delete; + LaunchHelper& operator=(LaunchHelper const&) = delete; private: cmCTestBuildHandler* Handler; cmCTest* CTest; void WriteLauncherConfig(); - void WriteScrapeMatchers(const char* purpose, + void WriteScrapeMatchers(char const* purpose, std::vector const& matchers); }; @@ -703,7 +703,7 @@ void cmCTestBuildHandler::LaunchHelper::WriteLauncherConfig() } void cmCTestBuildHandler::LaunchHelper::WriteScrapeMatchers( - const char* purpose, std::vector const& matchers) + char const* purpose, std::vector const& matchers) { if (matchers.empty()) { return; @@ -716,8 +716,8 @@ void cmCTestBuildHandler::LaunchHelper::WriteScrapeMatchers( } } -bool cmCTestBuildHandler::RunMakeCommand(const std::string& command, - int* retVal, const char* dir, +bool cmCTestBuildHandler::RunMakeCommand(std::string const& command, + int* retVal, char const* dir, int timeout, std::ostream& ofs, Encoding encoding) { @@ -869,7 +869,7 @@ bool cmCTestBuildHandler::RunMakeCommand(const std::string& command, launchDir.Load(this->CTestLaunchDir); unsigned long n = launchDir.GetNumberOfFiles(); for (unsigned long i = 0; i < n; ++i) { - const char* fname = launchDir.GetFile(i); + char const* fname = launchDir.GetFile(i); if (cmHasLiteralSuffix(fname, ".xml")) { launcherXMLFound = true; break; @@ -940,13 +940,13 @@ bool cmCTestBuildHandler::RunMakeCommand(const std::string& command, // ###################################################################### // ###################################################################### -void cmCTestBuildHandler::ProcessBuffer(const char* data, size_t length, +void cmCTestBuildHandler::ProcessBuffer(char const* data, size_t length, size_t& tick, size_t tick_len, std::ostream& ofs, t_BuildProcessingQueueType* queue) { - const std::string::size_type tick_line_len = 50; - const char* ptr; + std::string::size_type const tick_line_len = 50; + char const* ptr; for (ptr = data; ptr < data + length; ptr++) { queue->push_back(*ptr); } @@ -977,7 +977,7 @@ void cmCTestBuildHandler::ProcessBuffer(const char* data, size_t length, this->CurrentProcessingLine.clear(); cm::append(this->CurrentProcessingLine, queue->begin(), it); this->CurrentProcessingLine.push_back(0); - const char* line = this->CurrentProcessingLine.data(); + char const* line = this->CurrentProcessingLine.data(); // Process the line int lineType = this->ProcessSingleLine(line); @@ -1074,7 +1074,7 @@ void cmCTestBuildHandler::ProcessBuffer(const char* data, size_t length, ofs << cm::string_view(data, length); } -int cmCTestBuildHandler::ProcessSingleLine(const char* data) +int cmCTestBuildHandler::ProcessSingleLine(char const* data) { if (this->UseCTestLaunch) { // No log scraping when using launchers. diff --git a/Source/CTest/cmCTestBuildHandler.h b/Source/CTest/cmCTestBuildHandler.h index 98fe2da..00ed8c2 100644 --- a/Source/CTest/cmCTestBuildHandler.h +++ b/Source/CTest/cmCTestBuildHandler.h @@ -49,7 +49,7 @@ private: //! Run command specialized for make and configure. Returns process status // and retVal is return value or exception. - bool RunMakeCommand(const std::string& command, int* retVal, const char* dir, + bool RunMakeCommand(std::string const& command, int* retVal, char const* dir, int timeout, std::ostream& ofs, Encoding encoding = cmProcessOutput::Auto); @@ -86,8 +86,8 @@ private: void GenerateXMLLaunched(cmXMLWriter& xml); void GenerateXMLLogScraped(cmXMLWriter& xml); void GenerateXMLFooter(cmXMLWriter& xml, cmDuration elapsed_build_time); - bool IsLaunchedErrorFile(const char* fname); - bool IsLaunchedWarningFile(const char* fname); + bool IsLaunchedErrorFile(char const* fname); + bool IsLaunchedWarningFile(char const* fname); std::string StartBuild; std::string EndBuild; @@ -109,10 +109,10 @@ private: using t_BuildProcessingQueueType = std::deque; - void ProcessBuffer(const char* data, size_t length, size_t& tick, + void ProcessBuffer(char const* data, size_t length, size_t& tick, size_t tick_len, std::ostream& ofs, t_BuildProcessingQueueType* queue); - int ProcessSingleLine(const char* data); + int ProcessSingleLine(char const* data); t_BuildProcessingQueueType BuildProcessingQueue; t_BuildProcessingQueueType BuildProcessingErrorQueue; diff --git a/Source/CTest/cmCTestCVS.cxx b/Source/CTest/cmCTestCVS.cxx index 2be96df..a1be25d 100644 --- a/Source/CTest/cmCTestCVS.cxx +++ b/Source/CTest/cmCTestCVS.cxx @@ -26,7 +26,7 @@ cmCTestCVS::~cmCTestCVS() = default; class cmCTestCVS::UpdateParser : public cmCTestVC::LineParser { public: - UpdateParser(cmCTestCVS* cvs, const char* prefix) + UpdateParser(cmCTestCVS* cvs, char const* prefix) : CVS(cvs) { this->SetLog(&cvs->Log, prefix); @@ -106,7 +106,7 @@ class cmCTestCVS::LogParser : public cmCTestVC::LineParser { public: using Revision = cmCTestCVS::Revision; - LogParser(cmCTestCVS* cvs, const char* prefix, std::vector& revs) + LogParser(cmCTestCVS* cvs, char const* prefix, std::vector& revs) : CVS(cvs) , Revisions(revs) { @@ -214,7 +214,7 @@ std::string cmCTestCVS::ComputeBranchFlag(std::string const& dir) return "-b"; } -void cmCTestCVS::LoadRevisions(std::string const& file, const char* branchFlag, +void cmCTestCVS::LoadRevisions(std::string const& file, char const* branchFlag, std::vector& revisions) { cmCTestLog(this->CTest, HANDLER_OUTPUT, "." << std::flush); @@ -231,7 +231,7 @@ void cmCTestCVS::LoadRevisions(std::string const& file, const char* branchFlag, void cmCTestCVS::WriteXMLDirectory(cmXMLWriter& xml, std::string const& path, Directory const& dir) { - const char* slash = path.empty() ? "" : "/"; + char const* slash = path.empty() ? "" : "/"; xml.StartElement("Directory"); xml.Element("Name", path); diff --git a/Source/CTest/cmCTestCVS.h b/Source/CTest/cmCTestCVS.h index 1ea4b95..c4a5b8c 100644 --- a/Source/CTest/cmCTestCVS.h +++ b/Source/CTest/cmCTestCVS.h @@ -39,7 +39,7 @@ private: std::map Dirs; std::string ComputeBranchFlag(std::string const& dir); - void LoadRevisions(std::string const& file, const char* branchFlag, + void LoadRevisions(std::string const& file, char const* branchFlag, std::vector& revisions); void WriteXMLDirectory(cmXMLWriter& xml, std::string const& path, Directory const& dir); diff --git a/Source/CTest/cmCTestConfigureCommand.cxx b/Source/CTest/cmCTestConfigureCommand.cxx index d5ec299..27f4074 100644 --- a/Source/CTest/cmCTestConfigureCommand.cxx +++ b/Source/CTest/cmCTestConfigureCommand.cxx @@ -51,7 +51,7 @@ cmCTestConfigureCommand::InitializeHandler(HandlerArguments& arguments, } else { cmValue cmakeGeneratorName = mf.GetDefinition("CTEST_CMAKE_GENERATOR"); if (cmNonempty(cmakeGeneratorName)) { - const std::string& source_dir = + std::string const& source_dir = this->CTest->GetCTestConfiguration("SourceDirectory"); if (source_dir.empty()) { status.SetError( @@ -61,8 +61,8 @@ cmCTestConfigureCommand::InitializeHandler(HandlerArguments& arguments, return nullptr; } - const std::string cmlName = mf.GetSafeDefinition("CMAKE_LIST_FILE_NAME"); - const std::string cmakelists_file = cmStrCat( + std::string const cmlName = mf.GetSafeDefinition("CMAKE_LIST_FILE_NAME"); + std::string const cmakelists_file = cmStrCat( source_dir, "/", cmlName.empty() ? "CMakeLists.txt" : cmlName); if (!cmSystemTools::FileExists(cmakelists_file)) { std::ostringstream e; diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx index bac1096..4560f16 100644 --- a/Source/CTest/cmCTestCoverageHandler.cxx +++ b/Source/CTest/cmCTestCoverageHandler.cxx @@ -361,7 +361,7 @@ int cmCTestCoverageHandler::ProcessHandler() cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, " ", this->Quiet); } - const std::string fullFileName = file.first; + std::string const fullFileName = file.first; bool shouldIDoCoverage = this->ShouldIDoCoverage(fullFileName, sourceDir, binaryDir); if (!shouldIDoCoverage) { @@ -392,10 +392,10 @@ int cmCTestCoverageHandler::ProcessHandler() this->StartCoverageLogXML(covLogXML); } - const std::string fileName = cmSystemTools::GetFilenameName(fullFileName); - const std::string shortFileName = + std::string const fileName = cmSystemTools::GetFilenameName(fullFileName); + std::string const shortFileName = this->CTest->GetShortPathToFile(fullFileName); - const cmCTestCoverageHandlerContainer::SingleFileCoverageVector& fcov = + cmCTestCoverageHandlerContainer::SingleFileCoverageVector const& fcov = file.second; covLogXML.StartElement("File"); covLogXML.Attribute("Name", fileName); @@ -609,7 +609,7 @@ void cmCTestCoverageHandler::PopulateCustomVectors(cmMakefile* mf) # define fnc_prefix(s, t) cmHasPrefix(s, t) #endif -static bool IsFileInDir(const std::string& infile, const std::string& indir) +static bool IsFileInDir(std::string const& infile, std::string const& indir) { std::string file = cmSystemTools::CollapseFullPath(infile); std::string dir = cmSystemTools::CollapseFullPath(indir); @@ -716,9 +716,9 @@ struct cmCTestCoverageHandlerLocale cmSystemTools::UnsetEnv("LC_ALL"); } } - cmCTestCoverageHandlerLocale(const cmCTestCoverageHandlerLocale&) = delete; + cmCTestCoverageHandlerLocale(cmCTestCoverageHandlerLocale const&) = delete; cmCTestCoverageHandlerLocale& operator=( - const cmCTestCoverageHandlerLocale&) = delete; + cmCTestCoverageHandlerLocale const&) = delete; std::string lc_all; }; @@ -789,7 +789,7 @@ int cmCTestCoverageHandler::HandleDelphiCoverage( return static_cast(cont->TotalCoverage.size()); } -static std::string joinCommandLine(const std::vector& args) +static std::string joinCommandLine(std::vector const& args) { std::string ret; @@ -946,7 +946,7 @@ int cmCTestCoverageHandler::HandleGCovCoverage( std::vector covargs = basecovargs; covargs.push_back(fileDir); covargs.push_back(f); - const std::string command = joinCommandLine(covargs); + std::string const command = joinCommandLine(covargs); cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, command << std::endl, this->Quiet); @@ -1306,7 +1306,7 @@ int cmCTestCoverageHandler::HandleLCovCoverage( std::vector covargs = cmSystemTools::ParseArguments(lcovExtraFlags); covargs.insert(covargs.begin(), lcovCommand); - const std::string command = joinCommandLine(covargs); + std::string const command = joinCommandLine(covargs); // In intel compiler we have to call codecov only once in each executable // directory. It collects all *.dyn files to generate .dpi file. @@ -1691,7 +1691,7 @@ std::string cmCTestCoverageHandler::FindFile( // This is a header put on each marked up source file namespace { -const char* bullseyeHelp[] = { +char const* bullseyeHelp[] = { " Coverage produced by bullseye covbr tool: ", " www.bullseye.com/help/ref_covbr.html", " * An arrow --> indicates incomplete coverage.", @@ -1838,7 +1838,7 @@ int cmCTestCoverageHandler::RunBullseyeCoverageBranch( } int cmCTestCoverageHandler::RunBullseyeCommand( - cmCTestCoverageHandlerContainer* cont, const char* cmd, const char* arg, + cmCTestCoverageHandlerContainer* cont, char const* cmd, char const* arg, std::string& outputFile) { std::string program = cmSystemTools::FindProgram(cmd); @@ -2142,7 +2142,7 @@ void cmCTestCoverageHandler::LoadLabels() } } -void cmCTestCoverageHandler::LoadLabels(const char* dir) +void cmCTestCoverageHandler::LoadLabels(char const* dir) { LabelSet& dirLabels = this->TargetDirs[dir]; std::string fname = cmStrCat(dir, "/Labels.txt"); diff --git a/Source/CTest/cmCTestCoverageHandler.h b/Source/CTest/cmCTestCoverageHandler.h index 89969ce..b0b0ec6 100644 --- a/Source/CTest/cmCTestCoverageHandler.h +++ b/Source/CTest/cmCTestCoverageHandler.h @@ -100,7 +100,7 @@ private: std::vector& filesFullPath); int RunBullseyeCommand(cmCTestCoverageHandlerContainer* cont, - const char* cmd, const char* arg, + char const* cmd, char const* arg, std::string& outputFile); bool ParseBullsEyeCovsrcLine(std::string const& inputLine, std::string& sourceFile, int& functionsCalled, @@ -139,7 +139,7 @@ private: // Label reading and writing methods. void LoadLabels(); - void LoadLabels(const char* dir); + void LoadLabels(char const* dir); void WriteXMLLabels(cmXMLWriter& xml, std::string const& source); // Label-based filtering. diff --git a/Source/CTest/cmCTestCurl.cxx b/Source/CTest/cmCTestCurl.cxx index b203a51..46d6811 100644 --- a/Source/CTest/cmCTestCurl.cxx +++ b/Source/CTest/cmCTestCurl.cxx @@ -15,8 +15,8 @@ #include "cmValue.h" namespace { -const bool TLS_VERIFY_DEFAULT = true; -const int TLS_VERSION_DEFAULT = CURL_SSLVERSION_TLSv1_2; +bool const TLS_VERIFY_DEFAULT = true; +int const TLS_VERSION_DEFAULT = CURL_SSLVERSION_TLSv1_2; } cmCTestCurl::cmCTestCurl(cmCTest* ctest) @@ -49,7 +49,7 @@ size_t curlWriteMemoryCallback(void* ptr, size_t size, size_t nmemb, void* data) { int realsize = static_cast(size * nmemb); - const char* chPtr = static_cast(ptr); + char const* chPtr = static_cast(ptr); cm::append(*static_cast*>(data), chPtr, chPtr + realsize); return realsize; } diff --git a/Source/CTest/cmCTestCurl.h b/Source/CTest/cmCTestCurl.h index 7836f4b..2faaf89 100644 --- a/Source/CTest/cmCTestCurl.h +++ b/Source/CTest/cmCTestCurl.h @@ -26,8 +26,8 @@ class cmCTestCurl public: cmCTestCurl(cmCTest*); ~cmCTestCurl(); - cmCTestCurl(const cmCTestCurl&) = delete; - cmCTestCurl& operator=(const cmCTestCurl&) = delete; + cmCTestCurl(cmCTestCurl const&) = delete; + cmCTestCurl& operator=(cmCTestCurl const&) = delete; bool UploadFile(std::string const& local_file, std::string const& url, std::string const& fields, std::string& response); bool HttpRequest(std::string const& url, std::string const& fields, diff --git a/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.cxx b/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.cxx index 5ae89a1..7161671 100644 --- a/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.cxx +++ b/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.cxx @@ -13,7 +13,7 @@ namespace { // Try to remove the binary directory once -cmsys::Status TryToRemoveBinaryDirectoryOnce(const std::string& directoryPath) +cmsys::Status TryToRemoveBinaryDirectoryOnce(std::string const& directoryPath) { cmsys::Directory directory; directory.Load(directoryPath); @@ -48,7 +48,7 @@ cmsys::Status TryToRemoveBinaryDirectoryOnce(const std::string& directoryPath) /* * Empty Binary Directory */ -bool EmptyBinaryDirectory(const std::string& sname, std::string& err) +bool EmptyBinaryDirectory(std::string const& sname, std::string& err) { // try to avoid deleting root if (sname.size() < 2) { diff --git a/Source/CTest/cmCTestGIT.cxx b/Source/CTest/cmCTestGIT.cxx index 1ba8576..eb0d139 100644 --- a/Source/CTest/cmCTestGIT.cxx +++ b/Source/CTest/cmCTestGIT.cxx @@ -40,7 +40,7 @@ cmCTestGIT::~cmCTestGIT() = default; class cmCTestGIT::OneLineParser : public cmCTestVC::LineParser { public: - OneLineParser(cmCTestGIT* git, const char* prefix, std::string& l) + OneLineParser(cmCTestGIT* git, char const* prefix, std::string& l) : Line1(l) { this->SetLog(&git->Log, prefix); @@ -326,7 +326,7 @@ unsigned int cmCTestGIT::GetGitVersion() class cmCTestGIT::DiffParser : public cmCTestVC::LineParser { public: - DiffParser(cmCTestGIT* git, const char* prefix) + DiffParser(cmCTestGIT* git, char const* prefix) : LineParser('\0', false) , GIT(git) { @@ -366,16 +366,16 @@ protected: this->DiffField = DiffFieldNone; return true; } - const char* src_mode_first = this->Line.c_str() + 1; - const char* src_mode_last = this->ConsumeField(src_mode_first); - const char* dst_mode_first = this->ConsumeSpace(src_mode_last); - const char* dst_mode_last = this->ConsumeField(dst_mode_first); - const char* src_sha1_first = this->ConsumeSpace(dst_mode_last); - const char* src_sha1_last = this->ConsumeField(src_sha1_first); - const char* dst_sha1_first = this->ConsumeSpace(src_sha1_last); - const char* dst_sha1_last = this->ConsumeField(dst_sha1_first); - const char* status_first = this->ConsumeSpace(dst_sha1_last); - const char* status_last = this->ConsumeField(status_first); + char const* src_mode_first = this->Line.c_str() + 1; + char const* src_mode_last = this->ConsumeField(src_mode_first); + char const* dst_mode_first = this->ConsumeSpace(src_mode_last); + char const* dst_mode_last = this->ConsumeField(dst_mode_first); + char const* src_sha1_first = this->ConsumeSpace(dst_mode_last); + char const* src_sha1_last = this->ConsumeField(src_sha1_first); + char const* dst_sha1_first = this->ConsumeSpace(src_sha1_last); + char const* dst_sha1_last = this->ConsumeField(dst_sha1_first); + char const* status_first = this->ConsumeSpace(dst_sha1_last); + char const* status_last = this->ConsumeField(status_first); if (status_first != status_last) { this->CurChange.Action = *status_first; this->DiffField = DiffFieldSrc; @@ -410,14 +410,14 @@ protected: return true; } - const char* ConsumeSpace(const char* c) + char const* ConsumeSpace(char const* c) { while (*c && cmIsSpace(*c)) { ++c; } return c; } - const char* ConsumeField(const char* c) + char const* ConsumeField(char const* c) { while (*c && !cmIsSpace(*c)) { ++c; @@ -448,7 +448,7 @@ protected: class cmCTestGIT::CommitParser : public cmCTestGIT::DiffParser { public: - CommitParser(cmCTestGIT* git, const char* prefix) + CommitParser(cmCTestGIT* git, char const* prefix) : DiffParser(git, prefix) { this->Separator = SectionSep[this->Section]; @@ -475,29 +475,29 @@ private: long TimeZone = 0; }; - void ParsePerson(const char* str, Person& person) + void ParsePerson(char const* str, Person& person) { // Person Name 1234567890 +0000 - const char* c = str; + char const* c = str; while (*c && cmIsSpace(*c)) { ++c; } - const char* name_first = c; + char const* name_first = c; while (*c && *c != '<') { ++c; } - const char* name_last = c; + char const* name_last = c; while (name_last != name_first && cmIsSpace(*(name_last - 1))) { --name_last; } person.Name.assign(name_first, name_last - name_first); - const char* email_first = *c ? ++c : c; + char const* email_first = *c ? ++c : c; while (*c && *c != '>') { ++c; } - const char* email_last = *c ? c++ : c; + char const* email_last = *c ? c++ : c; person.EMail.assign(email_first, email_last - email_first); person.Time = strtoul(c, const_cast(&c), 10); diff --git a/Source/CTest/cmCTestGenericHandler.cxx b/Source/CTest/cmCTestGenericHandler.cxx index e4acbef..625333f 100644 --- a/Source/CTest/cmCTestGenericHandler.cxx +++ b/Source/CTest/cmCTestGenericHandler.cxx @@ -18,7 +18,7 @@ cmCTestGenericHandler::cmCTestGenericHandler(cmCTest* ctest) cmCTestGenericHandler::~cmCTestGenericHandler() = default; bool cmCTestGenericHandler::StartResultingXML(cmCTest::Part part, - const char* name, + char const* name, cmGeneratedFileStream& xofs) { if (!name) { @@ -54,7 +54,7 @@ bool cmCTestGenericHandler::StartResultingXML(cmCTest::Part part, return true; } -bool cmCTestGenericHandler::StartLogFile(const char* name, +bool cmCTestGenericHandler::StartLogFile(char const* name, cmGeneratedFileStream& xofs) { if (!name) { diff --git a/Source/CTest/cmCTestGenericHandler.h b/Source/CTest/cmCTestGenericHandler.h index 24251c0..02fce78 100644 --- a/Source/CTest/cmCTestGenericHandler.h +++ b/Source/CTest/cmCTestGenericHandler.h @@ -66,9 +66,9 @@ public: void SetCMakeInstance(cmake* cm) { this->CMake = cm; } protected: - bool StartResultingXML(cmCTest::Part part, const char* name, + bool StartResultingXML(cmCTest::Part part, char const* name, cmGeneratedFileStream& xofs); - bool StartLogFile(const char* name, cmGeneratedFileStream& xofs); + bool StartLogFile(char const* name, cmGeneratedFileStream& xofs); bool AppendXML = false; bool Quiet = false; diff --git a/Source/CTest/cmCTestGlobalVC.cxx b/Source/CTest/cmCTestGlobalVC.cxx index 75c4615..ae03d7f 100644 --- a/Source/CTest/cmCTestGlobalVC.cxx +++ b/Source/CTest/cmCTestGlobalVC.cxx @@ -18,7 +18,7 @@ cmCTestGlobalVC::cmCTestGlobalVC(cmCTest* ct, cmMakefile* mf, cmCTestGlobalVC::~cmCTestGlobalVC() = default; -const char* cmCTestGlobalVC::LocalPath(std::string const& path) +char const* cmCTestGlobalVC::LocalPath(std::string const& path) { return path.c_str(); } @@ -48,7 +48,7 @@ void cmCTestGlobalVC::DoRevision(Revision const& revision, // Update information about revisions of the changed files. for (Change const& c : changes) { - if (const char* local = this->LocalPath(c.Path)) { + if (char const* local = this->LocalPath(c.Path)) { std::string dir = cmSystemTools::GetFilenamePath(local); std::string name = cmSystemTools::GetFilenameName(local); File& file = this->Dirs[dir][name]; @@ -78,7 +78,7 @@ void cmCTestGlobalVC::WriteXMLDirectory(cmXMLWriter& xml, std::string const& path, Directory const& dir) { - const char* slash = path.empty() ? "" : "/"; + char const* slash = path.empty() ? "" : "/"; xml.StartElement("Directory"); xml.Element("Name", path); for (auto const& f : dir) { diff --git a/Source/CTest/cmCTestGlobalVC.h b/Source/CTest/cmCTestGlobalVC.h index 2169ee5..81d36f5 100644 --- a/Source/CTest/cmCTestGlobalVC.h +++ b/Source/CTest/cmCTestGlobalVC.h @@ -61,7 +61,7 @@ protected: // Information about revisions from a svn log. std::list Revisions; - virtual const char* LocalPath(std::string const& path); + virtual char const* LocalPath(std::string const& path); virtual void DoRevision(Revision const& revision, std::vector const& changes); diff --git a/Source/CTest/cmCTestHG.cxx b/Source/CTest/cmCTestHG.cxx index e84e355..50b25cc 100644 --- a/Source/CTest/cmCTestHG.cxx +++ b/Source/CTest/cmCTestHG.cxx @@ -26,7 +26,7 @@ cmCTestHG::~cmCTestHG() = default; class cmCTestHG::IdentifyParser : public cmCTestVC::LineParser { public: - IdentifyParser(cmCTestHG* hg, const char* prefix, std::string& rev) + IdentifyParser(cmCTestHG* hg, char const* prefix, std::string& rev) : Rev(rev) { this->SetLog(&hg->Log, prefix); @@ -50,7 +50,7 @@ private: class cmCTestHG::StatusParser : public cmCTestVC::LineParser { public: - StatusParser(cmCTestHG* hg, const char* prefix) + StatusParser(cmCTestHG* hg, char const* prefix) : HG(hg) { this->SetLog(&hg->Log, prefix); @@ -160,7 +160,7 @@ class cmCTestHG::LogParser , private cmXMLParser { public: - LogParser(cmCTestHG* hg, const char* prefix) + LogParser(cmCTestHG* hg, char const* prefix) : OutputLogger(hg->Log, prefix) , HG(hg) { @@ -178,19 +178,19 @@ private: Change CurChange; std::vector CData; - bool ProcessChunk(const char* data, int length) override + bool ProcessChunk(char const* data, int length) override { this->OutputLogger::ProcessChunk(data, length); this->ParseChunk(data, length); return true; } - void StartElement(const std::string& name, const char** atts) override + void StartElement(std::string const& name, char const** atts) override { this->CData.clear(); if (name == "logentry") { this->Rev = Revision(); - if (const char* rev = + if (char const* rev = cmCTestHG::LogParser::FindAttribute(atts, "revision")) { this->Rev.Rev = rev; } @@ -198,12 +198,12 @@ private: } } - void CharacterDataHandler(const char* data, int length) override + void CharacterDataHandler(char const* data, int length) override { cm::append(this->CData, data, data + length); } - void EndElement(const std::string& name) override + void EndElement(std::string const& name) override { if (name == "logentry") { this->HG->DoRevision(this->Rev, this->Changes); @@ -258,7 +258,7 @@ private: return output; } - void ReportError(int /*line*/, int /*column*/, const char* msg) override + void ReportError(int /*line*/, int /*column*/, char const* msg) override { this->HG->Log << "Error parsing hg log xml: " << msg << "\n"; } diff --git a/Source/CTest/cmCTestHandlerCommand.cxx b/Source/CTest/cmCTestHandlerCommand.cxx index 6847672..fc769e4 100644 --- a/Source/CTest/cmCTestHandlerCommand.cxx +++ b/Source/CTest/cmCTestHandlerCommand.cxx @@ -60,8 +60,8 @@ public: } } } - SaveRestoreErrorState(const SaveRestoreErrorState&) = delete; - SaveRestoreErrorState& operator=(const SaveRestoreErrorState&) = delete; + SaveRestoreErrorState(SaveRestoreErrorState const&) = delete; + SaveRestoreErrorState& operator=(SaveRestoreErrorState const&) = delete; private: bool InitialErrorState; diff --git a/Source/CTest/cmCTestLaunch.cxx b/Source/CTest/cmCTestLaunch.cxx index d8e1412..2ab2976 100644 --- a/Source/CTest/cmCTestLaunch.cxx +++ b/Source/CTest/cmCTestLaunch.cxx @@ -35,7 +35,7 @@ # include // for _setmode #endif -cmCTestLaunch::cmCTestLaunch(int argc, const char* const* argv, Op operation) +cmCTestLaunch::cmCTestLaunch(int argc, char const* const* argv, Op operation) { if (!this->ParseArguments(argc, argv)) { return; @@ -52,7 +52,7 @@ cmCTestLaunch::cmCTestLaunch(int argc, const char* const* argv, Op operation) cmCTestLaunch::~cmCTestLaunch() = default; -bool cmCTestLaunch::ParseArguments(int argc, const char* const* argv) +bool cmCTestLaunch::ParseArguments(int argc, char const* const* argv) { // Launcher options occur first and are separated from the real // command line by a '--' option. @@ -74,7 +74,7 @@ bool cmCTestLaunch::ParseArguments(int argc, const char* const* argv) Doing doing = DoingNone; int arg0 = 0; for (int i = 1; !arg0 && i < argc; ++i) { - const char* arg = argv[i]; + char const* arg = argv[i]; if (strcmp(arg, "--") == 0) { arg0 = i + 1; } else if (strcmp(arg, "--command-type") == 0) { @@ -145,7 +145,7 @@ bool cmCTestLaunch::ParseArguments(int argc, const char* const* argv) return false; } -void cmCTestLaunch::HandleRealArg(const char* arg) +void cmCTestLaunch::HandleRealArg(char const* arg) { #ifdef _WIN32 // Expand response file arguments. @@ -319,7 +319,7 @@ void cmCTestLaunch::LoadScrapeRules() } void cmCTestLaunch::LoadScrapeRules( - const char* purpose, std::vector& regexps) const + char const* purpose, std::vector& regexps) const { std::string fname = cmStrCat(this->Reporter.LogDir, "Custom", purpose, ".txt"); @@ -354,7 +354,7 @@ bool cmCTestLaunch::ScrapeLog(std::string const& fname) return false; } -int cmCTestLaunch::Main(int argc, const char* const argv[], Op operation) +int cmCTestLaunch::Main(int argc, char const* const argv[], Op operation) { if (argc == 2) { std::cerr << "ctest --launch: this mode is for internal CTest use only" diff --git a/Source/CTest/cmCTestLaunch.h b/Source/CTest/cmCTestLaunch.h index 3e3519c..b130266 100644 --- a/Source/CTest/cmCTestLaunch.h +++ b/Source/CTest/cmCTestLaunch.h @@ -29,14 +29,14 @@ public: }; /** Entry point from ctest executable main(). */ - static int Main(int argc, const char* const argv[], Op operation); + static int Main(int argc, char const* const argv[], Op operation); - cmCTestLaunch(const cmCTestLaunch&) = delete; - cmCTestLaunch& operator=(const cmCTestLaunch&) = delete; + cmCTestLaunch(cmCTestLaunch const&) = delete; + cmCTestLaunch& operator=(cmCTestLaunch const&) = delete; private: // Initialize the launcher from its command line. - cmCTestLaunch(int argc, const char* const* argv, Op operation); + cmCTestLaunch(int argc, char const* const* argv, Op operation); ~cmCTestLaunch(); // Run the real command. @@ -47,14 +47,14 @@ private: bool CheckResults(); // Parse out launcher-specific options specified before the real command. - bool ParseArguments(int argc, const char* const* argv); + bool ParseArguments(int argc, char const* const* argv); // The real command line appearing after launcher arguments. std::vector RealArgV; // The real command line after response file expansion. std::vector RealArgs; - void HandleRealArg(const char* arg); + void HandleRealArg(char const* arg); // Whether or not any data have been written to stdout or stderr. bool HaveOut; @@ -63,7 +63,7 @@ private: // Load custom rules to match warnings and their exceptions. bool ScrapeRulesLoaded; void LoadScrapeRules(); - void LoadScrapeRules(const char* purpose, + void LoadScrapeRules(char const* purpose, std::vector& regexps) const; bool ScrapeLog(std::string const& fname); diff --git a/Source/CTest/cmCTestLaunchReporter.cxx b/Source/CTest/cmCTestLaunchReporter.cxx index 4156294..1d887c8 100644 --- a/Source/CTest/cmCTestLaunchReporter.cxx +++ b/Source/CTest/cmCTestLaunchReporter.cxx @@ -189,7 +189,7 @@ void cmCTestLaunchReporter::WriteXMLAction(cmXMLElement& e2) const } // OutputType - const char* outputType = nullptr; + char const* outputType = nullptr; if (!this->OptionTargetType.empty()) { if (this->OptionTargetType == "EXECUTABLE") { outputType = "executable"; @@ -265,13 +265,13 @@ void cmCTestLaunchReporter::WriteXMLLabels(cmXMLElement& e2) } } -void cmCTestLaunchReporter::DumpFileToXML(cmXMLElement& e3, const char* tag, +void cmCTestLaunchReporter::DumpFileToXML(cmXMLElement& e3, char const* tag, std::string const& fname) { cmsys::ifstream fin(fname.c_str(), std::ios::in | std::ios::binary); std::string line; - const char* sep = ""; + char const* sep = ""; cmXMLElement e4(e3, tag); while (cmSystemTools::GetLineFromStream(fin, line)) { diff --git a/Source/CTest/cmCTestLaunchReporter.h b/Source/CTest/cmCTestLaunchReporter.h index e5a2d5b..cf8838e 100644 --- a/Source/CTest/cmCTestLaunchReporter.h +++ b/Source/CTest/cmCTestLaunchReporter.h @@ -24,8 +24,8 @@ public: cmCTestLaunchReporter(); ~cmCTestLaunchReporter(); - cmCTestLaunchReporter(const cmCTestLaunchReporter&) = delete; - cmCTestLaunchReporter& operator=(const cmCTestLaunchReporter&) = delete; + cmCTestLaunchReporter(cmCTestLaunchReporter const&) = delete; + cmCTestLaunchReporter& operator=(cmCTestLaunchReporter const&) = delete; // Methods to check the result of the real command. bool IsError() const; @@ -79,7 +79,7 @@ public: void WriteXMLCommand(cmXMLElement&); void WriteXMLResult(cmXMLElement&); void WriteXMLLabels(cmXMLElement&); - void DumpFileToXML(cmXMLElement&, const char* tag, std::string const& fname); + void DumpFileToXML(cmXMLElement&, char const* tag, std::string const& fname); // Configuration std::string SourceDir; diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx index e494163..c5a3cf6 100644 --- a/Source/CTest/cmCTestMemCheckHandler.cxx +++ b/Source/CTest/cmCTestMemCheckHandler.cxx @@ -25,7 +25,7 @@ struct CatToErrorType { - const char* ErrorCategory; + char const* ErrorCategory; int ErrorCode; }; @@ -40,7 +40,7 @@ static CatToErrorType cmCTestMemCheckBoundsChecker[] = { { nullptr, 0 } }; -static void xmlReportError(int line, const char* msg, void* data) +static void xmlReportError(int line, char const* msg, void* data) { cmCTest* ctest = static_cast(data); cmCTestLog(ctest, ERROR_MESSAGE, @@ -57,7 +57,7 @@ public: this->CTest = c; this->SetErrorCallback(xmlReportError, c); } - void StartElement(const std::string& name, const char** atts) override + void StartElement(std::string const& name, char const** atts) override { if (name == "MemoryLeak" || name == "ResourceLeak") { this->Errors.push_back(cmCTestMemCheckHandler::MLK); @@ -74,9 +74,9 @@ public: ostr << "\n"; this->Log += ostr.str(); } - void EndElement(const std::string& /*name*/) override {} + void EndElement(std::string const& /*name*/) override {} - const char* GetAttribute(const char* name, const char** atts) + char const* GetAttribute(char const* name, char const** atts) { int i = 0; for (; atts[i]; ++i) { @@ -86,10 +86,10 @@ public: } return nullptr; } - void ParseError(const char** atts) + void ParseError(char const** atts) { CatToErrorType* ptr = cmCTestMemCheckBoundsChecker; - const char* cat = this->GetAttribute("ErrorCategory", atts); + char const* cat = this->GetAttribute("ErrorCategory", atts); if (!cat) { this->Errors.push_back(cmCTestMemCheckHandler::ABW); // do not know cmCTestLog(this->CTest, ERROR_MESSAGE, @@ -237,12 +237,12 @@ void cmCTestMemCheckHandler::InitializeResultsVectors() // define the standard set of errors //---------------------------------------------------------------------- - static const char* cmCTestMemCheckResultStrings[] = { + static char const* cmCTestMemCheckResultStrings[] = { "ABR", "ABW", "ABWL", "COR", "EXU", "FFM", "FIM", "FMM", "FMR", "FMW", "FUM", "IPR", "IPW", "MAF", "MLK", "MPK", "NPR", "ODS", "PAR", "PLK", "UMC", "UMR", nullptr }; - static const char* cmCTestMemCheckResultLongStrings[] = { + static char const* cmCTestMemCheckResultLongStrings[] = { "Threading Problem", "ABW", "ABWL", @@ -375,7 +375,7 @@ void cmCTestMemCheckHandler::GenerateCTestXML(cmXMLWriter& xml) } xml.EndElement(); // Results if (memoryErrors > 0) { - const int maxTestNameWidth = this->CTest->GetMaxTestNameWidth(); + int const maxTestNameWidth = this->CTest->GetMaxTestNameWidth(); std::string outname = result.Name + " "; outname.resize(maxTestNameWidth + 4, '.'); cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, @@ -768,7 +768,7 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking() return true; } -bool cmCTestMemCheckHandler::ProcessMemCheckOutput(const std::string& str, +bool cmCTestMemCheckHandler::ProcessMemCheckOutput(std::string const& str, std::string& log, std::vector& results) { @@ -798,7 +798,7 @@ bool cmCTestMemCheckHandler::ProcessMemCheckOutput(const std::string& str, } std::vector::size_type cmCTestMemCheckHandler::FindOrAddWarning( - const std::string& warning) + std::string const& warning) { for (std::vector::size_type i = 0; i < this->ResultStrings.size(); ++i) { @@ -812,7 +812,7 @@ std::vector::size_type cmCTestMemCheckHandler::FindOrAddWarning( return this->ResultStrings.size() - 1; } bool cmCTestMemCheckHandler::ProcessMemCheckSanitizerOutput( - const std::string& str, std::string& log, std::vector& result) + std::string const& str, std::string& log, std::vector& result) { std::string regex; switch (this->MemoryTesterStyle) { @@ -865,7 +865,7 @@ bool cmCTestMemCheckHandler::ProcessMemCheckSanitizerOutput( return defects == 0; } bool cmCTestMemCheckHandler::ProcessMemCheckPurifyOutput( - const std::string& str, std::string& log, std::vector& results) + std::string const& str, std::string& log, std::vector& results) { std::vector lines; cmsys::SystemTools::Split(str, lines); @@ -908,7 +908,7 @@ bool cmCTestMemCheckHandler::ProcessMemCheckPurifyOutput( } bool cmCTestMemCheckHandler::ProcessMemCheckValgrindOutput( - const std::string& str, std::string& log, std::vector& results) + std::string const& str, std::string& log, std::vector& results) { std::vector lines; cmsys::SystemTools::Split(str, lines); @@ -1035,7 +1035,7 @@ bool cmCTestMemCheckHandler::ProcessMemCheckValgrindOutput( } bool cmCTestMemCheckHandler::ProcessMemCheckDrMemoryOutput( - const std::string& str, std::string& log, std::vector& results) + std::string const& str, std::string& log, std::vector& results) { std::vector lines; cmsys::SystemTools::Split(str, lines); @@ -1051,7 +1051,7 @@ bool cmCTestMemCheckHandler::ProcessMemCheckDrMemoryOutput( int defects = 0; std::ostringstream ostr; - for (const auto& l : lines) { + for (auto const& l : lines) { ostr << l << std::endl; if (drMemoryError.find(l)) { defects++; @@ -1072,7 +1072,7 @@ bool cmCTestMemCheckHandler::ProcessMemCheckDrMemoryOutput( } bool cmCTestMemCheckHandler::ProcessMemCheckBoundsCheckerOutput( - const std::string& str, std::string& log, std::vector& results) + std::string const& str, std::string& log, std::vector& results) { log.clear(); auto sttime = std::chrono::steady_clock::now(); @@ -1122,7 +1122,7 @@ bool cmCTestMemCheckHandler::ProcessMemCheckBoundsCheckerOutput( } bool cmCTestMemCheckHandler::ProcessMemCheckCudaOutput( - const std::string& str, std::string& log, std::vector& results) + std::string const& str, std::string& log, std::vector& results) { std::vector lines; cmsys::SystemTools::Split(str, lines); @@ -1327,9 +1327,9 @@ void cmCTestMemCheckHandler::PostProcessDrMemoryTest( cmsys::Glob g; g.FindFiles(drMemoryLogDir + "/resfile.*"); - const std::vector& files = g.GetFiles(); + std::vector const& files = g.GetFiles(); - for (const std::string& f : files) { + for (std::string const& f : files) { cmsys::ifstream ifs(f.c_str()); if (!ifs) { std::string log = "Cannot read memory tester output file: " + f; diff --git a/Source/CTest/cmCTestMemCheckHandler.h b/Source/CTest/cmCTestMemCheckHandler.h index 1971330..4f396d2 100644 --- a/Source/CTest/cmCTestMemCheckHandler.h +++ b/Source/CTest/cmCTestMemCheckHandler.h @@ -109,7 +109,7 @@ private: bool LogWithPID = false; // does log file add pid int DefectCount = 0; - std::vector::size_type FindOrAddWarning(const std::string& warning); + std::vector::size_type FindOrAddWarning(std::string const& warning); // initialize the ResultStrings and ResultStringsLong for // this type of checker void InitializeResultsVectors(); @@ -128,19 +128,19 @@ private: //! Parse Valgrind/Purify/Bounds Checker result out of the output // string. After running, log holds the output and results hold the // different memory errors. - bool ProcessMemCheckOutput(const std::string& str, std::string& log, + bool ProcessMemCheckOutput(std::string const& str, std::string& log, std::vector& results); - bool ProcessMemCheckValgrindOutput(const std::string& str, std::string& log, + bool ProcessMemCheckValgrindOutput(std::string const& str, std::string& log, std::vector& results); - bool ProcessMemCheckDrMemoryOutput(const std::string& str, std::string& log, + bool ProcessMemCheckDrMemoryOutput(std::string const& str, std::string& log, std::vector& results); - bool ProcessMemCheckPurifyOutput(const std::string& str, std::string& log, + bool ProcessMemCheckPurifyOutput(std::string const& str, std::string& log, std::vector& results); - bool ProcessMemCheckCudaOutput(const std::string& str, std::string& log, + bool ProcessMemCheckCudaOutput(std::string const& str, std::string& log, std::vector& results); - bool ProcessMemCheckSanitizerOutput(const std::string& str, std::string& log, + bool ProcessMemCheckSanitizerOutput(std::string const& str, std::string& log, std::vector& results); - bool ProcessMemCheckBoundsCheckerOutput(const std::string& str, + bool ProcessMemCheckBoundsCheckerOutput(std::string const& str, std::string& log, std::vector& results); diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx index 1ca67f0..bf8f3bc 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.cxx +++ b/Source/CTest/cmCTestMultiProcessHandler.cxx @@ -1057,39 +1057,39 @@ void cmCTestMultiProcessHandler::MarkFinished() cmSystemTools::RemoveFile(fname); } -static Json::Value DumpToJsonArray(const std::set& values) +static Json::Value DumpToJsonArray(std::set const& values) { Json::Value jsonArray = Json::arrayValue; - for (const auto& it : values) { + for (auto const& it : values) { jsonArray.append(it); } return jsonArray; } -static Json::Value DumpToJsonArray(const std::vector& values) +static Json::Value DumpToJsonArray(std::vector const& values) { Json::Value jsonArray = Json::arrayValue; - for (const auto& it : values) { + for (auto const& it : values) { jsonArray.append(it); } return jsonArray; } static Json::Value DumpRegExToJsonArray( - const std::vector>& values) + std::vector> const& values) { Json::Value jsonArray = Json::arrayValue; - for (const auto& it : values) { + for (auto const& it : values) { jsonArray.append(it.second); } return jsonArray; } static Json::Value DumpMeasurementToJsonArray( - const std::map& values) + std::map const& values) { Json::Value jsonArray = Json::arrayValue; - for (const auto& it : values) { + for (auto const& it : values) { Json::Value measurement = Json::objectValue; measurement["measurement"] = it.first; measurement["value"] = it.second; @@ -1109,8 +1109,8 @@ static Json::Value DumpTimeoutAfterMatch( } static Json::Value DumpResourceGroupsToJsonArray( - const std::vector< - std::vector>& + std::vector< + std::vector> const& resourceGroups) { Json::Value jsonResourceGroups = Json::arrayValue; @@ -1371,7 +1371,7 @@ static Json::Value DumpCTestInfo( if (!command.empty()) { std::vector commandAndArgs; commandAndArgs.push_back(command); - const std::vector& args = testRun.GetArguments(); + std::vector const& args = testRun.GetArguments(); if (!args.empty()) { commandAndArgs.reserve(args.size() + 1); cm::append(commandAndArgs, args); diff --git a/Source/CTest/cmCTestMultiProcessHandler.h b/Source/CTest/cmCTestMultiProcessHandler.h index 811be61..cb36a74 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.h +++ b/Source/CTest/cmCTestMultiProcessHandler.h @@ -90,7 +90,7 @@ public: this->RepeatCount = count; } - void SetResourceSpecFile(const std::string& resourceSpecFile) + void SetResourceSpecFile(std::string const& resourceSpecFile) { this->ResourceSpecFile = resourceSpecFile; } diff --git a/Source/CTest/cmCTestP4.cxx b/Source/CTest/cmCTestP4.cxx index 795b747..e9c8f61 100644 --- a/Source/CTest/cmCTestP4.cxx +++ b/Source/CTest/cmCTestP4.cxx @@ -29,7 +29,7 @@ cmCTestP4::~cmCTestP4() = default; class cmCTestP4::IdentifyParser : public cmCTestVC::LineParser { public: - IdentifyParser(cmCTestP4* p4, const char* prefix, std::string& rev) + IdentifyParser(cmCTestP4* p4, char const* prefix, std::string& rev) : Rev(rev) { this->SetLog(&p4->Log, prefix); @@ -53,7 +53,7 @@ private: class cmCTestP4::ChangesParser : public cmCTestVC::LineParser { public: - ChangesParser(cmCTestP4* p4, const char* prefix) + ChangesParser(cmCTestP4* p4, char const* prefix) : P4(p4) { this->SetLog(&this->P4->Log, prefix); @@ -76,7 +76,7 @@ private: class cmCTestP4::UserParser : public cmCTestVC::LineParser { public: - UserParser(cmCTestP4* p4, const char* prefix) + UserParser(cmCTestP4* p4, char const* prefix) : P4(p4) { this->SetLog(&this->P4->Log, prefix); @@ -116,7 +116,7 @@ private: class cmCTestP4::DiffParser : public cmCTestVC::LineParser { public: - DiffParser(cmCTestP4* p4, const char* prefix) + DiffParser(cmCTestP4* p4, char const* prefix) : P4(p4) { this->SetLog(&this->P4->Log, prefix); @@ -145,7 +145,7 @@ private: } }; -cmCTestP4::User cmCTestP4::GetUserData(const std::string& username) +cmCTestP4::User cmCTestP4::GetUserData(std::string const& username) { auto it = this->Users.find(username); @@ -188,7 +188,7 @@ Affected files ... class cmCTestP4::DescribeParser : public cmCTestVC::LineParser { public: - DescribeParser(cmCTestP4* p4, const char* prefix) + DescribeParser(cmCTestP4* p4, char const* prefix) : LineParser('\n', false) , P4(p4) { @@ -450,7 +450,7 @@ bool cmCTestP4::LoadModifications() return true; } -bool cmCTestP4::UpdateCustom(const std::string& custom) +bool cmCTestP4::UpdateCustom(std::string const& custom) { cmList p4_custom_command{ custom, cmList::EmptyElements::Yes }; diff --git a/Source/CTest/cmCTestP4.h b/Source/CTest/cmCTestP4.h index 61d7fa8..50de918 100644 --- a/Source/CTest/cmCTestP4.h +++ b/Source/CTest/cmCTestP4.h @@ -39,14 +39,14 @@ private: std::map Users; std::vector P4Options; - User GetUserData(const std::string& username); + User GetUserData(std::string const& username); void SetP4Options(std::vector& options); std::string GetWorkingRevision(); bool NoteOldRevision() override; bool NoteNewRevision() override; bool UpdateImpl() override; - bool UpdateCustom(const std::string& custom); + bool UpdateCustom(std::string const& custom); bool LoadRevisions() override; bool LoadModifications() override; diff --git a/Source/CTest/cmCTestResourceAllocator.cxx b/Source/CTest/cmCTestResourceAllocator.cxx index 9d468a7..93cdfde 100644 --- a/Source/CTest/cmCTestResourceAllocator.cxx +++ b/Source/CTest/cmCTestResourceAllocator.cxx @@ -9,7 +9,7 @@ #include "cmCTestResourceSpec.h" void cmCTestResourceAllocator::InitializeFromResourceSpec( - const cmCTestResourceSpec& spec) + cmCTestResourceSpec const& spec) { this->Resources.clear(); @@ -22,15 +22,15 @@ void cmCTestResourceAllocator::InitializeFromResourceSpec( } } -const std::map>& +std::map> const& cmCTestResourceAllocator::GetResources() const { return this->Resources; } -bool cmCTestResourceAllocator::AllocateResource(const std::string& name, - const std::string& id, +bool cmCTestResourceAllocator::AllocateResource(std::string const& name, + std::string const& id, unsigned int slots) { auto it = this->Resources.find(name); @@ -51,8 +51,8 @@ bool cmCTestResourceAllocator::AllocateResource(const std::string& name, return true; } -bool cmCTestResourceAllocator::DeallocateResource(const std::string& name, - const std::string& id, +bool cmCTestResourceAllocator::DeallocateResource(std::string const& name, + std::string const& id, unsigned int slots) { auto it = this->Resources.find(name); @@ -74,13 +74,13 @@ bool cmCTestResourceAllocator::DeallocateResource(const std::string& name, } bool cmCTestResourceAllocator::Resource::operator==( - const Resource& other) const + Resource const& other) const { return this->Total == other.Total && this->Locked == other.Locked; } bool cmCTestResourceAllocator::Resource::operator!=( - const Resource& other) const + Resource const& other) const { return !(*this == other); } diff --git a/Source/CTest/cmCTestResourceAllocator.h b/Source/CTest/cmCTestResourceAllocator.h index 129e64e..667dd74 100644 --- a/Source/CTest/cmCTestResourceAllocator.h +++ b/Source/CTest/cmCTestResourceAllocator.h @@ -17,18 +17,18 @@ public: unsigned int Free() const { return this->Total - this->Locked; } - bool operator==(const Resource& other) const; - bool operator!=(const Resource& other) const; + bool operator==(Resource const& other) const; + bool operator!=(Resource const& other) const; }; - void InitializeFromResourceSpec(const cmCTestResourceSpec& spec); + void InitializeFromResourceSpec(cmCTestResourceSpec const& spec); - const std::map>& GetResources() + std::map> const& GetResources() const; - bool AllocateResource(const std::string& name, const std::string& id, + bool AllocateResource(std::string const& name, std::string const& id, unsigned int slots); - bool DeallocateResource(const std::string& name, const std::string& id, + bool DeallocateResource(std::string const& name, std::string const& id, unsigned int slots); private: diff --git a/Source/CTest/cmCTestResourceGroupsLexerHelper.cxx b/Source/CTest/cmCTestResourceGroupsLexerHelper.cxx index 4c26b3f..479ad31 100644 --- a/Source/CTest/cmCTestResourceGroupsLexerHelper.cxx +++ b/Source/CTest/cmCTestResourceGroupsLexerHelper.cxx @@ -12,7 +12,7 @@ cmCTestResourceGroupsLexerHelper::cmCTestResourceGroupsLexerHelper( { } -bool cmCTestResourceGroupsLexerHelper::ParseString(const std::string& value) +bool cmCTestResourceGroupsLexerHelper::ParseString(std::string const& value) { yyscan_t lexer; cmCTestResourceGroups_yylex_init_extra(this, &lexer); @@ -30,7 +30,7 @@ void cmCTestResourceGroupsLexerHelper::SetProcessCount(unsigned int count) this->ProcessCount = count; } -void cmCTestResourceGroupsLexerHelper::SetResourceType(const std::string& type) +void cmCTestResourceGroupsLexerHelper::SetResourceType(std::string const& type) { this->ResourceType = type; } diff --git a/Source/CTest/cmCTestResourceGroupsLexerHelper.h b/Source/CTest/cmCTestResourceGroupsLexerHelper.h index ae4fa99..1f73e2f 100644 --- a/Source/CTest/cmCTestResourceGroupsLexerHelper.h +++ b/Source/CTest/cmCTestResourceGroupsLexerHelper.h @@ -20,10 +20,10 @@ public: output); ~cmCTestResourceGroupsLexerHelper() = default; - bool ParseString(const std::string& value); + bool ParseString(std::string const& value); void SetProcessCount(unsigned int count); - void SetResourceType(const std::string& type); + void SetResourceType(std::string const& type); void SetNeededSlots(int count); void WriteRequirement(); void WriteProcess(); diff --git a/Source/CTest/cmCTestResourceSpec.cxx b/Source/CTest/cmCTestResourceSpec.cxx index 0e81fa9..d699f1e 100644 --- a/Source/CTest/cmCTestResourceSpec.cxx +++ b/Source/CTest/cmCTestResourceSpec.cxx @@ -18,8 +18,8 @@ namespace { using JSONHelperBuilder = cmJSONHelperBuilder; -const cmsys::RegularExpression IdentifierRegex{ "^[a-z_][a-z0-9_]*$" }; -const cmsys::RegularExpression IdRegex{ "^[a-z0-9_]+$" }; +cmsys::RegularExpression const IdentifierRegex{ "^[a-z_][a-z0-9_]*$" }; +cmsys::RegularExpression const IdRegex{ "^[a-z0-9_]+$" }; struct Version { @@ -44,7 +44,7 @@ auto const VersionHelper = JSONHelperBuilder::Required( auto const RootVersionHelper = JSONHelperBuilder::Object().Bind( "version"_s, &TopVersion::Version, VersionHelper, false); -bool ResourceIdHelper(std::string& out, const Json::Value* value, +bool ResourceIdHelper(std::string& out, Json::Value const* value, cmJSONState* state) { if (!JSONHelperBuilder::String(cmCTestResourceSpecErrors::INVALID_RESOURCE)( @@ -74,7 +74,7 @@ auto const ResourceListHelper = auto const ResourceMapHelper = JSONHelperBuilder::MapFilter>( cmCTestResourceSpecErrors::INVALID_SOCKET_SPEC, ResourceListHelper, - [](const std::string& key) -> bool { + [](std::string const& key) -> bool { cmsys::RegularExpressionMatch match; return IdentifierRegex.find(key.c_str(), match); }); @@ -83,7 +83,7 @@ auto const SocketSetHelper = JSONHelperBuilder::Vector< std::map>>( cmCTestResourceSpecErrors::INVALID_SOCKET_SPEC, ResourceMapHelper); -bool SocketHelper(cmCTestResourceSpec::Socket& out, const Json::Value* value, +bool SocketHelper(cmCTestResourceSpec::Socket& out, Json::Value const* value, cmJSONState* state) { std::vector< @@ -112,7 +112,7 @@ auto const RootHelper = JSONHelperBuilder::Object().Bind( "local", &cmCTestResourceSpec::LocalSocket, LocalRequiredHelper, false); } -bool cmCTestResourceSpec::ReadFromJSONFile(const std::string& filename) +bool cmCTestResourceSpec::ReadFromJSONFile(std::string const& filename) { Json::Value root; @@ -133,36 +133,36 @@ bool cmCTestResourceSpec::ReadFromJSONFile(const std::string& filename) return RootHelper(*this, &root, &parseState); } -bool cmCTestResourceSpec::operator==(const cmCTestResourceSpec& other) const +bool cmCTestResourceSpec::operator==(cmCTestResourceSpec const& other) const { return this->LocalSocket == other.LocalSocket; } -bool cmCTestResourceSpec::operator!=(const cmCTestResourceSpec& other) const +bool cmCTestResourceSpec::operator!=(cmCTestResourceSpec const& other) const { return !(*this == other); } bool cmCTestResourceSpec::Socket::operator==( - const cmCTestResourceSpec::Socket& other) const + cmCTestResourceSpec::Socket const& other) const { return this->Resources == other.Resources; } bool cmCTestResourceSpec::Socket::operator!=( - const cmCTestResourceSpec::Socket& other) const + cmCTestResourceSpec::Socket const& other) const { return !(*this == other); } bool cmCTestResourceSpec::Resource::operator==( - const cmCTestResourceSpec::Resource& other) const + cmCTestResourceSpec::Resource const& other) const { return this->Id == other.Id && this->Capacity == other.Capacity; } bool cmCTestResourceSpec::Resource::operator!=( - const cmCTestResourceSpec::Resource& other) const + cmCTestResourceSpec::Resource const& other) const { return !(*this == other); } diff --git a/Source/CTest/cmCTestResourceSpec.h b/Source/CTest/cmCTestResourceSpec.h index 37ccd72..5155a3b 100644 --- a/Source/CTest/cmCTestResourceSpec.h +++ b/Source/CTest/cmCTestResourceSpec.h @@ -23,8 +23,8 @@ public: std::string Id; unsigned int Capacity; - bool operator==(const Resource& other) const; - bool operator!=(const Resource& other) const; + bool operator==(Resource const& other) const; + bool operator!=(Resource const& other) const; }; class Socket @@ -32,49 +32,49 @@ public: public: std::map> Resources; - bool operator==(const Socket& other) const; - bool operator!=(const Socket& other) const; + bool operator==(Socket const& other) const; + bool operator!=(Socket const& other) const; }; Socket LocalSocket; cmJSONState parseState; - bool ReadFromJSONFile(const std::string& filename); + bool ReadFromJSONFile(std::string const& filename); - bool operator==(const cmCTestResourceSpec& other) const; - bool operator!=(const cmCTestResourceSpec& other) const; + bool operator==(cmCTestResourceSpec const& other) const; + bool operator!=(cmCTestResourceSpec const& other) const; }; namespace cmCTestResourceSpecErrors { -const auto FILE_NOT_FOUND = [](const Json::Value*, cmJSONState* state) { +auto const FILE_NOT_FOUND = [](Json::Value const*, cmJSONState* state) { state->AddError("File not found"); }; -const auto JSON_PARSE_ERROR = [](const Json::Value* value, +auto const JSON_PARSE_ERROR = [](Json::Value const* value, cmJSONState* state) { state->AddErrorAtValue("JSON parse error", value); }; -const auto INVALID_ROOT = [](const Json::Value* value, cmJSONState* state) { +auto const INVALID_ROOT = [](Json::Value const* value, cmJSONState* state) { state->AddErrorAtValue("Invalid root object", value); }; -const auto NO_VERSION = [](const Json::Value* value, cmJSONState* state) { +auto const NO_VERSION = [](Json::Value const* value, cmJSONState* state) { state->AddErrorAtValue("No version specified", value); }; -const auto INVALID_VERSION = [](const Json::Value* value, cmJSONState* state) { +auto const INVALID_VERSION = [](Json::Value const* value, cmJSONState* state) { state->AddErrorAtValue("Invalid version object", value); }; -const auto UNSUPPORTED_VERSION = [](const Json::Value* value, +auto const UNSUPPORTED_VERSION = [](Json::Value const* value, cmJSONState* state) { state->AddErrorAtValue("Unsupported version", value); }; -const auto INVALID_SOCKET_SPEC = [](const Json::Value* value, +auto const INVALID_SOCKET_SPEC = [](Json::Value const* value, cmJSONState* state) { state->AddErrorAtValue("Invalid socket object", value); }; -const auto INVALID_RESOURCE_TYPE = [](const Json::Value* value, +auto const INVALID_RESOURCE_TYPE = [](Json::Value const* value, cmJSONState* state) { state->AddErrorAtValue("Invalid resource type object", value); }; -const auto INVALID_RESOURCE = [](const Json::Value* value, +auto const INVALID_RESOURCE = [](Json::Value const* value, cmJSONState* state) { state->AddErrorAtValue("Invalid resource object", value); }; diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx index 6c8d3d2..d617529 100644 --- a/Source/CTest/cmCTestRunTest.cxx +++ b/Source/CTest/cmCTestRunTest.cxx @@ -252,7 +252,7 @@ cmCTestRunTest::EndTestResult cmCTestRunTest::EndTest(size_t completed, // If the test did not pass, reprint test name and error std::string output = this->GetTestPrefix(completed, total); std::string testName = this->TestProperties->Name; - const int maxTestNameWidth = this->CTest->GetMaxTestNameWidth(); + int const maxTestNameWidth = this->CTest->GetMaxTestNameWidth(); testName.resize(maxTestNameWidth + 4, '.'); output += testName; @@ -306,7 +306,7 @@ cmCTestRunTest::EndTestResult cmCTestRunTest::EndTest(size_t completed, this->TestResult.Reason = reason; if (this->TestHandler->LogFile) { bool pass = true; - const char* reasonType = "Test Pass Reason"; + char const* reasonType = "Test Pass Reason"; if (this->TestResult.Status != cmCTestTestHandler::COMPLETED && this->TestResult.Status != cmCTestTestHandler::NOT_RUN) { reasonType = "Test Fail Reason"; @@ -975,7 +975,7 @@ void cmCTestRunTest::WriteLogOutputTop(size_t completed, size_t total) << indexStr.str(); outputStream << " "; - const int maxTestNameWidth = this->CTest->GetMaxTestNameWidth(); + int const maxTestNameWidth = this->CTest->GetMaxTestNameWidth(); std::string outname = this->TestProperties->Name + " "; outname.resize(maxTestNameWidth + 4, '.'); outputStream << outname; diff --git a/Source/CTest/cmCTestRunTest.h b/Source/CTest/cmCTestRunTest.h index b5e2a96..fd5e037 100644 --- a/Source/CTest/cmCTestRunTest.h +++ b/Source/CTest/cmCTestRunTest.h @@ -42,7 +42,7 @@ public: int GetIndex() { return this->Index; } - void AddFailedDependency(const std::string& failedTest) + void AddFailedDependency(std::string const& failedTest) { this->FailedDependencies.insert(failedTest); } @@ -88,7 +88,7 @@ public: std::string& GetActualCommand() { return this->ActualCommand; } - const std::vector& GetArguments() { return this->Arguments; } + std::vector const& GetArguments() { return this->Arguments; } void FinalizeTest(bool started = true); @@ -97,9 +97,9 @@ public: this->UseAllocatedResources = use; } void SetAllocatedResources( - const std::vector< - std::map>>& + std::vector>> const& resources) { this->AllocatedResources = resources; diff --git a/Source/CTest/cmCTestSVN.cxx b/Source/CTest/cmCTestSVN.cxx index dd29d92..402fa1a 100644 --- a/Source/CTest/cmCTestSVN.cxx +++ b/Source/CTest/cmCTestSVN.cxx @@ -44,7 +44,7 @@ void cmCTestSVN::CleanupImpl() class cmCTestSVN::InfoParser : public cmCTestVC::LineParser { public: - InfoParser(cmCTestSVN* svn, const char* prefix, std::string& rev, + InfoParser(cmCTestSVN* svn, char const* prefix, std::string& rev, SVNInfo& svninfo) : Rev(rev) , SVNRepo(svninfo) @@ -191,7 +191,7 @@ void cmCTestSVN::GuessBase(SVNInfo& svninfo, class cmCTestSVN::UpdateParser : public cmCTestVC::LineParser { public: - UpdateParser(cmCTestSVN* svn, const char* prefix) + UpdateParser(cmCTestSVN* svn, char const* prefix) : SVN(svn) { this->SetLog(&svn->Log, prefix); @@ -291,7 +291,7 @@ class cmCTestSVN::LogParser , private cmXMLParser { public: - LogParser(cmCTestSVN* svn, const char* prefix, SVNInfo& svninfo) + LogParser(cmCTestSVN* svn, char const* prefix, SVNInfo& svninfo) : OutputLogger(svn->Log, prefix) , SVN(svn) , SVNRepo(svninfo) @@ -311,39 +311,39 @@ private: Change CurChange; std::vector CData; - bool ProcessChunk(const char* data, int length) override + bool ProcessChunk(char const* data, int length) override { this->OutputLogger::ProcessChunk(data, length); this->ParseChunk(data, length); return true; } - void StartElement(const std::string& name, const char** atts) override + void StartElement(std::string const& name, char const** atts) override { this->CData.clear(); if (name == "logentry") { this->Rev = Revision(); this->Rev.SVNInfo = &this->SVNRepo; - if (const char* rev = + if (char const* rev = cmCTestSVN::LogParser::FindAttribute(atts, "revision")) { this->Rev.Rev = rev; } this->Changes.clear(); } else if (name == "path") { this->CurChange = Change(); - if (const char* action = + if (char const* action = cmCTestSVN::LogParser::FindAttribute(atts, "action")) { this->CurChange.Action = action[0]; } } } - void CharacterDataHandler(const char* data, int length) override + void CharacterDataHandler(char const* data, int length) override { cm::append(this->CData, data, data + length); } - void EndElement(const std::string& name) override + void EndElement(std::string const& name) override { if (name == "logentry") { this->SVN->DoRevisionSVN(this->Rev, this->Changes); @@ -362,7 +362,7 @@ private: this->CData.clear(); } - void ReportError(int /*line*/, int /*column*/, const char* msg) override + void ReportError(int /*line*/, int /*column*/, char const* msg) override { this->SVN->Log << "Error parsing svn log xml: " << msg << "\n"; } @@ -420,7 +420,7 @@ void cmCTestSVN::DoRevisionSVN(Revision const& revision, class cmCTestSVN::StatusParser : public cmCTestVC::LineParser { public: - StatusParser(cmCTestSVN* svn, const char* prefix) + StatusParser(cmCTestSVN* svn, char const* prefix) : SVN(svn) { this->SetLog(&svn->Log, prefix); @@ -486,7 +486,7 @@ void cmCTestSVN::WriteXMLGlobal(cmXMLWriter& xml) class cmCTestSVN::ExternalParser : public cmCTestVC::LineParser { public: - ExternalParser(cmCTestSVN* svn, const char* prefix) + ExternalParser(cmCTestSVN* svn, char const* prefix) : SVN(svn) { this->SetLog(&svn->Log, prefix); diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx index 7d7fa94..85ea215 100644 --- a/Source/CTest/cmCTestScriptHandler.cxx +++ b/Source/CTest/cmCTestScriptHandler.cxx @@ -46,7 +46,7 @@ cmCTestScriptHandler::cmCTestScriptHandler(cmCTest* ctest) cmCTestScriptHandler::~cmCTestScriptHandler() = default; // just adds an argument to the vector -void cmCTestScriptHandler::AddConfigurationScript(const std::string& script, +void cmCTestScriptHandler::AddConfigurationScript(std::string const& script, bool pscope) { this->ConfigurationScripts.emplace_back(script); @@ -79,7 +79,7 @@ void cmCTestScriptHandler::UpdateElapsedTime() } } -int cmCTestScriptHandler::ExecuteScript(const std::string& total_script_arg) +int cmCTestScriptHandler::ExecuteScript(std::string const& total_script_arg) { // execute the script passing in the arguments to the script as well as the // arguments from this invocation of cmake @@ -190,7 +190,7 @@ void cmCTestScriptHandler::CreateCMake() } this->CMake->SetProgressCallback( - [this](const std::string& m, float /*unused*/) { + [this](std::string const& m, float /*unused*/) { if (!m.empty()) { cmCTestLog(this->CTest, HANDLER_OUTPUT, "-- " << m << std::endl); } @@ -220,7 +220,7 @@ void cmCTestScriptHandler::CreateCMake() // this sets up some variables for the script to use, creates the required // cmake instance and generators, and then reads in the script -int cmCTestScriptHandler::ReadInScript(const std::string& total_script_arg) +int cmCTestScriptHandler::ReadInScript(std::string const& total_script_arg) { // Reset the error flag so that the script is read in no matter what cmSystemTools::ResetErrorOccurredFlag(); @@ -230,7 +230,7 @@ int cmCTestScriptHandler::ReadInScript(const std::string& total_script_arg) // passed into the scripts as S_ARG std::string script; std::string script_arg; - const std::string::size_type comma_pos = total_script_arg.find(','); + std::string::size_type const comma_pos = total_script_arg.find(','); if (comma_pos != std::string::npos) { script = total_script_arg.substr(0, comma_pos); script_arg = total_script_arg.substr(comma_pos + 1); @@ -288,7 +288,7 @@ int cmCTestScriptHandler::ReadInScript(const std::string& total_script_arg) } // Add definitions of variables passed in on the command line: - const std::map& defs = + std::map const& defs = this->CTest->GetDefinitions(); for (auto const& d : defs) { this->Makefile->AddDefinition(d.first, d.second); @@ -308,7 +308,7 @@ int cmCTestScriptHandler::ReadInScript(const std::string& total_script_arg) // run a specific script int cmCTestScriptHandler::RunConfigurationScript( - const std::string& total_script_arg, bool pscope) + std::string const& total_script_arg, bool pscope) { #ifndef CMAKE_BOOTSTRAP cmSystemTools::SaveRestoreEnvironment sre; @@ -331,7 +331,7 @@ int cmCTestScriptHandler::RunConfigurationScript( } bool cmCTestScriptHandler::RunScript(cmCTest* ctest, cmMakefile* mf, - const std::string& sname, bool InProcess, + std::string const& sname, bool InProcess, int* returnValue) { auto sh = cm::make_unique(ctest); diff --git a/Source/CTest/cmCTestScriptHandler.h b/Source/CTest/cmCTestScriptHandler.h index bcb3933..96a88dd 100644 --- a/Source/CTest/cmCTestScriptHandler.h +++ b/Source/CTest/cmCTestScriptHandler.h @@ -22,7 +22,7 @@ public: /** * Add a script to run, and if is should run in the current process */ - void AddConfigurationScript(const std::string&, bool pscope); + void AddConfigurationScript(std::string const&, bool pscope); /** * Run a dashboard using a specified configuration script @@ -33,7 +33,7 @@ public: * Run a script */ static bool RunScript(cmCTest* ctest, cmMakefile* mf, - const std::string& script, bool InProcess, + std::string const& script, bool InProcess, int* returnValue); /* @@ -42,8 +42,8 @@ public: void UpdateElapsedTime(); cmCTestScriptHandler(cmCTest* ctest); - cmCTestScriptHandler(const cmCTestScriptHandler&) = delete; - const cmCTestScriptHandler& operator=(const cmCTestScriptHandler&) = delete; + cmCTestScriptHandler(cmCTestScriptHandler const&) = delete; + cmCTestScriptHandler const& operator=(cmCTestScriptHandler const&) = delete; ~cmCTestScriptHandler(); void CreateCMake(); @@ -52,10 +52,10 @@ public: private: // reads in a script - int ReadInScript(const std::string& total_script_arg); - int ExecuteScript(const std::string& total_script_arg); + int ReadInScript(std::string const& total_script_arg); + int ExecuteScript(std::string const& total_script_arg); - int RunConfigurationScript(const std::string& script, bool pscope); + int RunConfigurationScript(std::string const& script, bool pscope); cmCTest* CTest = nullptr; std::vector ConfigurationScripts; diff --git a/Source/CTest/cmCTestStartCommand.cxx b/Source/CTest/cmCTestStartCommand.cxx index f6ff24b..42a4c93 100644 --- a/Source/CTest/cmCTestStartCommand.cxx +++ b/Source/CTest/cmCTestStartCommand.cxx @@ -25,7 +25,7 @@ bool cmCTestStartCommand::InitialPass(std::vector const& args, size_t cnt = 0; bool append = false; bool quiet = false; - const char* smodel = nullptr; + char const* smodel = nullptr; cmValue src_dir; cmValue bld_dir; @@ -110,7 +110,7 @@ bool cmCTestStartCommand::InitialPass(std::vector const& args, << " Build directory: " << *bld_dir << std::endl, quiet); } - const char* group = this->CTest->GetSpecificGroup(); + char const* group = this->CTest->GetSpecificGroup(); if (group) { cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, " Group: " << group << std::endl, quiet); diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx index 1564c0e..df908e6 100644 --- a/Source/CTest/cmCTestSubmitHandler.cxx +++ b/Source/CTest/cmCTestSubmitHandler.cxx @@ -62,18 +62,18 @@ private: return val; } - void StartElement(const std::string& /*name*/, - const char** /*atts*/) override + void StartElement(std::string const& /*name*/, + char const** /*atts*/) override { this->CurrentValue.clear(); } - void CharacterDataHandler(const char* data, int length) override + void CharacterDataHandler(char const* data, int length) override { cm::append(this->CurrentValue, data, data + length); } - void EndElement(const std::string& name) override + void EndElement(std::string const& name) override { if (name == "status") { std::string status = cmSystemTools::UpperCase(this->GetCurrentValue()); @@ -100,7 +100,7 @@ static size_t cmCTestSubmitHandlerWriteMemoryCallback(void* ptr, size_t size, size_t nmemb, void* data) { int realsize = static_cast(size * nmemb); - const char* chPtr = static_cast(ptr); + char const* chPtr = static_cast(ptr); cm::append(*static_cast(data), chPtr, chPtr + realsize); return realsize; @@ -128,8 +128,8 @@ cmCTestSubmitHandler::cmCTestSubmitHandler(cmCTest* ctest) } bool cmCTestSubmitHandler::SubmitUsingHTTP( - const std::string& localprefix, const std::vector& files, - const std::string& remoteprefix, const std::string& url) + std::string const& localprefix, std::vector const& files, + std::string const& remoteprefix, std::string const& url) { CURL* curl; FILE* ftpfile; @@ -707,7 +707,7 @@ int cmCTestSubmitHandler::ProcessHandler() this->CDashUploadType); } - const std::string& buildDirectory = + std::string const& buildDirectory = this->CTest->GetCTestConfiguration("BuildDirectory"); if (buildDirectory.empty()) { cmCTestLog(this->CTest, ERROR_MESSAGE, @@ -830,7 +830,7 @@ int cmCTestSubmitHandler::ProcessHandler() } cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, "Submit files\n", this->Quiet); - const char* specificGroup = this->CTest->GetSpecificGroup(); + char const* specificGroup = this->CTest->GetSpecificGroup(); if (specificGroup) { cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, " Send to group: " << specificGroup << std::endl, diff --git a/Source/CTest/cmCTestSubmitHandler.h b/Source/CTest/cmCTestSubmitHandler.h index 86067f6..d3e2739 100644 --- a/Source/CTest/cmCTestSubmitHandler.h +++ b/Source/CTest/cmCTestSubmitHandler.h @@ -51,10 +51,10 @@ private: /** * Submit file using various ways */ - bool SubmitUsingHTTP(const std::string& localprefix, - const std::vector& files, - const std::string& remoteprefix, - const std::string& url); + bool SubmitUsingHTTP(std::string const& localprefix, + std::vector const& files, + std::string const& remoteprefix, + std::string const& url); using cmCTestSubmitHandlerVectorOfChar = std::vector; diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index f42d84e..0eee5c3 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -64,8 +64,8 @@ public: } virtual ~cmCTestCommand() = default; - cmCTestCommand(const cmCTestCommand&) = default; - cmCTestCommand& operator=(const cmCTestCommand&) = default; + cmCTestCommand(cmCTestCommand const&) = default; + cmCTestCommand& operator=(cmCTestCommand const&) = default; bool operator()(std::vector const& args, cmExecutionStatus& status) @@ -99,7 +99,7 @@ bool ReadSubdirectory(std::string fname, cmExecutionStatus& status) status.SetError(workdir.GetError()); return false; } - const char* testFilename; + char const* testFilename; if (cmSystemTools::FileExists("CTestTestfile.cmake")) { // does the CTestTestfile.cmake exist ? testFilename = "CTestTestfile.cmake"; @@ -449,11 +449,11 @@ int cmCTestTestHandler::ProcessHandler() * regular expressions in `expressions`. Skip empty values. * Returns true if there were any expressions. */ -static bool BuildLabelRE(const std::vector& parts, +static bool BuildLabelRE(std::vector const& parts, std::vector& expressions) { expressions.clear(); - for (const auto& p : parts) { + for (auto const& p : parts) { if (!p.empty()) { expressions.emplace_back(p); } @@ -526,9 +526,9 @@ bool cmCTestTestHandler::ProcessOptions() return true; } -void cmCTestTestHandler::LogTestSummary(const std::vector& passed, - const std::vector& failed, - const cmDuration& durationInSecs) +void cmCTestTestHandler::LogTestSummary(std::vector const& passed, + std::vector const& failed, + cmDuration const& durationInSecs) { std::size_t total = passed.size() + failed.size(); @@ -567,7 +567,7 @@ void cmCTestTestHandler::LogTestSummary(const std::vector& passed, } void cmCTestTestHandler::LogDisabledTests( - const std::vector& disabledTests) + std::vector const& disabledTests) { if (!disabledTests.empty()) { cmGeneratedFileStream ofs; @@ -576,7 +576,7 @@ void cmCTestTestHandler::LogDisabledTests( << "The following tests did not run:" << std::endl); this->StartLogFile("TestsDisabled", ofs); - const char* disabled_reason; + char const* disabled_reason; cmCTestLog(this->CTest, HANDLER_OUTPUT, this->CTest->GetColorCode(cmCTest::Color::BLUE)); for (cmCTestTestResult const& dt : disabledTests) { @@ -595,8 +595,8 @@ void cmCTestTestHandler::LogDisabledTests( } } -void cmCTestTestHandler::LogFailedTests(const std::vector& failed, - const SetOfTests& resultsSet) +void cmCTestTestHandler::LogFailedTests(std::vector const& failed, + SetOfTests const& resultsSet) { if (!failed.empty()) { cmGeneratedFileStream ofs; @@ -617,7 +617,7 @@ void cmCTestTestHandler::LogFailedTests(const std::vector& failed, std::string ft_name_and_status = cmStrCat(ft.Name, " (", this->GetTestStatus(ft), ")"); std::string labels; - const cmCTestTestProperties& p = *ft.Properties; + cmCTestTestProperties const& p = *ft.Properties; if (!p.Labels.empty()) { static size_t const maxLen = 50; size_t const ns = ft_name_and_status.size() >= maxLen @@ -762,10 +762,10 @@ void cmCTestTestHandler::PrintLabelOrSubprojectSummary(bool doSubProject) * in order for the filter to apply to the test). */ static bool MatchLabelsAgainstFilterRE( - const std::vector& labels, - const std::vector& expressions) + std::vector const& labels, + std::vector const& expressions) { - for (const auto& re : expressions) { + for (auto const& re : expressions) { // check to see if the label regular expression matches bool found = false; // assume it does not match cmsys::RegularExpressionMatch match; @@ -978,7 +978,7 @@ void cmCTestTestHandler::UpdateForFixtures(ListOfTests& tests) const FixtureDependencies fixtureCleanups; for (auto it = this->TestList.begin(); it != this->TestList.end(); ++it) { - const cmCTestTestProperties& p = *it; + cmCTestTestProperties const& p = *it; for (std::string const& deps : p.FixturesSetup) { fixtureSetups.insert(std::make_pair(deps, it)); @@ -1039,7 +1039,7 @@ void cmCTestTestHandler::UpdateForFixtures(ListOfTests& tests) const std::pair setupRange = fixtureSetups.equal_range(requiredFixtureName); for (auto sIt = setupRange.first; sIt != setupRange.second; ++sIt) { - const std::string& setupTestName = sIt->second->Name; + std::string const& setupTestName = sIt->second->Name; tests[i].RequireSuccessDepends.insert(setupTestName); if (!cm::contains(tests[i].Depends, setupTestName)) { tests[i].Depends.push_back(setupTestName); @@ -1063,7 +1063,7 @@ void cmCTestTestHandler::UpdateForFixtures(ListOfTests& tests) const fixtureSetups.equal_range(requiredFixtureName); for (auto it = fixtureRange.first; it != fixtureRange.second; ++it) { ListOfTests::const_iterator lotIt = it->second; - const cmCTestTestProperties& p = *lotIt; + cmCTestTestProperties const& p = *lotIt; if (!addedTests.insert(p.Name).second) { // Already have p in our test list @@ -1094,7 +1094,7 @@ void cmCTestTestHandler::UpdateForFixtures(ListOfTests& tests) const fixtureCleanups.equal_range(requiredFixtureName); for (auto it = fixtureRange.first; it != fixtureRange.second; ++it) { ListOfTests::const_iterator lotIt = it->second; - const cmCTestTestProperties& p = *lotIt; + cmCTestTestProperties const& p = *lotIt; if (!addedTests.insert(p.Name).second) { // Already have p in our test list @@ -1135,16 +1135,16 @@ void cmCTestTestHandler::UpdateForFixtures(ListOfTests& tests) const // pathological case where setup and cleanup tests are in the test set // but no other test has that fixture as a requirement. for (cmCTestTestProperties& p : tests) { - const std::set& cleanups = p.FixturesCleanup; + std::set const& cleanups = p.FixturesCleanup; for (std::string const& fixture : cleanups) { // This cleanup test could be part of the original test list that was // passed in. It is then possible that no other test requires the // fIt fixture, so we have to check for this. auto cIt = fixtureRequirements.find(fixture); if (cIt != fixtureRequirements.end()) { - const std::vector& indices = cIt->second; + std::vector const& indices = cIt->second; for (size_t index : indices) { - const std::string& reqTestName = tests[index].Name; + std::string const& reqTestName = tests[index].Name; if (!cm::contains(p.Depends, reqTestName)) { p.Depends.push_back(reqTestName); } @@ -1155,9 +1155,9 @@ void cmCTestTestHandler::UpdateForFixtures(ListOfTests& tests) const // if no other test cases require the fixture cIt = setupFixturesAdded.find(fixture); if (cIt != setupFixturesAdded.end()) { - const std::vector& indices = cIt->second; + std::vector const& indices = cIt->second; for (size_t index : indices) { - const std::string& setupTestName = tests[index].Name; + std::string const& setupTestName = tests[index].Name; if (!cm::contains(p.Depends, setupTestName)) { p.Depends.push_back(setupTestName); } @@ -1187,7 +1187,7 @@ void cmCTestTestHandler::UpdateMaxTestNameWidth() } } -bool cmCTestTestHandler::GetValue(const char* tag, int& value, +bool cmCTestTestHandler::GetValue(char const* tag, int& value, std::istream& fin) { std::string line; @@ -1205,7 +1205,7 @@ bool cmCTestTestHandler::GetValue(const char* tag, int& value, return ret; } -bool cmCTestTestHandler::GetValue(const char* tag, double& value, +bool cmCTestTestHandler::GetValue(char const* tag, double& value, std::istream& fin) { std::string line; @@ -1223,7 +1223,7 @@ bool cmCTestTestHandler::GetValue(const char* tag, double& value, return ret; } -bool cmCTestTestHandler::GetValue(const char* tag, bool& value, +bool cmCTestTestHandler::GetValue(char const* tag, bool& value, std::istream& fin) { std::string line; @@ -1250,7 +1250,7 @@ bool cmCTestTestHandler::GetValue(const char* tag, bool& value, return ret; } -bool cmCTestTestHandler::GetValue(const char* tag, size_t& value, +bool cmCTestTestHandler::GetValue(char const* tag, size_t& value, std::istream& fin) { std::string line; @@ -1268,7 +1268,7 @@ bool cmCTestTestHandler::GetValue(const char* tag, size_t& value, return ret; } -bool cmCTestTestHandler::GetValue(const char* tag, std::string& value, +bool cmCTestTestHandler::GetValue(char const* tag, std::string& value, std::istream& fin) { std::string line; @@ -1418,7 +1418,7 @@ void cmCTestTestHandler::GenerateCTestXML(cmXMLWriter& xml) xml.Element("Value", result.ExecutionTime.count()); xml.EndElement(); // NamedMeasurement if (!result.Reason.empty()) { - const char* reasonType = "Pass Reason"; + char const* reasonType = "Pass Reason"; if (result.Status != cmCTestTestHandler::COMPLETED) { reasonType = "Fail Reason"; } @@ -1540,7 +1540,7 @@ void cmCTestTestHandler::AttachFiles(cmXMLWriter& xml, void cmCTestTestHandler::AttachFile(cmXMLWriter& xml, std::string const& file, std::string const& name) { - const std::string& base64 = this->CTest->Base64GzipEncodeFile(file); + std::string const& base64 = this->CTest->Base64GzipEncodeFile(file); std::string const fname = cmSystemTools::GetFilenameName(file); xml.StartElement("NamedMeasurement"); std::string measurement_name = name; @@ -1575,7 +1575,7 @@ int cmCTestTestHandler::ExecuteCommands(std::vector& vec) } // Find the appropriate executable to run for a test -std::string cmCTestTestHandler::FindTheExecutable(const std::string& exe) +std::string cmCTestTestHandler::FindTheExecutable(std::string const& exe) { std::string resConfig; std::vector extraPaths; @@ -1636,7 +1636,7 @@ void cmCTestTestHandler::AddConfigurations( // Find the appropriate executable to run for a test std::string cmCTestTestHandler::FindExecutable( - cmCTest* ctest, const std::string& testCommand, std::string& resultingConfig, + cmCTest* ctest, std::string const& testCommand, std::string& resultingConfig, std::vector& extraPaths, std::vector& failed) { // now run the compiled test if we can find it @@ -1715,7 +1715,7 @@ std::string cmCTestTestHandler::FindExecutable( } bool cmCTestTestHandler::ParseResourceGroupsProperty( - const std::string& val, + std::string const& val, std::vector>& resourceGroups) { cmCTestResourceGroupsLexerHelper lexer(resourceGroups); @@ -1761,7 +1761,7 @@ bool cmCTestTestHandler::GetListOfTests() cm.GetState()->AddBuiltinCommand("set_directory_properties", cmCTestSetDirectoryPropertiesCommand(this)); - const char* testFilename; + char const* testFilename; if (cmSystemTools::FileExists("CTestTestfile.cmake")) { // does the CTestTestfile.cmake exist ? testFilename = "CTestTestfile.cmake"; @@ -1818,7 +1818,7 @@ void cmCTestTestHandler::UseExcludeRegExp() std::string cmCTestTestHandler::GetTestStatus(cmCTestTestResult const& result) { - static const char* statuses[] = { "Not Run", "Timeout", "SEGFAULT", + static char const* statuses[] = { "Not Run", "Timeout", "SEGFAULT", "ILLEGAL", "INTERRUPT", "NUMERICAL", "OTHER_FAULT", "Failed", "BAD_COMMAND", "Completed" }; @@ -2008,7 +2008,7 @@ void cmCTestTestHandler::RecordCustomTestMeasurements(cmXMLWriter& xml, xml.EndElement(); } else if (parser.ElementName == "CTestMeasurementFile" || parser.ElementName == "DartMeasurementFile") { - const std::string& filename = cmCTest::CleanString(parser.CharacterData); + std::string const& filename = cmCTest::CleanString(parser.CharacterData); if (!cmSystemTools::FileExists(filename)) { xml.StartElement("NamedMeasurement"); xml.Attribute("name", parser.MeasurementName); @@ -2096,12 +2096,12 @@ void cmCTestTestHandler::CleanTestOutput(std::string& output, size_t length, // Advance n bytes in string delimited by begin/end but do not break in the // middle of a multi-byte UTF-8 encoding. auto utf8_advance = [](char const* const begin, char const* const end, - size_t n) -> const char* { + size_t n) -> char const* { char const* const stop = begin + n; char const* current = begin; while (current < stop) { unsigned int ch; - if (const char* next = cm_utf8_decode_character(current, end, &ch)) { + if (char const* next = cm_utf8_decode_character(current, end, &ch)) { if (next > stop) { break; } @@ -2115,7 +2115,7 @@ void cmCTestTestHandler::CleanTestOutput(std::string& output, size_t length, }; // Truncation message. - const std::string msg = + std::string const msg = "\n[This part of the test output was removed since it " "exceeds the threshold of " + std::to_string(length) + " bytes.]\n"; @@ -2150,7 +2150,7 @@ void cmCTestTestHandler::cmCTestTestProperties::AppendError( } bool cmCTestTestHandler::SetTestsProperties( - const std::vector& args) + std::vector const& args) { std::vector::const_iterator it; std::vector tests; @@ -2360,7 +2360,7 @@ bool cmCTestTestHandler::SetTestsProperties( } bool cmCTestTestHandler::SetDirectoryProperties( - const std::vector& args) + std::vector const& args) { std::vector::const_iterator it; std::vector tests; @@ -2404,9 +2404,9 @@ bool cmCTestTestHandler::SetDirectoryProperties( return true; } -bool cmCTestTestHandler::AddTest(const std::vector& args) +bool cmCTestTestHandler::AddTest(std::vector const& args) { - const std::string& testname = args[0]; + std::string const& testname = args[0]; cmCTestOptionalLog(this->CTest, DEBUG, "Add test: " << args[0] << std::endl, this->Quiet); @@ -2465,7 +2465,7 @@ bool cmCTestTestHandler::AddTest(const std::vector& args) } bool cmCTestTestHandler::cmCTestTestResourceRequirement::operator==( - const cmCTestTestResourceRequirement& other) const + cmCTestTestResourceRequirement const& other) const { return this->ResourceType == other.ResourceType && this->SlotsNeeded == other.SlotsNeeded && @@ -2473,12 +2473,12 @@ bool cmCTestTestHandler::cmCTestTestResourceRequirement::operator==( } bool cmCTestTestHandler::cmCTestTestResourceRequirement::operator!=( - const cmCTestTestResourceRequirement& other) const + cmCTestTestResourceRequirement const& other) const { return !(*this == other); } -void cmCTestTestHandler::SetJUnitXMLFileName(const std::string& filename) +void cmCTestTestHandler::SetJUnitXMLFileName(std::string const& filename) { this->TestOptions.JUnitXMLFileName = filename; } @@ -2547,7 +2547,7 @@ bool cmCTestTestHandler::WriteJUnitXML() "time", std::chrono::duration_cast(this->ElapsedTestingTime) .count()); - const std::time_t start_test_time_t = + std::time_t const start_test_time_t = std::chrono::system_clock::to_time_t(this->StartTestTime); cmTimestamp cmts; xml.Attribute("timestamp", diff --git a/Source/CTest/cmCTestTestHandler.h b/Source/CTest/cmCTestTestHandler.h index a9e2d67..393b3d3 100644 --- a/Source/CTest/cmCTestTestHandler.h +++ b/Source/CTest/cmCTestTestHandler.h @@ -96,17 +96,17 @@ public: /* * Add the test to the list of tests to be executed */ - bool AddTest(const std::vector& args); + bool AddTest(std::vector const& args); /* * Set tests properties */ - bool SetTestsProperties(const std::vector& args); + bool SetTestsProperties(std::vector const& args); /** * Set directory properties */ - bool SetDirectoryProperties(const std::vector& args); + bool SetDirectoryProperties(std::vector const& args); struct cmCTestTestResourceRequirement { @@ -114,8 +114,8 @@ public: int SlotsNeeded; int UnitsNeeded; - bool operator==(const cmCTestTestResourceRequirement& other) const; - bool operator!=(const cmCTestTestResourceRequirement& other) const; + bool operator==(cmCTestTestResourceRequirement const& other) const; + bool operator!=(cmCTestTestResourceRequirement const& other) const; }; struct Signal @@ -198,8 +198,8 @@ public: struct cmCTestTestResultLess { - bool operator()(const cmCTestTestResult& lhs, - const cmCTestTestResult& rhs) const + bool operator()(cmCTestTestResult const& lhs, + cmCTestTestResult const& rhs) const { return lhs.TestCount < rhs.TestCount; } @@ -213,19 +213,19 @@ public: // full signature static method to find an executable static std::string FindExecutable(cmCTest* ctest, - const std::string& testCommand, + std::string const& testCommand, std::string& resultingConfig, std::vector& extraPaths, std::vector& failed); static bool ParseResourceGroupsProperty( - const std::string& val, + std::string const& val, std::vector>& resourceGroups); using ListOfTests = std::vector; // Support for writing test results in JUnit XML format. - void SetJUnitXMLFileName(const std::string& id); + void SetJUnitXMLFileName(std::string const& id); protected: using SetOfTests = @@ -238,12 +238,12 @@ protected: int ExecuteCommands(std::vector& vec); bool ProcessOptions(); - void LogTestSummary(const std::vector& passed, - const std::vector& failed, - const cmDuration& durationInSecs); - void LogDisabledTests(const std::vector& disabledTests); - void LogFailedTests(const std::vector& failed, - const SetOfTests& resultsSet); + void LogTestSummary(std::vector const& passed, + std::vector const& failed, + cmDuration const& durationInSecs); + void LogDisabledTests(std::vector const& disabledTests); + void LogFailedTests(std::vector const& failed, + SetOfTests const& resultsSet); bool GenerateXML(); void WriteTestResultHeader(cmXMLWriter& xml, @@ -327,15 +327,15 @@ private: void UpdateMaxTestNameWidth(); - bool GetValue(const char* tag, std::string& value, std::istream& fin); - bool GetValue(const char* tag, int& value, std::istream& fin); - bool GetValue(const char* tag, size_t& value, std::istream& fin); - bool GetValue(const char* tag, bool& value, std::istream& fin); - bool GetValue(const char* tag, double& value, std::istream& fin); + bool GetValue(char const* tag, std::string& value, std::istream& fin); + bool GetValue(char const* tag, int& value, std::istream& fin); + bool GetValue(char const* tag, size_t& value, std::istream& fin); + bool GetValue(char const* tag, bool& value, std::istream& fin); + bool GetValue(char const* tag, double& value, std::istream& fin); /** * Find the executable for a test */ - std::string FindTheExecutable(const std::string& exe); + std::string FindTheExecutable(std::string const& exe); std::string GetTestStatus(cmCTestTestResult const&); void ExpandTestsToRunInformation(size_t numPossibleTests); diff --git a/Source/CTest/cmCTestTestMeasurementXMLParser.cxx b/Source/CTest/cmCTestTestMeasurementXMLParser.cxx index 636be24..b244e85 100644 --- a/Source/CTest/cmCTestTestMeasurementXMLParser.cxx +++ b/Source/CTest/cmCTestTestMeasurementXMLParser.cxx @@ -5,12 +5,12 @@ #include -void cmCTestTestMeasurementXMLParser::StartElement(const std::string& name, - const char** attributes) +void cmCTestTestMeasurementXMLParser::StartElement(std::string const& name, + char const** attributes) { this->CharacterData.clear(); this->ElementName = name; - for (const char** attr = attributes; *attr; attr += 2) { + for (char const** attr = attributes; *attr; attr += 2) { if (strcmp(attr[0], "name") == 0) { this->MeasurementName = attr[1]; } else if (strcmp(attr[0], "type") == 0) { @@ -19,7 +19,7 @@ void cmCTestTestMeasurementXMLParser::StartElement(const std::string& name, } } -void cmCTestTestMeasurementXMLParser::CharacterDataHandler(const char* data, +void cmCTestTestMeasurementXMLParser::CharacterDataHandler(char const* data, int length) { this->CharacterData.append(data, length); diff --git a/Source/CTest/cmCTestTestMeasurementXMLParser.h b/Source/CTest/cmCTestTestMeasurementXMLParser.h index b2c3eb3..240f225 100644 --- a/Source/CTest/cmCTestTestMeasurementXMLParser.h +++ b/Source/CTest/cmCTestTestMeasurementXMLParser.h @@ -15,7 +15,7 @@ public: std::string MeasurementType; protected: - void StartElement(const std::string& name, const char** atts) override; - void EndElement(const std::string& /*name*/) override {} - void CharacterDataHandler(const char* data, int length) override; + void StartElement(std::string const& name, char const** atts) override; + void EndElement(std::string const& /*name*/) override {} + void CharacterDataHandler(char const* data, int length) override; }; diff --git a/Source/CTest/cmCTestUpdateCommand.cxx b/Source/CTest/cmCTestUpdateCommand.cxx index 2e64585..b179e52 100644 --- a/Source/CTest/cmCTestUpdateCommand.cxx +++ b/Source/CTest/cmCTestUpdateCommand.cxx @@ -175,7 +175,7 @@ bool cmCTestUpdateCommand::ExecuteUpdate(UpdateArguments& args, // If no update command was specified, lookup one for this VCS tool. if (updateCommand.empty()) { - const char* key = TypeToCommandKey(updateType); + char const* key = TypeToCommandKey(updateType); if (key) { updateCommand = mf.GetSafeDefinition(key); } diff --git a/Source/CTest/cmCTestVC.cxx b/Source/CTest/cmCTestVC.cxx index 315067e..c88c1ad 100644 --- a/Source/CTest/cmCTestVC.cxx +++ b/Source/CTest/cmCTestVC.cxx @@ -38,7 +38,7 @@ void cmCTestVC::SetSourceDirectory(std::string const& dir) this->SourceDirectory = dir; } -bool cmCTestVC::InitialCheckout(const std::string& command) +bool cmCTestVC::InitialCheckout(std::string const& command) { cmCTestLog(this->CTest, HANDLER_OUTPUT, " First perform the initial checkout: " << command << "\n"); @@ -69,7 +69,7 @@ bool cmCTestVC::InitialCheckout(const std::string& command) return result; } -bool cmCTestVC::RunChild(const std::vector& cmd, +bool cmCTestVC::RunChild(std::vector const& cmd, OutputParser* out, OutputParser* err, std::string workDir, Encoding encoding) { @@ -84,10 +84,10 @@ bool cmCTestVC::RunChild(const std::vector& cmd, return status.front().SpawnResult == 0 && status.front().ExitStatus == 0; } -std::string cmCTestVC::ComputeCommandLine(const std::vector& cmd) +std::string cmCTestVC::ComputeCommandLine(std::vector const& cmd) { std::ostringstream line; - const char* sep = ""; + char const* sep = ""; for (auto const& arg : cmd) { line << sep << "\"" << arg << "\""; sep = " "; @@ -95,7 +95,7 @@ std::string cmCTestVC::ComputeCommandLine(const std::vector& cmd) return line.str(); } -bool cmCTestVC::RunUpdateCommand(const std::vector& cmd, +bool cmCTestVC::RunUpdateCommand(std::vector const& cmd, OutputParser* out, OutputParser* err, Encoding encoding) { @@ -202,7 +202,7 @@ void cmCTestVC::WriteXMLEntry(cmXMLWriter& xml, std::string const& path, std::string const& name, std::string const& full, File const& f) { - static const char* desc[3] = { "Updated", "Modified", "Conflicting" }; + static char const* desc[3] = { "Updated", "Modified", "Conflicting" }; Revision const& rev = f.Rev ? *f.Rev : this->Unknown; std::string prior = f.PriorRev ? f.PriorRev->Rev : std::string("Unknown"); xml.StartElement(desc[f.Status]); diff --git a/Source/CTest/cmCTestVC.h b/Source/CTest/cmCTestVC.h index 03b63de..52570c0 100644 --- a/Source/CTest/cmCTestVC.h +++ b/Source/CTest/cmCTestVC.h @@ -37,7 +37,7 @@ public: std::string GetNightlyTime(); /** Prepare the work tree. */ - bool InitialCheckout(const std::string& command); + bool InitialCheckout(std::string const& command); /** Perform cleanup operations on the work tree. */ void Cleanup(); @@ -110,15 +110,15 @@ protected: }; /** Convert a list of arguments to a human-readable command line. */ - static std::string ComputeCommandLine(const std::vector& cmd); + static std::string ComputeCommandLine(std::vector const& cmd); /** Run a command line and send output to given parsers. */ - bool RunChild(const std::vector& cmd, OutputParser* out, + bool RunChild(std::vector const& cmd, OutputParser* out, OutputParser* err, std::string workDir = {}, Encoding encoding = cmProcessOutput::Auto); /** Run VC update command line and send output to given parsers. */ - bool RunUpdateCommand(const std::vector& cmd, OutputParser* out, + bool RunUpdateCommand(std::vector const& cmd, OutputParser* out, OutputParser* err = nullptr, Encoding encoding = cmProcessOutput::Auto); diff --git a/Source/CTest/cmParseCacheCoverage.cxx b/Source/CTest/cmParseCacheCoverage.cxx index 84d7de0..07fa478 100644 --- a/Source/CTest/cmParseCacheCoverage.cxx +++ b/Source/CTest/cmParseCacheCoverage.cxx @@ -70,7 +70,7 @@ void cmParseCacheCoverage::RemoveUnCoveredFiles() } } -bool cmParseCacheCoverage::ReadCMCovFile(const char* file) +bool cmParseCacheCoverage::ReadCMCovFile(char const* file) { cmsys::ifstream in(file); if (!in) { diff --git a/Source/CTest/cmParseCacheCoverage.h b/Source/CTest/cmParseCacheCoverage.h index 523f83b..53be6fb 100644 --- a/Source/CTest/cmParseCacheCoverage.h +++ b/Source/CTest/cmParseCacheCoverage.h @@ -28,5 +28,5 @@ protected: // remove files with no coverage void RemoveUnCoveredFiles(); // Read a single mcov file - bool ReadCMCovFile(const char* f); + bool ReadCMCovFile(char const* f); }; diff --git a/Source/CTest/cmParseCoberturaCoverage.cxx b/Source/CTest/cmParseCoberturaCoverage.cxx index 9311769..5178721 100644 --- a/Source/CTest/cmParseCoberturaCoverage.cxx +++ b/Source/CTest/cmParseCoberturaCoverage.cxx @@ -22,7 +22,7 @@ public: } protected: - void EndElement(const std::string& name) override + void EndElement(std::string const& name) override { if (name == "source") { this->InSource = false; @@ -33,7 +33,7 @@ protected: } } - void CharacterDataHandler(const char* data, int length) override + void CharacterDataHandler(char const* data, int length) override { std::string tmp; tmp.insert(0, data, length); @@ -45,7 +45,7 @@ protected: } } - void StartElement(const std::string& name, const char** atts) override + void StartElement(std::string const& name, char const** atts) override { std::string FoundSource; std::string finalpath; @@ -157,7 +157,7 @@ cmParseCoberturaCoverage::cmParseCoberturaCoverage( { } -bool cmParseCoberturaCoverage::ReadCoverageXML(const char* xmlFile) +bool cmParseCoberturaCoverage::ReadCoverageXML(char const* xmlFile) { cmParseCoberturaCoverage::XMLParser parser(this->CTest, this->Coverage); parser.ParseFile(xmlFile); diff --git a/Source/CTest/cmParseCoberturaCoverage.h b/Source/CTest/cmParseCoberturaCoverage.h index 45b3f43..76cee3a 100644 --- a/Source/CTest/cmParseCoberturaCoverage.h +++ b/Source/CTest/cmParseCoberturaCoverage.h @@ -33,7 +33,7 @@ public: bool inSource; std::vector filepaths; //! Read the XML produced by running `coverage xml` - bool ReadCoverageXML(const char* xmlFile); + bool ReadCoverageXML(char const* xmlFile); private: class XMLParser; diff --git a/Source/CTest/cmParseDelphiCoverage.cxx b/Source/CTest/cmParseDelphiCoverage.cxx index 640873e..a781673 100644 --- a/Source/CTest/cmParseDelphiCoverage.cxx +++ b/Source/CTest/cmParseDelphiCoverage.cxx @@ -81,7 +81,7 @@ public: } return true; } - bool ParseFile(const char* file) + bool ParseFile(char const* file) { std::string line = file; std::string lineresult; @@ -224,7 +224,7 @@ bool cmParseDelphiCoverage::LoadCoverageData( return true; } -bool cmParseDelphiCoverage::ReadDelphiHTML(const char* file) +bool cmParseDelphiCoverage::ReadDelphiHTML(char const* file) { cmParseDelphiCoverage::HTMLParser parser(this->CTest, this->Coverage); parser.ParseFile(file); diff --git a/Source/CTest/cmParseDelphiCoverage.h b/Source/CTest/cmParseDelphiCoverage.h index 2a014a1..7fe33e2 100644 --- a/Source/CTest/cmParseDelphiCoverage.h +++ b/Source/CTest/cmParseDelphiCoverage.h @@ -24,9 +24,9 @@ class cmParseDelphiCoverage public: cmParseDelphiCoverage(cmCTestCoverageHandlerContainer& cont, cmCTest* ctest); bool LoadCoverageData(std::vector const& files); - bool ReadDelphiHTML(const char* file); + bool ReadDelphiHTML(char const* file); // Read a single HTML file from output - bool ReadHTMLFile(const char* f); + bool ReadHTMLFile(char const* f); protected: class HTMLParser; diff --git a/Source/CTest/cmParseGTMCoverage.cxx b/Source/CTest/cmParseGTMCoverage.cxx index c63b496..c7b2092 100644 --- a/Source/CTest/cmParseGTMCoverage.cxx +++ b/Source/CTest/cmParseGTMCoverage.cxx @@ -42,7 +42,7 @@ bool cmParseGTMCoverage::LoadCoverageData(std::string const& d) return true; } -bool cmParseGTMCoverage::ReadMCovFile(const char* file) +bool cmParseGTMCoverage::ReadMCovFile(char const* file) { cmsys::ifstream in(file); if (!in) { diff --git a/Source/CTest/cmParseGTMCoverage.h b/Source/CTest/cmParseGTMCoverage.h index c35bf6e..1d9e610 100644 --- a/Source/CTest/cmParseGTMCoverage.h +++ b/Source/CTest/cmParseGTMCoverage.h @@ -26,7 +26,7 @@ protected: // implement virtual from parent bool LoadCoverageData(std::string const& dir) override; // Read a single mcov file - bool ReadMCovFile(const char* f); + bool ReadMCovFile(char const* f); // find out what line in a mumps file (filepath) the given entry point // or function is. lineoffset is set by this method. bool FindFunctionInMumpsFile(std::string const& filepath, diff --git a/Source/CTest/cmParseJacocoCoverage.cxx b/Source/CTest/cmParseJacocoCoverage.cxx index 9cf30df..11eb26f 100644 --- a/Source/CTest/cmParseJacocoCoverage.cxx +++ b/Source/CTest/cmParseJacocoCoverage.cxx @@ -23,9 +23,9 @@ public: } protected: - void EndElement(const std::string& /*name*/) override {} + void EndElement(std::string const& /*name*/) override {} - void StartElement(const std::string& name, const char** atts) override + void StartElement(std::string const& name, char const** atts) override { if (name == "package") { this->PackageName = atts[1]; @@ -170,7 +170,7 @@ bool cmParseJacocoCoverage::LoadCoverageData( return true; } -bool cmParseJacocoCoverage::ReadJacocoXML(const char* file) +bool cmParseJacocoCoverage::ReadJacocoXML(char const* file) { cmParseJacocoCoverage::XMLParser parser(this->CTest, this->Coverage); parser.ParseFile(file); diff --git a/Source/CTest/cmParseJacocoCoverage.h b/Source/CTest/cmParseJacocoCoverage.h index 3442dd0..077d960 100644 --- a/Source/CTest/cmParseJacocoCoverage.h +++ b/Source/CTest/cmParseJacocoCoverage.h @@ -35,7 +35,7 @@ private: // remove files with no coverage void RemoveUnCoveredFiles(); // Read a single mcov file - bool ReadJacocoXML(const char* f); + bool ReadJacocoXML(char const* f); // split a string based on , bool SplitString(std::vector& args, std::string const& line); bool FindJavaFile(std::string const& routine, std::string& filepath); diff --git a/Source/CTest/cmParseMumpsCoverage.cxx b/Source/CTest/cmParseMumpsCoverage.cxx index dc3064d..6829d85 100644 --- a/Source/CTest/cmParseMumpsCoverage.cxx +++ b/Source/CTest/cmParseMumpsCoverage.cxx @@ -22,7 +22,7 @@ cmParseMumpsCoverage::cmParseMumpsCoverage( cmParseMumpsCoverage::~cmParseMumpsCoverage() = default; -bool cmParseMumpsCoverage::ReadCoverageFile(const char* file) +bool cmParseMumpsCoverage::ReadCoverageFile(char const* file) { // Read the gtm_coverage.mcov file, that has two lines of data: // packages:/full/path/to/Vista/Packages @@ -131,7 +131,7 @@ bool cmParseMumpsCoverage::FindMumpsFile(std::string const& routine, return true; } // try some alternate names - const char* tryname[] = { "GUX", "GTM", "ONT", nullptr }; + char const* tryname[] = { "GUX", "GTM", "ONT", nullptr }; for (int k = 0; tryname[k] != nullptr; k++) { std::string routine2 = routine + tryname[k]; i = this->RoutineToDirectory.find(routine2); diff --git a/Source/CTest/cmParseMumpsCoverage.h b/Source/CTest/cmParseMumpsCoverage.h index 00a8431..e325fd9 100644 --- a/Source/CTest/cmParseMumpsCoverage.h +++ b/Source/CTest/cmParseMumpsCoverage.h @@ -23,7 +23,7 @@ public: virtual ~cmParseMumpsCoverage(); // This is the toplevel coverage file locating the coverage files // and the mumps source code package tree. - bool ReadCoverageFile(const char* file); + bool ReadCoverageFile(char const* file); protected: // sub classes will use this to diff --git a/Source/CTest/cmParsePHPCoverage.cxx b/Source/CTest/cmParsePHPCoverage.cxx index 044f518..14c9fe8 100644 --- a/Source/CTest/cmParsePHPCoverage.cxx +++ b/Source/CTest/cmParsePHPCoverage.cxx @@ -171,7 +171,7 @@ bool cmParsePHPCoverage::ReadFileInformation(std::istream& in) return false; } -bool cmParsePHPCoverage::ReadPHPData(const char* file) +bool cmParsePHPCoverage::ReadPHPData(char const* file) { cmsys::ifstream in(file); if (!in) { @@ -200,7 +200,7 @@ bool cmParsePHPCoverage::ReadPHPData(const char* file) return true; } -bool cmParsePHPCoverage::ReadPHPCoverageDirectory(const char* d) +bool cmParsePHPCoverage::ReadPHPCoverageDirectory(char const* d) { cmsys::Directory dir; if (!dir.Load(d)) { diff --git a/Source/CTest/cmParsePHPCoverage.h b/Source/CTest/cmParsePHPCoverage.h index 763a6bb..797fff6 100644 --- a/Source/CTest/cmParsePHPCoverage.h +++ b/Source/CTest/cmParsePHPCoverage.h @@ -21,11 +21,11 @@ class cmParsePHPCoverage { public: cmParsePHPCoverage(cmCTestCoverageHandlerContainer& cont, cmCTest* ctest); - bool ReadPHPCoverageDirectory(const char* dir); + bool ReadPHPCoverageDirectory(char const* dir); void PrintCoverage(); private: - bool ReadPHPData(const char* file); + bool ReadPHPData(char const* file); bool ReadArraySize(std::istream& in, int& size); bool ReadFileInformation(std::istream& in); bool ReadInt(std::istream& in, int& v); diff --git a/Source/CTest/cmProcess.cxx b/Source/CTest/cmProcess.cxx index 7a89ffb..3e1beb9 100644 --- a/Source/CTest/cmProcess.cxx +++ b/Source/CTest/cmProcess.cxx @@ -171,7 +171,7 @@ bool cmProcess::Buffer::GetLine(std::string& line) for (size_type sz = this->size(); this->Last != sz; ++this->Last) { if ((*this)[this->Last] == '\n' || (*this)[this->Last] == '\0') { // Extract the range first..last as a line. - const char* text = this->data() + this->First; + char const* text = this->data() + this->First; size_type length = this->Last - this->First; while (length && text[length - 1] == '\r') { length--; @@ -210,13 +210,13 @@ bool cmProcess::Buffer::GetLast(std::string& line) } void cmProcess::OnReadCB(uv_stream_t* stream, ssize_t nread, - const uv_buf_t* buf) + uv_buf_t const* buf) { auto* self = static_cast(stream->data); self->OnRead(nread, buf); } -void cmProcess::OnRead(ssize_t nread, const uv_buf_t* buf) +void cmProcess::OnRead(ssize_t nread, uv_buf_t const* buf) { std::string line; if (nread > 0) { @@ -295,7 +295,7 @@ void cmProcess::OnTimeout() if (p->TimeoutGracePeriod) { this->Timeout = *p->TimeoutGracePeriod; } else { - static const cmDuration defaultGracePeriod{ 1.0 }; + static cmDuration const defaultGracePeriod{ 1.0 }; this->Timeout = defaultGracePeriod; } this->StartTimer(); @@ -535,7 +535,7 @@ std::string cmProcess::GetExitExceptionString() const case STATUS_NO_MEMORY: default: char buf[1024]; - const char* fmt = "Exit code 0x%" KWIML_INT_PRIx64 "\n"; + char const* fmt = "Exit code 0x%" KWIML_INT_PRIx64 "\n"; snprintf(buf, sizeof(buf), fmt, this->ExitValue); exception_str.assign(buf); } diff --git a/Source/CTest/cmProcess.h b/Source/CTest/cmProcess.h index 0131de6..24f0ed4 100644 --- a/Source/CTest/cmProcess.h +++ b/Source/CTest/cmProcess.h @@ -124,13 +124,13 @@ private: int term_signal); static void OnTimeoutCB(uv_timer_t* timer); static void OnReadCB(uv_stream_t* stream, ssize_t nread, - const uv_buf_t* buf); + uv_buf_t const* buf); static void OnAllocateCB(uv_handle_t* handle, size_t suggested_size, uv_buf_t* buf); void OnExit(int64_t exit_status, int term_signal); void OnTimeout(); - void OnRead(ssize_t nread, const uv_buf_t* buf); + void OnRead(ssize_t nread, uv_buf_t const* buf); void OnAllocate(size_t suggested_size, uv_buf_t* buf); void StartTimer(); @@ -151,7 +151,7 @@ private: std::string Command; std::string WorkingDirectory; std::vector Arguments; - std::vector ProcessArgs; + std::vector ProcessArgs; int Id; int64_t ExitValue; Termination TerminationStyle = Termination::Normal; diff --git a/Source/CTest/cmUVJobServerClient.cxx b/Source/CTest/cmUVJobServerClient.cxx index 055b29b..e528c25 100644 --- a/Source/CTest/cmUVJobServerClient.cxx +++ b/Source/CTest/cmUVJobServerClient.cxx @@ -169,7 +169,7 @@ public: void Connect(); void ConnectFDs(int rfd, int wfd); - void ConnectFIFO(const char* path); + void ConnectFIFO(char const* path); void Disconnect(int status); cm::uv_pipe_ptr OpenFD(int fd); @@ -180,10 +180,10 @@ public: static void OnAllocateCB(uv_handle_t* handle, size_t suggested_size, uv_buf_t* buf); static void OnReadCB(uv_stream_t* stream, ssize_t nread, - const uv_buf_t* buf); + uv_buf_t const* buf); void OnAllocate(size_t suggested_size, uv_buf_t* buf); - void OnRead(ssize_t nread, const uv_buf_t* buf); + void OnRead(ssize_t nread, uv_buf_t const* buf); char ReadBuf = '.'; @@ -220,7 +220,7 @@ void ImplPosix::Connect() // --jobserver-auth= for gnu make versions >= 4.2 // --jobserver-fds= for gnu make versions < 4.2 // -J for bsd make - static const std::vector prefixes = { + static std::vector const prefixes = { "--jobserver-auth=", "--jobserver-fds=", "-J" }; @@ -300,7 +300,7 @@ void ImplPosix::ConnectFDs(int rfd, int wfd) this->Conn = Connection::FDs; } -void ImplPosix::ConnectFIFO(const char* path) +void ImplPosix::ConnectFIFO(char const* path) { int fd = open(path, O_RDWR); if (fd < 0) { @@ -385,7 +385,7 @@ void ImplPosix::OnAllocateCB(uv_handle_t* handle, size_t suggested_size, } void ImplPosix::OnReadCB(uv_stream_t* stream, ssize_t nread, - const uv_buf_t* buf) + uv_buf_t const* buf) { auto* self = static_cast(stream->data); self->OnRead(nread, buf); @@ -396,7 +396,7 @@ void ImplPosix::OnAllocate(size_t /*suggested_size*/, uv_buf_t* buf) *buf = uv_buf_init(&this->ReadBuf, 1); } -void ImplPosix::OnRead(ssize_t nread, const uv_buf_t* /*buf*/) +void ImplPosix::OnRead(ssize_t nread, uv_buf_t const* /*buf*/) { if (nread == 0) { return; diff --git a/Source/Checks/cm_cxx_filesystem.cxx b/Source/Checks/cm_cxx_filesystem.cxx index 456ec46..ccbb339 100644 --- a/Source/Checks/cm_cxx_filesystem.cxx +++ b/Source/Checks/cm_cxx_filesystem.cxx @@ -50,7 +50,7 @@ int main() class my_string_view : public std::string_view { public: - my_string_view(const char* p) + my_string_view(char const* p) : std::string_view(p) { } diff --git a/Source/CursesDialog/ccmake.cxx b/Source/CursesDialog/ccmake.cxx index 8f7e515..c46d91a 100644 --- a/Source/CursesDialog/ccmake.cxx +++ b/Source/CursesDialog/ccmake.cxx @@ -24,12 +24,12 @@ #include "cmake.h" namespace { -const cmDocumentationEntry cmDocumentationName = { +cmDocumentationEntry const cmDocumentationName = { {}, " ccmake - Curses Interface for CMake." }; -const cmDocumentationEntry cmDocumentationUsage[2] = { +cmDocumentationEntry const cmDocumentationUsage[2] = { { {}, " ccmake \n" " ccmake " }, @@ -39,7 +39,7 @@ const cmDocumentationEntry cmDocumentationUsage[2] = { "directory to re-generate its build system." }, }; -const cmDocumentationEntry cmDocumentationUsageNote = { +cmDocumentationEntry const cmDocumentationUsageNote = { {}, "Run 'ccmake --help' for more information." }; @@ -157,7 +157,7 @@ int main(int argc, char const* const* argv) * joined by '\n' before display. * Removing any trailing '\n' avoid extra empty lines in the final results */ - auto cleanMessage = [](const std::string& message) -> std::string { + auto cleanMessage = [](std::string const& message) -> std::string { auto msg = message; if (!msg.empty() && msg.back() == '\n') { msg.pop_back(); @@ -165,13 +165,13 @@ int main(int argc, char const* const* argv) return msg; }; cmSystemTools::SetMessageCallback( - [&](const std::string& message, const cmMessageMetadata& md) { + [&](std::string const& message, cmMessageMetadata const& md) { myform->AddError(cleanMessage(message), md.title); }); - cmSystemTools::SetStderrCallback([&](const std::string& message) { + cmSystemTools::SetStderrCallback([&](std::string const& message) { myform->AddError(cleanMessage(message), ""); }); - cmSystemTools::SetStdoutCallback([&](const std::string& message) { + cmSystemTools::SetStdoutCallback([&](std::string const& message) { myform->UpdateProgress(cleanMessage(message), -1); }); diff --git a/Source/CursesDialog/cmCursesCacheEntryComposite.cxx b/Source/CursesDialog/cmCursesCacheEntryComposite.cxx index 3a47485..9f49ee2 100644 --- a/Source/CursesDialog/cmCursesCacheEntryComposite.cxx +++ b/Source/CursesDialog/cmCursesCacheEntryComposite.cxx @@ -22,7 +22,7 @@ #include "cmValue.h" cmCursesCacheEntryComposite::cmCursesCacheEntryComposite( - const std::string& key, int labelwidth, int entrywidth) + std::string const& key, int labelwidth, int entrywidth) : Key(key) , LabelWidth(labelwidth) , EntryWidth(entrywidth) @@ -35,7 +35,7 @@ cmCursesCacheEntryComposite::cmCursesCacheEntryComposite( } cmCursesCacheEntryComposite::cmCursesCacheEntryComposite( - const std::string& key, cmState* state, bool isNew, int labelwidth, + std::string const& key, cmState* state, bool isNew, int labelwidth, int entrywidth) : Key(key) , LabelWidth(labelwidth) @@ -100,7 +100,7 @@ cmCursesCacheEntryComposite::cmCursesCacheEntryComposite( cmCursesCacheEntryComposite::~cmCursesCacheEntryComposite() = default; -const char* cmCursesCacheEntryComposite::GetValue() +char const* cmCursesCacheEntryComposite::GetValue() { if (this->Label) { return this->Label->GetValue(); diff --git a/Source/CursesDialog/cmCursesCacheEntryComposite.h b/Source/CursesDialog/cmCursesCacheEntryComposite.h index d414918..2017a9f 100644 --- a/Source/CursesDialog/cmCursesCacheEntryComposite.h +++ b/Source/CursesDialog/cmCursesCacheEntryComposite.h @@ -14,9 +14,9 @@ class cmState; class cmCursesCacheEntryComposite { public: - cmCursesCacheEntryComposite(const std::string& key, int labelwidth, + cmCursesCacheEntryComposite(std::string const& key, int labelwidth, int entrywidth); - cmCursesCacheEntryComposite(const std::string& key, cmState* state, + cmCursesCacheEntryComposite(std::string const& key, cmState* state, bool isNew, int labelwidth, int entrywidth); ~cmCursesCacheEntryComposite(); @@ -28,7 +28,7 @@ public: cmCursesCacheEntryComposite& operator=(cmCursesCacheEntryComposite&&) = default; - const char* GetValue(); + char const* GetValue(); friend class cmCursesMainForm; diff --git a/Source/CursesDialog/cmCursesForm.cxx b/Source/CursesDialog/cmCursesForm.cxx index 900fbca..c02c5a4 100644 --- a/Source/CursesDialog/cmCursesForm.cxx +++ b/Source/CursesDialog/cmCursesForm.cxx @@ -40,7 +40,7 @@ void cmCursesForm::DebugEnd() cmCursesForm::DebugFile.close(); } -void cmCursesForm::LogMessage(const char* msg) +void cmCursesForm::LogMessage(char const* msg) { if (!cmCursesForm::Debug) { return; @@ -53,7 +53,7 @@ void cmCursesForm::HandleResize() { endwin(); if (!initscr()) { - static const char errmsg[] = "Error: ncurses initialization failed\n"; + static char const errmsg[] = "Error: ncurses initialization failed\n"; #ifdef _WIN32 fprintf(stderr, "%s", errmsg); #else diff --git a/Source/CursesDialog/cmCursesForm.h b/Source/CursesDialog/cmCursesForm.h index 3a1eb25..7e6e129 100644 --- a/Source/CursesDialog/cmCursesForm.h +++ b/Source/CursesDialog/cmCursesForm.h @@ -35,7 +35,7 @@ public: // Description: // During a CMake run, an error handle should add errors // to be displayed afterwards. - virtual void AddError(const std::string&, const char*) {} + virtual void AddError(std::string const&, char const*) {} // Description: // Turn debugging on. This will create ccmakelog.txt. @@ -47,7 +47,7 @@ public: // Description: // Write a debugging message. - static void LogMessage(const char* msg); + static void LogMessage(char const* msg); // Description: // Return the FORM. Should be only used by low-level methods. diff --git a/Source/CursesDialog/cmCursesLabelWidget.cxx b/Source/CursesDialog/cmCursesLabelWidget.cxx index 83aea5a..f8dd132 100644 --- a/Source/CursesDialog/cmCursesLabelWidget.cxx +++ b/Source/CursesDialog/cmCursesLabelWidget.cxx @@ -5,7 +5,7 @@ #include "cmCursesWidget.h" cmCursesLabelWidget::cmCursesLabelWidget(int width, int height, int left, - int top, const std::string& name) + int top, std::string const& name) : cmCursesWidget(width, height, left, top) { field_opts_off(this->Field, O_EDIT); diff --git a/Source/CursesDialog/cmCursesLabelWidget.h b/Source/CursesDialog/cmCursesLabelWidget.h index c10aa37..698491d 100644 --- a/Source/CursesDialog/cmCursesLabelWidget.h +++ b/Source/CursesDialog/cmCursesLabelWidget.h @@ -15,7 +15,7 @@ class cmCursesLabelWidget : public cmCursesWidget { public: cmCursesLabelWidget(int width, int height, int left, int top, - const std::string& name); + std::string const& name); ~cmCursesLabelWidget() override; cmCursesLabelWidget(cmCursesLabelWidget const&) = delete; diff --git a/Source/CursesDialog/cmCursesLongMessageForm.cxx b/Source/CursesDialog/cmCursesLongMessageForm.cxx index 6e6f0d6..8c3982a 100644 --- a/Source/CursesDialog/cmCursesLongMessageForm.cxx +++ b/Source/CursesDialog/cmCursesLongMessageForm.cxx @@ -17,7 +17,7 @@ inline int ctrl(int z) } cmCursesLongMessageForm::cmCursesLongMessageForm( - std::vector const& messages, const char* title, + std::vector const& messages, char const* title, ScrollBehavior scrollBehavior) : Scrolling(scrollBehavior) { @@ -148,7 +148,7 @@ void cmCursesLongMessageForm::Render(int /*left*/, int /*top*/, int /*width*/, refresh(); } -void cmCursesLongMessageForm::DrawMessage(const char* msg) const +void cmCursesLongMessageForm::DrawMessage(char const* msg) const { int i = 0; while (msg[i] != '\0' && i < MAX_CONTENT_SIZE) { diff --git a/Source/CursesDialog/cmCursesLongMessageForm.h b/Source/CursesDialog/cmCursesLongMessageForm.h index 4f69cb1..4421120 100644 --- a/Source/CursesDialog/cmCursesLongMessageForm.h +++ b/Source/CursesDialog/cmCursesLongMessageForm.h @@ -20,7 +20,7 @@ public: }; cmCursesLongMessageForm(std::vector const& messages, - const char* title, ScrollBehavior scrollBehavior); + char const* title, ScrollBehavior scrollBehavior); ~cmCursesLongMessageForm() override; cmCursesLongMessageForm(cmCursesLongMessageForm const&) = delete; @@ -50,7 +50,7 @@ public: protected: static constexpr int MAX_CONTENT_SIZE = 60000; - void DrawMessage(const char* msg) const; + void DrawMessage(char const* msg) const; std::string Messages; std::string Title; diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx index 81bf0b3..23a28db 100644 --- a/Source/CursesDialog/cmCursesMainForm.cxx +++ b/Source/CursesDialog/cmCursesMainForm.cxx @@ -61,7 +61,7 @@ cmCursesMainForm::~cmCursesMainForm() } // See if a cache entry is in the list of entries in the ui. -bool cmCursesMainForm::LookForCacheEntry(const std::string& key) +bool cmCursesMainForm::LookForCacheEntry(std::string const& key) { return std::any_of(this->Entries.begin(), this->Entries.end(), [&key](cmCursesCacheEntryComposite const& entry) { @@ -326,7 +326,7 @@ void cmCursesMainForm::PrintKeys(int process /* = 0 */) " "); } { - const char* toggleKeyInstruction = + char const* toggleKeyInstruction = " [t] Toggle advanced mode (currently %s)"; snprintf(thirdLine, sizeof(thirdLine), toggleKeyInstruction, this->AdvancedMode ? "on" : "off"); @@ -439,7 +439,7 @@ void cmCursesMainForm::UpdateStatusBar(cm::optional message) pos_form_cursor(this->Form); } -void cmCursesMainForm::UpdateProgress(const std::string& msg, float prog) +void cmCursesMainForm::UpdateProgress(std::string const& msg, float prog) { if (prog >= 0) { constexpr int progressBarWidth = 40; @@ -473,7 +473,7 @@ int cmCursesMainForm::Configure(int noconfigure) if (noconfigure == 0) { this->UpdateProgress("Configuring", 0); this->CMakeInstance->SetProgressCallback( - [this](const std::string& msg, float prog) { + [this](std::string const& msg, float prog) { this->UpdateProgress(msg, prog); }); } @@ -505,7 +505,7 @@ int cmCursesMainForm::Configure(int noconfigure) int xx; int yy; getmaxyx(stdscr, yy, xx); - const char* title = "Configure produced the following output"; + char const* title = "Configure produced the following output"; if (cmSystemTools::GetErrorOccurredFlag()) { title = "Configure failed with the following output"; } @@ -540,7 +540,7 @@ int cmCursesMainForm::Generate() this->UpdateProgress("Generating", 0); this->CMakeInstance->SetProgressCallback( - [this](const std::string& msg, float prog) { + [this](std::string const& msg, float prog) { this->UpdateProgress(msg, prog); }); @@ -560,7 +560,7 @@ int cmCursesMainForm::Generate() int xx; int yy; getmaxyx(stdscr, yy, xx); - const char* title = "Generate produced the following output"; + char const* title = "Generate produced the following output"; if (cmSystemTools::GetErrorOccurredFlag()) { title = "Generate failed with the following output"; } @@ -587,15 +587,15 @@ int cmCursesMainForm::Generate() return 0; } -void cmCursesMainForm::AddError(const std::string& message, - const char* /*unused*/) +void cmCursesMainForm::AddError(std::string const& message, + char const* /*unused*/) { this->Outputs.emplace_back(message); this->HasNonStatusOutputs = true; this->DisplayOutputs(message); } -void cmCursesMainForm::RemoveEntry(const char* value) +void cmCursesMainForm::RemoveEntry(char const* value) { if (!value) { return; @@ -604,7 +604,7 @@ void cmCursesMainForm::RemoveEntry(const char* value) auto removeIt = std::find_if(this->Entries.begin(), this->Entries.end(), [value](cmCursesCacheEntryComposite& entry) -> bool { - const char* val = entry.GetValue(); + char const* val = entry.GetValue(); return val && !strcmp(value, val); }); @@ -618,7 +618,7 @@ void cmCursesMainForm::RemoveEntry(const char* value) void cmCursesMainForm::FillCacheManagerFromUI() { for (cmCursesCacheEntryComposite& entry : this->Entries) { - const std::string& cacheKey = entry.Key; + std::string const& cacheKey = entry.Key; cmValue existingValue = this->CMakeInstance->GetState()->GetCacheEntryValue(cacheKey); if (existingValue) { @@ -643,7 +643,7 @@ void cmCursesMainForm::FillCacheManagerFromUI() } void cmCursesMainForm::FixValue(cmStateEnums::CacheEntryType type, - const std::string& in, std::string& out) const + std::string const& in, std::string& out) const { out = in.substr(0, in.find_last_not_of(' ') + 1); if (type == cmStateEnums::PATH || type == cmStateEnums::FILEPATH) { @@ -826,7 +826,7 @@ void cmCursesMainForm::HandleInput() int findex = field_index(cur); cmCursesWidget* lbl = reinterpret_cast( field_userptr(this->Fields[findex - 2])); - const char* curField = lbl->GetValue(); + char const* curField = lbl->GetValue(); cmValue helpString = nullptr; cmValue existingValue = @@ -955,7 +955,7 @@ void cmCursesMainForm::HandleInput() } } -int cmCursesMainForm::LoadCache(const char* /*unused*/) +int cmCursesMainForm::LoadCache(char const* /*unused*/) { int r = this->CMakeInstance->LoadCache(); @@ -972,12 +972,12 @@ int cmCursesMainForm::LoadCache(const char* /*unused*/) return r; } -void cmCursesMainForm::JumpToCacheEntry(const char* astr) +void cmCursesMainForm::JumpToCacheEntry(char const* astr) { this->JumpToCacheEntry(astr, false); } -void cmCursesMainForm::JumpToCacheEntry(const char* astr, bool reverse) +void cmCursesMainForm::JumpToCacheEntry(char const* astr, bool reverse) { std::string str; if (astr) { @@ -998,7 +998,7 @@ void cmCursesMainForm::JumpToCacheEntry(const char* astr, bool reverse) field_userptr(this->Fields[findex - 2])); } if (lbl) { - const char* curField = lbl->GetValue(); + char const* curField = lbl->GetValue(); if (curField) { std::string cfld = cmSystemTools::LowerCase(curField); if (cfld.find(str) != std::string::npos && findex != start_index) { @@ -1057,7 +1057,7 @@ void cmCursesMainForm::DisplayOutputs(std::string const& newOutput) } } -const char* cmCursesMainForm::s_ConstHelpMessage = +char const* cmCursesMainForm::s_ConstHelpMessage = "CMake is used to configure and generate build files for software projects. " "The basic steps for configuring a project with ccmake are as follows:\n\n" "1. Run ccmake in the directory where you want the object and executable " diff --git a/Source/CursesDialog/cmCursesMainForm.h b/Source/CursesDialog/cmCursesMainForm.h index 1ce75e7..9dbbfdd 100644 --- a/Source/CursesDialog/cmCursesMainForm.h +++ b/Source/CursesDialog/cmCursesMainForm.h @@ -53,7 +53,7 @@ public: * Returns true if an entry with the given key is in the * list of current composites. */ - bool LookForCacheEntry(const std::string& key); + bool LookForCacheEntry(std::string const& key); enum { @@ -84,7 +84,7 @@ public: * During a CMake run, an error handle should add errors * to be displayed afterwards. */ - void AddError(const std::string& message, const char* title) override; + void AddError(std::string const& message, char const* title) override; /** * Write files to cache file without reconfiguring. @@ -105,30 +105,30 @@ public: /** * Used by main program */ - int LoadCache(const char* dir); + int LoadCache(char const* dir); /** * Progress callback */ - void UpdateProgress(const std::string& msg, float prog); + void UpdateProgress(std::string const& msg, float prog); protected: // Copy the cache values from the user interface to the actual // cache. void FillCacheManagerFromUI(); // Fix formatting of values to a consistent form. - void FixValue(cmStateEnums::CacheEntryType type, const std::string& in, + void FixValue(cmStateEnums::CacheEntryType type, std::string const& in, std::string& out) const; // Re-post the existing fields. Used to toggle between // normal and advanced modes. Render() should be called // afterwards. void RePost(); // Remove an entry from the interface and the cache. - void RemoveEntry(const char* value); + void RemoveEntry(char const* value); // Jump to the cache entry whose name matches the string. - void JumpToCacheEntry(const char* str); - void JumpToCacheEntry(const char* str, bool reverse); + void JumpToCacheEntry(char const* str); + void JumpToCacheEntry(char const* str, bool reverse); // Clear and reset the output log and state void ResetOutputs(); @@ -156,7 +156,7 @@ protected: std::vector HelpMessage; // Common help - static const char* s_ConstHelpMessage; + static char const* s_ConstHelpMessage; // Fields displayed. Includes labels, new entry markers, entries std::vector Fields; diff --git a/Source/CursesDialog/cmCursesOptionsWidget.cxx b/Source/CursesDialog/cmCursesOptionsWidget.cxx index 5238e2d..dd54a70 100644 --- a/Source/CursesDialog/cmCursesOptionsWidget.cxx +++ b/Source/CursesDialog/cmCursesOptionsWidget.cxx @@ -79,7 +79,7 @@ void cmCursesOptionsWidget::PreviousOption() this->SetValue(this->Options[this->CurrentOption]); } -void cmCursesOptionsWidget::SetOption(const std::string& value) +void cmCursesOptionsWidget::SetOption(std::string const& value) { this->CurrentOption = 0; // default to 0 index this->SetValue(value); diff --git a/Source/CursesDialog/cmCursesOptionsWidget.h b/Source/CursesDialog/cmCursesOptionsWidget.h index cb06e4d..311c4f2 100644 --- a/Source/CursesDialog/cmCursesOptionsWidget.h +++ b/Source/CursesDialog/cmCursesOptionsWidget.h @@ -25,7 +25,7 @@ public: // when this widget has focus. Returns true if the input was // handled. bool HandleInput(int& key, cmCursesMainForm* fm, WINDOW* w) override; - void SetOption(const std::string&); + void SetOption(std::string const&); void AddOption(std::string const&); void NextOption(); void PreviousOption(); diff --git a/Source/CursesDialog/cmCursesStringWidget.cxx b/Source/CursesDialog/cmCursesStringWidget.cxx index c0d06ce..e1cf01a 100644 --- a/Source/CursesDialog/cmCursesStringWidget.cxx +++ b/Source/CursesDialog/cmCursesStringWidget.cxx @@ -165,17 +165,17 @@ bool cmCursesStringWidget::HandleInput(int& key, cmCursesMainForm* fm, return true; } -void cmCursesStringWidget::SetString(const std::string& value) +void cmCursesStringWidget::SetString(std::string const& value) { this->SetValue(value); } -const char* cmCursesStringWidget::GetString() +char const* cmCursesStringWidget::GetString() { return this->GetValue(); } -const char* cmCursesStringWidget::GetValue() +char const* cmCursesStringWidget::GetValue() { return field_buffer(this->Field, 0); } diff --git a/Source/CursesDialog/cmCursesStringWidget.h b/Source/CursesDialog/cmCursesStringWidget.h index faa2ade..d125fa5 100644 --- a/Source/CursesDialog/cmCursesStringWidget.h +++ b/Source/CursesDialog/cmCursesStringWidget.h @@ -32,9 +32,9 @@ public: /** * Set/Get the string. */ - void SetString(const std::string& value); - const char* GetString(); - const char* GetValue() override; + void SetString(std::string const& value); + char const* GetString(); + char const* GetValue() override; /** * Set/Get InEdit flag. Can be used to tell the widget to leave diff --git a/Source/CursesDialog/cmCursesWidget.cxx b/Source/CursesDialog/cmCursesWidget.cxx index cc07411..0568290 100644 --- a/Source/CursesDialog/cmCursesWidget.cxx +++ b/Source/CursesDialog/cmCursesWidget.cxx @@ -32,13 +32,13 @@ void cmCursesWidget::Move(int x, int y, bool isNewPage) } } -void cmCursesWidget::SetValue(const std::string& value) +void cmCursesWidget::SetValue(std::string const& value) { this->Value = value; set_field_buffer(this->Field, 0, const_cast(value.c_str())); } -const char* cmCursesWidget::GetValue() +char const* cmCursesWidget::GetValue() { return this->Value.c_str(); } diff --git a/Source/CursesDialog/cmCursesWidget.h b/Source/CursesDialog/cmCursesWidget.h index 29ec28b..e81552f 100644 --- a/Source/CursesDialog/cmCursesWidget.h +++ b/Source/CursesDialog/cmCursesWidget.h @@ -37,8 +37,8 @@ public: * Set/Get the value (setting the value also changes the contents * of the field buffer). */ - virtual void SetValue(const std::string& value); - virtual const char* GetValue(); + virtual void SetValue(std::string const& value); + virtual char const* GetValue(); /** * Get the type of the widget (STRING, PATH etc...) diff --git a/Source/QtDialog/AddCacheEntry.cxx b/Source/QtDialog/AddCacheEntry.cxx index 7c34c60..817f79e 100644 --- a/Source/QtDialog/AddCacheEntry.cxx +++ b/Source/QtDialog/AddCacheEntry.cxx @@ -6,17 +6,17 @@ #include #include -static const int NumTypes = 4; -static const int DefaultTypeIndex = 0; -static const QByteArray TypeStrings[NumTypes] = { "BOOL", "PATH", "FILEPATH", +static int const NumTypes = 4; +static int const DefaultTypeIndex = 0; +static QByteArray const TypeStrings[NumTypes] = { "BOOL", "PATH", "FILEPATH", "STRING" }; -static const QCMakeProperty::PropertyType Types[NumTypes] = { +static QCMakeProperty::PropertyType const Types[NumTypes] = { QCMakeProperty::BOOL, QCMakeProperty::PATH, QCMakeProperty::FILEPATH, QCMakeProperty::STRING }; -AddCacheEntry::AddCacheEntry(QWidget* p, const QStringList& varNames, - const QStringList& varTypes) +AddCacheEntry::AddCacheEntry(QWidget* p, QStringList const& varNames, + QStringList const& varTypes) : QWidget(p) , VarNames(varNames) , VarTypes(varTypes) @@ -43,7 +43,7 @@ AddCacheEntry::AddCacheEntry(QWidget* p, const QStringList& varNames, this->Name->setCompleter(completer); connect( completer, - static_cast(&QCompleter::activated), + static_cast(&QCompleter::activated), this, &AddCacheEntry::onCompletionActivated); } @@ -87,7 +87,7 @@ QString AddCacheEntry::typeString() const return TypeStrings[DefaultTypeIndex]; } -void AddCacheEntry::onCompletionActivated(const QString& text) +void AddCacheEntry::onCompletionActivated(QString const& text) { cm_qsizetype idx = this->VarNames.indexOf(text); if (idx != -1) { diff --git a/Source/QtDialog/AddCacheEntry.h b/Source/QtDialog/AddCacheEntry.h index 35522c5..2837e3d 100644 --- a/Source/QtDialog/AddCacheEntry.h +++ b/Source/QtDialog/AddCacheEntry.h @@ -15,8 +15,8 @@ class AddCacheEntry { Q_OBJECT public: - AddCacheEntry(QWidget* p, const QStringList& varNames, - const QStringList& varTypes); + AddCacheEntry(QWidget* p, QStringList const& varNames, + QStringList const& varTypes); QString name() const; QVariant value() const; @@ -25,9 +25,9 @@ public: QString typeString() const; private slots: - void onCompletionActivated(const QString& text); + void onCompletionActivated(QString const& text); private: - const QStringList& VarNames; - const QStringList& VarTypes; + QStringList const& VarNames; + QStringList const& VarTypes; }; diff --git a/Source/QtDialog/CMakeSetup.cxx b/Source/QtDialog/CMakeSetup.cxx index c3adae1..f634161 100644 --- a/Source/QtDialog/CMakeSetup.cxx +++ b/Source/QtDialog/CMakeSetup.cxx @@ -23,12 +23,12 @@ #include "cmake.h" namespace { -const cmDocumentationEntry cmDocumentationName = { +cmDocumentationEntry const cmDocumentationName = { {}, " cmake-gui - CMake GUI." }; -const cmDocumentationEntry cmDocumentationUsage = { +cmDocumentationEntry const cmDocumentationUsage = { {}, " cmake-gui [options]\n" " cmake-gui [options] \n" @@ -37,7 +37,7 @@ const cmDocumentationEntry cmDocumentationUsage = { " cmake-gui [options] --browse-manual []" }; -const cmDocumentationEntry cmDocumentationOptions[3] = { +cmDocumentationEntry const cmDocumentationOptions[3] = { { "-S ", "Explicitly specify a source directory." }, { "-B ", "Explicitly specify a build directory." }, { "--preset=", "Specify a configure preset." } @@ -62,7 +62,7 @@ Q_IMPORT_PLUGIN(QWindowsVistaStylePlugin); int CMakeGUIExec(CMakeSetupDialog* window); void SetupDefaultQSettings(); -void OpenReferenceManual(const QString& filename); +void OpenReferenceManual(QString const& filename); int main(int argc, char** argv) { @@ -156,7 +156,7 @@ int main(int argc, char** argv) std::string sourceDirectory; std::string presetName; for (int i = 1; i < args.size(); ++i) { - const QString& arg = args[i]; + QString const& arg = args[i]; if (arg.startsWith("-S")) { QString path = arg.mid(2); if (path.isEmpty()) { diff --git a/Source/QtDialog/CMakeSetupDialog.cxx b/Source/QtDialog/CMakeSetupDialog.cxx index af6cf74..a7ae291 100644 --- a/Source/QtDialog/CMakeSetupDialog.cxx +++ b/Source/QtDialog/CMakeSetupDialog.cxx @@ -43,7 +43,7 @@ #include "RegexExplorer.h" #include "WarningMessagesDialog.h" -void OpenReferenceManual(const QString& filename) +void OpenReferenceManual(QString const& filename) { QString urlFormat("https://cmake.org/cmake/help/v%1.%2/"); QUrl url(urlFormat.arg(QString::number(cmVersion::GetMajorVersion()), @@ -59,7 +59,7 @@ void OpenReferenceManual(const QString& filename) } namespace { -const QString PRESETS_DISABLED_TOOLTIP = +QString const PRESETS_DISABLED_TOOLTIP = "This option is disabled because there are no available presets in " "CMakePresets.json or CMakeUserPresets.json."; } @@ -709,7 +709,7 @@ void CMakeSetupDialog::doSourceBrowse() } } -void CMakeSetupDialog::updateSourceDirectory(const QString& dir) +void CMakeSetupDialog::updateSourceDirectory(QString const& dir) { if (this->SourceDirectory->text() != dir) { this->SourceDirectory->blockSignals(true); @@ -718,7 +718,7 @@ void CMakeSetupDialog::updateSourceDirectory(const QString& dir) } } -void CMakeSetupDialog::updateBinaryDirectory(const QString& dir) +void CMakeSetupDialog::updateBinaryDirectory(QString const& dir) { if (this->BinaryDirectory->currentText() != dir) { this->BinaryDirectory->blockSignals(true); @@ -727,7 +727,7 @@ void CMakeSetupDialog::updateBinaryDirectory(const QString& dir) } } -void CMakeSetupDialog::updatePresets(const QVector& presets) +void CMakeSetupDialog::updatePresets(QVector const& presets) { if (this->Preset->presets() != presets) { this->Preset->blockSignals(true); @@ -744,7 +744,7 @@ void CMakeSetupDialog::updatePresets(const QVector& presets) } } -void CMakeSetupDialog::updatePreset(const QString& name) +void CMakeSetupDialog::updatePreset(QString const& name) { if (this->Preset->presetName() != name) { this->Preset->blockSignals(true); @@ -753,8 +753,8 @@ void CMakeSetupDialog::updatePreset(const QString& name) } } -void CMakeSetupDialog::showPresetLoadError(const QString& dir, - const QString& message) +void CMakeSetupDialog::showPresetLoadError(QString const& dir, + QString const& message) { QMessageBox::warning( this, "Error Reading CMake Presets", @@ -778,7 +778,7 @@ void CMakeSetupDialog::doBinaryBrowse() } } -void CMakeSetupDialog::setBinaryDirectory(const QString& dir) +void CMakeSetupDialog::setBinaryDirectory(QString const& dir) { this->BinaryDirectory->setEditText(dir); } @@ -788,7 +788,7 @@ void CMakeSetupDialog::setStartupBinaryDirectory(bool startup) this->StartupBinaryDirectory = startup; } -void CMakeSetupDialog::onSourceDirectoryChanged(const QString& dir) +void CMakeSetupDialog::onSourceDirectoryChanged(QString const& dir) { this->Output->clear(); QMetaObject::invokeMethod(this->CMakeThread->cmakeInstance(), @@ -796,7 +796,7 @@ void CMakeSetupDialog::onSourceDirectoryChanged(const QString& dir) Q_ARG(QString, dir)); } -void CMakeSetupDialog::onBinaryDirectoryChanged(const QString& dir) +void CMakeSetupDialog::onBinaryDirectoryChanged(QString const& dir) { QString title = QString(tr("CMake %1 - %2")); title = title.arg(cmVersion::GetCMakeVersion()); @@ -813,7 +813,7 @@ void CMakeSetupDialog::onBinaryDirectoryChanged(const QString& dir) Q_ARG(QString, dir)); } -void CMakeSetupDialog::onBuildPresetChanged(const QString& name) +void CMakeSetupDialog::onBuildPresetChanged(QString const& name) { QMetaObject::invokeMethod(this->CMakeThread->cmakeInstance(), "setPreset", Qt::QueuedConnection, Q_ARG(QString, name), @@ -821,17 +821,17 @@ void CMakeSetupDialog::onBuildPresetChanged(const QString& name) this->StartupBinaryDirectory = false; } -void CMakeSetupDialog::setSourceDirectory(const QString& dir) +void CMakeSetupDialog::setSourceDirectory(QString const& dir) { this->SourceDirectory->setText(dir); } -void CMakeSetupDialog::setDeferredPreset(const QString& preset) +void CMakeSetupDialog::setDeferredPreset(QString const& preset) { this->DeferredPreset = preset; } -void CMakeSetupDialog::showProgress(const QString& /*msg*/, float percent) +void CMakeSetupDialog::showProgress(QString const& /*msg*/, float percent) { percent = (percent * ProgressFactor) + ProgressOffset; this->ProgressBar->setValue(qRound(percent * 100)); @@ -843,7 +843,7 @@ void CMakeSetupDialog::showProgress(const QString& /*msg*/, float percent) #endif } -void CMakeSetupDialog::error(const QString& msg) +void CMakeSetupDialog::error(QString const& msg) { this->Output->setCurrentCharFormat(this->ErrorFormat); // QTextEdit will terminate the msg with a ParagraphSeparator, but it also @@ -856,7 +856,7 @@ void CMakeSetupDialog::error(const QString& msg) this->Output->append(paragraph); } -void CMakeSetupDialog::message(const QString& msg) +void CMakeSetupDialog::message(QString const& msg) { this->Output->setCurrentCharFormat(this->MessageFormat); this->Output->append(msg); @@ -986,7 +986,7 @@ bool CMakeSetupDialog::setupFirstConfigure() return false; } -void CMakeSetupDialog::updateGeneratorLabel(const QString& gen) +void CMakeSetupDialog::updateGeneratorLabel(QString const& gen) { QString str = tr("Current Generator: "); if (gen.isEmpty()) { @@ -1061,7 +1061,7 @@ void CMakeSetupDialog::setExitAfterGenerate(bool b) this->ExitAfterGenerate = b; } -void CMakeSetupDialog::addBinaryPath(const QString& path) +void CMakeSetupDialog::addBinaryPath(QString const& path) { QString cleanpath = QDir::cleanPath(path); @@ -1090,7 +1090,7 @@ void CMakeSetupDialog::dragEnterEvent(QDragEnterEvent* e) return; } - const QMimeData* dat = e->mimeData(); + QMimeData const* dat = e->mimeData(); QList urls = dat->urls(); QString file = urls.count() ? urls[0].toLocalFile() : QString(); if (!file.isEmpty() && @@ -1109,7 +1109,7 @@ void CMakeSetupDialog::dropEvent(QDropEvent* e) return; } - const QMimeData* dat = e->mimeData(); + QMimeData const* dat = e->mimeData(); QList urls = dat->urls(); QString file = urls.count() ? urls[0].toLocalFile() : QString(); if (file.endsWith("CMakeCache.txt", Qt::CaseInsensitive)) { @@ -1143,7 +1143,7 @@ QStringList CMakeSetupDialog::loadBuildPaths() return buildPaths; } -void CMakeSetupDialog::saveBuildPaths(const QStringList& paths) +void CMakeSetupDialog::saveBuildPaths(QStringList const& paths) { QSettings settings; settings.beginGroup("Settings/StartPath"); @@ -1370,10 +1370,10 @@ void CMakeSetupDialog::showUserChanges() dialog.exec(); } -void CMakeSetupDialog::setSearchFilter(const QString& str) +void CMakeSetupDialog::setSearchFilter(QString const& str) { this->CacheValues->selectionModel()->clear(); - const bool valid = this->CacheValues->setSearchFilter(str); + bool const valid = this->CacheValues->setSearchFilter(str); QtCMake::setSearchFilterColor(this->Search, valid); } diff --git a/Source/QtDialog/CMakeSetupDialog.h b/Source/QtDialog/CMakeSetupDialog.h index d4c72cb..cc9bd14 100644 --- a/Source/QtDialog/CMakeSetupDialog.h +++ b/Source/QtDialog/CMakeSetupDialog.h @@ -34,9 +34,9 @@ public: ~CMakeSetupDialog(); public slots: - void setBinaryDirectory(const QString& dir); - void setSourceDirectory(const QString& dir); - void setDeferredPreset(const QString& preset); + void setBinaryDirectory(QString const& dir); + void setSourceDirectory(QString const& dir); + void setDeferredPreset(QString const& preset); void setStartupBinaryDirectory(bool startup); protected slots: @@ -48,29 +48,29 @@ protected slots: void doHelp(); void doAbout(); void doInterrupt(); - void error(const QString& message); - void message(const QString& message); + void error(QString const& message); + void message(QString const& message); void doSourceBrowse(); void doBinaryBrowse(); void doReloadCache(); void doDeleteCache(); - void updateSourceDirectory(const QString& dir); - void updateBinaryDirectory(const QString& dir); - void updatePresets(const QVector& presets); - void updatePreset(const QString& name); - void showPresetLoadError(const QString& dir, const QString& message); - void showProgress(const QString& msg, float percent); + void updateSourceDirectory(QString const& dir); + void updateBinaryDirectory(QString const& dir); + void updatePresets(QVector const& presets); + void updatePreset(QString const& name); + void showPresetLoadError(QString const& dir, QString const& message); + void showProgress(QString const& msg, float percent); void setEnabledState(bool); bool setupFirstConfigure(); - void updateGeneratorLabel(const QString& gen); + void updateGeneratorLabel(QString const& gen); void setExitAfterGenerate(bool); - void addBinaryPath(const QString&); + void addBinaryPath(QString const&); QStringList loadBuildPaths(); - void saveBuildPaths(const QStringList&); - void onBinaryDirectoryChanged(const QString& dir); - void onSourceDirectoryChanged(const QString& dir); - void onBuildPresetChanged(const QString& name); + void saveBuildPaths(QStringList const&); + void onBinaryDirectoryChanged(QString const& dir); + void onSourceDirectoryChanged(QString const& dir); + void onBuildPresetChanged(QString const& name); void setCacheModified(); void removeSelectedCacheEntries(); void selectionChanged(); @@ -81,7 +81,7 @@ protected slots: void setAdvancedView(bool); void setGroupedView(bool); void showUserChanges(); - void setSearchFilter(const QString& str); + void setSearchFilter(QString const& str); bool prepareConfigure(); bool doConfigureInternal(); bool doGenerateInternal(); diff --git a/Source/QtDialog/EnvironmentDialog.cxx b/Source/QtDialog/EnvironmentDialog.cxx index 2752c0f..d6cf0da 100644 --- a/Source/QtDialog/EnvironmentDialog.cxx +++ b/Source/QtDialog/EnvironmentDialog.cxx @@ -12,7 +12,7 @@ #include EnvironmentItemModel::EnvironmentItemModel( - const QProcessEnvironment& environment, QObject* parent) + QProcessEnvironment const& environment, QObject* parent) : QStandardItemModel(parent) { this->clear(); @@ -42,7 +42,7 @@ void EnvironmentItemModel::clear() this->setHorizontalHeaderLabels(labels); } -QModelIndex EnvironmentItemModel::buddy(const QModelIndex& index) const +QModelIndex EnvironmentItemModel::buddy(QModelIndex const& index) const { if (index.column() == 0) { return this->index(index.row(), index.column() + 1, index.parent()); @@ -50,14 +50,14 @@ QModelIndex EnvironmentItemModel::buddy(const QModelIndex& index) const return index; } -void EnvironmentItemModel::appendVariable(const QString& key, - const QString& value) +void EnvironmentItemModel::appendVariable(QString const& key, + QString const& value) { this->insertVariable(this->rowCount(), key, value); } -void EnvironmentItemModel::insertVariable(int row, const QString& key, - const QString& value) +void EnvironmentItemModel::insertVariable(int row, QString const& key, + QString const& value) { for (int i = 0; i < this->rowCount(); ++i) { if (this->data(this->index(i, 0), Qt::DisplayRole) == key) { @@ -77,7 +77,7 @@ EnvironmentSearchFilter::EnvironmentSearchFilter(QObject* parent) } bool EnvironmentSearchFilter::filterAcceptsRow(int row, - const QModelIndex& parent) const + QModelIndex const& parent) const { auto* model = this->sourceModel(); auto key = @@ -89,7 +89,7 @@ bool EnvironmentSearchFilter::filterAcceptsRow(int row, #endif } -EnvironmentDialog::EnvironmentDialog(const QProcessEnvironment& environment, +EnvironmentDialog::EnvironmentDialog(QProcessEnvironment const& environment, QWidget* parent) : QDialog(parent) { @@ -112,8 +112,8 @@ EnvironmentDialog::EnvironmentDialog(const QProcessEnvironment& environment, QObject::connect(this->RemoveEntry, &QAbstractButton::clicked, this, &EnvironmentDialog::removeSelectedEntries); QObject::connect( - this->Search, &QLineEdit::textChanged, [this](const QString& text) { - const bool valid = QtCMake::setSearchFilter(this->m_filter, text); + this->Search, &QLineEdit::textChanged, [this](QString const& text) { + bool const valid = QtCMake::setSearchFilter(this->m_filter, text); QtCMake::setSearchFilterColor(this->Search, valid); }); QObject::connect(this->Environment->selectionModel(), diff --git a/Source/QtDialog/EnvironmentDialog.h b/Source/QtDialog/EnvironmentDialog.h index 6aae798..93fca07 100644 --- a/Source/QtDialog/EnvironmentDialog.h +++ b/Source/QtDialog/EnvironmentDialog.h @@ -14,17 +14,17 @@ class EnvironmentItemModel : public QStandardItemModel { Q_OBJECT public: - EnvironmentItemModel(const QProcessEnvironment& environment, + EnvironmentItemModel(QProcessEnvironment const& environment, QObject* parent = nullptr); QProcessEnvironment environment() const; void clear(); - QModelIndex buddy(const QModelIndex& index) const override; + QModelIndex buddy(QModelIndex const& index) const override; public slots: - void appendVariable(const QString& key, const QString& value); - void insertVariable(int row, const QString& key, const QString& value); + void appendVariable(QString const& key, QString const& value); + void insertVariable(int row, QString const& key, QString const& value); }; class EnvironmentSearchFilter : public QSortFilterProxyModel @@ -34,7 +34,7 @@ public: EnvironmentSearchFilter(QObject* parent = nullptr); protected: - bool filterAcceptsRow(int row, const QModelIndex& parent) const override; + bool filterAcceptsRow(int row, QModelIndex const& parent) const override; }; class EnvironmentDialog @@ -43,7 +43,7 @@ class EnvironmentDialog { Q_OBJECT public: - EnvironmentDialog(const QProcessEnvironment& environment, + EnvironmentDialog(QProcessEnvironment const& environment, QWidget* parent = nullptr); QProcessEnvironment environment() const; diff --git a/Source/QtDialog/FirstConfigure.cxx b/Source/QtDialog/FirstConfigure.cxx index 2986e1f..fec62c6 100644 --- a/Source/QtDialog/FirstConfigure.cxx +++ b/Source/QtDialog/FirstConfigure.cxx @@ -137,7 +137,7 @@ void StartCompilerSetup::setGenerators( this->GeneratorOptions->addItems(generator_list); } -void StartCompilerSetup::setCurrentGenerator(const QString& gen) +void StartCompilerSetup::setCurrentGenerator(QString const& gen) { int idx = this->GeneratorOptions->findText(gen); if (idx != -1) { @@ -145,12 +145,12 @@ void StartCompilerSetup::setCurrentGenerator(const QString& gen) } } -void StartCompilerSetup::setPlatform(const QString& platform) +void StartCompilerSetup::setPlatform(QString const& platform) { this->PlatformOptions->setCurrentText(platform); } -void StartCompilerSetup::setToolset(const QString& toolset) +void StartCompilerSetup::setToolset(QString const& toolset) { this->Toolset->setText(toolset); } @@ -297,7 +297,7 @@ QString NativeCompilerSetup::getCCompiler() const return this->CCompiler->text(); } -void NativeCompilerSetup::setCCompiler(const QString& s) +void NativeCompilerSetup::setCCompiler(QString const& s) { this->CCompiler->setText(s); } @@ -307,7 +307,7 @@ QString NativeCompilerSetup::getCXXCompiler() const return this->CXXCompiler->text(); } -void NativeCompilerSetup::setCXXCompiler(const QString& s) +void NativeCompilerSetup::setCXXCompiler(QString const& s) { this->CXXCompiler->setText(s); } @@ -317,7 +317,7 @@ QString NativeCompilerSetup::getFortranCompiler() const return this->FortranCompiler->text(); } -void NativeCompilerSetup::setFortranCompiler(const QString& s) +void NativeCompilerSetup::setFortranCompiler(QString const& s) { this->FortranCompiler->setText(s); } @@ -359,7 +359,7 @@ QString CrossCompilerSetup::getCCompiler() const return this->CrossCompilers->CCompiler->text(); } -void CrossCompilerSetup::setCCompiler(const QString& s) +void CrossCompilerSetup::setCCompiler(QString const& s) { this->CrossCompilers->CCompiler->setText(s); } @@ -369,7 +369,7 @@ QString CrossCompilerSetup::getCXXCompiler() const return this->CrossCompilers->CXXCompiler->text(); } -void CrossCompilerSetup::setCXXCompiler(const QString& s) +void CrossCompilerSetup::setCXXCompiler(QString const& s) { this->CrossCompilers->CXXCompiler->setText(s); } @@ -379,7 +379,7 @@ QString CrossCompilerSetup::getFortranCompiler() const return this->CrossCompilers->FortranCompiler->text(); } -void CrossCompilerSetup::setFortranCompiler(const QString& s) +void CrossCompilerSetup::setFortranCompiler(QString const& s) { this->CrossCompilers->FortranCompiler->setText(s); } @@ -389,7 +389,7 @@ QString CrossCompilerSetup::getSystem() const return this->systemName->text(); } -void CrossCompilerSetup::setSystem(const QString& t) +void CrossCompilerSetup::setSystem(QString const& t) { this->systemName->setText(t); } @@ -399,7 +399,7 @@ QString CrossCompilerSetup::getVersion() const return this->systemVersion->text(); } -void CrossCompilerSetup::setVersion(const QString& t) +void CrossCompilerSetup::setVersion(QString const& t) { this->systemVersion->setText(t); } @@ -409,7 +409,7 @@ QString CrossCompilerSetup::getProcessor() const return this->systemProcessor->text(); } -void CrossCompilerSetup::setProcessor(const QString& t) +void CrossCompilerSetup::setProcessor(QString const& t) { this->systemProcessor->setText(t); } @@ -419,7 +419,7 @@ QString CrossCompilerSetup::getFindRoot() const return this->crossFindRoot->text(); } -void CrossCompilerSetup::setFindRoot(const QString& t) +void CrossCompilerSetup::setFindRoot(QString const& t) { this->crossFindRoot->setText(t); } @@ -470,16 +470,16 @@ QString ToolchainCompilerSetup::toolchainFile() const return this->ToolchainFile->text(); } -void ToolchainCompilerSetup::setToolchainFile(const QString& t) +void ToolchainCompilerSetup::setToolchainFile(QString const& t) { this->ToolchainFile->setText(t); } FirstConfigure::FirstConfigure() { - const char* env_generator = std::getenv("CMAKE_GENERATOR"); - const char* env_generator_platform = nullptr; - const char* env_generator_toolset = nullptr; + char const* env_generator = std::getenv("CMAKE_GENERATOR"); + char const* env_generator_platform = nullptr; + char const* env_generator_toolset = nullptr; if (env_generator && std::strlen(env_generator)) { mDefaultGenerator = env_generator; env_generator_platform = std::getenv("CMAKE_GENERATOR_PLATFORM"); @@ -519,17 +519,17 @@ void FirstConfigure::setGenerators( this->mStartCompilerSetupPage->setGenerators(gens); } -void FirstConfigure::setCurrentGenerator(const QString& gen) +void FirstConfigure::setCurrentGenerator(QString const& gen) { this->mStartCompilerSetupPage->setCurrentGenerator(gen); } -void FirstConfigure::setPlatform(const QString& platform) +void FirstConfigure::setPlatform(QString const& platform) { this->mStartCompilerSetupPage->setPlatform(platform); } -void FirstConfigure::setToolset(const QString& toolset) +void FirstConfigure::setToolset(QString const& toolset) { this->mStartCompilerSetupPage->setToolset(toolset); } @@ -733,7 +733,7 @@ QString FirstConfigure::getCrossRoot() const return this->mCrossCompilerSetupPage->getFindRoot(); } -const QString CrossModes[] = { "BOTH", "ONLY", "NEVER" }; +QString const CrossModes[] = { "BOTH", "ONLY", "NEVER" }; QString FirstConfigure::getCrossProgramMode() const { diff --git a/Source/QtDialog/FirstConfigure.h b/Source/QtDialog/FirstConfigure.h index ea6fae6..bf76bbf 100644 --- a/Source/QtDialog/FirstConfigure.h +++ b/Source/QtDialog/FirstConfigure.h @@ -41,9 +41,9 @@ public: QString defaultGeneratorToolset, QWidget* p); ~StartCompilerSetup(); void setGenerators(std::vector const& gens); - void setCurrentGenerator(const QString& gen); - void setToolset(const QString& toolset); - void setPlatform(const QString& platform); + void setCurrentGenerator(QString const& gen); + void setToolset(QString const& toolset); + void setPlatform(QString const& platform); void setCompilerOption(CompilerOption option); QString getGenerator() const; QString getToolset() const; @@ -94,13 +94,13 @@ public: ~NativeCompilerSetup(); QString getCCompiler() const; - void setCCompiler(const QString&); + void setCCompiler(QString const&); QString getCXXCompiler() const; - void setCXXCompiler(const QString&); + void setCXXCompiler(QString const&); QString getFortranCompiler() const; - void setFortranCompiler(const QString&); + void setFortranCompiler(QString const&); int nextId() const { return -1; } }; @@ -116,25 +116,25 @@ public: ~CrossCompilerSetup(); QString getSystem() const; - void setSystem(const QString&); + void setSystem(QString const&); QString getVersion() const; - void setVersion(const QString&); + void setVersion(QString const&); QString getProcessor() const; - void setProcessor(const QString&); + void setProcessor(QString const&); QString getCCompiler() const; - void setCCompiler(const QString&); + void setCCompiler(QString const&); QString getCXXCompiler() const; - void setCXXCompiler(const QString&); + void setCXXCompiler(QString const&); QString getFortranCompiler() const; - void setFortranCompiler(const QString&); + void setFortranCompiler(QString const&); QString getFindRoot() const; - void setFindRoot(const QString&); + void setFindRoot(QString const&); enum CrossMode { @@ -162,7 +162,7 @@ public: ~ToolchainCompilerSetup(); QString toolchainFile() const; - void setToolchainFile(const QString&); + void setToolchainFile(QString const&); int nextId() const { return -1; } @@ -179,9 +179,9 @@ public: ~FirstConfigure(); void setGenerators(std::vector const& gens); - void setCurrentGenerator(const QString& gen); - void setToolset(const QString& toolset); - void setPlatform(const QString& platform); + void setCurrentGenerator(QString const& gen); + void setToolset(QString const& toolset); + void setPlatform(QString const& platform); void setCompilerOption(CompilerOption option); QString getGenerator() const; QString getPlatform() const; diff --git a/Source/QtDialog/QCMake.cxx b/Source/QtDialog/QCMake.cxx index 50cb124..dac4f53 100644 --- a/Source/QtDialog/QCMake.cxx +++ b/Source/QtDialog/QCMake.cxx @@ -38,7 +38,7 @@ QCMake::QCMake(QObject* p) cmSystemTools::SetRunCommandHideConsole(true); cmSystemTools::SetMessageCallback( - [this](std::string const& msg, const cmMessageMetadata& md) { + [this](std::string const& msg, cmMessageMetadata const& md) { this->messageCallback(msg, md.title); }); cmSystemTools::SetStdoutCallback( @@ -51,7 +51,7 @@ QCMake::QCMake(QObject* p) this->CMakeInstance->SetCMakeEditCommand( cmSystemTools::GetCMakeGUICommand()); this->CMakeInstance->SetProgressCallback( - [this](const std::string& msg, float percent) { + [this](std::string const& msg, float percent) { this->progressCallback(msg, percent); }); @@ -79,12 +79,12 @@ QCMake::QCMake(QObject* p) QCMake::~QCMake() = default; -void QCMake::loadCache(const QString& dir) +void QCMake::loadCache(QString const& dir) { this->setBinaryDirectory(dir); } -void QCMake::setSourceDirectory(const QString& _dir) +void QCMake::setSourceDirectory(QString const& _dir) { QString dir = QString::fromStdString( cmSystemTools::GetActualCaseForPath(_dir.toStdString())); @@ -100,7 +100,7 @@ void QCMake::setSourceDirectory(const QString& _dir) } } -void QCMake::setBinaryDirectory(const QString& _dir) +void QCMake::setBinaryDirectory(QString const& _dir) { QString dir = QString::fromStdString( cmSystemTools::GetActualCaseForPath(_dir.toStdString())); @@ -166,7 +166,7 @@ void QCMake::setBinaryDirectory(const QString& _dir) } } -void QCMake::setPreset(const QString& name, bool setBinary) +void QCMake::setPreset(QString const& name, bool setBinary) { if (this->PresetName != name) { this->PresetName = name; @@ -216,7 +216,7 @@ void QCMake::setPreset(const QString& name, bool setBinary) } } -void QCMake::setGenerator(const QString& gen) +void QCMake::setGenerator(QString const& gen) { if (this->Generator != gen) { this->Generator = gen; @@ -224,7 +224,7 @@ void QCMake::setGenerator(const QString& gen) } } -void QCMake::setPlatform(const QString& platform) +void QCMake::setPlatform(QString const& platform) { if (this->Platform != platform) { this->Platform = platform; @@ -232,7 +232,7 @@ void QCMake::setPlatform(const QString& platform) } } -void QCMake::setToolset(const QString& toolset) +void QCMake::setToolset(QString const& toolset) { if (this->Toolset != toolset) { this->Toolset = toolset; @@ -240,7 +240,7 @@ void QCMake::setToolset(const QString& toolset) } } -void QCMake::setEnvironment(const QProcessEnvironment& environment) +void QCMake::setEnvironment(QProcessEnvironment const& environment) { this->Environment = environment; } @@ -330,7 +330,7 @@ void QCMake::open() emit this->openDone(successful); } -void QCMake::setProperties(const QCMakePropertyList& newProps) +void QCMake::setProperties(QCMakePropertyList const& newProps) { QCMakePropertyList props = newProps; @@ -353,9 +353,9 @@ void QCMake::setProperties(const QCMakePropertyList& newProps) } else { prop = props[idx]; #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) - const bool isBool = prop.Value.type() == QVariant::Bool; + bool const isBool = prop.Value.type() == QVariant::Bool; #else - const bool isBool = prop.Value.metaType() == QMetaType::fromType(); + bool const isBool = prop.Value.metaType() == QMetaType::fromType(); #endif if (isBool) { state->SetCacheEntryValue(key, prop.Value.toBool() ? "ON" : "OFF"); @@ -401,7 +401,7 @@ void QCMake::setProperties(const QCMakePropertyList& newProps) namespace { template -QCMakeProperty cache_to_property(const T& v) +QCMakeProperty cache_to_property(T const& v) { QCMakeProperty prop; prop.Key = QString::fromStdString(v.first); @@ -528,7 +528,7 @@ bool QCMake::interruptCallback() #endif } -void QCMake::progressCallback(const std::string& msg, float percent) +void QCMake::progressCallback(std::string const& msg, float percent) { if (percent >= 0) { emit this->progressChanged(QString::fromStdString(msg), percent); @@ -538,7 +538,7 @@ void QCMake::progressCallback(const std::string& msg, float percent) QCoreApplication::processEvents(); } -void QCMake::messageCallback(std::string const& msg, const char* /*title*/) +void QCMake::messageCallback(std::string const& msg, char const* /*title*/) { emit this->errorMessage(QString::fromStdString(msg)); QCoreApplication::processEvents(); @@ -602,7 +602,7 @@ void QCMake::loadPresets() preset.enabled = it.Expanded && it.Expanded->ConditionResult && std::find_if(this->AvailableGenerators.begin(), this->AvailableGenerators.end(), - [&p](const cmake::GeneratorInfo& g) { + [&p](cmake::GeneratorInfo const& g) { return g.name == p.Generator; }) != this->AvailableGenerators.end(); presets.push_back(preset); diff --git a/Source/QtDialog/QCMake.h b/Source/QtDialog/QCMake.h index d42dac4..71e8656 100644 --- a/Source/QtDialog/QCMake.h +++ b/Source/QtDialog/QCMake.h @@ -43,11 +43,11 @@ struct QCMakeProperty QString Help; PropertyType Type; bool Advanced; - bool operator==(const QCMakeProperty& other) const + bool operator==(QCMakeProperty const& other) const { return this->Key == other.Key; } - bool operator<(const QCMakeProperty& other) const + bool operator<(QCMakeProperty const& other) const { return this->Key < other.Key; } @@ -72,21 +72,21 @@ public: ~QCMake(); public slots: /// load the cache file in a directory - void loadCache(const QString& dir); + void loadCache(QString const& dir); /// set the source directory containing the source - void setSourceDirectory(const QString& dir); + void setSourceDirectory(QString const& dir); /// set the binary directory to build in - void setBinaryDirectory(const QString& dir); + void setBinaryDirectory(QString const& dir); /// set the preset name to use - void setPreset(const QString& name, bool setBinary = true); + void setPreset(QString const& name, bool setBinary = true); /// set the desired generator to use - void setGenerator(const QString& generator); + void setGenerator(QString const& generator); /// set the desired generator to use - void setPlatform(const QString& platform); + void setPlatform(QString const& platform); /// set the desired generator to use - void setToolset(const QString& toolset); + void setToolset(QString const& toolset); /// set the configure and generate environment - void setEnvironment(const QProcessEnvironment& environment); + void setEnvironment(QProcessEnvironment const& environment); /// do the configure step void configure(); /// generate the files @@ -94,7 +94,7 @@ public slots: /// open the project void open(); /// set the property values - void setProperties(const QCMakePropertyList&); + void setProperties(QCMakePropertyList const&); /// interrupt the configure or generate process (if connecting, make a direct /// connection) void interrupt(); @@ -146,38 +146,38 @@ public: signals: /// signal when properties change (during read from disk or configure /// process) - void propertiesChanged(const QCMakePropertyList& vars); + void propertiesChanged(QCMakePropertyList const& vars); /// signal when the generator changes - void generatorChanged(const QString& gen); + void generatorChanged(QString const& gen); /// signal when the source directory changes (binary directory already /// containing a CMakeCache.txt file) - void sourceDirChanged(const QString& dir); + void sourceDirChanged(QString const& dir); /// signal when the binary directory changes - void binaryDirChanged(const QString& dir); + void binaryDirChanged(QString const& dir); /// signal when the preset list changes - void presetsChanged(const QVector& presets); + void presetsChanged(QVector const& presets); /// signal when the selected preset changes - void presetChanged(const QString& name); + void presetChanged(QString const& name); /// signal when there's an error reading the presets files - void presetLoadError(const QString& dir, const QString& error); + void presetLoadError(QString const& dir, QString const& error); /// signal when uninitialized warning changes void warnUninitializedModeChanged(bool value); /// signal for progress events - void progressChanged(const QString& msg, float percent); + void progressChanged(QString const& msg, float percent); /// signal when configure is done void configureDone(int error); /// signal when generate is done void generateDone(int error); /// signal when there is an output message - void outputMessage(const QString& msg); + void outputMessage(QString const& msg); /// signal when there is an error message - void errorMessage(const QString& msg); + void errorMessage(QString const& msg); /// signal when debug output changes void debugOutputChanged(bool); /// signal when the toolset changes - void toolsetChanged(const QString& toolset); + void toolsetChanged(QString const& toolset); /// signal when the platform changes - void platformChanged(const QString& platform); + void platformChanged(QString const& platform); /// signal when open is done void openDone(bool successful); /// signal when open is done @@ -188,7 +188,7 @@ protected: bool interruptCallback(); void progressCallback(std::string const& msg, float percent); - void messageCallback(std::string const& msg, const char* title); + void messageCallback(std::string const& msg, char const* title); void stdoutCallback(std::string const& msg); void stderrCallback(std::string const& msg); void setUpEnvironment() const; diff --git a/Source/QtDialog/QCMakeCacheView.cxx b/Source/QtDialog/QCMakeCacheView.cxx index 94dfa3e..90f5ac2 100644 --- a/Source/QtDialog/QCMakeCacheView.cxx +++ b/Source/QtDialog/QCMakeCacheView.cxx @@ -23,10 +23,10 @@ public: } protected: - bool filterAcceptsRow(int row, const QModelIndex& p) const override + bool filterAcceptsRow(int row, QModelIndex const& p) const override { QStringList strs; - const QAbstractItemModel* m = this->sourceModel(); + QAbstractItemModel const* m = this->sourceModel(); QModelIndex idx = m->index(row, 0, p); // if there are no children, get strings for column 0 and 1 @@ -80,9 +80,9 @@ public: protected: bool ShowAdvanced = false; - bool filterAcceptsRow(int row, const QModelIndex& p) const override + bool filterAcceptsRow(int row, QModelIndex const& p) const override { - const QAbstractItemModel* m = this->sourceModel(); + QAbstractItemModel const* m = this->sourceModel(); QModelIndex idx = m->index(row, 0, p); // if there are no children @@ -168,7 +168,7 @@ bool QCMakeCacheView::showAdvanced() const return this->AdvancedFilter->showAdvanced(); } -bool QCMakeCacheView::setSearchFilter(const QString& s) +bool QCMakeCacheView::setSearchFilter(QString const& s) { return QtCMake::setSearchFilter(this->SearchFilter, s); } @@ -187,7 +187,7 @@ QCMakeCacheModel::QCMakeCacheModel(QObject* p) QCMakeCacheModel::~QCMakeCacheModel() = default; -static uint qHash(const QCMakeProperty& p) +static uint qHash(QCMakeProperty const& p) { return qHash(p.Key); } @@ -207,7 +207,7 @@ void QCMakeCacheModel::clear() this->setHorizontalHeaderLabels(labels); } -void QCMakeCacheModel::setProperties(const QCMakePropertyList& props) +void QCMakeCacheModel::setProperties(QCMakePropertyList const& props) { this->beginResetModel(); @@ -363,8 +363,8 @@ void QCMakeCacheModel::setViewType(QCMakeCacheModel::ViewType t) this->endResetModel(); } -void QCMakeCacheModel::setPropertyData(const QModelIndex& idx1, - const QCMakeProperty& prop, bool isNew) +void QCMakeCacheModel::setPropertyData(QModelIndex const& idx1, + QCMakeProperty const& prop, bool isNew) { QModelIndex idx2 = idx1.sibling(idx1.row(), 1); @@ -398,7 +398,7 @@ void QCMakeCacheModel::setPropertyData(const QModelIndex& idx1, } } -void QCMakeCacheModel::getPropertyData(const QModelIndex& idx1, +void QCMakeCacheModel::getPropertyData(QModelIndex const& idx1, QCMakeProperty& prop) const { QModelIndex idx2 = idx1.sibling(idx1.row(), 1); @@ -418,7 +418,7 @@ void QCMakeCacheModel::getPropertyData(const QModelIndex& idx1, } } -QString QCMakeCacheModel::prefix(const QString& s) +QString QCMakeCacheModel::prefix(QString const& s) { QString prefix = s.section('_', 0, 0); if (prefix == s) { @@ -428,7 +428,7 @@ QString QCMakeCacheModel::prefix(const QString& s) } void QCMakeCacheModel::breakProperties( - const QSet& props, QMap& result) + QSet const& props, QMap& result) { QMap tmp; // return a map of properties grouped by prefixes, and sorted @@ -502,9 +502,9 @@ QCMakePropertyList QCMakeCacheModel::properties() const } bool QCMakeCacheModel::insertProperty(QCMakeProperty::PropertyType t, - const QString& name, - const QString& description, - const QVariant& value, bool advanced) + QString const& name, + QString const& description, + QVariant const& value, bool advanced) { QCMakeProperty prop; prop.Key = name; @@ -535,7 +535,7 @@ int QCMakeCacheModel::newPropertyCount() const return this->NewPropertyCount; } -Qt::ItemFlags QCMakeCacheModel::flags(const QModelIndex& idx) const +Qt::ItemFlags QCMakeCacheModel::flags(QModelIndex const& idx) const { Qt::ItemFlags f = QStandardItemModel::flags(idx); if (!this->EditEnabled) { @@ -548,7 +548,7 @@ Qt::ItemFlags QCMakeCacheModel::flags(const QModelIndex& idx) const return f; } -QModelIndex QCMakeCacheModel::buddy(const QModelIndex& idx) const +QModelIndex QCMakeCacheModel::buddy(QModelIndex const& idx) const { if (!this->hasChildren(idx) && this->data(idx, TypeRole).toInt() != QCMakeProperty::BOOL) { @@ -569,8 +569,8 @@ void QCMakeCacheModelDelegate::setFileDialogFlag(bool f) } QWidget* QCMakeCacheModelDelegate::createEditor( - QWidget* p, const QStyleOptionViewItem& /*option*/, - const QModelIndex& idx) const + QWidget* p, QStyleOptionViewItem const& /*option*/, + QModelIndex const& idx) const { QModelIndex var = idx.sibling(idx.row(), 0); int type = var.data(QCMakeCacheModel::TypeRole).toInt(); @@ -606,8 +606,8 @@ QWidget* QCMakeCacheModelDelegate::createEditor( bool QCMakeCacheModelDelegate::editorEvent(QEvent* e, QAbstractItemModel* model, - const QStyleOptionViewItem& option, - const QModelIndex& index) + QStyleOptionViewItem const& option, + QModelIndex const& index) { Qt::ItemFlags flags = model->flags(index); if (!(flags & Qt::ItemIsUserCheckable) || @@ -661,14 +661,14 @@ bool QCMakeCacheModelDelegate::eventFilter(QObject* object, QEvent* evt) void QCMakeCacheModelDelegate::setModelData(QWidget* editor, QAbstractItemModel* model, - const QModelIndex& index) const + QModelIndex const& index) const { QItemDelegate::setModelData(editor, model, index); const_cast(this)->recordChange(model, index); } -QSize QCMakeCacheModelDelegate::sizeHint(const QStyleOptionViewItem& option, - const QModelIndex& index) const +QSize QCMakeCacheModelDelegate::sizeHint(QStyleOptionViewItem const& option, + QModelIndex const& index) const { QSize sz = QItemDelegate::sizeHint(option, index); QStyle* style = QApplication::style(); @@ -700,7 +700,7 @@ void QCMakeCacheModelDelegate::clearChanges() } void QCMakeCacheModelDelegate::recordChange(QAbstractItemModel* model, - const QModelIndex& index) + QModelIndex const& index) { QModelIndex idx = index; QAbstractItemModel* mymodel = model; diff --git a/Source/QtDialog/QCMakeCacheView.h b/Source/QtDialog/QCMakeCacheView.h index 549cca2..4df17f7 100644 --- a/Source/QtDialog/QCMakeCacheView.h +++ b/Source/QtDialog/QCMakeCacheView.h @@ -30,7 +30,7 @@ public: // set the search filter string. any property key or value not matching will // be filtered out - bool setSearchFilter(const QString&); + bool setSearchFilter(QString const&); public slots: // set whether to show advanced entries @@ -74,7 +74,7 @@ public slots: // to prefix. Any property that existed already and which is found in this // list of properties to set will become an old property. All others will // become new properties and be marked red. - void setProperties(const QCMakePropertyList& props); + void setProperties(QCMakePropertyList const& props); // set whether to show new properties in red void setShowNewProperties(bool); @@ -87,8 +87,8 @@ public slots: // insert a new property at a row specifying all the information about the // property - bool insertProperty(QCMakeProperty::PropertyType t, const QString& name, - const QString& description, const QVariant& value, + bool insertProperty(QCMakeProperty::PropertyType t, QString const& name, + QString const& description, QVariant const& value, bool advanced); public: @@ -102,11 +102,11 @@ public: int newPropertyCount() const; // return flags (overloaded to modify flag based on EditEnabled flag) - Qt::ItemFlags flags(const QModelIndex& index) const; - QModelIndex buddy(const QModelIndex& idx) const; + Qt::ItemFlags flags(QModelIndex const& index) const; + QModelIndex buddy(QModelIndex const& idx) const; // get the data in the model for this property - void getPropertyData(const QModelIndex& idx1, QCMakeProperty& prop) const; + void getPropertyData(QModelIndex const& idx1, QCMakeProperty& prop) const; // set the view type void setViewType(ViewType t); @@ -119,16 +119,16 @@ protected: ViewType View; // set the data in the model for this property - void setPropertyData(const QModelIndex& idx1, const QCMakeProperty& p, + void setPropertyData(QModelIndex const& idx1, QCMakeProperty const& p, bool isNew); // breaks up he property list into groups // where each group has the same prefix up to the first underscore - static void breakProperties(const QSet& props, + static void breakProperties(QSet const& props, QMap& result); // gets the prefix of a string up to the first _ - static QString prefix(const QString& s); + static QString prefix(QString const& s); }; /// Qt delegate class for interaction (or other customization) @@ -139,16 +139,16 @@ class QCMakeCacheModelDelegate : public QItemDelegate public: QCMakeCacheModelDelegate(QObject* p); /// create our own editors for cache properties - QWidget* createEditor(QWidget* parent, const QStyleOptionViewItem& option, - const QModelIndex& index) const; + QWidget* createEditor(QWidget* parent, QStyleOptionViewItem const& option, + QModelIndex const& index) const; bool editorEvent(QEvent* event, QAbstractItemModel* model, - const QStyleOptionViewItem& option, - const QModelIndex& index); + QStyleOptionViewItem const& option, + QModelIndex const& index); bool eventFilter(QObject* object, QEvent* event); void setModelData(QWidget* editor, QAbstractItemModel* model, - const QModelIndex& index) const; - QSize sizeHint(const QStyleOptionViewItem& option, - const QModelIndex& index) const; + QModelIndex const& index) const; + QSize sizeHint(QStyleOptionViewItem const& option, + QModelIndex const& index) const; QSet changes() const; void clearChanges(); @@ -160,7 +160,7 @@ protected: bool FileDialogFlag; // record a change to an item in the model. // this simply saves the item in the set of changes - void recordChange(QAbstractItemModel* model, const QModelIndex& index); + void recordChange(QAbstractItemModel* model, QModelIndex const& index); // properties changed by user via this delegate QSet mChanges; diff --git a/Source/QtDialog/QCMakePreset.cxx b/Source/QtDialog/QCMakePreset.cxx index 176f532..2a93f9c 100644 --- a/Source/QtDialog/QCMakePreset.cxx +++ b/Source/QtDialog/QCMakePreset.cxx @@ -2,7 +2,7 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "QCMakePreset.h" -bool operator==(const QCMakePreset& lhs, const QCMakePreset& rhs) +bool operator==(QCMakePreset const& lhs, QCMakePreset const& rhs) { return lhs.name == rhs.name && lhs.displayName == rhs.displayName && lhs.description == rhs.description && lhs.generator == rhs.generator && @@ -11,12 +11,12 @@ bool operator==(const QCMakePreset& lhs, const QCMakePreset& rhs) lhs.setToolset == rhs.setToolset && lhs.enabled == rhs.enabled; } -bool operator!=(const QCMakePreset& lhs, const QCMakePreset& rhs) +bool operator!=(QCMakePreset const& lhs, QCMakePreset const& rhs) { return !(lhs == rhs); } -bool operator<(const QCMakePreset& lhs, const QCMakePreset& rhs) +bool operator<(QCMakePreset const& lhs, QCMakePreset const& rhs) { return lhs.name < rhs.name || (lhs.name == rhs.name && @@ -37,17 +37,17 @@ bool operator<(const QCMakePreset& lhs, const QCMakePreset& rhs) (lhs.enabled < rhs.enabled)))))))))))))))); } -bool operator<=(const QCMakePreset& lhs, const QCMakePreset& rhs) +bool operator<=(QCMakePreset const& lhs, QCMakePreset const& rhs) { return rhs >= lhs; } -bool operator>(const QCMakePreset& lhs, const QCMakePreset& rhs) +bool operator>(QCMakePreset const& lhs, QCMakePreset const& rhs) { return rhs < lhs; } -bool operator>=(const QCMakePreset& lhs, const QCMakePreset& rhs) +bool operator>=(QCMakePreset const& lhs, QCMakePreset const& rhs) { return !(lhs < rhs); } diff --git a/Source/QtDialog/QCMakePreset.h b/Source/QtDialog/QCMakePreset.h index 7387655..7359e59 100644 --- a/Source/QtDialog/QCMakePreset.h +++ b/Source/QtDialog/QCMakePreset.h @@ -21,11 +21,11 @@ public: bool enabled; }; -bool operator==(const QCMakePreset& lhs, const QCMakePreset& rhs); -bool operator!=(const QCMakePreset& lhs, const QCMakePreset& rhs); -bool operator<(const QCMakePreset& lhs, const QCMakePreset& rhs); -bool operator<=(const QCMakePreset& lhs, const QCMakePreset& rhs); -bool operator>(const QCMakePreset& lhs, const QCMakePreset& rhs); -bool operator>=(const QCMakePreset& lhs, const QCMakePreset& rhs); +bool operator==(QCMakePreset const& lhs, QCMakePreset const& rhs); +bool operator!=(QCMakePreset const& lhs, QCMakePreset const& rhs); +bool operator<(QCMakePreset const& lhs, QCMakePreset const& rhs); +bool operator<=(QCMakePreset const& lhs, QCMakePreset const& rhs); +bool operator>(QCMakePreset const& lhs, QCMakePreset const& rhs); +bool operator>=(QCMakePreset const& lhs, QCMakePreset const& rhs); Q_DECLARE_METATYPE(QCMakePreset) diff --git a/Source/QtDialog/QCMakePresetComboBox.cxx b/Source/QtDialog/QCMakePresetComboBox.cxx index efadb73..2625bc5 100644 --- a/Source/QtDialog/QCMakePresetComboBox.cxx +++ b/Source/QtDialog/QCMakePresetComboBox.cxx @@ -28,7 +28,7 @@ QCMakePresetComboBox::QCMakePresetComboBox(QWidget* parent) }); } -const QVector& QCMakePresetComboBox::presets() const +QVector const& QCMakePresetComboBox::presets() const { return this->m_model->presets(); } @@ -42,12 +42,12 @@ QString QCMakePresetComboBox::presetName() const return QString{}; } -void QCMakePresetComboBox::setPresets(const QVector& presets) +void QCMakePresetComboBox::setPresets(QVector const& presets) { this->m_model->setPresets(presets); } -void QCMakePresetComboBox::setPresetName(const QString& name) +void QCMakePresetComboBox::setPresetName(QString const& name) { this->setCurrentIndex(this->m_model->presetNameToRow(name)); if (this->signalsBlocked()) { diff --git a/Source/QtDialog/QCMakePresetComboBox.h b/Source/QtDialog/QCMakePresetComboBox.h index d1eeffe..271c533 100644 --- a/Source/QtDialog/QCMakePresetComboBox.h +++ b/Source/QtDialog/QCMakePresetComboBox.h @@ -16,15 +16,15 @@ class QCMakePresetComboBox : public QComboBox public: QCMakePresetComboBox(QWidget* parent = nullptr); - const QVector& presets() const; + QVector const& presets() const; QString presetName() const; public slots: - void setPresets(const QVector& presets); - void setPresetName(const QString& name); + void setPresets(QVector const& presets); + void setPresetName(QString const& name); signals: - void presetChanged(const QString& name); + void presetChanged(QString const& name); private: QCMakePresetItemModel* m_model; diff --git a/Source/QtDialog/QCMakePresetItemModel.cxx b/Source/QtDialog/QCMakePresetItemModel.cxx index cb96b6b..ac071f2 100644 --- a/Source/QtDialog/QCMakePresetItemModel.cxx +++ b/Source/QtDialog/QCMakePresetItemModel.cxx @@ -10,7 +10,7 @@ QCMakePresetItemModel::QCMakePresetItemModel(QObject* parent) { } -QVariant QCMakePresetItemModel::data(const QModelIndex& index, int role) const +QVariant QCMakePresetItemModel::data(QModelIndex const& index, int role) const { switch (role) { case Qt::AccessibleDescriptionRole: @@ -62,7 +62,7 @@ QVariant QCMakePresetItemModel::data(const QModelIndex& index, int role) const } } -Qt::ItemFlags QCMakePresetItemModel::flags(const QModelIndex& index) const +Qt::ItemFlags QCMakePresetItemModel::flags(QModelIndex const& index) const { Qt::ItemFlags flags = Qt::ItemIsEditable | Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled; @@ -75,7 +75,7 @@ Qt::ItemFlags QCMakePresetItemModel::flags(const QModelIndex& index) const return flags; } -int QCMakePresetItemModel::rowCount(const QModelIndex& parent) const +int QCMakePresetItemModel::rowCount(QModelIndex const& parent) const { if (parent.isValid()) { return 0; @@ -86,7 +86,7 @@ int QCMakePresetItemModel::rowCount(const QModelIndex& parent) const return this->m_presets.size() + 2; } -int QCMakePresetItemModel::columnCount(const QModelIndex& parent) const +int QCMakePresetItemModel::columnCount(QModelIndex const& parent) const { if (parent.isValid()) { return 0; @@ -95,7 +95,7 @@ int QCMakePresetItemModel::columnCount(const QModelIndex& parent) const } QModelIndex QCMakePresetItemModel::index(int row, int column, - const QModelIndex& parent) const + QModelIndex const& parent) const { if (parent.isValid() || column != 0 || row < 0 || row >= this->rowCount(QModelIndex{})) { @@ -113,7 +113,7 @@ QModelIndex QCMakePresetItemModel::index(int row, int column, return this->createIndex(row, column, static_cast(row)); } -QModelIndex QCMakePresetItemModel::parent(const QModelIndex& /*index*/) const +QModelIndex QCMakePresetItemModel::parent(QModelIndex const& /*index*/) const { return QModelIndex{}; } @@ -130,7 +130,7 @@ void QCMakePresetItemModel::setPresets(QVector const& presets) this->endResetModel(); } -int QCMakePresetItemModel::presetNameToRow(const QString& name) const +int QCMakePresetItemModel::presetNameToRow(QString const& name) const { if (this->m_presets.empty()) { return 0; diff --git a/Source/QtDialog/QCMakePresetItemModel.h b/Source/QtDialog/QCMakePresetItemModel.h index 79fba29..388a2a2 100644 --- a/Source/QtDialog/QCMakePresetItemModel.h +++ b/Source/QtDialog/QCMakePresetItemModel.h @@ -20,19 +20,19 @@ class QCMakePresetItemModel : public QAbstractItemModel public: QCMakePresetItemModel(QObject* parent = nullptr); - QVariant data(const QModelIndex& index, int role) const override; - Qt::ItemFlags flags(const QModelIndex& index) const override; + QVariant data(QModelIndex const& index, int role) const override; + Qt::ItemFlags flags(QModelIndex const& index) const override; - int rowCount(const QModelIndex& parent = QModelIndex{}) const override; - int columnCount(const QModelIndex& parent = QModelIndex{}) const override; + int rowCount(QModelIndex const& parent = QModelIndex{}) const override; + int columnCount(QModelIndex const& parent = QModelIndex{}) const override; QModelIndex index(int row, int column, - const QModelIndex& parent = QModelIndex{}) const override; - QModelIndex parent(const QModelIndex& index) const override; + QModelIndex const& parent = QModelIndex{}) const override; + QModelIndex parent(QModelIndex const& index) const override; QVector const& presets() const; - int presetNameToRow(const QString& name) const; + int presetNameToRow(QString const& name) const; public slots: void setPresets(QVector const& presets); diff --git a/Source/QtDialog/QCMakeWidgets.cxx b/Source/QtDialog/QCMakeWidgets.cxx index f1bb2f1..e414b11 100644 --- a/Source/QtDialog/QCMakeWidgets.cxx +++ b/Source/QtDialog/QCMakeWidgets.cxx @@ -34,13 +34,13 @@ QCMakeFileEditor::QCMakeFileEditor(QWidget* p, QString var) &QCMakeFileEditor::chooseFile); } -QCMakeFilePathEditor::QCMakeFilePathEditor(QWidget* p, const QString& var) +QCMakeFilePathEditor::QCMakeFilePathEditor(QWidget* p, QString const& var) : QCMakeFileEditor(p, var) { this->setCompleter(new QCMakeFileCompleter(this, false)); } -QCMakePathEditor::QCMakePathEditor(QWidget* p, const QString& var) +QCMakePathEditor::QCMakePathEditor(QWidget* p, QString const& var) : QCMakeFileEditor(p, var) { this->setCompleter(new QCMakeFileCompleter(this, true)); @@ -156,13 +156,13 @@ QCMakeFileCompleter::QCMakeFileCompleter(QObject* o, bool dirs) #endif } -QString QCMakeFileCompleter::pathFromIndex(const QModelIndex& idx) const +QString QCMakeFileCompleter::pathFromIndex(QModelIndex const& idx) const { return QDir::fromNativeSeparators(QCompleter::pathFromIndex(idx)); } namespace QtCMake { -bool setSearchFilter(QSortFilterProxyModel* model, const QString& searchString) +bool setSearchFilter(QSortFilterProxyModel* model, QString const& searchString) { #if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)) QRegularExpression const regex(searchString, diff --git a/Source/QtDialog/QCMakeWidgets.h b/Source/QtDialog/QCMakeWidgets.h index 858a913..4d3b793 100644 --- a/Source/QtDialog/QCMakeWidgets.h +++ b/Source/QtDialog/QCMakeWidgets.h @@ -35,7 +35,7 @@ class QCMakePathEditor : public QCMakeFileEditor { Q_OBJECT public: - QCMakePathEditor(QWidget* p = nullptr, const QString& var = QString()); + QCMakePathEditor(QWidget* p = nullptr, QString const& var = QString()); void chooseFile(); }; @@ -44,7 +44,7 @@ class QCMakeFilePathEditor : public QCMakeFileEditor { Q_OBJECT public: - QCMakeFilePathEditor(QWidget* p = nullptr, const QString& var = QString()); + QCMakeFilePathEditor(QWidget* p = nullptr, QString const& var = QString()); void chooseFile(); }; @@ -54,7 +54,7 @@ class QCMakeFileCompleter : public QCompleter Q_OBJECT public: QCMakeFileCompleter(QObject* o, bool dirs); - virtual QString pathFromIndex(const QModelIndex& idx) const; + virtual QString pathFromIndex(QModelIndex const& idx) const; }; // editor for strings @@ -69,7 +69,7 @@ public: { this->addItems(strings); } - void setValue(const QString& v) + void setValue(QString const& v) { int i = this->findText(v); if (i != -1) { @@ -80,7 +80,7 @@ public: namespace QtCMake { bool setSearchFilter(QSortFilterProxyModel* model, - const QString& searchString); + QString const& searchString); void setSearchFilterColor(QLineEdit* edit, bool valid); } diff --git a/Source/QtDialog/RegexExplorer.cxx b/Source/QtDialog/RegexExplorer.cxx index 6194940..dbe7d1c 100644 --- a/Source/QtDialog/RegexExplorer.cxx +++ b/Source/QtDialog/RegexExplorer.cxx @@ -24,7 +24,7 @@ void RegexExplorer::setStatusColor(QWidget* widget, bool successful) widget->setPalette(palette); } -void RegexExplorer::on_regularExpression_textChanged(const QString& text) +void RegexExplorer::on_regularExpression_textChanged(QString const& text) { #ifdef QT_NO_STL m_regex = text.toAscii().constData(); @@ -67,7 +67,7 @@ void RegexExplorer::on_inputText_textChanged() std::string matchingText; if (matchAll->isChecked()) { - const char* p = m_text.c_str(); + char const* p = m_text.c_str(); while (m_regexParser.find(p)) { std::string::size_type l = m_regexParser.start(); std::string::size_type r = m_regexParser.end(); @@ -133,7 +133,7 @@ void RegexExplorer::clearMatch() bool RegexExplorer::stripEscapes(std::string& source) { - const char* in = source.c_str(); + char const* in = source.c_str(); std::string result; result.reserve(source.size()); diff --git a/Source/QtDialog/RegexExplorer.h b/Source/QtDialog/RegexExplorer.h index 9a42320..160bd04 100644 --- a/Source/QtDialog/RegexExplorer.h +++ b/Source/QtDialog/RegexExplorer.h @@ -22,7 +22,7 @@ public: RegexExplorer(QWidget* p); private slots: - void on_regularExpression_textChanged(const QString& text); + void on_regularExpression_textChanged(QString const& text); void on_inputText_textChanged(); void on_matchNumber_currentIndexChanged(int index); void on_matchAll_toggled(bool checked); diff --git a/Source/bindexplib.cxx b/Source/bindexplib.cxx index abf3b0b..b58a1c4 100644 --- a/Source/bindexplib.cxx +++ b/Source/bindexplib.cxx @@ -164,10 +164,10 @@ PIMAGE_SECTION_HEADER GetSectionHeaderOffset( /* + * Utility func, strstr with size + */ -const char* StrNStr(const char* start, const char* find, size_t& size) +char const* StrNStr(char const* start, char const* find, size_t& size) { size_t len; - const char* hint; + char const* hint; if (!start || !find || !size) { size = 0; @@ -175,7 +175,7 @@ const char* StrNStr(const char* start, const char* find, size_t& size) } len = strlen(find); - while ((hint = (const char*)memchr(start, find[0], size - len + 1))) { + while ((hint = (char const*)memchr(start, find[0], size - len + 1))) { size -= (hint - start); if (!strncmp(hint, find, len)) return hint; @@ -254,7 +254,7 @@ public: */ if (pSymbolTable->N.Name.Short != 0) { symbol.clear(); - symbol.insert(0, (const char*)pSymbolTable->N.ShortName, 8); + symbol.insert(0, (char const*)pSymbolTable->N.ShortName, 8); } else { symbol = stringTable + pSymbolTable->N.Name.Long; } @@ -279,9 +279,9 @@ public: // deleting destructor" // if scalarPrefix and vectorPrefix are not found then print // the symbol - const char* scalarPrefix = "??_G"; - const char* vectorPrefix = "??_E"; - const char* vftablePrefix = "??_7"; + char const* scalarPrefix = "??_G"; + char const* vectorPrefix = "??_E"; + char const* vftablePrefix = "??_7"; // The original code had a check for // symbol.find("real@") == std::string::npos) // but this disallows member functions with the name "real". @@ -346,7 +346,7 @@ private: }; #endif -static bool DumpFileWithLlvmNm(std::string const& nmPath, const char* filename, +static bool DumpFileWithLlvmNm(std::string const& nmPath, char const* filename, std::set& symbols, std::set& dataSymbols) { @@ -386,7 +386,7 @@ static bool DumpFileWithLlvmNm(std::string const& nmPath, const char* filename, line.c_str()); return false; } - const char sym_type = line[sym_end + 1]; + char const sym_type = line[sym_end + 1]; line.resize(sym_end); switch (sym_type) { case 'D': @@ -401,7 +401,7 @@ static bool DumpFileWithLlvmNm(std::string const& nmPath, const char* filename, return true; } -static bool DumpFile(std::string const& nmPath, const char* filename, +static bool DumpFile(std::string const& nmPath, char const* filename, std::set& symbols, std::set& dataSymbols) { @@ -501,12 +501,12 @@ static bool DumpFile(std::string const& nmPath, const char* filename, #endif } -bool bindexplib::AddObjectFile(const char* filename) +bool bindexplib::AddObjectFile(char const* filename) { return DumpFile(this->NmPath, filename, this->Symbols, this->DataSymbols); } -bool bindexplib::AddDefinitionFile(const char* filename) +bool bindexplib::AddDefinitionFile(char const* filename) { cmsys::ifstream infile(filename); if (!infile) { diff --git a/Source/bindexplib.h b/Source/bindexplib.h index c5d81c7..f9c7405 100644 --- a/Source/bindexplib.h +++ b/Source/bindexplib.h @@ -12,8 +12,8 @@ class bindexplib { public: bindexplib() { NmPath = "nm"; } - bool AddDefinitionFile(const char* filename); - bool AddObjectFile(const char* filename); + bool AddDefinitionFile(char const* filename); + bool AddObjectFile(char const* filename); void WriteFile(FILE* file); void SetNmPath(std::string const& nm); diff --git a/Source/cmAddCustomCommandCommand.cxx b/Source/cmAddCustomCommandCommand.cxx index accc7ca..2103c0f 100644 --- a/Source/cmAddCustomCommandCommand.cxx +++ b/Source/cmAddCustomCommandCommand.cxx @@ -45,7 +45,7 @@ bool cmAddCustomCommandCommand(std::vector const& args, std::string job_pool; std::string job_server_aware; std::string comment_buffer; - const char* comment = nullptr; + char const* comment = nullptr; std::vector depends; std::vector outputs; std::vector output; diff --git a/Source/cmAddCustomTargetCommand.cxx b/Source/cmAddCustomTargetCommand.cxx index 61762d6..3eafaed 100644 --- a/Source/cmAddCustomTargetCommand.cxx +++ b/Source/cmAddCustomTargetCommand.cxx @@ -51,7 +51,7 @@ bool cmAddCustomTargetCommand(std::vector const& args, bool uses_terminal = false; bool command_expand_lists = false; std::string comment_buffer; - const char* comment = nullptr; + char const* comment = nullptr; std::vector sources; std::string job_pool; std::string job_server_aware; diff --git a/Source/cmAddSubDirectoryCommand.cxx b/Source/cmAddSubDirectoryCommand.cxx index 6a2ab0b..47b6d1d 100644 --- a/Source/cmAddSubDirectoryCommand.cxx +++ b/Source/cmAddSubDirectoryCommand.cxx @@ -88,8 +88,8 @@ bool cmAddSubDirectoryCommand(std::vector const& args, // Remove the CurrentDirectory from the srcPath and replace it // with the CurrentOutputDirectory. - const std::string& src = mf.GetCurrentSourceDirectory(); - const std::string& bin = mf.GetCurrentBinaryDirectory(); + std::string const& src = mf.GetCurrentSourceDirectory(); + std::string const& bin = mf.GetCurrentBinaryDirectory(); size_t srcLen = src.length(); size_t binLen = bin.length(); if (srcLen > 0 && src.back() == '/') { diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h index 2c3ee9b..227434f 100644 --- a/Source/cmAlgorithms.h +++ b/Source/cmAlgorithms.h @@ -19,7 +19,7 @@ template FwdIt cmRotate(FwdIt first, FwdIt middle, FwdIt last) { - const typename std::iterator_traits::difference_type dist = + typename std::iterator_traits::difference_type const dist = std::distance(middle, last); std::rotate(first, middle, last); std::advance(first, dist); @@ -75,7 +75,7 @@ typename Range::const_iterator cmRemoveIndices(Range& r, InputRange const& rem) { typename InputRange::const_iterator remIt = rem.begin(); typename InputRange::const_iterator remEnd = rem.end(); - const auto rangeEnd = r.end(); + auto const rangeEnd = r.end(); if (remIt == remEnd) { return rangeEnd; } diff --git a/Source/cmArchiveWrite.cxx b/Source/cmArchiveWrite.cxx index e992b4b..62f6f7f 100644 --- a/Source/cmArchiveWrite.cxx +++ b/Source/cmArchiveWrite.cxx @@ -32,12 +32,12 @@ static std::string cm_archive_error_string(struct archive* a) { - const char* e = archive_error_string(a); + char const* e = archive_error_string(a); return e ? e : "unknown error"; } static void cm_archive_entry_copy_pathname(struct archive_entry* e, - const std::string& dest) + std::string const& dest) { #if cmsys_STL_HAS_WSTRING archive_entry_copy_pathname_w(e, cmsys::Encoding::ToWide(dest).c_str()); @@ -47,7 +47,7 @@ static void cm_archive_entry_copy_pathname(struct archive_entry* e, } static void cm_archive_entry_copy_sourcepath(struct archive_entry* e, - const std::string& file) + std::string const& file) { #if cmsys_STL_HAS_WSTRING archive_entry_copy_sourcepath_w(e, cmsys::Encoding::ToWide(file).c_str()); @@ -66,8 +66,8 @@ public: { } ~Entry() { archive_entry_free(this->Object); } - Entry(const Entry&) = delete; - Entry& operator=(const Entry&) = delete; + Entry(Entry const&) = delete; + Entry& operator=(Entry const&) = delete; operator struct archive_entry *() { return this->Object; } }; @@ -75,10 +75,10 @@ struct cmArchiveWrite::Callback { // archive_write_callback static __LA_SSIZE_T Write(struct archive* /*unused*/, void* cd, - const void* b, size_t n) + void const* b, size_t n) { cmArchiveWrite* self = static_cast(cd); - if (self->Stream.write(static_cast(b), + if (self->Stream.write(static_cast(b), static_cast(n))) { return static_cast<__LA_SSIZE_T>(n); } @@ -278,7 +278,7 @@ cmArchiveWrite::~cmArchiveWrite() archive_write_free(this->Archive); } -bool cmArchiveWrite::Add(std::string path, size_t skip, const char* prefix, +bool cmArchiveWrite::Add(std::string path, size_t skip, char const* prefix, bool recursive) { if (!path.empty() && path.back() == '/') { @@ -288,7 +288,7 @@ bool cmArchiveWrite::Add(std::string path, size_t skip, const char* prefix, return this->Okay(); } -bool cmArchiveWrite::AddPath(const char* path, size_t skip, const char* prefix, +bool cmArchiveWrite::AddPath(char const* path, size_t skip, char const* prefix, bool recursive) { if (strcmp(path, ".") != 0 || @@ -310,7 +310,7 @@ bool cmArchiveWrite::AddPath(const char* path, size_t skip, const char* prefix, std::string::size_type end = next.size(); unsigned long n = d.GetNumberOfFiles(); for (unsigned long i = 0; i < n; ++i) { - const char* file = d.GetFile(i); + char const* file = d.GetFile(i); if (strcmp(file, ".") != 0 && strcmp(file, "..") != 0) { next.erase(end); next += file; @@ -323,7 +323,7 @@ bool cmArchiveWrite::AddPath(const char* path, size_t skip, const char* prefix, return true; } -bool cmArchiveWrite::AddFile(const char* file, size_t skip, const char* prefix) +bool cmArchiveWrite::AddFile(char const* file, size_t skip, char const* prefix) { this->Error = ""; // Skip the file if we have no name for it. This may happen on a @@ -331,7 +331,7 @@ bool cmArchiveWrite::AddFile(const char* file, size_t skip, const char* prefix) if (skip >= strlen(file)) { return true; } - const char* out = file + skip; + char const* out = file + skip; cmLocaleRAII localeRAII; static_cast(localeRAII); @@ -425,7 +425,7 @@ bool cmArchiveWrite::AddFile(const char* file, size_t skip, const char* prefix) return true; } -bool cmArchiveWrite::AddData(const char* file, size_t size) +bool cmArchiveWrite::AddData(char const* file, size_t size) { cmsys::ifstream fin(file, std::ios::in | std::ios::binary); if (!fin) { diff --git a/Source/cmArchiveWrite.h b/Source/cmArchiveWrite.h index b9fa3d7..381a27e 100644 --- a/Source/cmArchiveWrite.h +++ b/Source/cmArchiveWrite.h @@ -59,8 +59,8 @@ public: ~cmArchiveWrite(); - cmArchiveWrite(const cmArchiveWrite&) = delete; - cmArchiveWrite& operator=(const cmArchiveWrite&) = delete; + cmArchiveWrite(cmArchiveWrite const&) = delete; + cmArchiveWrite& operator=(cmArchiveWrite const&) = delete; bool Open(); @@ -72,7 +72,7 @@ public: * skip. The remaining part of the input path is appended to the * "prefix" value to construct the final name in the archive. */ - bool Add(std::string path, size_t skip = 0, const char* prefix = nullptr, + bool Add(std::string path, size_t skip = 0, char const* prefix = nullptr, bool recursive = true); /** Returns true if there has been no error. */ @@ -127,7 +127,7 @@ public: } //! Sets UNAME and GNAME to be used in the tar file - void SetUNAMEAndGNAME(const std::string& uname_, const std::string& gname_) + void SetUNAMEAndGNAME(std::string const& uname_, std::string const& gname_) { this->Uname = uname_; this->Gname = gname_; @@ -143,10 +143,10 @@ public: private: bool Okay() const { return this->Error.empty(); } - bool AddPath(const char* path, size_t skip, const char* prefix, + bool AddPath(char const* path, size_t skip, char const* prefix, bool recursive = true); - bool AddFile(const char* file, size_t skip, const char* prefix); - bool AddData(const char* file, size_t size); + bool AddFile(char const* file, size_t skip, char const* prefix); + bool AddData(char const* file, size_t size); struct Callback; friend struct Callback; diff --git a/Source/cmBase32.cxx b/Source/cmBase32.cxx index e8e46aa..b11fd79 100644 --- a/Source/cmBase32.cxx +++ b/Source/cmBase32.cxx @@ -4,7 +4,7 @@ // -- Static functions -static const unsigned char Base32EncodeTable[33] = +static unsigned char const Base32EncodeTable[33] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"; inline unsigned char Base32EncodeChar(int schar) @@ -12,7 +12,7 @@ inline unsigned char Base32EncodeChar(int schar) return Base32EncodeTable[schar]; } -static void Base32Encode5(const unsigned char src[5], char dst[8]) +static void Base32Encode5(unsigned char const src[5], char dst[8]) { // [0]:5 bits dst[0] = Base32EncodeChar((src[0] >> 3) & 0x1F); @@ -36,16 +36,16 @@ static void Base32Encode5(const unsigned char src[5], char dst[8]) cmBase32Encoder::cmBase32Encoder() = default; -std::string cmBase32Encoder::encodeString(const unsigned char* input, +std::string cmBase32Encoder::encodeString(unsigned char const* input, size_t len, bool padding) { std::string res; - static const size_t blockSize = 5; - static const size_t bufferSize = 8; + static size_t const blockSize = 5; + static size_t const bufferSize = 8; char buffer[bufferSize]; - const unsigned char* end = input + len; + unsigned char const* end = input + len; while ((input + blockSize) <= end) { Base32Encode5(input, buffer); res.append(buffer, bufferSize); diff --git a/Source/cmBase32.h b/Source/cmBase32.h index d70a062..c883162 100644 --- a/Source/cmBase32.h +++ b/Source/cmBase32.h @@ -15,7 +15,7 @@ class cmBase32Encoder { public: - static const char paddingChar = '='; + static char const paddingChar = '='; cmBase32Encoder(); ~cmBase32Encoder() = default; @@ -24,6 +24,6 @@ public: // @arg input Input data pointer // @arg len Input data size // @arg padding Flag to append "=" on demand - std::string encodeString(const unsigned char* input, size_t len, + std::string encodeString(unsigned char const* input, size_t len, bool padding = true); }; diff --git a/Source/cmBinUtilsLinker.cxx b/Source/cmBinUtilsLinker.cxx index a9f4d91..99e85a7 100644 --- a/Source/cmBinUtilsLinker.cxx +++ b/Source/cmBinUtilsLinker.cxx @@ -10,7 +10,7 @@ cmBinUtilsLinker::cmBinUtilsLinker(cmRuntimeDependencyArchive* archive) { } -void cmBinUtilsLinker::SetError(const std::string& e) +void cmBinUtilsLinker::SetError(std::string const& e) { this->Archive->SetError(e); } diff --git a/Source/cmBinUtilsLinker.h b/Source/cmBinUtilsLinker.h index 5330070..950c601 100644 --- a/Source/cmBinUtilsLinker.h +++ b/Source/cmBinUtilsLinker.h @@ -23,5 +23,5 @@ public: protected: cmRuntimeDependencyArchive* Archive; - void SetError(const std::string& e); + void SetError(std::string const& e); }; diff --git a/Source/cmBinUtilsLinuxELFGetRuntimeDependenciesTool.cxx b/Source/cmBinUtilsLinuxELFGetRuntimeDependenciesTool.cxx index abd1209..366c8ba 100644 --- a/Source/cmBinUtilsLinuxELFGetRuntimeDependenciesTool.cxx +++ b/Source/cmBinUtilsLinuxELFGetRuntimeDependenciesTool.cxx @@ -13,7 +13,7 @@ cmBinUtilsLinuxELFGetRuntimeDependenciesTool:: } void cmBinUtilsLinuxELFGetRuntimeDependenciesTool::SetError( - const std::string& error) + std::string const& error) { this->Archive->SetError(error); } diff --git a/Source/cmBinUtilsLinuxELFGetRuntimeDependenciesTool.h b/Source/cmBinUtilsLinuxELFGetRuntimeDependenciesTool.h index 15216a4..311bd8e 100644 --- a/Source/cmBinUtilsLinuxELFGetRuntimeDependenciesTool.h +++ b/Source/cmBinUtilsLinuxELFGetRuntimeDependenciesTool.h @@ -23,5 +23,5 @@ public: protected: cmRuntimeDependencyArchive* Archive; - void SetError(const std::string& e); + void SetError(std::string const& e); }; diff --git a/Source/cmBinUtilsLinuxELFLinker.cxx b/Source/cmBinUtilsLinuxELFLinker.cxx index ca40726..98da3d1 100644 --- a/Source/cmBinUtilsLinuxELFLinker.cxx +++ b/Source/cmBinUtilsLinuxELFLinker.cxx @@ -22,12 +22,12 @@ #include "cmStringAlgorithms.h" #include "cmSystemTools.h" -static std::string ReplaceOrigin(const std::string& rpath, - const std::string& origin) +static std::string ReplaceOrigin(std::string const& rpath, + std::string const& origin) { - static const cmsys::RegularExpression originRegex( + static cmsys::RegularExpression const originRegex( "(\\$ORIGIN)([^a-zA-Z0-9_]|$)"); - static const cmsys::RegularExpression originCurlyRegex("\\${ORIGIN}"); + static cmsys::RegularExpression const originCurlyRegex("\\${ORIGIN}"); cmsys::RegularExpressionMatch match; if (originRegex.find(rpath.c_str(), match)) { @@ -186,7 +186,7 @@ bool cmBinUtilsLinuxELFLinker::ScanDependencies(std::string const& mainFile) } namespace { -bool FileHasArchitecture(const char* filename, std::uint16_t machine) +bool FileHasArchitecture(char const* filename, std::uint16_t machine) { cmELF elf(filename); if (!elf) { diff --git a/Source/cmBinUtilsLinuxELFObjdumpGetRuntimeDependenciesTool.cxx b/Source/cmBinUtilsLinuxELFObjdumpGetRuntimeDependenciesTool.cxx index 8043f82..d676cc8 100644 --- a/Source/cmBinUtilsLinuxELFObjdumpGetRuntimeDependenciesTool.cxx +++ b/Source/cmBinUtilsLinuxELFObjdumpGetRuntimeDependenciesTool.cxx @@ -44,9 +44,9 @@ bool cmBinUtilsLinuxELFObjdumpGetRuntimeDependenciesTool::GetFileInfo( } std::string line; - static const cmsys::RegularExpression neededRegex("^ *NEEDED *([^\n]*)$"); - static const cmsys::RegularExpression rpathRegex("^ *RPATH *([^\n]*)$"); - static const cmsys::RegularExpression runpathRegex("^ *RUNPATH *([^\n]*)$"); + static cmsys::RegularExpression const neededRegex("^ *NEEDED *([^\n]*)$"); + static cmsys::RegularExpression const rpathRegex("^ *RPATH *([^\n]*)$"); + static cmsys::RegularExpression const runpathRegex("^ *RUNPATH *([^\n]*)$"); cmUVPipeIStream output(process.GetLoop(), process.OutputStream()); while (std::getline(output, line)) { cmsys::RegularExpressionMatch match; diff --git a/Source/cmBinUtilsMacOSMachOGetRuntimeDependenciesTool.cxx b/Source/cmBinUtilsMacOSMachOGetRuntimeDependenciesTool.cxx index a296a47..4e89476 100644 --- a/Source/cmBinUtilsMacOSMachOGetRuntimeDependenciesTool.cxx +++ b/Source/cmBinUtilsMacOSMachOGetRuntimeDependenciesTool.cxx @@ -13,7 +13,7 @@ cmBinUtilsMacOSMachOGetRuntimeDependenciesTool:: } void cmBinUtilsMacOSMachOGetRuntimeDependenciesTool::SetError( - const std::string& error) + std::string const& error) { this->Archive->SetError(error); } diff --git a/Source/cmBinUtilsMacOSMachOGetRuntimeDependenciesTool.h b/Source/cmBinUtilsMacOSMachOGetRuntimeDependenciesTool.h index 60d34aa..17e7f26 100644 --- a/Source/cmBinUtilsMacOSMachOGetRuntimeDependenciesTool.h +++ b/Source/cmBinUtilsMacOSMachOGetRuntimeDependenciesTool.h @@ -22,5 +22,5 @@ public: protected: cmRuntimeDependencyArchive* Archive; - void SetError(const std::string& error); + void SetError(std::string const& error); }; diff --git a/Source/cmBinUtilsMacOSMachOLinker.cxx b/Source/cmBinUtilsMacOSMachOLinker.cxx index 082f348..601b6c6 100644 --- a/Source/cmBinUtilsMacOSMachOLinker.cxx +++ b/Source/cmBinUtilsMacOSMachOLinker.cxx @@ -54,7 +54,7 @@ bool cmBinUtilsMacOSMachOLinker::Prepare() } auto cmBinUtilsMacOSMachOLinker::GetFileInfo(std::string const& file) - -> const FileInfo* + -> FileInfo const* { // Memoize processed rpaths and library dependencies to reduce the number // of calls to otool, especially in the case of heavily recursive libraries @@ -86,7 +86,7 @@ bool cmBinUtilsMacOSMachOLinker::ScanDependencies( if (!executableFile.empty()) { executablePath = cmSystemTools::GetFilenamePath(executableFile); } - const FileInfo* file_info = this->GetFileInfo(file); + FileInfo const* file_info = this->GetFileInfo(file); if (!file_info) { return false; } @@ -119,7 +119,7 @@ bool cmBinUtilsMacOSMachOLinker::GetFileDependencies( !IsMissingSystemDylib(path)) { auto filename = cmSystemTools::GetFilenameName(path); bool unique; - const FileInfo* dep_file_info = this->GetFileInfo(path); + FileInfo const* dep_file_info = this->GetFileInfo(path); if (!dep_file_info) { return false; } diff --git a/Source/cmBinUtilsMacOSMachOLinker.h b/Source/cmBinUtilsMacOSMachOLinker.h index ac1177b..546bdc6 100644 --- a/Source/cmBinUtilsMacOSMachOLinker.h +++ b/Source/cmBinUtilsMacOSMachOLinker.h @@ -34,7 +34,7 @@ private: std::unique_ptr Tool; std::unordered_map ScannedFileInfo; - const FileInfo* GetFileInfo(std::string const& file); + FileInfo const* GetFileInfo(std::string const& file); bool ScanDependencies(std::string const& file, std::vector const& libs, diff --git a/Source/cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool.cxx b/Source/cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool.cxx index 4c35841..09d5419 100644 --- a/Source/cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool.cxx +++ b/Source/cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool.cxx @@ -43,12 +43,12 @@ bool cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool::GetFileInfo( } std::string line; - static const cmsys::RegularExpression rpathRegex("^ *cmd LC_RPATH$"); - static const cmsys::RegularExpression loadDylibRegex( + static cmsys::RegularExpression const rpathRegex("^ *cmd LC_RPATH$"); + static cmsys::RegularExpression const loadDylibRegex( "^ *cmd LC_LOAD(_WEAK)?_DYLIB$"); - static const cmsys::RegularExpression pathRegex( + static cmsys::RegularExpression const pathRegex( "^ *path (.*) \\(offset [0-9]+\\)$"); - static const cmsys::RegularExpression nameRegex( + static cmsys::RegularExpression const nameRegex( "^ *name (.*) \\(offset [0-9]+\\)$"); cmUVPipeIStream output(process.GetLoop(), process.OutputStream()); while (std::getline(output, line)) { diff --git a/Source/cmBinUtilsWindowsPEDumpbinGetRuntimeDependenciesTool.cxx b/Source/cmBinUtilsWindowsPEDumpbinGetRuntimeDependenciesTool.cxx index cd21140..32b29e1 100644 --- a/Source/cmBinUtilsWindowsPEDumpbinGetRuntimeDependenciesTool.cxx +++ b/Source/cmBinUtilsWindowsPEDumpbinGetRuntimeDependenciesTool.cxx @@ -19,7 +19,7 @@ cmBinUtilsWindowsPEDumpbinGetRuntimeDependenciesTool:: } bool cmBinUtilsWindowsPEDumpbinGetRuntimeDependenciesTool::GetFileInfo( - const std::string& file, std::vector& needed) + std::string const& file, std::vector& needed) { cmUVProcessChainBuilder builder; builder.SetBuiltinStream(cmUVProcessChainBuilder::Stream_OUTPUT); @@ -42,7 +42,7 @@ bool cmBinUtilsWindowsPEDumpbinGetRuntimeDependenciesTool::GetFileInfo( } std::string line; - static const cmsys::RegularExpression regex( + static cmsys::RegularExpression const regex( "^ ([^\n]*\\.[Dd][Ll][Ll])\r$"); cmUVPipeIStream output(process.GetLoop(), process.OutputStream()); while (std::getline(output, line)) { diff --git a/Source/cmBinUtilsWindowsPEDumpbinGetRuntimeDependenciesTool.h b/Source/cmBinUtilsWindowsPEDumpbinGetRuntimeDependenciesTool.h index 8609479..08e6cc7 100644 --- a/Source/cmBinUtilsWindowsPEDumpbinGetRuntimeDependenciesTool.h +++ b/Source/cmBinUtilsWindowsPEDumpbinGetRuntimeDependenciesTool.h @@ -17,6 +17,6 @@ public: cmBinUtilsWindowsPEDumpbinGetRuntimeDependenciesTool( cmRuntimeDependencyArchive* archive); - bool GetFileInfo(const std::string& file, + bool GetFileInfo(std::string const& file, std::vector& needed) override; }; diff --git a/Source/cmBinUtilsWindowsPEGetRuntimeDependenciesTool.cxx b/Source/cmBinUtilsWindowsPEGetRuntimeDependenciesTool.cxx index 468a40c..820296b 100644 --- a/Source/cmBinUtilsWindowsPEGetRuntimeDependenciesTool.cxx +++ b/Source/cmBinUtilsWindowsPEGetRuntimeDependenciesTool.cxx @@ -13,7 +13,7 @@ cmBinUtilsWindowsPEGetRuntimeDependenciesTool:: } void cmBinUtilsWindowsPEGetRuntimeDependenciesTool::SetError( - const std::string& error) + std::string const& error) { this->Archive->SetError(error); } diff --git a/Source/cmBinUtilsWindowsPEGetRuntimeDependenciesTool.h b/Source/cmBinUtilsWindowsPEGetRuntimeDependenciesTool.h index da71aaa..9b8fa5e 100644 --- a/Source/cmBinUtilsWindowsPEGetRuntimeDependenciesTool.h +++ b/Source/cmBinUtilsWindowsPEGetRuntimeDependenciesTool.h @@ -15,11 +15,11 @@ public: cmRuntimeDependencyArchive* archive); virtual ~cmBinUtilsWindowsPEGetRuntimeDependenciesTool() = default; - virtual bool GetFileInfo(const std::string& file, + virtual bool GetFileInfo(std::string const& file, std::vector& needed) = 0; protected: cmRuntimeDependencyArchive* Archive; - void SetError(const std::string& error); + void SetError(std::string const& error); }; diff --git a/Source/cmBinUtilsWindowsPEObjdumpGetRuntimeDependenciesTool.cxx b/Source/cmBinUtilsWindowsPEObjdumpGetRuntimeDependenciesTool.cxx index d54aa7d..9101162 100644 --- a/Source/cmBinUtilsWindowsPEObjdumpGetRuntimeDependenciesTool.cxx +++ b/Source/cmBinUtilsWindowsPEObjdumpGetRuntimeDependenciesTool.cxx @@ -20,7 +20,7 @@ cmBinUtilsWindowsPEObjdumpGetRuntimeDependenciesTool:: } bool cmBinUtilsWindowsPEObjdumpGetRuntimeDependenciesTool::GetFileInfo( - const std::string& file, std::vector& needed) + std::string const& file, std::vector& needed) { cmUVProcessChainBuilder builder; builder.SetBuiltinStream(cmUVProcessChainBuilder::Stream_OUTPUT); @@ -43,7 +43,7 @@ bool cmBinUtilsWindowsPEObjdumpGetRuntimeDependenciesTool::GetFileInfo( } std::string line; - static const cmsys::RegularExpression regex( + static cmsys::RegularExpression const regex( "^[\t ]*DLL Name: ([^\n]*\\.[Dd][Ll][Ll])$"); cmUVPipeIStream output(process.GetLoop(), process.OutputStream()); while (cmSystemTools::GetLineFromStream(output, line)) { diff --git a/Source/cmBinUtilsWindowsPEObjdumpGetRuntimeDependenciesTool.h b/Source/cmBinUtilsWindowsPEObjdumpGetRuntimeDependenciesTool.h index fe89a2d..efd6851 100644 --- a/Source/cmBinUtilsWindowsPEObjdumpGetRuntimeDependenciesTool.h +++ b/Source/cmBinUtilsWindowsPEObjdumpGetRuntimeDependenciesTool.h @@ -17,6 +17,6 @@ public: cmBinUtilsWindowsPEObjdumpGetRuntimeDependenciesTool( cmRuntimeDependencyArchive* archive); - bool GetFileInfo(const std::string& file, + bool GetFileInfo(std::string const& file, std::vector& needed) override; }; diff --git a/Source/cmBlockCommand.cxx b/Source/cmBlockCommand.cxx index 5bf7bed..6a1c4c9 100644 --- a/Source/cmBlockCommand.cxx +++ b/Source/cmBlockCommand.cxx @@ -33,18 +33,18 @@ using ScopeSet = cm::enum_set; class BlockScopePushPop { public: - BlockScopePushPop(cmMakefile* m, const ScopeSet& scopes); + BlockScopePushPop(cmMakefile* m, ScopeSet const& scopes); ~BlockScopePushPop() = default; - BlockScopePushPop(const BlockScopePushPop&) = delete; - BlockScopePushPop& operator=(const BlockScopePushPop&) = delete; + BlockScopePushPop(BlockScopePushPop const&) = delete; + BlockScopePushPop& operator=(BlockScopePushPop const&) = delete; private: std::unique_ptr PolicyScope; std::unique_ptr VariableScope; }; -BlockScopePushPop::BlockScopePushPop(cmMakefile* mf, const ScopeSet& scopes) +BlockScopePushPop::BlockScopePushPop(cmMakefile* mf, ScopeSet const& scopes) { if (scopes.contains(ScopeType::POLICIES)) { this->PolicyScope = cm::make_unique(mf); @@ -57,7 +57,7 @@ BlockScopePushPop::BlockScopePushPop(cmMakefile* mf, const ScopeSet& scopes) class cmBlockFunctionBlocker : public cmFunctionBlocker { public: - cmBlockFunctionBlocker(cmMakefile* mf, const ScopeSet& scopes, + cmBlockFunctionBlocker(cmMakefile* mf, ScopeSet const& scopes, std::vector variableNames); ~cmBlockFunctionBlocker() override; @@ -80,7 +80,7 @@ private: }; cmBlockFunctionBlocker::cmBlockFunctionBlocker( - cmMakefile* const mf, const ScopeSet& scopes, + cmMakefile* const mf, ScopeSet const& scopes, std::vector variableNames) : Makefile{ mf } , Scopes{ scopes } diff --git a/Source/cmBuildDatabase.cxx b/Source/cmBuildDatabase.cxx index dc5f906..9770587 100644 --- a/Source/cmBuildDatabase.cxx +++ b/Source/cmBuildDatabase.cxx @@ -498,9 +498,9 @@ int cmcmd_cmake_module_compile_db( std::vector::const_iterator argBeg, std::vector::const_iterator argEnd) { - const std::string* command = nullptr; - const std::string* output = nullptr; - std::vector inputs; + std::string const* command = nullptr; + std::string const* output = nullptr; + std::vector inputs; bool next_is_output = false; for (auto i = argBeg; i != argEnd; ++i) { diff --git a/Source/cmBuildOptions.h b/Source/cmBuildOptions.h index aa3184e..00cb288 100644 --- a/Source/cmBuildOptions.h +++ b/Source/cmBuildOptions.h @@ -35,8 +35,8 @@ public: , ResolveMode(resolveMode) { } - explicit cmBuildOptions(const cmBuildOptions&) noexcept = default; - cmBuildOptions& operator=(const cmBuildOptions&) noexcept = default; + explicit cmBuildOptions(cmBuildOptions const&) noexcept = default; + cmBuildOptions& operator=(cmBuildOptions const&) noexcept = default; bool Clean = false; bool Fast = false; diff --git a/Source/cmCMakeHostSystemInformationCommand.cxx b/Source/cmCMakeHostSystemInformationCommand.cxx index 0366030..1c78e97 100644 --- a/Source/cmCMakeHostSystemInformationCommand.cxx +++ b/Source/cmCMakeHostSystemInformationCommand.cxx @@ -46,7 +46,7 @@ std::string ValueToString(std::size_t const value) return std::to_string(value); } -std::string ValueToString(const char* const value) +std::string ValueToString(char const* const value) { return value ? value : std::string{}; } @@ -266,13 +266,13 @@ std::map GetOSReleaseVariables( cmExecutionStatus& status) { auto& makefile = status.GetMakefile(); - const auto& sysroot = makefile.GetSafeDefinition("CMAKE_SYSROOT"); + auto const& sysroot = makefile.GetSafeDefinition("CMAKE_SYSROOT"); std::map data; // Based on // https://www.freedesktop.org/software/systemd/man/latest/os-release.html for (auto name : { "/etc/os-release"_s, "/usr/lib/os-release"_s }) { - const auto& filename = cmStrCat(sysroot, name); + auto const& filename = cmStrCat(sysroot, name); if (cmSystemTools::FileExists(filename)) { cmsys::ifstream fin(filename.c_str()); for (std::string line; !std::getline(fin, line).fail();) { @@ -381,21 +381,21 @@ cm::optional GetDistribValue(cmExecutionStatus& status, std::string const& key, std::string const& variable) { - const auto prefix = "DISTRIB_"_s; + auto const prefix = "DISTRIB_"_s; if (!cmHasPrefix(key, prefix)) { return {}; } - static const std::map s_os_release = + static std::map const s_os_release = GetOSReleaseVariables(status); auto& makefile = status.GetMakefile(); - const std::string subkey = + std::string const subkey = key.substr(prefix.size(), key.size() - prefix.size()); if (subkey == "INFO"_s) { std::string vars; - for (const auto& kv : s_os_release) { + for (auto const& kv : s_os_release) { auto cmake_var_name = cmStrCat(variable, '_', kv.first); vars += DELIM[!vars.empty()] + cmake_var_name; makefile.AddDefinition(cmake_var_name, kv.second); @@ -404,7 +404,7 @@ cm::optional GetDistribValue(cmExecutionStatus& status, } // Query individual variable - const auto it = s_os_release.find(subkey); + auto const it = s_os_release.find(subkey); if (it != s_os_release.cend()) { return it->second; } diff --git a/Source/cmCMakeLanguageCommand.cxx b/Source/cmCMakeLanguageCommand.cxx index fe9257e..6bde3d4 100644 --- a/Source/cmCMakeLanguageCommand.cxx +++ b/Source/cmCMakeLanguageCommand.cxx @@ -217,7 +217,7 @@ bool cmCMakeLanguageCommandEVAL(std::vector const& args, "called with unsupported arguments between EVAL and CODE arguments"); } - const std::string code = + std::string const code = cmJoin(cmMakeRange(expandedArgs.begin() + 2, expandedArgs.end()), " "); return makefile.ReadListFileAsString( code, cmStrCat(context.FilePath, ":", context.Line, ":EVAL")); @@ -324,7 +324,7 @@ bool cmCMakeLanguageCommandGET_MESSAGE_LOG_LEVEL( Message::LogLevel logLevel = makefile.GetCurrentLogLevel(); std::string outputValue = cmake::LogLevelToString(logLevel); - const std::string& outputVariable = expandedArgs[1]; + std::string const& outputVariable = expandedArgs[1]; makefile.AddDefinition(outputVariable, outputValue); return true; } diff --git a/Source/cmCMakePath.cxx b/Source/cmCMakePath.cxx index be5c74a..9d82bef 100644 --- a/Source/cmCMakePath.cxx +++ b/Source/cmCMakePath.cxx @@ -68,7 +68,7 @@ cmCMakePath cmCMakePath::GetNarrowStem() const return stem; } -cmCMakePath cmCMakePath::Absolute(const cm::filesystem::path& base) const +cmCMakePath cmCMakePath::Absolute(cm::filesystem::path const& base) const { if (this->Path.is_relative()) { auto path = base; @@ -80,7 +80,7 @@ cmCMakePath cmCMakePath::Absolute(const cm::filesystem::path& base) const return *this; } -bool cmCMakePath::IsPrefix(const cmCMakePath& path) const +bool cmCMakePath::IsPrefix(cmCMakePath const& path) const { auto prefix_it = this->Path.begin(); auto prefix_end = this->Path.end(); diff --git a/Source/cmCMakePath.h b/Source/cmCMakePath.h index 52fd6aa..e047ab7 100644 --- a/Source/cmCMakePath.h +++ b/Source/cmCMakePath.h @@ -111,7 +111,7 @@ public: cmCMakePath() noexcept = default; - cmCMakePath(const cmCMakePath&) = default; + cmCMakePath(cmCMakePath const&) = default; cmCMakePath(cmCMakePath&& path) noexcept : Path(std::forward(path.Path)) @@ -126,7 +126,7 @@ public: : Path(FormatPath(source, fmt)) { } - cmCMakePath(const char* source, format fmt = generic_format) noexcept + cmCMakePath(char const* source, format fmt = generic_format) noexcept : Path(FormatPath(cm::string_view{ source }, fmt)) { } @@ -134,7 +134,7 @@ public: // Oracle DeveloperStudio C++ compiler on Solaris/Sparc is confused when // standard methods and templates use the same name. The template is selected // rather than the standard one regardless the arguments of the method. - cmCMakePath(const std::string& source, format fmt = generic_format) + cmCMakePath(std::string const& source, format fmt = generic_format) : Path(FormatPath(source, fmt)) { } @@ -157,13 +157,13 @@ public: return *this; } template > - cmCMakePath& Assign(const Source& source) + cmCMakePath& Assign(Source const& source) { this->Path = source; return *this; } - cmCMakePath& operator=(const cmCMakePath& path) + cmCMakePath& operator=(cmCMakePath const& path) { if (this != &path) { this->Path = path.Path; @@ -191,22 +191,22 @@ public: this->Assign(std::forward(source)); return *this; } - cmCMakePath& operator=(const cm::filesystem::path& source) + cmCMakePath& operator=(cm::filesystem::path const& source) { this->Assign(source); return *this; } - cmCMakePath& operator=(const std::string& source) + cmCMakePath& operator=(std::string const& source) { this->Assign(source); return *this; } - cmCMakePath& operator=(const cm::string_view source) + cmCMakePath& operator=(cm::string_view const source) { this->Assign(source); return *this; } - cmCMakePath& operator=(const char* source) + cmCMakePath& operator=(char const* source) { this->Assign(cm::string_view{ source }); return *this; @@ -219,7 +219,7 @@ public: return *this; } template > - cmCMakePath& operator=(const Source& source) + cmCMakePath& operator=(Source const& source) { this->Assign(source); return *this; @@ -227,11 +227,11 @@ public: #endif // Concatenation - cmCMakePath& Append(const cmCMakePath& path) + cmCMakePath& Append(cmCMakePath const& path) { return this->Append(path.Path); } - cmCMakePath& Append(const cm::filesystem::path& path) + cmCMakePath& Append(cm::filesystem::path const& path) { this->Path /= path; // filesystem::path::append use preferred_separator ('\' on Windows) @@ -243,7 +243,7 @@ public: // Oracle DeveloperStudio C++ compiler on Solaris/Sparc is confused when // standard methods and templates use the same name. The template is selected // rather than the standard one regardless the arguments of the method. - cmCMakePath& Append(const std::string& source) + cmCMakePath& Append(std::string const& source) { return this->Append(cm::filesystem::path(source)); } @@ -251,29 +251,29 @@ public: { return this->Append(cm::filesystem::path(source)); } - cmCMakePath& Append(const char* source) + cmCMakePath& Append(char const* source) { return this->Append(cm::filesystem::path(cm::string_view{ source })); } #else template > - cmCMakePath& Append(const Source& source) + cmCMakePath& Append(Source const& source) { return this->Append(cm::filesystem::path(source)); } #endif - cmCMakePath& operator/=(const cmCMakePath& path) + cmCMakePath& operator/=(cmCMakePath const& path) { return this->Append(path); } template > - cmCMakePath& operator/=(const Source& source) + cmCMakePath& operator/=(Source const& source) { return this->Append(source); } - cmCMakePath& Concat(const cmCMakePath& path) + cmCMakePath& Concat(cmCMakePath const& path) { this->Path += path.Path; return *this; @@ -287,36 +287,36 @@ public: // Oracle DeveloperStudio C++ compiler on Solaris/Sparc is confused when // standard methods and templates use the same name. The template is selected // rather than the standard one regardless the arguments of the method. - cmCMakePath& Concat(const cm::filesystem::path& source) + cmCMakePath& Concat(cm::filesystem::path const& source) { this->Path.operator+=(source); return *this; } - cmCMakePath& Concat(const std::string& source) + cmCMakePath& Concat(std::string const& source) { this->Path.operator+=(source); return *this; } - cmCMakePath& Concat(const char* source) + cmCMakePath& Concat(char const* source) { this->Path.operator+=(source); return *this; } #else template > - cmCMakePath& Concat(const Source& source) + cmCMakePath& Concat(Source const& source) { this->Path.operator+=(source); return *this; } #endif - cmCMakePath& operator+=(const cmCMakePath& path) + cmCMakePath& operator+=(cmCMakePath const& path) { return this->Concat(path); } template > - cmCMakePath& operator+=(const Source& source) + cmCMakePath& operator+=(Source const& source) { return this->Concat(source); } @@ -330,7 +330,7 @@ public: return *this; } - cmCMakePath& ReplaceFileName(const cmCMakePath& filename) + cmCMakePath& ReplaceFileName(cmCMakePath const& filename) { if (this->Path.has_filename()) { this->Path.replace_filename(filename.Path); @@ -341,14 +341,14 @@ public: // Oracle DeveloperStudio C++ compiler on Solaris/Sparc is confused when // standard methods and templates use the same name. The template is selected // rather than the standard one regardless the arguments of the method. - cmCMakePath& ReplaceFileName(const cm::filesystem::path& filename) + cmCMakePath& ReplaceFileName(cm::filesystem::path const& filename) { if (this->Path.has_filename()) { this->Path.replace_filename(filename); } return *this; } - cmCMakePath& ReplaceFileName(const std::string& filename) + cmCMakePath& ReplaceFileName(std::string const& filename) { if (this->Path.has_filename()) { this->Path.replace_filename(filename); @@ -364,7 +364,7 @@ public: } #else template > - cmCMakePath& ReplaceFileName(const Source& filename) + cmCMakePath& ReplaceFileName(Source const& filename) { if (this->Path.has_filename()) { this->Path.replace_filename(filename); @@ -373,7 +373,7 @@ public: } #endif - cmCMakePath& ReplaceExtension(const cmCMakePath& extension = cmCMakePath()) + cmCMakePath& ReplaceExtension(cmCMakePath const& extension = cmCMakePath()) { this->Path.replace_extension(extension.Path); return *this; @@ -382,24 +382,24 @@ public: // Oracle DeveloperStudio C++ compiler on Solaris/Sparc is confused when // standard methods and templates use the same name. The template is selected // rather than the standard one regardless the arguments of the method. - cmCMakePath& ReplaceExtension(const cm::filesystem::path& extension) + cmCMakePath& ReplaceExtension(cm::filesystem::path const& extension) { this->Path.replace_extension(extension); return *this; } - cmCMakePath& ReplaceExtension(const std::string& extension) + cmCMakePath& ReplaceExtension(std::string const& extension) { this->Path.replace_extension(extension); return *this; } - cmCMakePath& ReplaceExtension(const cm::string_view extension) + cmCMakePath& ReplaceExtension(cm::string_view const extension) { this->Path.replace_extension(extension); return *this; } #else template > - cmCMakePath& ReplaceExtension(const Source& extension) + cmCMakePath& ReplaceExtension(Source const& extension) { this->Path.replace_extension(extension); return *this; @@ -407,12 +407,12 @@ public: #endif cmCMakePath& ReplaceWideExtension( - const cmCMakePath& extension = cmCMakePath()) + cmCMakePath const& extension = cmCMakePath()) { return this->ReplaceWideExtension( static_cast(extension.Path.string())); } - cmCMakePath& ReplaceWideExtension(const cm::filesystem::path& extension) + cmCMakePath& ReplaceWideExtension(cm::filesystem::path const& extension) { return this->ReplaceWideExtension( static_cast(extension.string())); @@ -421,13 +421,13 @@ public: // Oracle DeveloperStudio C++ compiler on Solaris/Sparc is confused when // standard methods and templates use the same name. The template is selected // rather than the standard one regardless the arguments of the method. - cmCMakePath& ReplaceWideExtension(const std::string& extension) + cmCMakePath& ReplaceWideExtension(std::string const& extension) { return this->ReplaceWideExtension(cm::string_view{ extension }); } #else template > - cmCMakePath& ReplaceWideExtension(const Source& extension) + cmCMakePath& ReplaceWideExtension(Source const& extension) { return this->ReplaceWideExtension(extension); } @@ -502,11 +502,11 @@ public: return path.generic_string(); } - cmCMakePath Relative(const cmCMakePath& base) const + cmCMakePath Relative(cmCMakePath const& base) const { return this->Relative(base.Path); } - cmCMakePath Relative(const cm::filesystem::path& base) const + cmCMakePath Relative(cm::filesystem::path const& base) const { auto path = this->Path.lexically_relative(base); // filesystem::path:lexically_relative use preferred_separator ('\') on @@ -517,7 +517,7 @@ public: // Oracle DeveloperStudio C++ compiler on Solaris/Sparc is confused when // standard methods and templates use the same name. The template is selected // rather than the standard one regardless the arguments of the method. - cmCMakePath Relative(const std::string& base) const + cmCMakePath Relative(std::string const& base) const { return this->Relative(cm::filesystem::path(base)); } @@ -527,16 +527,16 @@ public: } #else template > - cmCMakePath Relative(const Source& base) const + cmCMakePath Relative(Source const& base) const { return this->Relative(cm::filesystem::path(base)); } #endif - cmCMakePath Proximate(const cmCMakePath& base) const + cmCMakePath Proximate(cmCMakePath const& base) const { return this->Proximate(base.Path); } - cmCMakePath Proximate(const cm::filesystem::path& base) const + cmCMakePath Proximate(cm::filesystem::path const& base) const { auto path = this->Path.lexically_proximate(base); // filesystem::path::lexically_proximate use preferred_separator ('\') on @@ -547,7 +547,7 @@ public: // Oracle DeveloperStudio C++ compiler on Solaris/Sparc is confused when // standard methods and templates use the same name. The template is selected // rather than the standard one regardless the arguments of the method. - cmCMakePath Proximate(const std::string& base) const + cmCMakePath Proximate(std::string const& base) const { return this->Proximate(cm::filesystem::path(base)); } @@ -557,13 +557,13 @@ public: } #else template > - cmCMakePath Proximate(const Source& base) const + cmCMakePath Proximate(Source const& base) const { return this->Proximate(cm::filesystem::path(base)); } #endif - cmCMakePath Absolute(const cmCMakePath& base) const + cmCMakePath Absolute(cmCMakePath const& base) const { return this->Absolute(base.Path); } @@ -571,7 +571,7 @@ public: // Oracle DeveloperStudio C++ compiler on Solaris/Sparc is confused when // standard methods and templates use the same name. The template is selected // rather than the standard one regardless the arguments of the method. - cmCMakePath Absolute(const std::string& base) const + cmCMakePath Absolute(std::string const& base) const { return this->Absolute(cm::filesystem::path(base)); } @@ -581,15 +581,15 @@ public: } #else template > - cmCMakePath Absolute(const Source& base) const + cmCMakePath Absolute(Source const& base) const { return this->Absolute(cm::filesystem::path(base)); } #endif - cmCMakePath Absolute(const cm::filesystem::path& base) const; + cmCMakePath Absolute(cm::filesystem::path const& base) const; // Comparison - int Compare(const cmCMakePath& path) const noexcept + int Compare(cmCMakePath const& path) const noexcept { return this->Path.compare(path.Path); } @@ -608,7 +608,7 @@ public: bool IsAbsolute() const { return this->Path.is_absolute(); } bool IsRelative() const { return this->Path.is_relative(); } - bool IsPrefix(const cmCMakePath& path) const; + bool IsPrefix(cmCMakePath const& path) const; // Iterators // ========= @@ -617,18 +617,18 @@ public: // Non-members // =========== - friend bool operator==(const cmCMakePath& lhs, - const cmCMakePath& rhs) noexcept + friend bool operator==(cmCMakePath const& lhs, + cmCMakePath const& rhs) noexcept { return lhs.Compare(rhs) == 0; } - friend bool operator!=(const cmCMakePath& lhs, - const cmCMakePath& rhs) noexcept + friend bool operator!=(cmCMakePath const& lhs, + cmCMakePath const& rhs) noexcept { return lhs.Compare(rhs) != 0; } - friend cmCMakePath operator/(const cmCMakePath& lhs, const cmCMakePath& rhs) + friend cmCMakePath operator/(cmCMakePath const& lhs, cmCMakePath const& rhs) { cmCMakePath result(lhs); result /= rhs; @@ -637,7 +637,7 @@ public: } private: - friend std::size_t hash_value(const cmCMakePath& path) noexcept; + friend std::size_t hash_value(cmCMakePath const& path) noexcept; static std::string FormatPath(std::string path, format fmt = generic_format); static std::string FormatPath(cm::string_view path, @@ -659,12 +659,12 @@ public: using value_type = cmCMakePath; using difference_type = cm::filesystem::path::iterator::difference_type; - using pointer = const cmCMakePath*; - using reference = const cmCMakePath&; + using pointer = cmCMakePath const*; + using reference = cmCMakePath const&; iterator() = default; - iterator(const iterator& other) + iterator(iterator const& other) : Iterator(other.Iterator) , Path(other.Path) , PathElement(*this->Iterator) @@ -673,7 +673,7 @@ public: ~iterator() = default; - iterator& operator=(const iterator& other) + iterator& operator=(iterator const& other) { if (this != &other) { this->Iterator = other.Iterator; @@ -720,9 +720,9 @@ public: private: friend class cmCMakePath; - friend bool operator==(const iterator&, const iterator&); + friend bool operator==(iterator const&, iterator const&); - iterator(const cmCMakePath* path, const cm::filesystem::path::iterator& it) + iterator(cmCMakePath const* path, cm::filesystem::path::iterator const& it) : Iterator(it) , Path(path) , PathElement(*this->Iterator) @@ -730,7 +730,7 @@ private: } cm::filesystem::path::iterator Iterator; - const cmCMakePath* Path = nullptr; + cmCMakePath const* Path = nullptr; cmCMakePath PathElement; }; @@ -745,14 +745,14 @@ inline cmCMakePath::iterator cmCMakePath::end() const // Non-member functions // ==================== -inline bool operator==(const cmCMakePath::iterator& lhs, - const cmCMakePath::iterator& rhs) +inline bool operator==(cmCMakePath::iterator const& lhs, + cmCMakePath::iterator const& rhs) { return lhs.Path == rhs.Path && lhs.Path && lhs.Iterator == rhs.Iterator; } -inline bool operator!=(const cmCMakePath::iterator& lhs, - const cmCMakePath::iterator& rhs) +inline bool operator!=(cmCMakePath::iterator const& lhs, + cmCMakePath::iterator const& rhs) { return !(lhs == rhs); } @@ -762,7 +762,7 @@ inline void swap(cmCMakePath& lhs, cmCMakePath& rhs) noexcept lhs.swap(rhs); } -inline std::size_t hash_value(const cmCMakePath& path) noexcept +inline std::size_t hash_value(cmCMakePath const& path) noexcept { return cm::filesystem::hash_value(path.Path); } diff --git a/Source/cmCMakePathCommand.cxx b/Source/cmCMakePathCommand.cxx index 0c8f537..97c83bb 100644 --- a/Source/cmCMakePathCommand.cxx +++ b/Source/cmCMakePathCommand.cxx @@ -53,7 +53,7 @@ public: cmMakeRange(args).advance(Advance), &this->Inputs); } - const std::vector& GetInputs() const { return this->Inputs; } + std::vector const& GetInputs() const { return this->Inputs; } protected: mutable std::vector Inputs; @@ -108,7 +108,7 @@ public: }; // retrieve value of input path from specified variable -bool getInputPath(const std::string& arg, cmExecutionStatus& status, +bool getInputPath(std::string const& arg, cmExecutionStatus& status, std::string& path) { cmValue def = status.GetMakefile().GetDefinition(arg); @@ -125,43 +125,43 @@ bool HandleGetCommand(std::vector const& args, cmExecutionStatus& status) { static std::map> const + std::function> const actions{ { "ROOT_NAME"_s, - [](const cmCMakePath& path, bool) -> cmCMakePath { + [](cmCMakePath const& path, bool) -> cmCMakePath { return path.GetRootName(); } }, { "ROOT_DIRECTORY"_s, - [](const cmCMakePath& path, bool) -> cmCMakePath { + [](cmCMakePath const& path, bool) -> cmCMakePath { return path.GetRootDirectory(); } }, { "ROOT_PATH"_s, - [](const cmCMakePath& path, bool) -> cmCMakePath { + [](cmCMakePath const& path, bool) -> cmCMakePath { return path.GetRootPath(); } }, { "FILENAME"_s, - [](const cmCMakePath& path, bool) -> cmCMakePath { + [](cmCMakePath const& path, bool) -> cmCMakePath { return path.GetFileName(); } }, { "EXTENSION"_s, - [](const cmCMakePath& path, bool last_only) -> cmCMakePath { + [](cmCMakePath const& path, bool last_only) -> cmCMakePath { if (last_only) { return path.GetExtension(); } return path.GetWideExtension(); } }, { "STEM"_s, - [](const cmCMakePath& path, bool last_only) -> cmCMakePath { + [](cmCMakePath const& path, bool last_only) -> cmCMakePath { if (last_only) { return path.GetStem(); } return path.GetNarrowStem(); } }, { "RELATIVE_PART"_s, - [](const cmCMakePath& path, bool) -> cmCMakePath { + [](cmCMakePath const& path, bool) -> cmCMakePath { return path.GetRelativePath(); } }, { "PARENT_PATH"_s, - [](const cmCMakePath& path, bool) -> cmCMakePath { + [](cmCMakePath const& path, bool) -> cmCMakePath { return path.GetParentPath(); } } }; @@ -170,7 +170,7 @@ bool HandleGetCommand(std::vector const& args, return false; } - const auto& action = args[2]; + auto const& action = args[2]; if (actions.find(action) == actions.end()) { status.SetError( @@ -227,7 +227,7 @@ bool HandleSetCommand(std::vector const& args, static NormalizeParser const parser; - const auto arguments = parser.Parse(args); + auto const arguments = parser.Parse(args); if (parser.GetInputs().size() != 1) { status.SetError("SET called with unexpected arguments."); @@ -256,14 +256,14 @@ bool HandleAppendCommand(std::vector const& args, static OutputVariableParser const parser{}; - const auto arguments = parser.Parse(args); + auto const arguments = parser.Parse(args); if (arguments.MaybeReportError(status.GetMakefile())) { return true; } cmCMakePath path(status.GetMakefile().GetSafeDefinition(args[1])); - for (const auto& input : parser.GetInputs()) { + for (auto const& input : parser.GetInputs()) { path /= input; } @@ -278,7 +278,7 @@ bool HandleAppendStringCommand(std::vector const& args, { static OutputVariableParser const parser{}; - const auto arguments = parser.Parse(args); + auto const arguments = parser.Parse(args); if (arguments.MaybeReportError(status.GetMakefile())) { return true; @@ -290,7 +290,7 @@ bool HandleAppendStringCommand(std::vector const& args, } cmCMakePath path(inputPath); - for (const auto& input : parser.GetInputs()) { + for (auto const& input : parser.GetInputs()) { path += input; } @@ -305,7 +305,7 @@ bool HandleRemoveFilenameCommand(std::vector const& args, { static OutputVariableParser const parser{}; - const auto arguments = parser.Parse(args); + auto const arguments = parser.Parse(args); if (arguments.MaybeReportError(status.GetMakefile())) { return true; @@ -335,7 +335,7 @@ bool HandleReplaceFilenameCommand(std::vector const& args, { static OutputVariableParser const parser{}; - const auto arguments = parser.Parse(args); + auto const arguments = parser.Parse(args); if (arguments.MaybeReportError(status.GetMakefile())) { return true; @@ -454,7 +454,7 @@ bool HandleNormalPathCommand(std::vector const& args, { static OutputVariableParser const parser{}; - const auto arguments = parser.Parse(args); + auto const arguments = parser.Parse(args); if (arguments.MaybeReportError(status.GetMakefile())) { return true; @@ -480,8 +480,8 @@ bool HandleNormalPathCommand(std::vector const& args, bool HandleTransformPathCommand( std::vector const& args, cmExecutionStatus& status, - const std::function& transform, + std::function const& transform, bool normalizeOption = false) { struct Arguments : public ArgumentParser::ParseResult @@ -536,7 +536,7 @@ bool HandleRelativePathCommand(std::vector const& args, { return HandleTransformPathCommand( args, status, - [](const cmCMakePath& path, const std::string& base) -> cmCMakePath { + [](cmCMakePath const& path, std::string const& base) -> cmCMakePath { return path.Relative(base); }); } @@ -546,7 +546,7 @@ bool HandleAbsolutePathCommand(std::vector const& args, { return HandleTransformPathCommand( args, status, - [](const cmCMakePath& path, const std::string& base) -> cmCMakePath { + [](cmCMakePath const& path, std::string const& base) -> cmCMakePath { return path.Absolute(base); }, true); @@ -562,7 +562,7 @@ bool HandleNativePathCommand(std::vector const& args, static NormalizeParser const parser; - const auto arguments = parser.Parse(args); + auto const arguments = parser.Parse(args); if (parser.GetInputs().size() != 1) { status.SetError("NATIVE_PATH called with unexpected arguments."); @@ -593,19 +593,19 @@ bool HandleConvertCommand(std::vector const& args, cmExecutionStatus& status) { #if defined(_WIN32) && !defined(__CYGWIN__) - const auto pathSep = ";"_s; + auto const pathSep = ";"_s; #else - const auto pathSep = ":"_s; + auto const pathSep = ":"_s; #endif - const auto cmakePath = "TO_CMAKE_PATH_LIST"_s; - const auto nativePath = "TO_NATIVE_PATH_LIST"_s; + auto const cmakePath = "TO_CMAKE_PATH_LIST"_s; + auto const nativePath = "TO_NATIVE_PATH_LIST"_s; if (args.size() < 4 || args.size() > 5) { status.SetError("CONVERT must be called with three or four arguments."); return false; } - const auto& action = args[2]; + auto const& action = args[2]; if (action != cmakePath && action != nativePath) { status.SetError( @@ -620,7 +620,7 @@ bool HandleConvertCommand(std::vector const& args, static NormalizeParser const parser; - const auto arguments = parser.Parse<4>(args); + auto const arguments = parser.Parse<4>(args); if (!parser.GetInputs().empty()) { status.SetError("CONVERT called with unexpected arguments."); @@ -664,19 +664,19 @@ bool HandleCompareCommand(std::vector const& args, } static std::map> const operators{ + std::function> const operators{ { "EQUAL"_s, - [](const cmCMakePath& path1, const cmCMakePath& path2) -> bool { + [](cmCMakePath const& path1, cmCMakePath const& path2) -> bool { return path1 == path2; } }, { "NOT_EQUAL"_s, - [](const cmCMakePath& path1, const cmCMakePath& path2) -> bool { + [](cmCMakePath const& path1, cmCMakePath const& path2) -> bool { return path1 != path2; } } }; - const auto op = operators.find(args[2]); + auto const op = operators.find(args[2]); if (op == operators.end()) { status.SetError(cmStrCat( "COMPARE called with an unknown comparison operator: ", args[2], ".")); @@ -699,7 +699,7 @@ bool HandleCompareCommand(std::vector const& args, bool HandleHasItemCommand( std::vector const& args, cmExecutionStatus& status, - const std::function& has_item) + std::function const& has_item) { if (args.size() != 3) { status.SetError( @@ -730,7 +730,7 @@ bool HandleHasRootNameCommand(std::vector const& args, { return HandleHasItemCommand( args, status, - [](const cmCMakePath& path) -> bool { return path.HasRootName(); }); + [](cmCMakePath const& path) -> bool { return path.HasRootName(); }); } bool HandleHasRootDirectoryCommand(std::vector const& args, @@ -738,7 +738,7 @@ bool HandleHasRootDirectoryCommand(std::vector const& args, { return HandleHasItemCommand( args, status, - [](const cmCMakePath& path) -> bool { return path.HasRootDirectory(); }); + [](cmCMakePath const& path) -> bool { return path.HasRootDirectory(); }); } bool HandleHasRootPathCommand(std::vector const& args, @@ -746,7 +746,7 @@ bool HandleHasRootPathCommand(std::vector const& args, { return HandleHasItemCommand( args, status, - [](const cmCMakePath& path) -> bool { return path.HasRootPath(); }); + [](cmCMakePath const& path) -> bool { return path.HasRootPath(); }); } bool HandleHasFilenameCommand(std::vector const& args, @@ -754,7 +754,7 @@ bool HandleHasFilenameCommand(std::vector const& args, { return HandleHasItemCommand( args, status, - [](const cmCMakePath& path) -> bool { return path.HasFileName(); }); + [](cmCMakePath const& path) -> bool { return path.HasFileName(); }); } bool HandleHasExtensionCommand(std::vector const& args, @@ -762,7 +762,7 @@ bool HandleHasExtensionCommand(std::vector const& args, { return HandleHasItemCommand( args, status, - [](const cmCMakePath& path) -> bool { return path.HasExtension(); }); + [](cmCMakePath const& path) -> bool { return path.HasExtension(); }); } bool HandleHasStemCommand(std::vector const& args, @@ -770,7 +770,7 @@ bool HandleHasStemCommand(std::vector const& args, { return HandleHasItemCommand( args, status, - [](const cmCMakePath& path) -> bool { return path.HasStem(); }); + [](cmCMakePath const& path) -> bool { return path.HasStem(); }); } bool HandleHasRelativePartCommand(std::vector const& args, @@ -778,7 +778,7 @@ bool HandleHasRelativePartCommand(std::vector const& args, { return HandleHasItemCommand( args, status, - [](const cmCMakePath& path) -> bool { return path.HasRelativePath(); }); + [](cmCMakePath const& path) -> bool { return path.HasRelativePath(); }); } bool HandleHasParentPathCommand(std::vector const& args, @@ -786,7 +786,7 @@ bool HandleHasParentPathCommand(std::vector const& args, { return HandleHasItemCommand( args, status, - [](const cmCMakePath& path) -> bool { return path.HasParentPath(); }); + [](cmCMakePath const& path) -> bool { return path.HasParentPath(); }); } bool HandleIsAbsoluteCommand(std::vector const& args, @@ -849,7 +849,7 @@ bool HandleIsPrefixCommand(std::vector const& args, static NormalizeParser const parser; - const auto arguments = parser.Parse(args); + auto const arguments = parser.Parse(args); if (parser.GetInputs().size() != 2) { status.SetError("IS_PREFIX called with unexpected arguments."); @@ -861,8 +861,8 @@ bool HandleIsPrefixCommand(std::vector const& args, return false; } - const auto& input = parser.GetInputs().front(); - const auto& output = parser.GetInputs().back(); + auto const& input = parser.GetInputs().front(); + auto const& output = parser.GetInputs().back(); if (output.empty()) { status.SetError("Invalid name for output variable."); @@ -895,7 +895,7 @@ bool HandleHashCommand(std::vector const& args, return false; } - const auto& output = args[2]; + auto const& output = args[2]; if (output.empty()) { status.SetError("Invalid name for output variable."); diff --git a/Source/cmCMakePkgConfigCommand.cxx b/Source/cmCMakePkgConfigCommand.cxx index 468d2ab..61ddf9c 100644 --- a/Source/cmCMakePkgConfigCommand.cxx +++ b/Source/cmCMakePkgConfigCommand.cxx @@ -71,9 +71,9 @@ cm::optional GetPkgConfigBin(cmMakefile& mf) return result; } -std::vector GetLocations(cmMakefile& mf, const char* cachevar, - const char* envvar, const char* desc, - const char* pcvar, bool need_pkgconf, +std::vector GetLocations(cmMakefile& mf, char const* cachevar, + char const* envvar, char const* desc, + char const* pcvar, bool need_pkgconf, std::vector default_locs) { auto def = mf.GetDefinition(cachevar); @@ -172,7 +172,7 @@ std::vector GetPkgConfSysCflags(cmMakefile& mf) } std::string paths; - auto get_and_append = [&](const char* var) { + auto get_and_append = [&](char const* var) { if (paths.empty()) { cmSystemTools::GetEnv(var, paths); } else { @@ -223,8 +223,8 @@ std::vector GetPcPath(cmMakefile& mf) return {}; } -cm::optional GetPath(cmMakefile& mf, const char* cachevar, - const char* envvar, const char* desc) +cm::optional GetPath(cmMakefile& mf, char const* cachevar, + char const* envvar, char const* desc) { cm::optional result; @@ -258,8 +258,8 @@ cm::optional GetTopBuildDir(cmMakefile& mf) "Package file top_build_dir variable default value"); } -bool GetBool(cmMakefile& mf, const char* cachevar, const char* envvar, - const char* desc) +bool GetBool(cmMakefile& mf, char const* cachevar, char const* envvar, + char const* desc) { auto def = mf.GetDefinition(cachevar); if (def) { @@ -451,7 +451,7 @@ cm::optional HandleCommon(CommonArguments& args, return {}; } - auto warn_or_error = [&](const std::string& err) { + auto warn_or_error = [&](std::string const& err) { if (args.Required) { status.SetError(err); cmSystemTools::SetFatalErrorOccurred(); @@ -610,7 +610,7 @@ struct ExtractArguments : CommonArguments SystemLibraryDirs; }; -const auto ExtractParser = +auto const ExtractParser = BIND_COMMON(ExtractArguments) .Bind("ALLOW_SYSTEM_INCLUDES"_s, &ExtractArguments::AllowSystemIncludes) .Bind("ALLOW_SYSTEM_LIBS"_s, &ExtractArguments::AllowSystemLibs) @@ -653,12 +653,12 @@ bool HandleExtractCommand(std::vector const& args, mf.AddDefinition("CMAKE_PKG_CONFIG_DESCRIPTION", resolved.Description()); mf.AddDefinition("CMAKE_PKG_CONFIG_VERSION", version); - auto make_list = [&](const char* def, - const std::vector& deps) { + auto make_list = [&](char const* def, + std::vector const& deps) { std::vector vec; vec.reserve(deps.size()); - for (const auto& dep : deps) { + for (auto const& dep : deps) { vec.emplace_back(dep.Name); } diff --git a/Source/cmCMakePresetsErrors.cxx b/Source/cmCMakePresetsErrors.cxx index 668476a..1e83c08 100644 --- a/Source/cmCMakePresetsErrors.cxx +++ b/Source/cmCMakePresetsErrors.cxx @@ -15,7 +15,7 @@ #include "cmStringAlgorithms.h" namespace cmCMakePresetsErrors { -const Json::Value* getPreset(cmJSONState* state) +Json::Value const* getPreset(cmJSONState* state) { if (state->parseStack.size() < 2) { return nullptr; @@ -30,7 +30,7 @@ const Json::Value* getPreset(cmJSONState* state) std::string getPresetName(cmJSONState* state) { - const Json::Value* preset = getPreset(state); + Json::Value const* preset = getPreset(state); if (preset && preset->isMember("name")) { return preset->operator[]("name").asString(); } @@ -45,58 +45,58 @@ std::string getVariableName(cmJSONState* state) return errMsg; } -void FILE_NOT_FOUND(const std::string& filename, cmJSONState* state) +void FILE_NOT_FOUND(std::string const& filename, cmJSONState* state) { state->AddError(cmStrCat("File not found: ", filename)); } -void INVALID_ROOT(const Json::Value* value, cmJSONState* state) +void INVALID_ROOT(Json::Value const* value, cmJSONState* state) { state->AddErrorAtValue("Invalid root object", value); } -void NO_VERSION(const Json::Value* value, cmJSONState* state) +void NO_VERSION(Json::Value const* value, cmJSONState* state) { state->AddErrorAtValue("No \"version\" field", value); } -void INVALID_VERSION(const Json::Value* value, cmJSONState* state) +void INVALID_VERSION(Json::Value const* value, cmJSONState* state) { state->AddErrorAtValue("Invalid \"version\" field", value); } -void UNRECOGNIZED_VERSION(const Json::Value* value, cmJSONState* state) +void UNRECOGNIZED_VERSION(Json::Value const* value, cmJSONState* state) { state->AddErrorAtValue("Unrecognized \"version\" field", value); } -void INVALID_PRESETS(const Json::Value* value, cmJSONState* state) +void INVALID_PRESETS(Json::Value const* value, cmJSONState* state) { state->AddErrorAtValue("Invalid \"configurePresets\" field", value); } -void INVALID_PRESET(const Json::Value* value, cmJSONState* state) +void INVALID_PRESET(Json::Value const* value, cmJSONState* state) { state->AddErrorAtValue("Invalid preset", value); } -void INVALID_PRESET_NAMED(const std::string& presetName, cmJSONState* state) +void INVALID_PRESET_NAMED(std::string const& presetName, cmJSONState* state) { state->AddError(cmStrCat("Invalid preset: \"", presetName, "\"")); } -void INVALID_VARIABLE(const Json::Value* value, cmJSONState* state) +void INVALID_VARIABLE(Json::Value const* value, cmJSONState* state) { std::string var = cmCMakePresetsErrors::getVariableName(state); state->AddErrorAtValue(cmStrCat("Invalid CMake ", var), value); } -void DUPLICATE_PRESETS(const std::string& presetName, cmJSONState* state) +void DUPLICATE_PRESETS(std::string const& presetName, cmJSONState* state) { state->AddError(cmStrCat("Duplicate preset: \"", presetName, "\"")); } -void CYCLIC_PRESET_INHERITANCE(const std::string& presetName, +void CYCLIC_PRESET_INHERITANCE(std::string const& presetName, cmJSONState* state) { @@ -104,61 +104,61 @@ void CYCLIC_PRESET_INHERITANCE(const std::string& presetName, cmStrCat("Cyclic preset inheritance for preset \"", presetName, "\"")); } -void INHERITED_PRESET_UNREACHABLE_FROM_FILE(const std::string& presetName, +void INHERITED_PRESET_UNREACHABLE_FROM_FILE(std::string const& presetName, cmJSONState* state) { state->AddError(cmStrCat("Inherited preset \"", presetName, "\" is unreachable from preset's file")); } -void CONFIGURE_PRESET_UNREACHABLE_FROM_FILE(const std::string& presetName, +void CONFIGURE_PRESET_UNREACHABLE_FROM_FILE(std::string const& presetName, cmJSONState* state) { state->AddError(cmStrCat("Configure preset \"", presetName, "\" is unreachable from preset's file")); } -void INVALID_MACRO_EXPANSION(const std::string& presetName, cmJSONState* state) +void INVALID_MACRO_EXPANSION(std::string const& presetName, cmJSONState* state) { state->AddError(cmStrCat("Invalid macro expansion in \"", presetName, "\"")); } -void BUILD_TEST_PRESETS_UNSUPPORTED(const Json::Value*, cmJSONState* state) +void BUILD_TEST_PRESETS_UNSUPPORTED(Json::Value const*, cmJSONState* state) { state->AddError("File version must be 2 or higher for build and test preset " "support"); } -void PACKAGE_PRESETS_UNSUPPORTED(const Json::Value*, cmJSONState* state) +void PACKAGE_PRESETS_UNSUPPORTED(Json::Value const*, cmJSONState* state) { state->AddError( "File version must be 6 or higher for package preset support"); } -void WORKFLOW_PRESETS_UNSUPPORTED(const Json::Value*, cmJSONState* state) +void WORKFLOW_PRESETS_UNSUPPORTED(Json::Value const*, cmJSONState* state) { state->AddError( "File version must be 6 or higher for workflow preset support"); } -void INCLUDE_UNSUPPORTED(const Json::Value*, cmJSONState* state) +void INCLUDE_UNSUPPORTED(Json::Value const*, cmJSONState* state) { state->AddError("File version must be 4 or higher for include support"); } -void INVALID_INCLUDE(const Json::Value* value, cmJSONState* state) +void INVALID_INCLUDE(Json::Value const* value, cmJSONState* state) { state->AddErrorAtValue("Invalid \"include\" field", value); } -void INVALID_CONFIGURE_PRESET(const std::string& presetName, +void INVALID_CONFIGURE_PRESET(std::string const& presetName, cmJSONState* state) { state->AddError( cmStrCat(R"(Invalid "configurePreset": ")", presetName, "\"")); } -void INSTALL_PREFIX_UNSUPPORTED(const Json::Value* value, cmJSONState* state) +void INSTALL_PREFIX_UNSUPPORTED(Json::Value const* value, cmJSONState* state) { state->AddErrorAtValue( "File version must be 3 or higher for installDir preset " @@ -183,7 +183,7 @@ void GRAPHVIZ_FILE_UNSUPPORTED(cmJSONState* state) "File version must be 10 or higher for graphviz preset support"); } -void CYCLIC_INCLUDE(const std::string& file, cmJSONState* state) +void CYCLIC_INCLUDE(std::string const& file, cmJSONState* state) { state->AddError(cmStrCat("Cyclic include among preset files: ", file)); } @@ -194,33 +194,33 @@ void TEST_OUTPUT_TRUNCATION_UNSUPPORTED(cmJSONState* state) "preset support"); } -void INVALID_WORKFLOW_STEPS(const std::string& workflowStep, +void INVALID_WORKFLOW_STEPS(std::string const& workflowStep, cmJSONState* state) { state->AddError(cmStrCat("Invalid workflow step \"", workflowStep, "\"")); } -void NO_WORKFLOW_STEPS(const std::string& presetName, cmJSONState* state) +void NO_WORKFLOW_STEPS(std::string const& presetName, cmJSONState* state) { state->AddError( cmStrCat("No workflow steps specified for \"", presetName, "\"")); } -void FIRST_WORKFLOW_STEP_NOT_CONFIGURE(const std::string& stepName, +void FIRST_WORKFLOW_STEP_NOT_CONFIGURE(std::string const& stepName, cmJSONState* state) { state->AddError(cmStrCat("First workflow step \"", stepName, "\" must be a configure step")); } -void CONFIGURE_WORKFLOW_STEP_NOT_FIRST(const std::string& stepName, +void CONFIGURE_WORKFLOW_STEP_NOT_FIRST(std::string const& stepName, cmJSONState* state) { state->AddError(cmStrCat("Configure workflow step \"", stepName, "\" must be the first step")); } -void WORKFLOW_STEP_UNREACHABLE_FROM_FILE(const std::string& workflowStep, +void WORKFLOW_STEP_UNREACHABLE_FROM_FILE(std::string const& workflowStep, cmJSONState* state) { state->AddError(cmStrCat("Workflow step \"", workflowStep, @@ -240,7 +240,7 @@ void TRACE_UNSUPPORTED(cmJSONState* state) JsonErrors::ErrorGenerator UNRECOGNIZED_VERSION_RANGE(int min, int max) { - return [min, max](const Json::Value* value, cmJSONState* state) -> void { + return [min, max](Json::Value const* value, cmJSONState* state) -> void { state->AddErrorAtValue(cmStrCat("Unrecognized \"version\" ", value->asString(), ": must be >=", min, " and <=", max), @@ -249,9 +249,9 @@ JsonErrors::ErrorGenerator UNRECOGNIZED_VERSION_RANGE(int min, int max) } JsonErrors::ErrorGenerator UNRECOGNIZED_CMAKE_VERSION( - const std::string& version, int current, int required) + std::string const& version, int current, int required) { - return [version, current, required](const Json::Value* value, + return [version, current, required](Json::Value const* value, cmJSONState* state) -> void { state->AddErrorAtValue(cmStrCat("\"cmakeMinimumRequired\" ", version, " version ", required, @@ -260,7 +260,7 @@ JsonErrors::ErrorGenerator UNRECOGNIZED_CMAKE_VERSION( }; } -void INVALID_PRESET_NAME(const Json::Value* value, cmJSONState* state) +void INVALID_PRESET_NAME(Json::Value const* value, cmJSONState* state) { std::string errMsg = "Invalid Preset Name"; if (value && value->isConvertibleTo(Json::ValueType::stringValue) && @@ -270,7 +270,7 @@ void INVALID_PRESET_NAME(const Json::Value* value, cmJSONState* state) state->AddErrorAtValue(errMsg, value); } -void INVALID_CONDITION(const Json::Value* value, cmJSONState* state) +void INVALID_CONDITION(Json::Value const* value, cmJSONState* state) { state->AddErrorAtValue( cmStrCat("Invalid condition for preset \"", getPresetName(state), "\""), @@ -278,42 +278,42 @@ void INVALID_CONDITION(const Json::Value* value, cmJSONState* state) } JsonErrors::ErrorGenerator INVALID_CONDITION_OBJECT( - JsonErrors::ObjectError errorType, const Json::Value::Members& extraFields) + JsonErrors::ObjectError errorType, Json::Value::Members const& extraFields) { return JsonErrors::INVALID_NAMED_OBJECT( - [](const Json::Value*, cmJSONState* state) -> std::string { + [](Json::Value const*, cmJSONState* state) -> std::string { return cmStrCat(" condition for preset \"", getPresetName(state), "\""); })(errorType, extraFields); } JsonErrors::ErrorGenerator INVALID_VARIABLE_OBJECT( - JsonErrors::ObjectError errorType, const Json::Value::Members& extraFields) + JsonErrors::ObjectError errorType, Json::Value::Members const& extraFields) { return JsonErrors::INVALID_NAMED_OBJECT( - [](const Json::Value*, cmJSONState* state) -> std::string { + [](Json::Value const*, cmJSONState* state) -> std::string { return getVariableName(state); })(errorType, extraFields); } JsonErrors::ErrorGenerator INVALID_PRESET_OBJECT( - JsonErrors::ObjectError errorType, const Json::Value::Members& extraFields) + JsonErrors::ObjectError errorType, Json::Value::Members const& extraFields) { return JsonErrors::INVALID_NAMED_OBJECT( - [](const Json::Value*, cmJSONState*) -> std::string { return "Preset"; })( + [](Json::Value const*, cmJSONState*) -> std::string { return "Preset"; })( errorType, extraFields); } JsonErrors::ErrorGenerator INVALID_ROOT_OBJECT( - JsonErrors::ObjectError errorType, const Json::Value::Members& extraFields) + JsonErrors::ObjectError errorType, Json::Value::Members const& extraFields) { return JsonErrors::INVALID_NAMED_OBJECT( - [](const Json::Value*, cmJSONState*) -> std::string { + [](Json::Value const*, cmJSONState*) -> std::string { return "root object"; })(errorType, extraFields); } -void PRESET_MISSING_FIELD(const std::string& presetName, - const std::string& missingField, cmJSONState* state) +void PRESET_MISSING_FIELD(std::string const& presetName, + std::string const& missingField, cmJSONState* state) { state->AddError(cmStrCat("Preset \"", presetName, "\" missing field \"", missingField, "\"")); diff --git a/Source/cmCMakePresetsErrors.h b/Source/cmCMakePresetsErrors.h index 22830d2..cd0b305 100644 --- a/Source/cmCMakePresetsErrors.h +++ b/Source/cmCMakePresetsErrors.h @@ -13,58 +13,58 @@ class cmJSONState; namespace cmCMakePresetsErrors { -const Json::Value* getPreset(cmJSONState* state); +Json::Value const* getPreset(cmJSONState* state); std::string getPresetName(cmJSONState* state); std::string getVariableName(cmJSONState* state); -void FILE_NOT_FOUND(const std::string& filename, cmJSONState* state); +void FILE_NOT_FOUND(std::string const& filename, cmJSONState* state); -void INVALID_ROOT(const Json::Value* value, cmJSONState* state); +void INVALID_ROOT(Json::Value const* value, cmJSONState* state); -void NO_VERSION(const Json::Value* value, cmJSONState* state); +void NO_VERSION(Json::Value const* value, cmJSONState* state); -void INVALID_VERSION(const Json::Value* value, cmJSONState* state); +void INVALID_VERSION(Json::Value const* value, cmJSONState* state); -void UNRECOGNIZED_VERSION(const Json::Value* value, cmJSONState* state); +void UNRECOGNIZED_VERSION(Json::Value const* value, cmJSONState* state); -void INVALID_PRESETS(const Json::Value* value, cmJSONState* state); +void INVALID_PRESETS(Json::Value const* value, cmJSONState* state); -void INVALID_PRESET(const Json::Value* value, cmJSONState* state); +void INVALID_PRESET(Json::Value const* value, cmJSONState* state); -void INVALID_PRESET_NAMED(const std::string& presetName, cmJSONState* state); +void INVALID_PRESET_NAMED(std::string const& presetName, cmJSONState* state); -void INVALID_VARIABLE(const Json::Value* value, cmJSONState* state); +void INVALID_VARIABLE(Json::Value const* value, cmJSONState* state); -void DUPLICATE_PRESETS(const std::string& presetName, cmJSONState* state); +void DUPLICATE_PRESETS(std::string const& presetName, cmJSONState* state); -void CYCLIC_PRESET_INHERITANCE(const std::string& presetName, +void CYCLIC_PRESET_INHERITANCE(std::string const& presetName, cmJSONState* state); -void INHERITED_PRESET_UNREACHABLE_FROM_FILE(const std::string& presetName, +void INHERITED_PRESET_UNREACHABLE_FROM_FILE(std::string const& presetName, cmJSONState* state); -void CONFIGURE_PRESET_UNREACHABLE_FROM_FILE(const std::string& presetName, +void CONFIGURE_PRESET_UNREACHABLE_FROM_FILE(std::string const& presetName, cmJSONState* state); -void INVALID_MACRO_EXPANSION(const std::string& presetName, +void INVALID_MACRO_EXPANSION(std::string const& presetName, cmJSONState* state); -void BUILD_TEST_PRESETS_UNSUPPORTED(const Json::Value*, cmJSONState* state); +void BUILD_TEST_PRESETS_UNSUPPORTED(Json::Value const*, cmJSONState* state); -void PACKAGE_PRESETS_UNSUPPORTED(const Json::Value*, cmJSONState* state); +void PACKAGE_PRESETS_UNSUPPORTED(Json::Value const*, cmJSONState* state); -void WORKFLOW_PRESETS_UNSUPPORTED(const Json::Value*, cmJSONState* state); +void WORKFLOW_PRESETS_UNSUPPORTED(Json::Value const*, cmJSONState* state); -void INCLUDE_UNSUPPORTED(const Json::Value*, cmJSONState* state); +void INCLUDE_UNSUPPORTED(Json::Value const*, cmJSONState* state); -void INVALID_INCLUDE(const Json::Value* value, cmJSONState* state); +void INVALID_INCLUDE(Json::Value const* value, cmJSONState* state); -void INVALID_CONFIGURE_PRESET(const std::string& presetName, +void INVALID_CONFIGURE_PRESET(std::string const& presetName, cmJSONState* state); -void INSTALL_PREFIX_UNSUPPORTED(const Json::Value* value, cmJSONState* state); +void INSTALL_PREFIX_UNSUPPORTED(Json::Value const* value, cmJSONState* state); void CONDITION_UNSUPPORTED(cmJSONState* state); @@ -72,22 +72,22 @@ void TOOLCHAIN_FILE_UNSUPPORTED(cmJSONState* state); void GRAPHVIZ_FILE_UNSUPPORTED(cmJSONState* state); -void CYCLIC_INCLUDE(const std::string& file, cmJSONState* state); +void CYCLIC_INCLUDE(std::string const& file, cmJSONState* state); void TEST_OUTPUT_TRUNCATION_UNSUPPORTED(cmJSONState* state); -void INVALID_WORKFLOW_STEPS(const std::string& workflowStep, +void INVALID_WORKFLOW_STEPS(std::string const& workflowStep, cmJSONState* state); -void NO_WORKFLOW_STEPS(const std::string& presetName, cmJSONState* state); +void NO_WORKFLOW_STEPS(std::string const& presetName, cmJSONState* state); -void FIRST_WORKFLOW_STEP_NOT_CONFIGURE(const std::string& stepName, +void FIRST_WORKFLOW_STEP_NOT_CONFIGURE(std::string const& stepName, cmJSONState* state); -void CONFIGURE_WORKFLOW_STEP_NOT_FIRST(const std::string& stepName, +void CONFIGURE_WORKFLOW_STEP_NOT_FIRST(std::string const& stepName, cmJSONState* state); -void WORKFLOW_STEP_UNREACHABLE_FROM_FILE(const std::string& workflowStep, +void WORKFLOW_STEP_UNREACHABLE_FROM_FILE(std::string const& workflowStep, cmJSONState* state); void CTEST_JUNIT_UNSUPPORTED(cmJSONState* state); @@ -97,26 +97,26 @@ void TRACE_UNSUPPORTED(cmJSONState* state); JsonErrors::ErrorGenerator UNRECOGNIZED_VERSION_RANGE(int min, int max); JsonErrors::ErrorGenerator UNRECOGNIZED_CMAKE_VERSION( - const std::string& version, int current, int required); + std::string const& version, int current, int required); -void INVALID_PRESET_NAME(const Json::Value* value, cmJSONState* state); +void INVALID_PRESET_NAME(Json::Value const* value, cmJSONState* state); -void INVALID_CONDITION(const Json::Value* value, cmJSONState* state); +void INVALID_CONDITION(Json::Value const* value, cmJSONState* state); JsonErrors::ErrorGenerator INVALID_CONDITION_OBJECT( - JsonErrors::ObjectError errorType, const Json::Value::Members& extraFields); + JsonErrors::ObjectError errorType, Json::Value::Members const& extraFields); JsonErrors::ErrorGenerator INVALID_VARIABLE_OBJECT( - JsonErrors::ObjectError errorType, const Json::Value::Members& extraFields); + JsonErrors::ObjectError errorType, Json::Value::Members const& extraFields); JsonErrors::ErrorGenerator INVALID_PRESET_OBJECT( - JsonErrors::ObjectError errorType, const Json::Value::Members& extraFields); + JsonErrors::ObjectError errorType, Json::Value::Members const& extraFields); JsonErrors::ErrorGenerator INVALID_ROOT_OBJECT( - JsonErrors::ObjectError errorType, const Json::Value::Members& extraFields); + JsonErrors::ObjectError errorType, Json::Value::Members const& extraFields); -void PRESET_MISSING_FIELD(const std::string& presetName, - const std::string& missingField, cmJSONState* state); +void PRESET_MISSING_FIELD(std::string const& presetName, + std::string const& missingField, cmJSONState* state); void SCHEMA_UNSUPPORTED(cmJSONState* state); } diff --git a/Source/cmCMakePresetsGraph.cxx b/Source/cmCMakePresetsGraph.cxx index 2d41ff2..84e1a0f 100644 --- a/Source/cmCMakePresetsGraph.cxx +++ b/Source/cmCMakePresetsGraph.cxx @@ -57,7 +57,7 @@ using PresetMacroExpander = cmCMakePresetsGraphInternal::PresetMacroExpander; using cmCMakePresetsGraphInternal::ExpandMacros; -void InheritString(std::string& child, const std::string& parent) +void InheritString(std::string& child, std::string const& parent) { if (child.empty()) { child = parent; @@ -66,7 +66,7 @@ void InheritString(std::string& child, const std::string& parent) template void InheritOptionalValue(cm::optional& child, - const cm::optional& parent) + cm::optional const& parent) { if (!child) { child = parent; @@ -74,7 +74,7 @@ void InheritOptionalValue(cm::optional& child, } template -void InheritVector(std::vector& child, const std::vector& parent) +void InheritVector(std::vector& child, std::vector const& parent) { if (child.empty()) { child = parent; @@ -187,25 +187,25 @@ bool ComputePresetInheritance( return true; } -constexpr const char* ValidPrefixes[] = { +constexpr char const* ValidPrefixes[] = { "", "env", "penv", "vendor", }; -bool PrefixesValidMacroNamespace(const std::string& str) +bool PrefixesValidMacroNamespace(std::string const& str) { return std::any_of( std::begin(ValidPrefixes), std::end(ValidPrefixes), - [&str](const char* prefix) -> bool { return cmHasPrefix(prefix, str); }); + [&str](char const* prefix) -> bool { return cmHasPrefix(prefix, str); }); } -bool IsValidMacroNamespace(const std::string& str) +bool IsValidMacroNamespace(std::string const& str) { return std::any_of( std::begin(ValidPrefixes), std::end(ValidPrefixes), - [&str](const char* prefix) -> bool { return str == prefix; }); + [&str](char const* prefix) -> bool { return str == prefix; }); } ExpandMacroResult VisitEnv(std::string& value, CycleStatus& status, @@ -227,8 +227,8 @@ public: , MacroExpanders(macroExpanders) { } - ExpandMacroResult operator()(const std::string& macroNamespace, - const std::string& macroName, + ExpandMacroResult operator()(std::string const& macroNamespace, + std::string const& macroName, std::string& macroOut, int version) const override { @@ -260,8 +260,8 @@ public: } }; -bool ExpandMacros(const cmCMakePresetsGraph& graph, - const ConfigurePreset& preset, +bool ExpandMacros(cmCMakePresetsGraph const& graph, + ConfigurePreset const& preset, cm::optional& out, MacroExpanderVector const& macroExpanders) { @@ -309,7 +309,7 @@ bool ExpandMacros(const cmCMakePresetsGraph& graph, return true; } -bool ExpandMacros(const cmCMakePresetsGraph& graph, const BuildPreset& preset, +bool ExpandMacros(cmCMakePresetsGraph const& graph, BuildPreset const& preset, cm::optional& out, MacroExpanderVector const& macroExpanders) { @@ -325,7 +325,7 @@ bool ExpandMacros(const cmCMakePresetsGraph& graph, const BuildPreset& preset, return true; } -bool ExpandMacros(const cmCMakePresetsGraph& graph, const TestPreset& preset, +bool ExpandMacros(cmCMakePresetsGraph const& graph, TestPreset const& preset, cm::optional& out, MacroExpanderVector const& macroExpanders) { @@ -378,8 +378,8 @@ bool ExpandMacros(const cmCMakePresetsGraph& graph, const TestPreset& preset, return true; } -bool ExpandMacros(const cmCMakePresetsGraph& graph, - const PackagePreset& preset, +bool ExpandMacros(cmCMakePresetsGraph const& graph, + PackagePreset const& preset, cm::optional& out, MacroExpanderVector const& macroExpanders) { @@ -400,8 +400,8 @@ bool ExpandMacros(const cmCMakePresetsGraph& graph, return true; } -bool ExpandMacros(const cmCMakePresetsGraph& /*graph*/, - const WorkflowPreset& /*preset*/, +bool ExpandMacros(cmCMakePresetsGraph const& /*graph*/, + WorkflowPreset const& /*preset*/, cm::optional& /*out*/, MacroExpanderVector const& /*macroExpanders*/) { @@ -409,7 +409,7 @@ bool ExpandMacros(const cmCMakePresetsGraph& /*graph*/, } template -bool ExpandMacros(cmCMakePresetsGraph& graph, const T& preset, +bool ExpandMacros(cmCMakePresetsGraph& graph, T const& preset, cm::optional& out) { out.emplace(preset); @@ -562,8 +562,8 @@ ExpandMacroResult cmCMakePresetsGraphInternal::ExpandMacros( } ExpandMacroResult cmCMakePresetsGraphInternal::ExpandMacro( - std::string& out, const std::string& macroNamespace, - const std::string& macroName, MacroExpanderVector const& macroExpanders, + std::string& out, std::string const& macroNamespace, + std::string const& macroName, MacroExpanderVector const& macroExpanders, int version) { for (auto const& macroExpander : macroExpanders) { @@ -582,8 +582,8 @@ ExpandMacroResult cmCMakePresetsGraphInternal::ExpandMacro( namespace { template -bool SetupWorkflowConfigurePreset(const T& preset, - const ConfigurePreset*& configurePreset, +bool SetupWorkflowConfigurePreset(T const& preset, + ConfigurePreset const*& configurePreset, cmJSONState* state) { if (preset.ConfigurePreset != configurePreset->Name) { @@ -595,7 +595,7 @@ bool SetupWorkflowConfigurePreset(const T& preset, template <> bool SetupWorkflowConfigurePreset( - const ConfigurePreset& preset, const ConfigurePreset*& configurePreset, + ConfigurePreset const& preset, ConfigurePreset const*& configurePreset, cmJSONState*) { configurePreset = &preset; @@ -604,9 +604,9 @@ bool SetupWorkflowConfigurePreset( template bool TryReachPresetFromWorkflow( - const WorkflowPreset& origin, - const std::map>& presets, const std::string& name, - const ConfigurePreset*& configurePreset, cmJSONState* state) + WorkflowPreset const& origin, + std::map> const& presets, std::string const& name, + ConfigurePreset const*& configurePreset, cmJSONState* state) { auto it = presets.find(name); if (it == presets.end()) { @@ -624,7 +624,7 @@ bool TryReachPresetFromWorkflow( } ExpandMacroResult BaseMacroExpander::operator()( - const std::string& macroNamespace, const std::string& macroName, + std::string const& macroNamespace, std::string const& macroName, std::string& macroOut, int version) const { if (macroNamespace.empty()) { @@ -764,11 +764,11 @@ bool cmCMakePresetsGraphInternal::NotCondition::Evaluate( } bool cmCMakePresetsGraph::ConfigurePreset::VisitPresetInherit( - const cmCMakePresetsGraph::Preset& parentPreset) + cmCMakePresetsGraph::Preset const& parentPreset) { auto& preset = *this; - const ConfigurePreset& parent = - static_cast(parentPreset); + ConfigurePreset const& parent = + static_cast(parentPreset); InheritString(preset.Generator, parent.Generator); InheritString(preset.Architecture, parent.Architecture); InheritString(preset.Toolset, parent.Toolset); @@ -840,10 +840,10 @@ bool cmCMakePresetsGraph::ConfigurePreset::VisitPresetAfterInherit( } bool cmCMakePresetsGraph::BuildPreset::VisitPresetInherit( - const cmCMakePresetsGraph::Preset& parentPreset) + cmCMakePresetsGraph::Preset const& parentPreset) { auto& preset = *this; - const BuildPreset& parent = static_cast(parentPreset); + BuildPreset const& parent = static_cast(parentPreset); InheritString(preset.ConfigurePreset, parent.ConfigurePreset); InheritOptionalValue(preset.InheritConfigureEnvironment, @@ -872,10 +872,10 @@ bool cmCMakePresetsGraph::BuildPreset::VisitPresetAfterInherit( } bool cmCMakePresetsGraph::TestPreset::VisitPresetInherit( - const cmCMakePresetsGraph::Preset& parentPreset) + cmCMakePresetsGraph::Preset const& parentPreset) { auto& preset = *this; - const TestPreset& parent = static_cast(parentPreset); + TestPreset const& parent = static_cast(parentPreset); InheritString(preset.ConfigurePreset, parent.ConfigurePreset); InheritOptionalValue(preset.InheritConfigureEnvironment, @@ -887,7 +887,7 @@ bool cmCMakePresetsGraph::TestPreset::VisitPresetInherit( if (parent.Output) { if (preset.Output) { auto& output = preset.Output.value(); - const auto& parentOutput = parent.Output.value(); + auto const& parentOutput = parent.Output.value(); InheritOptionalValue(output.ShortProgress, parentOutput.ShortProgress); InheritOptionalValue(output.Verbosity, parentOutput.Verbosity); InheritOptionalValue(output.Debug, parentOutput.Debug); @@ -916,7 +916,7 @@ bool cmCMakePresetsGraph::TestPreset::VisitPresetInherit( if (parent.Filter->Include) { if (preset.Filter && preset.Filter->Include) { auto& include = *preset.Filter->Include; - const auto& parentInclude = *parent.Filter->Include; + auto const& parentInclude = *parent.Filter->Include; InheritString(include.Name, parentInclude.Name); InheritString(include.Label, parentInclude.Label); InheritOptionalValue(include.Index, parentInclude.Index); @@ -931,7 +931,7 @@ bool cmCMakePresetsGraph::TestPreset::VisitPresetInherit( if (parent.Filter->Exclude) { if (preset.Filter && preset.Filter->Exclude) { auto& exclude = *preset.Filter->Exclude; - const auto& parentExclude = *parent.Filter->Exclude; + auto const& parentExclude = *parent.Filter->Exclude; InheritString(exclude.Name, parentExclude.Name); InheritString(exclude.Label, parentExclude.Label); InheritOptionalValue(exclude.Fixtures, parentExclude.Fixtures); @@ -947,7 +947,7 @@ bool cmCMakePresetsGraph::TestPreset::VisitPresetInherit( if (parent.Execution) { if (preset.Execution) { auto& execution = *preset.Execution; - const auto& parentExecution = *parent.Execution; + auto const& parentExecution = *parent.Execution; InheritOptionalValue(execution.StopOnFailure, parentExecution.StopOnFailure); InheritOptionalValue(execution.EnableFailover, @@ -984,11 +984,11 @@ bool cmCMakePresetsGraph::TestPreset::VisitPresetAfterInherit( } bool cmCMakePresetsGraph::PackagePreset::VisitPresetInherit( - const cmCMakePresetsGraph::Preset& parentPreset) + cmCMakePresetsGraph::Preset const& parentPreset) { auto& preset = *this; - const PackagePreset& parent = - static_cast(parentPreset); + PackagePreset const& parent = + static_cast(parentPreset); InheritString(preset.ConfigurePreset, parent.ConfigurePreset); InheritOptionalValue(preset.InheritConfigureEnvironment, @@ -1021,7 +1021,7 @@ bool cmCMakePresetsGraph::PackagePreset::VisitPresetAfterInherit( } bool cmCMakePresetsGraph::WorkflowPreset::VisitPresetInherit( - const cmCMakePresetsGraph::Preset& /*parentPreset*/) + cmCMakePresetsGraph::Preset const& /*parentPreset*/) { return true; } @@ -1032,17 +1032,17 @@ bool cmCMakePresetsGraph::WorkflowPreset::VisitPresetAfterInherit( return true; } -std::string cmCMakePresetsGraph::GetFilename(const std::string& sourceDir) +std::string cmCMakePresetsGraph::GetFilename(std::string const& sourceDir) { return cmStrCat(sourceDir, "/CMakePresets.json"); } -std::string cmCMakePresetsGraph::GetUserFilename(const std::string& sourceDir) +std::string cmCMakePresetsGraph::GetUserFilename(std::string const& sourceDir) { return cmStrCat(sourceDir, "/CMakeUserPresets.json"); } -bool cmCMakePresetsGraph::ReadProjectPresets(const std::string& sourceDir, +bool cmCMakePresetsGraph::ReadProjectPresets(std::string const& sourceDir, bool allowNoFiles) { this->SourceDir = sourceDir; @@ -1108,7 +1108,7 @@ bool cmCMakePresetsGraph::ReadProjectPresetsInternal(bool allowNoFiles) for (auto& it : this->BuildPresets) { if (!it.second.Unexpanded.Hidden) { - const auto configurePreset = + auto const configurePreset = this->ConfigurePresets.find(it.second.Unexpanded.ConfigurePreset); if (configurePreset == this->ConfigurePresets.end()) { cmCMakePresetsErrors::INVALID_CONFIGURE_PRESET(it.first, @@ -1138,7 +1138,7 @@ bool cmCMakePresetsGraph::ReadProjectPresetsInternal(bool allowNoFiles) for (auto& it : this->TestPresets) { if (!it.second.Unexpanded.Hidden) { - const auto configurePreset = + auto const configurePreset = this->ConfigurePresets.find(it.second.Unexpanded.ConfigurePreset); if (configurePreset == this->ConfigurePresets.end()) { cmCMakePresetsErrors::INVALID_CONFIGURE_PRESET(it.first, @@ -1168,7 +1168,7 @@ bool cmCMakePresetsGraph::ReadProjectPresetsInternal(bool allowNoFiles) for (auto& it : this->PackagePresets) { if (!it.second.Unexpanded.Hidden) { - const auto configurePreset = + auto const configurePreset = this->ConfigurePresets.find(it.second.Unexpanded.ConfigurePreset); if (configurePreset == this->ConfigurePresets.end()) { cmCMakePresetsErrors::INVALID_CONFIGURE_PRESET(it.first, @@ -1199,7 +1199,7 @@ bool cmCMakePresetsGraph::ReadProjectPresetsInternal(bool allowNoFiles) for (auto& it : this->WorkflowPresets) { using Type = WorkflowPreset::WorkflowStep::Type; - const ConfigurePreset* configurePreset = nullptr; + ConfigurePreset const* configurePreset = nullptr; for (auto const& step : it.second.Unexpanded.Steps) { if (!configurePreset && step.PresetType != Type::Configure) { cmCMakePresetsErrors::FIRST_WORKFLOW_STEP_NOT_CONFIGURE( @@ -1282,7 +1282,7 @@ void cmCMakePresetsGraph::printPrecedingNewline(PrintPrecedingNewline* newline) } void cmCMakePresetsGraph::PrintPresets( - const std::vector& presets) + std::vector const& presets) { if (presets.empty()) { return; @@ -1290,15 +1290,15 @@ void cmCMakePresetsGraph::PrintPresets( auto longestPresetName = std::max_element(presets.begin(), presets.end(), - [](const cmCMakePresetsGraph::Preset* a, - const cmCMakePresetsGraph::Preset* b) { + [](cmCMakePresetsGraph::Preset const* a, + cmCMakePresetsGraph::Preset const* b) { return a->Name.length() < b->Name.length(); }); auto longestLength = (*longestPresetName)->Name.length(); - for (const auto* preset : presets) { + for (auto const* preset : presets) { std::cout << " \"" << preset->Name << '"'; - const auto& description = preset->DisplayName; + auto const& description = preset->DisplayName; if (!description.empty()) { for (std::size_t i = 0; i < longestLength - preset->Name.length(); ++i) { std::cout << ' '; @@ -1312,21 +1312,21 @@ void cmCMakePresetsGraph::PrintPresets( void cmCMakePresetsGraph::PrintConfigurePresetList( PrintPrecedingNewline* newline) const { - PrintConfigurePresetList([](const ConfigurePreset&) { return true; }, + PrintConfigurePresetList([](ConfigurePreset const&) { return true; }, newline); } void cmCMakePresetsGraph::PrintConfigurePresetList( - const std::function& filter, + std::function const& filter, PrintPrecedingNewline* newline) const { - std::vector presets; + std::vector presets; for (auto const& p : this->ConfigurePresetOrder) { auto const& preset = this->ConfigurePresets.at(p); if (!preset.Unexpanded.Hidden && preset.Expanded && preset.Expanded->ConditionResult && filter(preset.Unexpanded)) { presets.push_back( - static_cast(&preset.Unexpanded)); + static_cast(&preset.Unexpanded)); } } @@ -1340,13 +1340,13 @@ void cmCMakePresetsGraph::PrintConfigurePresetList( void cmCMakePresetsGraph::PrintBuildPresetList( PrintPrecedingNewline* newline) const { - std::vector presets; + std::vector presets; for (auto const& p : this->BuildPresetOrder) { auto const& preset = this->BuildPresets.at(p); if (!preset.Unexpanded.Hidden && preset.Expanded && preset.Expanded->ConditionResult) { presets.push_back( - static_cast(&preset.Unexpanded)); + static_cast(&preset.Unexpanded)); } } @@ -1360,13 +1360,13 @@ void cmCMakePresetsGraph::PrintBuildPresetList( void cmCMakePresetsGraph::PrintTestPresetList( PrintPrecedingNewline* newline) const { - std::vector presets; + std::vector presets; for (auto const& p : this->TestPresetOrder) { auto const& preset = this->TestPresets.at(p); if (!preset.Unexpanded.Hidden && preset.Expanded && preset.Expanded->ConditionResult) { presets.push_back( - static_cast(&preset.Unexpanded)); + static_cast(&preset.Unexpanded)); } } @@ -1380,21 +1380,21 @@ void cmCMakePresetsGraph::PrintTestPresetList( void cmCMakePresetsGraph::PrintPackagePresetList( PrintPrecedingNewline* newline) const { - this->PrintPackagePresetList([](const PackagePreset&) { return true; }, + this->PrintPackagePresetList([](PackagePreset const&) { return true; }, newline); } void cmCMakePresetsGraph::PrintPackagePresetList( - const std::function& filter, + std::function const& filter, PrintPrecedingNewline* newline) const { - std::vector presets; + std::vector presets; for (auto const& p : this->PackagePresetOrder) { auto const& preset = this->PackagePresets.at(p); if (!preset.Unexpanded.Hidden && preset.Expanded && preset.Expanded->ConditionResult && filter(preset.Unexpanded)) { presets.push_back( - static_cast(&preset.Unexpanded)); + static_cast(&preset.Unexpanded)); } } @@ -1408,13 +1408,13 @@ void cmCMakePresetsGraph::PrintPackagePresetList( void cmCMakePresetsGraph::PrintWorkflowPresetList( PrintPrecedingNewline* newline) const { - std::vector presets; + std::vector presets; for (auto const& p : this->WorkflowPresetOrder) { auto const& preset = this->WorkflowPresets.at(p); if (!preset.Unexpanded.Hidden && preset.Expanded && preset.Expanded->ConditionResult) { presets.push_back( - static_cast(&preset.Unexpanded)); + static_cast(&preset.Unexpanded)); } } diff --git a/Source/cmCMakePresetsGraph.h b/Source/cmCMakePresetsGraph.h index 6ff6a0e..2701035 100644 --- a/Source/cmCMakePresetsGraph.h +++ b/Source/cmCMakePresetsGraph.h @@ -63,8 +63,8 @@ public: public: Preset() = default; Preset(Preset&& /*other*/) = default; - Preset(const Preset& /*other*/) = default; - Preset& operator=(const Preset& /*other*/) = default; + Preset(Preset const& /*other*/) = default; + Preset& operator=(Preset const& /*other*/) = default; virtual ~Preset() = default; #if __cplusplus >= 201703L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) Preset& operator=(Preset&& /*other*/) = default; @@ -87,7 +87,7 @@ public: std::map> Environment; - virtual bool VisitPresetInherit(const Preset& parent) = 0; + virtual bool VisitPresetInherit(Preset const& parent) = 0; virtual bool VisitPresetBeforeInherit() { return true; } virtual bool VisitPresetAfterInherit(int /* version */, @@ -102,8 +102,8 @@ public: public: ConfigurePreset() = default; ConfigurePreset(ConfigurePreset&& /*other*/) = default; - ConfigurePreset(const ConfigurePreset& /*other*/) = default; - ConfigurePreset& operator=(const ConfigurePreset& /*other*/) = default; + ConfigurePreset(ConfigurePreset const& /*other*/) = default; + ConfigurePreset& operator=(ConfigurePreset const& /*other*/) = default; ~ConfigurePreset() override = default; #if __cplusplus >= 201703L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) ConfigurePreset& operator=(ConfigurePreset&& /*other*/) = default; @@ -143,7 +143,7 @@ public: std::vector TraceSource; std::string TraceRedirect; - bool VisitPresetInherit(const Preset& parent) override; + bool VisitPresetInherit(Preset const& parent) override; bool VisitPresetBeforeInherit() override; bool VisitPresetAfterInherit(int version, cmJSONState* state) override; }; @@ -153,8 +153,8 @@ public: public: BuildPreset() = default; BuildPreset(BuildPreset&& /*other*/) = default; - BuildPreset(const BuildPreset& /*other*/) = default; - BuildPreset& operator=(const BuildPreset& /*other*/) = default; + BuildPreset(BuildPreset const& /*other*/) = default; + BuildPreset& operator=(BuildPreset const& /*other*/) = default; ~BuildPreset() override = default; #if __cplusplus >= 201703L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) BuildPreset& operator=(BuildPreset&& /*other*/) = default; @@ -175,7 +175,7 @@ public: std::vector NativeToolOptions; cm::optional ResolvePackageReferences; - bool VisitPresetInherit(const Preset& parent) override; + bool VisitPresetInherit(Preset const& parent) override; bool VisitPresetAfterInherit(int /* version */, cmJSONState* /*state*/) override; }; @@ -185,8 +185,8 @@ public: public: TestPreset() = default; TestPreset(TestPreset&& /*other*/) = default; - TestPreset(const TestPreset& /*other*/) = default; - TestPreset& operator=(const TestPreset& /*other*/) = default; + TestPreset(TestPreset const& /*other*/) = default; + TestPreset& operator=(TestPreset const& /*other*/) = default; ~TestPreset() override = default; #if __cplusplus >= 201703L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) TestPreset& operator=(TestPreset&& /*other*/) = default; @@ -309,7 +309,7 @@ public: cm::optional Filter; cm::optional Execution; - bool VisitPresetInherit(const Preset& parent) override; + bool VisitPresetInherit(Preset const& parent) override; bool VisitPresetAfterInherit(int /* version */, cmJSONState* /*state*/) override; }; @@ -319,8 +319,8 @@ public: public: PackagePreset() = default; PackagePreset(PackagePreset&& /*other*/) = default; - PackagePreset(const PackagePreset& /*other*/) = default; - PackagePreset& operator=(const PackagePreset& /*other*/) = default; + PackagePreset(PackagePreset const& /*other*/) = default; + PackagePreset& operator=(PackagePreset const& /*other*/) = default; ~PackagePreset() override = default; #if __cplusplus >= 201703L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) PackagePreset& operator=(PackagePreset&& /*other*/) = default; @@ -346,7 +346,7 @@ public: std::string PackageDirectory; std::string VendorName; - bool VisitPresetInherit(const Preset& parent) override; + bool VisitPresetInherit(Preset const& parent) override; bool VisitPresetAfterInherit(int /* version */, cmJSONState* /*state*/) override; }; @@ -356,8 +356,8 @@ public: public: WorkflowPreset() = default; WorkflowPreset(WorkflowPreset&& /*other*/) = default; - WorkflowPreset(const WorkflowPreset& /*other*/) = default; - WorkflowPreset& operator=(const WorkflowPreset& /*other*/) = default; + WorkflowPreset(WorkflowPreset const& /*other*/) = default; + WorkflowPreset& operator=(WorkflowPreset const& /*other*/) = default; ~WorkflowPreset() override = default; #if __cplusplus >= 201703L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) WorkflowPreset& operator=(WorkflowPreset&& /*other*/) = default; @@ -384,7 +384,7 @@ public: std::vector Steps; - bool VisitPresetInherit(const Preset& parent) override; + bool VisitPresetInherit(Preset const& parent) override; bool VisitPresetAfterInherit(int /* version */, cmJSONState* /* state */) override; }; @@ -412,17 +412,17 @@ public: std::string SourceDir; std::vector> Files; - int GetVersion(const Preset& preset) const + int GetVersion(Preset const& preset) const { return preset.OriginFile->Version; } - static std::string GetFilename(const std::string& sourceDir); - static std::string GetUserFilename(const std::string& sourceDir); - bool ReadProjectPresets(const std::string& sourceDir, + static std::string GetFilename(std::string const& sourceDir); + static std::string GetUserFilename(std::string const& sourceDir); + bool ReadProjectPresets(std::string const& sourceDir, bool allowNoFiles = false); - std::string GetGeneratorForPreset(const std::string& presetName) const + std::string GetGeneratorForPreset(std::string const& presetName) const { auto configurePresetName = presetName; @@ -457,17 +457,17 @@ public: static void printPrecedingNewline(PrintPrecedingNewline* p); static void PrintPresets( - const std::vector& presets); + std::vector const& presets); void PrintConfigurePresetList( PrintPrecedingNewline* newline = nullptr) const; void PrintConfigurePresetList( - const std::function& filter, + std::function const& filter, PrintPrecedingNewline* newline = nullptr) const; void PrintBuildPresetList(PrintPrecedingNewline* newline = nullptr) const; void PrintTestPresetList(PrintPrecedingNewline* newline = nullptr) const; void PrintPackagePresetList(PrintPrecedingNewline* newline = nullptr) const; void PrintPackagePresetList( - const std::function& filter, + std::function const& filter, PrintPrecedingNewline* newline = nullptr) const; void PrintWorkflowPresetList(PrintPrecedingNewline* newline = nullptr) const; void PrintAllPresets() const; @@ -486,7 +486,7 @@ private: }; bool ReadProjectPresetsInternal(bool allowNoFiles); - bool ReadJSONFile(const std::string& filename, RootType rootType, + bool ReadJSONFile(std::string const& filename, RootType rootType, ReadReason readReason, std::vector& inProgressFiles, File*& file, std::string& errMsg); void ClearPresets(); diff --git a/Source/cmCMakePresetsGraphInternal.h b/Source/cmCMakePresetsGraphInternal.h index a67be21..2412072 100644 --- a/Source/cmCMakePresetsGraphInternal.h +++ b/Source/cmCMakePresetsGraphInternal.h @@ -31,8 +31,8 @@ enum class ExpandMacroResult class MacroExpander { public: - virtual ExpandMacroResult operator()(const std::string& macroNamespace, - const std::string& macroName, + virtual ExpandMacroResult operator()(std::string const& macroNamespace, + std::string const& macroName, std::string& macroOut, int version) const = 0; virtual ~MacroExpander() = default; @@ -44,8 +44,8 @@ ExpandMacroResult ExpandMacros(std::string& out, int version); ExpandMacroResult ExpandMacro(std::string& out, - const std::string& macroNamespace, - const std::string& macroName, + std::string const& macroNamespace, + std::string const& macroName, MacroExpanderVector const& macroExpanders, int version); } @@ -56,7 +56,7 @@ public: virtual ~Condition() = default; virtual bool Evaluate( - const cmCMakePresetsGraphInternal::MacroExpanderVector& expanders, + cmCMakePresetsGraphInternal::MacroExpanderVector const& expanders, int version, cm::optional& out) const = 0; virtual bool IsNull() const { return false; } }; @@ -68,17 +68,17 @@ class BaseMacroExpander : public MacroExpander cm::optional File; public: - BaseMacroExpander(const cmCMakePresetsGraph& graph) + BaseMacroExpander(cmCMakePresetsGraph const& graph) : Graph(graph) { } - BaseMacroExpander(const cmCMakePresetsGraph& graph, const std::string& file) + BaseMacroExpander(cmCMakePresetsGraph const& graph, std::string const& file) : Graph(graph) , File(file) { } - ExpandMacroResult operator()(const std::string& macroNamespace, - const std::string& macroName, + ExpandMacroResult operator()(std::string const& macroNamespace, + std::string const& macroName, std::string& macroOut, int version) const override; }; @@ -90,13 +90,13 @@ class PresetMacroExpander : public MacroExpander T const& Preset; public: - PresetMacroExpander(const cmCMakePresetsGraph& graph, const T& preset) + PresetMacroExpander(cmCMakePresetsGraph const& graph, T const& preset) : Graph(graph) , Preset(preset) { } - ExpandMacroResult operator()(const std::string& macroNamespace, - const std::string& macroName, + ExpandMacroResult operator()(std::string const& macroNamespace, + std::string const& macroName, std::string& macroOut, int version) const override { @@ -199,58 +199,58 @@ public: std::unique_ptr SubCondition; }; -bool PresetStringHelper(std::string& out, const Json::Value* value, +bool PresetStringHelper(std::string& out, Json::Value const* value, cmJSONState* state); -bool PresetNameHelper(std::string& out, const Json::Value* value, +bool PresetNameHelper(std::string& out, Json::Value const* value, cmJSONState* state); bool PresetVectorStringHelper(std::vector& out, - const Json::Value* value, cmJSONState* state); + Json::Value const* value, cmJSONState* state); -bool PresetBoolHelper(bool& out, const Json::Value* value, cmJSONState* state); +bool PresetBoolHelper(bool& out, Json::Value const* value, cmJSONState* state); bool PresetOptionalBoolHelper(cm::optional& out, - const Json::Value* value, cmJSONState* state); + Json::Value const* value, cmJSONState* state); -bool PresetIntHelper(int& out, const Json::Value* value, cmJSONState* state); +bool PresetIntHelper(int& out, Json::Value const* value, cmJSONState* state); -bool PresetOptionalIntHelper(cm::optional& out, const Json::Value* value, +bool PresetOptionalIntHelper(cm::optional& out, Json::Value const* value, cmJSONState* state); -bool PresetVectorIntHelper(std::vector& out, const Json::Value* value, +bool PresetVectorIntHelper(std::vector& out, Json::Value const* value, cmJSONState* state); bool ConfigurePresetsHelper( std::vector& out, - const Json::Value* value, cmJSONState* state); + Json::Value const* value, cmJSONState* state); bool BuildPresetsHelper(std::vector& out, - const Json::Value* value, cmJSONState* state); + Json::Value const* value, cmJSONState* state); bool TestPresetsHelper(std::vector& out, - const Json::Value* value, cmJSONState* state); + Json::Value const* value, cmJSONState* state); bool PackagePresetsHelper(std::vector& out, - const Json::Value* value, cmJSONState* state); + Json::Value const* value, cmJSONState* state); bool WorkflowPresetsHelper( std::vector& out, - const Json::Value* value, cmJSONState* state); + Json::Value const* value, cmJSONState* state); -cmJSONHelper VendorHelper(const ErrorGenerator& error); +cmJSONHelper VendorHelper(ErrorGenerator const& error); bool PresetConditionHelper( std::shared_ptr& out, - const Json::Value* value, cmJSONState* state); + Json::Value const* value, cmJSONState* state); bool PresetVectorOneOrMoreStringHelper(std::vector& out, - const Json::Value* value, + Json::Value const* value, cmJSONState* state); bool EnvironmentMapHelper( std::map>& out, - const Json::Value* value, cmJSONState* state); + Json::Value const* value, cmJSONState* state); cmJSONHelper SchemaHelper(); } diff --git a/Source/cmCMakePresetsGraphReadJSON.cxx b/Source/cmCMakePresetsGraphReadJSON.cxx index 18ae9af..ed843be 100644 --- a/Source/cmCMakePresetsGraphReadJSON.cxx +++ b/Source/cmCMakePresetsGraphReadJSON.cxx @@ -110,7 +110,7 @@ auto const MatchesConditionHelper = ConditionStringHelper, true); bool SubConditionHelper(std::unique_ptr& out, - const Json::Value* value, cmJSONState* state); + Json::Value const* value, cmJSONState* state); auto const ListConditionVectorHelper = JSONHelperBuilder::Vector>( @@ -132,7 +132,7 @@ auto const NotConditionHelper = SubConditionHelper); bool ConditionHelper(std::unique_ptr& out, - const Json::Value* value, cmJSONState* state) + Json::Value const* value, cmJSONState* state) { if (!value) { out.reset(); @@ -223,7 +223,7 @@ bool ConditionHelper(std::unique_ptr& out, } bool SubConditionHelper(std::unique_ptr& out, - const Json::Value* value, cmJSONState* state) + Json::Value const* value, cmJSONState* state) { std::unique_ptr ptr; auto result = ConditionHelper(ptr, value, state); @@ -236,7 +236,7 @@ bool SubConditionHelper(std::unique_ptr& out, } bool EnvironmentHelper(cm::optional& out, - const Json::Value* value, cmJSONState* state) + Json::Value const* value, cmJSONState* state) { if (!value || value->isNull()) { out = cm::nullopt; @@ -259,7 +259,7 @@ auto const VersionHelper = JSONHelperBuilder::Required( auto const VersionRangeHelper = JSONHelperBuilder::Checked( cmCMakePresetsErrors::UNRECOGNIZED_VERSION_RANGE(MIN_VERSION, MAX_VERSION), VersionHelper, - [](const int v) -> bool { return v >= MIN_VERSION && v <= MAX_VERSION; }); + [](int const v) -> bool { return v >= MIN_VERSION && v <= MAX_VERSION; }); auto const RootVersionHelper = JSONHelperBuilder::Object(cmCMakePresetsErrors::INVALID_ROOT_OBJECT) @@ -308,8 +308,8 @@ auto const RootPresetsHelper = class EnvironmentMacroExpander : public MacroExpander { public: - ExpandMacroResult operator()(const std::string& macroNamespace, - const std::string& macroName, + ExpandMacroResult operator()(std::string const& macroNamespace, + std::string const& macroName, std::string& macroOut, int /*version*/) const override { @@ -330,14 +330,14 @@ public: } namespace cmCMakePresetsGraphInternal { -bool PresetStringHelper(std::string& out, const Json::Value* value, +bool PresetStringHelper(std::string& out, Json::Value const* value, cmJSONState* state) { static auto const helper = JSONHelperBuilder::String(); return helper(out, value, state); } -bool PresetNameHelper(std::string& out, const Json::Value* value, +bool PresetNameHelper(std::string& out, Json::Value const* value, cmJSONState* state) { if (!value || !value->isString() || value->asString().empty()) { @@ -349,7 +349,7 @@ bool PresetNameHelper(std::string& out, const Json::Value* value, } bool PresetVectorStringHelper(std::vector& out, - const Json::Value* value, cmJSONState* state) + Json::Value const* value, cmJSONState* state) { static auto const helper = JSONHelperBuilder::Vector( cmCMakePresetsErrors::INVALID_PRESET, @@ -357,34 +357,34 @@ bool PresetVectorStringHelper(std::vector& out, return helper(out, value, state); } -bool PresetBoolHelper(bool& out, const Json::Value* value, cmJSONState* state) +bool PresetBoolHelper(bool& out, Json::Value const* value, cmJSONState* state) { static auto const helper = JSONHelperBuilder::Bool(); return helper(out, value, state); } bool PresetOptionalBoolHelper(cm::optional& out, - const Json::Value* value, cmJSONState* state) + Json::Value const* value, cmJSONState* state) { static auto const helper = JSONHelperBuilder::Optional(PresetBoolHelper); return helper(out, value, state); } -bool PresetIntHelper(int& out, const Json::Value* value, cmJSONState* state) +bool PresetIntHelper(int& out, Json::Value const* value, cmJSONState* state) { static auto const helper = JSONHelperBuilder::Int(); return helper(out, value, state); } -bool PresetOptionalIntHelper(cm::optional& out, const Json::Value* value, +bool PresetOptionalIntHelper(cm::optional& out, Json::Value const* value, cmJSONState* state) { static auto const helper = JSONHelperBuilder::Optional(PresetIntHelper); return helper(out, value, state); } -bool PresetVectorIntHelper(std::vector& out, const Json::Value* value, +bool PresetVectorIntHelper(std::vector& out, Json::Value const* value, cmJSONState* state) { static auto const helper = JSONHelperBuilder::Vector( @@ -392,9 +392,9 @@ bool PresetVectorIntHelper(std::vector& out, const Json::Value* value, return helper(out, value, state); } -cmJSONHelper VendorHelper(const ErrorGenerator& error) +cmJSONHelper VendorHelper(ErrorGenerator const& error) { - return [error](std::nullptr_t& /*out*/, const Json::Value* value, + return [error](std::nullptr_t& /*out*/, Json::Value const* value, cmJSONState* state) -> bool { if (!value) { return true; @@ -411,7 +411,7 @@ cmJSONHelper VendorHelper(const ErrorGenerator& error) bool PresetConditionHelper( std::shared_ptr& out, - const Json::Value* value, cmJSONState* state) + Json::Value const* value, cmJSONState* state) { std::unique_ptr ptr; auto result = ConditionHelper(ptr, value, state); @@ -420,7 +420,7 @@ bool PresetConditionHelper( } bool PresetVectorOneOrMoreStringHelper(std::vector& out, - const Json::Value* value, + Json::Value const* value, cmJSONState* state) { out.clear(); @@ -438,7 +438,7 @@ bool PresetVectorOneOrMoreStringHelper(std::vector& out, bool EnvironmentMapHelper( std::map>& out, - const Json::Value* value, cmJSONState* state) + Json::Value const* value, cmJSONState* state) { static auto const helper = JSONHelperBuilder::Map>( cmCMakePresetsErrors::INVALID_PRESET, EnvironmentHelper); @@ -448,13 +448,13 @@ bool EnvironmentMapHelper( cmJSONHelper SchemaHelper() { - return [](std::nullptr_t&, const Json::Value*, cmJSONState*) -> bool { + return [](std::nullptr_t&, Json::Value const*, cmJSONState*) -> bool { return true; }; } } -bool cmCMakePresetsGraph::ReadJSONFile(const std::string& filename, +bool cmCMakePresetsGraph::ReadJSONFile(std::string const& filename, RootType rootType, ReadReason readReason, std::vector& inProgressFiles, @@ -724,7 +724,7 @@ bool cmCMakePresetsGraph::ReadJSONFile(const std::string& filename, } auto const includeFile = [this, &inProgressFiles, - file](const std::string& include, + file](std::string const& include, RootType rootType2, ReadReason readReason2, std::string& FailureMessage) -> bool { bool r; diff --git a/Source/cmCMakePresetsGraphReadJSONBuildPresets.cxx b/Source/cmCMakePresetsGraphReadJSONBuildPresets.cxx index c743ac1..8433fe4 100644 --- a/Source/cmCMakePresetsGraphReadJSONBuildPresets.cxx +++ b/Source/cmCMakePresetsGraphReadJSONBuildPresets.cxx @@ -24,7 +24,7 @@ using BuildPreset = cmCMakePresetsGraph::BuildPreset; using JSONHelperBuilder = cmJSONHelperBuilder; bool PackageResolveModeHelper(cm::optional& out, - const Json::Value* value, cmJSONState* state) + Json::Value const* value, cmJSONState* state) { if (!value) { out = cm::nullopt; @@ -50,9 +50,9 @@ bool PackageResolveModeHelper(cm::optional& out, return true; } -std::function const +std::function const ResolvePackageReferencesHelper = [](BuildPreset& out, - const Json::Value* value, + Json::Value const* value, cmJSONState* state) -> bool { return PackageResolveModeHelper(out.ResolvePackageReferences, value, state); }; @@ -102,7 +102,7 @@ auto const BuildPresetHelper = namespace cmCMakePresetsGraphInternal { bool BuildPresetsHelper(std::vector& out, - const Json::Value* value, cmJSONState* state) + Json::Value const* value, cmJSONState* state) { static auto const helper = JSONHelperBuilder::Vector( cmCMakePresetsErrors::INVALID_PRESETS, BuildPresetHelper); diff --git a/Source/cmCMakePresetsGraphReadJSONConfigurePresets.cxx b/Source/cmCMakePresetsGraphReadJSONConfigurePresets.cxx index 8f49d69..354f5aa 100644 --- a/Source/cmCMakePresetsGraphReadJSONConfigurePresets.cxx +++ b/Source/cmCMakePresetsGraphReadJSONConfigurePresets.cxx @@ -29,7 +29,7 @@ using TraceEnableMode = cmCMakePresetsGraph::TraceEnableMode; using TraceOutputFormat = cmTraceEnums::TraceOutputFormat; bool ArchToolsetStrategyHelper(cm::optional& out, - const Json::Value* value, cmJSONState* state) + Json::Value const* value, cmJSONState* state) { if (!value) { out = cm::nullopt; @@ -55,7 +55,7 @@ bool ArchToolsetStrategyHelper(cm::optional& out, return false; } -std::function +std::function ArchToolsetHelper( std::string ConfigurePreset::*valueField, cm::optional ConfigurePreset::*strategyField) @@ -67,7 +67,7 @@ ArchToolsetHelper( cmCMakePresetsGraphInternal::PresetStringHelper, false) .Bind("strategy", strategyField, ArchToolsetStrategyHelper, false); return [valueField, strategyField, - objectHelper](ConfigurePreset& out, const Json::Value* value, + objectHelper](ConfigurePreset& out, Json::Value const* value, cmJSONState* state) -> bool { if (!value) { (out.*valueField).clear(); @@ -96,7 +96,7 @@ auto const ToolsetHelper = ArchToolsetHelper( &ConfigurePreset::Toolset, &ConfigurePreset::ToolsetStrategy); bool TraceEnableModeHelper(cm::optional& out, - const Json::Value* value, cmJSONState* state) + Json::Value const* value, cmJSONState* state) { if (!value) { out = cm::nullopt; @@ -123,7 +123,7 @@ bool TraceEnableModeHelper(cm::optional& out, } bool TraceOutputFormatHelper(cm::optional& out, - const Json::Value* value, cmJSONState* state) + Json::Value const* value, cmJSONState* state) { if (!value) { out = cm::nullopt; @@ -149,7 +149,7 @@ bool TraceOutputFormatHelper(cm::optional& out, auto const VariableStringHelper = JSONHelperBuilder::String(); -bool VariableValueHelper(std::string& out, const Json::Value* value, +bool VariableValueHelper(std::string& out, Json::Value const* value, cmJSONState* state) { if (!value) { @@ -171,7 +171,7 @@ auto const VariableObjectHelper = .Bind("type"_s, &CacheVariable::Type, VariableStringHelper, false) .Bind("value"_s, &CacheVariable::Value, VariableValueHelper); -bool VariableHelper(cm::optional& out, const Json::Value* value, +bool VariableHelper(cm::optional& out, Json::Value const* value, cmJSONState* state) { if (value->isBool()) { @@ -294,7 +294,7 @@ auto const ConfigurePresetHelper = namespace cmCMakePresetsGraphInternal { bool ConfigurePresetsHelper(std::vector& out, - const Json::Value* value, cmJSONState* state) + Json::Value const* value, cmJSONState* state) { static auto const helper = JSONHelperBuilder::Vector( cmCMakePresetsErrors::INVALID_PRESETS, ConfigurePresetHelper); diff --git a/Source/cmCMakePresetsGraphReadJSONPackagePresets.cxx b/Source/cmCMakePresetsGraphReadJSONPackagePresets.cxx index ac49c62..020acc3 100644 --- a/Source/cmCMakePresetsGraphReadJSONPackagePresets.cxx +++ b/Source/cmCMakePresetsGraphReadJSONPackagePresets.cxx @@ -81,7 +81,7 @@ auto const PackagePresetHelper = namespace cmCMakePresetsGraphInternal { bool PackagePresetsHelper(std::vector& out, - const Json::Value* value, cmJSONState* state) + Json::Value const* value, cmJSONState* state) { static auto const helper = cmJSONHelperBuilder::Vector( cmCMakePresetsErrors::INVALID_PRESETS, PackagePresetHelper); diff --git a/Source/cmCMakePresetsGraphReadJSONTestPresets.cxx b/Source/cmCMakePresetsGraphReadJSONTestPresets.cxx index f9e0753..acf6ad4 100644 --- a/Source/cmCMakePresetsGraphReadJSONTestPresets.cxx +++ b/Source/cmCMakePresetsGraphReadJSONTestPresets.cxx @@ -25,7 +25,7 @@ using TestPreset = cmCMakePresetsGraph::TestPreset; using JSONHelperBuilder = cmJSONHelperBuilder; bool TestPresetOutputVerbosityHelper( - TestPreset::OutputOptions::VerbosityEnum& out, const Json::Value* value, + TestPreset::OutputOptions::VerbosityEnum& out, Json::Value const* value, cmJSONState* state) { if (!value) { @@ -62,7 +62,7 @@ auto const TestPresetOptionalOutputVerbosityHelper = TestPresetOutputVerbosityHelper); bool TestPresetOutputTruncationHelper( - cm::optional& out, const Json::Value* value, + cm::optional& out, Json::Value const* value, cmJSONState* state) { if (!value) { @@ -144,7 +144,7 @@ auto const TestPresetOptionalFilterIncludeIndexObjectHelper = bool TestPresetOptionalFilterIncludeIndexHelper( cm::optional& out, - const Json::Value* value, cmJSONState* state) + Json::Value const* value, cmJSONState* state) { if (!value) { out = cm::nullopt; @@ -197,7 +197,7 @@ auto const TestPresetOptionalFilterExcludeHelper = TestPresetOptionalFilterExcludeFixturesHelper, false)); bool TestPresetExecutionShowOnlyHelper( - TestPreset::ExecutionOptions::ShowOnlyEnum& out, const Json::Value* value, + TestPreset::ExecutionOptions::ShowOnlyEnum& out, Json::Value const* value, cmJSONState* state) { if (!value || !value->isString()) { @@ -225,7 +225,7 @@ auto const TestPresetOptionalExecutionShowOnlyHelper = bool TestPresetExecutionModeHelper( TestPreset::ExecutionOptions::RepeatOptions::ModeEnum& out, - const Json::Value* value, cmJSONState* state) + Json::Value const* value, cmJSONState* state) { if (!value) { return true; @@ -265,7 +265,7 @@ auto const TestPresetOptionalExecutionRepeatHelper = bool TestPresetExecutionNoTestsActionHelper( TestPreset::ExecutionOptions::NoTestsActionEnum& out, - const Json::Value* value, cmJSONState* state) + Json::Value const* value, cmJSONState* state) { if (!value) { out = TestPreset::ExecutionOptions::NoTestsActionEnum::Default; @@ -377,7 +377,7 @@ auto const TestPresetHelper = namespace cmCMakePresetsGraphInternal { bool TestPresetsHelper(std::vector& out, - const Json::Value* value, cmJSONState* state) + Json::Value const* value, cmJSONState* state) { static auto const helper = JSONHelperBuilder::Vector( cmCMakePresetsErrors::INVALID_PRESETS, TestPresetHelper); diff --git a/Source/cmCMakePresetsGraphReadJSONWorkflowPresets.cxx b/Source/cmCMakePresetsGraphReadJSONWorkflowPresets.cxx index e152871..9dc2bde 100644 --- a/Source/cmCMakePresetsGraphReadJSONWorkflowPresets.cxx +++ b/Source/cmCMakePresetsGraphReadJSONWorkflowPresets.cxx @@ -19,7 +19,7 @@ namespace { using WorkflowPreset = cmCMakePresetsGraph::WorkflowPreset; bool WorkflowStepTypeHelper(WorkflowPreset::WorkflowStep::Type& out, - const Json::Value* value, cmJSONState* state) + Json::Value const* value, cmJSONState* state) { if (!value) { cmCMakePresetsErrors::INVALID_PRESET(value, state); @@ -85,7 +85,7 @@ auto const WorkflowPresetHelper = namespace cmCMakePresetsGraphInternal { bool WorkflowPresetsHelper( std::vector& out, - const Json::Value* value, cmJSONState* state) + Json::Value const* value, cmJSONState* state) { static auto const helper = cmJSONHelperBuilder::Vector( cmCMakePresetsErrors::INVALID_PRESETS, WorkflowPresetHelper); diff --git a/Source/cmCPackPropertiesGenerator.cxx b/Source/cmCPackPropertiesGenerator.cxx index fbf7d73..c1e662d 100644 --- a/Source/cmCPackPropertiesGenerator.cxx +++ b/Source/cmCPackPropertiesGenerator.cxx @@ -19,7 +19,7 @@ cmCPackPropertiesGenerator::cmCPackPropertiesGenerator( } void cmCPackPropertiesGenerator::GenerateScriptForConfig( - std::ostream& os, const std::string& config, Indent indent) + std::ostream& os, std::string const& config, Indent indent) { std::string const& expandedFileName = this->InstalledFile.GetNameExpression().Evaluate(this->LG, config); diff --git a/Source/cmCPackPropertiesGenerator.h b/Source/cmCPackPropertiesGenerator.h index 63c469a..6d777e9 100644 --- a/Source/cmCPackPropertiesGenerator.h +++ b/Source/cmCPackPropertiesGenerator.h @@ -29,7 +29,7 @@ public: delete; protected: - void GenerateScriptForConfig(std::ostream& os, const std::string& config, + void GenerateScriptForConfig(std::ostream& os, std::string const& config, Indent indent) override; cmLocalGenerator* LG; diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 0aeffc1..c2bebae 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -87,8 +87,8 @@ struct cmCTest::Private /** Representation of one part. */ struct PartInfo { - void SetName(const std::string& name) { this->Name = name; } - const std::string& GetName() const { return this->Name; } + void SetName(std::string const& name) { this->Name = name; } + std::string const& GetName() const { return this->Name; } void Enable() { this->Enabled = true; } explicit operator bool() const { return this->Enabled; } @@ -222,7 +222,7 @@ struct tm* cmCTest::GetNightlyTime(std::string const& str, bool tomorrowtag) tctime = time(nullptr); cmCTestLog(this, DEBUG, " Get the current time: " << tctime << std::endl); - const int dayLength = 24 * 60 * 60; + int const dayLength = 24 * 60 * 60; cmCTestLog(this, DEBUG, "Seconds: " << tctime << std::endl); while (ntime > tctime) { // If nightlySeconds is in the past, this is the current @@ -256,7 +256,7 @@ bool cmCTest::GetTomorrowTag() const return this->Impl->TomorrowTag; } -std::string cmCTest::CleanString(const std::string& str, +std::string cmCTest::CleanString(std::string const& str, std::string::size_type spos) { spos = str.find_first_not_of(" \n\t\r\f\v", spos); @@ -294,10 +294,10 @@ std::string cmCTest::GetCostDataFile() return fname; } -std::string cmCTest::DecodeURL(const std::string& in) +std::string cmCTest::DecodeURL(std::string const& in) { std::string out; - for (const char* c = in.c_str(); *c; ++c) { + for (char const* c = in.c_str(); *c; ++c) { if (*c == '%' && isxdigit(*(c + 1)) && isxdigit(*(c + 2))) { char buf[3] = { *(c + 1), *(c + 2), 0 }; out.append(1, static_cast(strtoul(buf, nullptr, 16))); @@ -371,7 +371,7 @@ bool cmCTest::ShouldCompressTestOutput() return this->Impl->CompressTestOutput; } -cmCTest::Part cmCTest::GetPartFromName(const std::string& name) +cmCTest::Part cmCTest::GetPartFromName(std::string const& name) { // Look up by lower-case to make names case-insensitive. std::string lower_name = cmSystemTools::LowerCase(name); @@ -621,7 +621,7 @@ int cmCTest::GetTestModel() const return this->Impl->TestModel; } -bool cmCTest::SetTest(const std::string& ttype, bool report) +bool cmCTest::SetTest(std::string const& ttype, bool report) { if (cmSystemTools::LowerCase(ttype) == "all") { for (Part p = PartStart; p != PartCount; p = static_cast(p + 1)) { @@ -642,7 +642,7 @@ bool cmCTest::SetTest(const std::string& ttype, bool report) return false; } -bool cmCTest::OpenOutputFile(const std::string& path, const std::string& name, +bool cmCTest::OpenOutputFile(std::string const& path, std::string const& name, cmGeneratedFileStream& stream, bool compress) { std::string testingDir = this->Impl->BinaryDir + "/Testing"; @@ -680,7 +680,7 @@ bool cmCTest::OpenOutputFile(const std::string& path, const std::string& name, return true; } -bool cmCTest::AddIfExists(Part part, const std::string& file) +bool cmCTest::AddIfExists(Part part, std::string const& file) { if (this->CTestFileExists(file)) { this->AddSubmitFile(part, file); @@ -695,7 +695,7 @@ bool cmCTest::AddIfExists(Part part, const std::string& file) return true; } -bool cmCTest::CTestFileExists(const std::string& filename) +bool cmCTest::CTestFileExists(std::string const& filename) { std::string testingDir = this->Impl->BinaryDir + "/Testing/" + this->Impl->CurrentTag + "/" + filename; @@ -708,7 +708,7 @@ int cmCTest::ProcessSteps() this->Impl->Verbose = true; this->Impl->ProduceXML = true; - const std::string currDir = cmSystemTools::GetLogicalWorkingDirectory(); + std::string const currDir = cmSystemTools::GetLogicalWorkingDirectory(); std::string workDir = currDir; if (!this->Impl->TestDir.empty()) { workDir = cmSystemTools::ToNormalizedPathOnDisk(this->Impl->TestDir); @@ -826,7 +826,7 @@ int cmCTest::ProcessSteps() d.Load(notes_dir); unsigned long kk; for (kk = 0; kk < d.GetNumberOfFiles(); kk++) { - const char* file = d.GetFile(kk); + char const* file = d.GetFile(kk); std::string fullname = notes_dir + "/" + file; if (cmSystemTools::FileExists(fullname, true)) { if (!this->Impl->NotesFiles.empty()) { @@ -887,7 +887,7 @@ std::string cmCTest::GetTestGroupString() const return this->GetTestModelString(); } -int cmCTest::GetTestModelFromString(const std::string& str) +int cmCTest::GetTestModelFromString(std::string const& str) { if (str.empty()) { return cmCTest::EXPERIMENTAL; @@ -902,8 +902,8 @@ int cmCTest::GetTestModelFromString(const std::string& str) return cmCTest::EXPERIMENTAL; } -bool cmCTest::RunMakeCommand(const std::string& command, std::string& output, - int* retVal, const char* dir, cmDuration timeout, +bool cmCTest::RunMakeCommand(std::string const& command, std::string& output, + int* retVal, char const* dir, cmDuration timeout, std::ostream& ofs, Encoding encoding) { // First generate the command and arguments @@ -1014,7 +1014,7 @@ bool cmCTest::RunMakeCommand(const std::string& command, std::string& output, return true; } -std::string cmCTest::SafeBuildIdField(const std::string& value) +std::string cmCTest::SafeBuildIdField(std::string const& value) { std::string safevalue(value); @@ -1022,7 +1022,7 @@ std::string cmCTest::SafeBuildIdField(const std::string& value) // Disallow non-filename and non-space whitespace characters. // If they occur, replace them with "" // - const char* disallowed = "\\:*?\"<>|\n\r\t\f\v"; + char const* disallowed = "\\:*?\"<>|\n\r\t\f\v"; if (safevalue.find_first_of(disallowed) != std::string::npos) { std::string::size_type i = 0; @@ -1232,7 +1232,7 @@ int cmCTest::GenerateNotesFile(cmake* cm, return 0; } -int cmCTest::GenerateNotesFile(cmake* cm, const std::string& cfiles) +int cmCTest::GenerateNotesFile(cmake* cm, std::string const& cfiles) { if (cfiles.empty()) { return 1; @@ -1330,7 +1330,7 @@ bool cmCTest::SubmitExtraFiles(std::vector const& files) return true; } -bool cmCTest::SubmitExtraFiles(const std::string& cfiles) +bool cmCTest::SubmitExtraFiles(std::string const& cfiles) { if (cfiles.empty()) { return true; @@ -1491,8 +1491,8 @@ void cmCTest::ErrorMessageUnknownDashDValue(std::string const& val) " ctest -D NightlyMemoryCheck\n"); } -bool cmCTest::CheckArgument(const std::string& arg, cm::string_view varg1, - const char* varg2) +bool cmCTest::CheckArgument(std::string const& arg, cm::string_view varg1, + char const* varg2) { return (arg == varg1) || (varg2 && arg == varg2); } @@ -1541,7 +1541,7 @@ bool cmCTest::ColoredOutputSupportedByConsole() #endif } -bool cmCTest::AddVariableDefinition(const std::string& arg) +bool cmCTest::AddVariableDefinition(std::string const& arg) { std::string name; std::string value; @@ -1555,10 +1555,10 @@ bool cmCTest::AddVariableDefinition(const std::string& arg) return false; } -bool cmCTest::SetArgsFromPreset(const std::string& presetName, +bool cmCTest::SetArgsFromPreset(std::string const& presetName, bool listPresets) { - const auto workingDirectory = cmSystemTools::GetLogicalWorkingDirectory(); + auto const workingDirectory = cmSystemTools::GetLogicalWorkingDirectory(); cmCMakePresetsGraph settingsFile; auto result = settingsFile.ReadProjectPresets(workingDirectory); @@ -1644,7 +1644,7 @@ bool cmCTest::SetArgsFromPreset(const std::string& presetName, // Set build directory to value specified by the configure preset. this->AddCTestConfigurationOverwrite( cmStrCat("BuildDirectory=", expandedConfigurePreset->BinaryDir)); - for (const auto& kvp : expandedPreset->OverwriteConfigurationFile) { + for (auto const& kvp : expandedPreset->OverwriteConfigurationFile) { this->AddCTestConfigurationOverwrite(kvp); } @@ -1653,7 +1653,7 @@ bool cmCTest::SetArgsFromPreset(const std::string& presetName, expandedPreset->Output->ShortProgress.value_or(false); if (expandedPreset->Output->Verbosity) { - const auto& verbosity = *expandedPreset->Output->Verbosity; + auto const& verbosity = *expandedPreset->Output->Verbosity; switch (verbosity) { case cmCMakePresetsGraph::TestPreset::OutputOptions::VerbosityEnum:: Extra: @@ -1719,9 +1719,9 @@ bool cmCTest::SetArgsFromPreset(const std::string& presetName, if (expandedPreset->Filter->Include->Index) { if (expandedPreset->Filter->Include->Index->IndexFile.empty()) { - const auto& start = expandedPreset->Filter->Include->Index->Start; - const auto& end = expandedPreset->Filter->Include->Index->End; - const auto& stride = expandedPreset->Filter->Include->Index->Stride; + auto const& start = expandedPreset->Filter->Include->Index->Start; + auto const& end = expandedPreset->Filter->Include->Index->End; + auto const& stride = expandedPreset->Filter->Include->Index->Stride; std::string indexOptions; indexOptions += (start ? std::to_string(*start) : "") + ","; indexOptions += (end ? std::to_string(*end) : "") + ","; @@ -1858,7 +1858,7 @@ bool cmCTest::SetArgsFromPreset(const std::string& presetName, // the main entry point of ctest, called from main int cmCTest::Run(std::vector const& args) { - const char* ctestExec = "ctest"; + char const* ctestExec = "ctest"; bool cmakeAndTest = false; bool processSteps = false; bool SRArgumentSpecified = false; @@ -2680,7 +2680,7 @@ int cmCTest::ExecuteTests() this->Impl->ExtraVerbose = this->Impl->Verbose; this->Impl->Verbose = true; - const std::string currDir = cmSystemTools::GetLogicalWorkingDirectory(); + std::string const currDir = cmSystemTools::GetLogicalWorkingDirectory(); std::string workDir = currDir; if (!this->Impl->TestDir.empty()) { workDir = cmSystemTools::ToNormalizedPathOnDisk(this->Impl->TestDir); @@ -2723,7 +2723,7 @@ int cmCTest::ExecuteTests() if (handler.ProcessHandler() < 0) { cmCTestLog(this, ERROR_MESSAGE, "Errors while running CTest\n"); if (!this->Impl->OutputTestOutputOnTestFailure) { - const std::string lastTestLog = + std::string const lastTestLog = this->GetBinaryDir() + "/Testing/Temporary/LastTest.log"; cmCTestLog(this, ERROR_MESSAGE, "Output from these tests are in: " << lastTestLog << '\n'); @@ -2746,7 +2746,7 @@ int cmCTest::RunCMakeAndTest() return retv; } -void cmCTest::SetNotesFiles(const std::string& notes) +void cmCTest::SetNotesFiles(std::string const& notes) { this->Impl->NotesFiles = notes; } @@ -2814,7 +2814,7 @@ void cmCTest::SetScheduleType(std::string const& type) this->Impl->ScheduleType = type; } -void cmCTest::ReadCustomConfigurationFileTree(const std::string& dir, +void cmCTest::ReadCustomConfigurationFileTree(std::string const& dir, cmMakefile* mf) { cmCTestLog(this, DEBUG, @@ -2850,7 +2850,7 @@ void cmCTest::ReadCustomConfigurationFileTree(const std::string& dir, } } -void cmCTest::PopulateCustomVector(cmMakefile* mf, const std::string& def, +void cmCTest::PopulateCustomVector(cmMakefile* mf, std::string const& def, std::vector& vec) { cmValue dval = mf->GetDefinition(def); @@ -2866,7 +2866,7 @@ void cmCTest::PopulateCustomVector(cmMakefile* mf, const std::string& def, } } -void cmCTest::PopulateCustomInteger(cmMakefile* mf, const std::string& def, +void cmCTest::PopulateCustomInteger(cmMakefile* mf, std::string const& def, int& val) { cmValue dval = mf->GetDefinition(def); @@ -2876,11 +2876,11 @@ void cmCTest::PopulateCustomInteger(cmMakefile* mf, const std::string& def, val = atoi(dval->c_str()); } -std::string cmCTest::GetShortPathToFile(const std::string& cfname) +std::string cmCTest::GetShortPathToFile(std::string const& cfname) { - const std::string& sourceDir = + std::string const& sourceDir = this->GetCTestConfiguration("SourceDirectory"); - const std::string& buildDir = this->GetCTestConfiguration("BuildDirectory"); + std::string const& buildDir = this->GetCTestConfiguration("BuildDirectory"); std::string fname = cmSystemTools::CollapseFullPath(cfname); // Find relative paths to both directories @@ -2925,7 +2925,7 @@ std::string cmCTest::GetShortPathToFile(const std::string& cfname) return path; } -std::string cmCTest::GetCTestConfiguration(const std::string& name) +std::string cmCTest::GetCTestConfiguration(std::string const& name) { if (this->Impl->CTestConfigurationOverwrites.find(name) != this->Impl->CTestConfigurationOverwrites.end()) { @@ -2939,7 +2939,7 @@ void cmCTest::EmptyCTestConfiguration() this->Impl->CTestConfiguration.clear(); } -void cmCTest::SetCTestConfiguration(const char* name, const std::string& value, +void cmCTest::SetCTestConfiguration(char const* name, std::string const& value, bool suppress) { cmCTestOptionalLog(this, HANDLER_VERBOSE_OUTPUT, @@ -3061,7 +3061,7 @@ std::vector& cmCTest::GetInitialCommandLineArguments() return this->Impl->InitialCommandLineArguments; } -const char* cmCTest::GetSpecificGroup() +char const* cmCTest::GetSpecificGroup() { if (this->Impl->SpecificGroup.empty()) { return nullptr; @@ -3069,7 +3069,7 @@ const char* cmCTest::GetSpecificGroup() return this->Impl->SpecificGroup.c_str(); } -void cmCTest::SetSpecificGroup(const char* group) +void cmCTest::SetSpecificGroup(char const* group) { if (!group) { this->Impl->SpecificGroup.clear(); @@ -3128,7 +3128,7 @@ bool cmCTest::GetOutputTestOutputOnTestFailure() const return this->Impl->OutputTestOutputOnTestFailure; } -const std::map& cmCTest::GetDefinitions() const +std::map const& cmCTest::GetDefinitions() const { return this->Impl->Definitions; } @@ -3148,7 +3148,7 @@ cmCTest::NoTests cmCTest::GetNoTestsMode() const return this->Impl->NoTestsMode; } -void cmCTest::SetBuildID(const std::string& id) +void cmCTest::SetBuildID(std::string const& id) { this->Impl->BuildID = id; } @@ -3168,7 +3168,7 @@ std::vector cmCTest::GetCommandLineHttpHeaders() const return this->Impl->CommandLineHttpHeaders; } -void cmCTest::AddSubmitFile(Part part, const std::string& name) +void cmCTest::AddSubmitFile(Part part, std::string const& name) { this->Impl->Parts[part].SubmitFiles.emplace_back(name); } @@ -3188,7 +3188,7 @@ void cmCTest::SetSuppressUpdatingCTestConfiguration(bool val) this->Impl->SuppressUpdatingCTestConfiguration = val; } -void cmCTest::AddCTestConfigurationOverwrite(const std::string& overStr) +void cmCTest::AddCTestConfigurationOverwrite(std::string const& overStr) { size_t epos = overStr.find('='); if (epos == std::string::npos) { @@ -3204,7 +3204,7 @@ void cmCTest::AddCTestConfigurationOverwrite(const std::string& overStr) this->Impl->CTestConfigurationOverwrites[key] = value; } -void cmCTest::SetConfigType(const std::string& ct) +void cmCTest::SetConfigType(std::string const& ct) { this->Impl->ConfigType = ct; cmSystemTools::ReplaceString(this->Impl->ConfigType, ".\\", ""); @@ -3213,7 +3213,7 @@ void cmCTest::SetConfigType(const std::string& ct) } bool cmCTest::SetCTestConfigurationFromCMakeVariable( - cmMakefile* mf, const char* dconfig, const std::string& cmake_var, + cmMakefile* mf, char const* dconfig, std::string const& cmake_var, bool suppress) { cmValue ctvar = mf->GetDefinition(cmake_var); @@ -3305,10 +3305,10 @@ void cmCTest::SetCMakeVariables(cmMakefile& mf) bool cmCTest::RunCommand(std::vector const& args, std::string* stdOut, std::string* stdErr, int* retVal, - const char* dir, cmDuration timeout, + char const* dir, cmDuration timeout, Encoding encoding) { - std::vector argv; + std::vector argv; argv.reserve(args.size() + 1); for (std::string const& a : args) { argv.push_back(a.c_str()); @@ -3393,7 +3393,7 @@ bool cmCTest::RunCommand(std::vector const& args, bool result = true; if (timedOut) { - const char* error_str = "Process terminated due to timeout\n"; + char const* error_str = "Process terminated due to timeout\n"; cmCTestLog(this, ERROR_MESSAGE, error_str << std::endl); stdErr->append(error_str, strlen(error_str)); result = false; @@ -3421,7 +3421,7 @@ bool cmCTest::RunCommand(std::vector const& args, return result; } -void cmCTest::SetOutputLogFileName(const std::string& name) +void cmCTest::SetOutputLogFileName(std::string const& name) { if (!name.empty()) { this->Impl->OutputLogFile = cm::make_unique(name); @@ -3430,7 +3430,7 @@ void cmCTest::SetOutputLogFileName(const std::string& name) } } -void cmCTest::SetOutputJUnitFileName(const std::string& name) +void cmCTest::SetOutputJUnitFileName(std::string const& name) { this->Impl->TestOptions.JUnitXMLFileName = name; // Turn test output compression off. @@ -3439,7 +3439,7 @@ void cmCTest::SetOutputJUnitFileName(const std::string& name) this->Impl->CompressTestOutput = false; } -static const char* cmCTestStringLogType[] = { "DEBUG", +static char const* cmCTestStringLogType[] = { "DEBUG", "OUTPUT", "HANDLER_OUTPUT", "HANDLER_PROGRESS_OUTPUT", diff --git a/Source/cmCTest.h b/Source/cmCTest.h index c8dc485..b308344 100644 --- a/Source/cmCTest.h +++ b/Source/cmCTest.h @@ -57,7 +57,7 @@ public: /** Get a testing part id from its string name. Returns PartCount if the string does not name a valid part. */ - Part GetPartFromName(const std::string& name); + Part GetPartFromName(std::string const& name); /** Process Command line arguments */ int Run(std::vector const& args); @@ -105,13 +105,13 @@ public: /** * Check if CTest file exists */ - bool CTestFileExists(const std::string& filename); - bool AddIfExists(Part part, const std::string& file); + bool CTestFileExists(std::string const& filename); + bool AddIfExists(Part part, std::string const& file); /** * Set the cmake test */ - bool SetTest(const std::string&, bool report = true); + bool SetTest(std::string const&, bool report = true); /** * Set the cmake test mode (experimental, nightly, continuous). @@ -121,11 +121,11 @@ public: std::string GetTestModelString() const; std::string GetTestGroupString() const; - static int GetTestModelFromString(const std::string& str); - static std::string CleanString(const std::string& str, + static int GetTestModelFromString(std::string const& str); + static std::string CleanString(std::string const& str, std::string::size_type spos = 0); - std::string GetCTestConfiguration(const std::string& name); - void SetCTestConfiguration(const char* name, const std::string& value, + std::string GetCTestConfiguration(std::string const& name); + void SetCTestConfiguration(char const* name, std::string const& value, bool suppress = false); void EmptyCTestConfiguration(); @@ -137,15 +137,15 @@ public: cmCTest(); ~cmCTest(); - cmCTest(const cmCTest&) = delete; - cmCTest& operator=(const cmCTest&) = delete; + cmCTest(cmCTest const&) = delete; + cmCTest& operator=(cmCTest const&) = delete; /** Set the notes files to be created. */ - void SetNotesFiles(const std::string& notes); + void SetNotesFiles(std::string const& notes); - void PopulateCustomVector(cmMakefile* mf, const std::string& definition, + void PopulateCustomVector(cmMakefile* mf, std::string const& definition, std::vector& vec); - void PopulateCustomInteger(cmMakefile* mf, const std::string& def, int& val); + void PopulateCustomInteger(cmMakefile* mf, std::string const& def, int& val); /** Get the current time as string */ std::string CurrentTime(); @@ -170,7 +170,7 @@ public: /** * Open file in the output directory and set the stream */ - bool OpenOutputFile(const std::string& path, const std::string& name, + bool OpenOutputFile(std::string const& path, std::string const& name, cmGeneratedFileStream& stream, bool compress = false); /** Should we only show what we would do? */ @@ -218,7 +218,7 @@ public: */ bool RunCommand(std::vector const& args, std::string* stdOut, std::string* stdErr, int* retVal = nullptr, - const char* dir = nullptr, + char const* dir = nullptr, cmDuration timeout = cmDuration::zero(), Encoding encoding = cmProcessOutput::Auto); @@ -226,7 +226,7 @@ public: * Clean/make safe for xml the given value such that it may be used as * one of the key fields by CDash when computing the buildid. */ - static std::string SafeBuildIdField(const std::string& value); + static std::string SafeBuildIdField(std::string const& value); /** Start CTest XML output file */ void StartXML(cmXMLWriter& xml, cmake* cm, bool append); @@ -238,8 +238,8 @@ public: * Run command specialized for make and configure. Returns process status * and retVal is return value or exception. */ - bool RunMakeCommand(const std::string& command, std::string& output, - int* retVal, const char* dir, cmDuration timeout, + bool RunMakeCommand(std::string const& command, std::string& output, + int* retVal, char const* dir, cmDuration timeout, std::ostream& ofs, Encoding encoding = cmProcessOutput::Auto); @@ -255,7 +255,7 @@ public: * This means if the file is in binary or * source directory, it will become /.../relative/path/to/file */ - std::string GetShortPathToFile(const std::string& fname); + std::string GetShortPathToFile(std::string const& fname); enum { @@ -285,8 +285,8 @@ public: * Set the CTest variable from CMake variable */ bool SetCTestConfigurationFromCMakeVariable(cmMakefile* mf, - const char* dconfig, - const std::string& cmake_var, + char const* dconfig, + std::string const& cmake_var, bool suppress = false); /** @@ -295,7 +295,7 @@ public: void SetCMakeVariables(cmMakefile& mf); /** Decode a URL to the original string. */ - static std::string DecodeURL(const std::string&); + static std::string DecodeURL(std::string const&); /** * Should ctect configuration be updated. When using new style ctest @@ -308,7 +308,7 @@ public: * * The format is key=value */ - void AddCTestConfigurationOverwrite(const std::string& encstr); + void AddCTestConfigurationOverwrite(std::string const& encstr); /** Create XML file that contains all the notes specified */ int GenerateNotesFile(cmake* cm, std::vector const& files); @@ -317,17 +317,17 @@ public: int GenerateDoneFile(); /** Submit extra files to the server */ - bool SubmitExtraFiles(const std::string& files); + bool SubmitExtraFiles(std::string const& files); bool SubmitExtraFiles(std::vector const& files); /** Set the output log file name */ - void SetOutputLogFileName(const std::string& name); + void SetOutputLogFileName(std::string const& name); /** Set the output JUnit file name */ - void SetOutputJUnitFileName(const std::string& name); + void SetOutputJUnitFileName(std::string const& name); /** Set the visual studio or Xcode config type */ - void SetConfigType(const std::string& ct); + void SetConfigType(std::string const& ct); /** Various log types */ enum LogType @@ -359,24 +359,24 @@ public: std::string GetColorCode(Color color) const; /** The Build ID is assigned by CDash */ - void SetBuildID(const std::string& id); + void SetBuildID(std::string const& id); std::string GetBuildID() const; /** Add file to be submitted */ - void AddSubmitFile(Part part, const std::string& name); + void AddSubmitFile(Part part, std::string const& name); std::vector const& GetSubmitFiles(Part part) const; void ClearSubmitFiles(Part part); /** * Read the custom configuration files and apply them to the current ctest */ - void ReadCustomConfigurationFileTree(const std::string& dir, cmMakefile* mf); + void ReadCustomConfigurationFileTree(std::string const& dir, cmMakefile* mf); std::vector& GetInitialCommandLineArguments(); /** Set the group to submit to */ - void SetSpecificGroup(const char* group); - const char* GetSpecificGroup(); + void SetSpecificGroup(char const* group); + char const* GetSpecificGroup(); void SetFailover(bool failover); bool GetFailover() const; @@ -398,7 +398,7 @@ public: bool GetOutputTestOutputOnTestFailure() const; - const std::map& GetDefinitions() const; + std::map const& GetDefinitions() const; /** Return the number of times a test should be run */ int GetRepeatCount() const; @@ -430,7 +430,7 @@ public: std::vector GetCommandLineHttpHeaders() const; private: - int GenerateNotesFile(cmake* cm, const std::string& files); + int GenerateNotesFile(cmake* cm, std::string const& files); void BlockTestErrorDiagnostics(); @@ -441,10 +441,10 @@ private: void ErrorMessageUnknownDashDValue(std::string const& val); /** add a variable definition from a command line -D value */ - bool AddVariableDefinition(const std::string& arg); + bool AddVariableDefinition(std::string const& arg); /** set command line arguments read from a test preset */ - bool SetArgsFromPreset(const std::string& presetName, bool listPresets); + bool SetArgsFromPreset(std::string const& presetName, bool listPresets); #if !defined(_WIN32) /** returns true iff the console supports progress output */ @@ -462,8 +462,8 @@ private: std::vector const& files); /** Check if the argument is the one specified */ - static bool CheckArgument(const std::string& arg, cm::string_view varg1, - const char* varg2 = nullptr); + static bool CheckArgument(std::string const& arg, cm::string_view varg1, + char const* varg2 = nullptr); int RunCMakeAndTest(); int RunScripts(std::vector> const& scripts); diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx index 51b2300..4ce2b66 100644 --- a/Source/cmCacheManager.cxx +++ b/Source/cmCacheManager.cxx @@ -20,7 +20,7 @@ #include "cmSystemTools.h" #include "cmVersion.h" -void cmCacheManager::CleanCMakeFiles(const std::string& path) +void cmCacheManager::CleanCMakeFiles(std::string const& path) { std::string glob = cmStrCat(path, "/CMakeFiles/*.cmake"); cmsys::Glob globIt; @@ -29,7 +29,7 @@ void cmCacheManager::CleanCMakeFiles(const std::string& path) std::for_each(files.begin(), files.end(), cmSystemTools::RemoveFile); } -bool cmCacheManager::LoadCache(const std::string& path, bool internal, +bool cmCacheManager::LoadCache(std::string const& path, bool internal, std::set& excludes, std::set& includes) { @@ -47,7 +47,7 @@ bool cmCacheManager::LoadCache(const std::string& path, bool internal, if (!fin) { return false; } - const char* realbuffer; + char const* realbuffer; std::string buffer; std::string entryKey; unsigned int lineno = 0; @@ -167,19 +167,19 @@ bool cmCacheManager::LoadCache(const std::string& path, bool internal, return true; } -const char* cmCacheManager::PersistentProperties[] = { "ADVANCED", "MODIFIED", +char const* cmCacheManager::PersistentProperties[] = { "ADVANCED", "MODIFIED", "STRINGS" }; -bool cmCacheManager::ReadPropertyEntry(const std::string& entryKey, - const CacheEntry& e) +bool cmCacheManager::ReadPropertyEntry(std::string const& entryKey, + CacheEntry const& e) { // All property entries are internal. if (e.Type != cmStateEnums::INTERNAL) { return false; } - const char* end = entryKey.c_str() + entryKey.size(); - for (const char* p : cmCacheManager::PersistentProperties) { + char const* end = entryKey.c_str() + entryKey.size(); + for (char const* p : cmCacheManager::PersistentProperties) { std::string::size_type plen = strlen(p) + 1; if (entryKey.size() > plen && *(end - plen) == '-' && strcmp(end - plen + 1, p) == 0) { @@ -199,11 +199,11 @@ bool cmCacheManager::ReadPropertyEntry(const std::string& entryKey, } void cmCacheManager::WritePropertyEntries(std::ostream& os, - const std::string& entryKey, - const CacheEntry& e, + std::string const& entryKey, + CacheEntry const& e, cmMessenger* messenger) const { - for (const char* p : cmCacheManager::PersistentProperties) { + for (char const* p : cmCacheManager::PersistentProperties) { if (cmValue value = e.GetProperty(p)) { std::string helpstring = cmStrCat(p, " property for variable: ", entryKey); @@ -220,7 +220,7 @@ void cmCacheManager::WritePropertyEntries(std::ostream& os, } } -bool cmCacheManager::SaveCache(const std::string& path, cmMessenger* messenger) +bool cmCacheManager::SaveCache(std::string const& path, cmMessenger* messenger) { std::string cacheFile = cmStrCat(path, "/CMakeCache.txt"); cmGeneratedFileStream fout(cacheFile); @@ -354,7 +354,7 @@ bool cmCacheManager::SaveCache(const std::string& path, cmMessenger* messenger) return true; } -bool cmCacheManager::DeleteCache(const std::string& path) +bool cmCacheManager::DeleteCache(std::string const& path) { std::string cacheFile = path; cmSystemTools::ConvertToUnixSlashes(cacheFile); @@ -375,7 +375,7 @@ bool cmCacheManager::DeleteCache(const std::string& path) void cmCacheManager::OutputKey(std::ostream& fout, std::string const& key) { // support : in key name by double quoting - const char* q = + char const* q = (key.find(':') != std::string::npos || cmHasLiteralPrefix(key, "//")) ? "\"" : ""; @@ -406,7 +406,7 @@ void cmCacheManager::OutputValueNoNewlines(std::ostream& fout, } void cmCacheManager::OutputHelpString(std::ostream& fout, - const std::string& helpString) + std::string const& helpString) { std::string::size_type end = helpString.size(); if (end == 0) { @@ -472,13 +472,13 @@ void cmCacheManager::OutputNewlineTruncationWarning(std::ostream& fout, } } -void cmCacheManager::RemoveCacheEntry(const std::string& key) +void cmCacheManager::RemoveCacheEntry(std::string const& key) { this->Cache.erase(key); } cmCacheManager::CacheEntry* cmCacheManager::GetCacheEntry( - const std::string& key) + std::string const& key) { auto i = this->Cache.find(key); if (i != this->Cache.end()) { @@ -487,8 +487,8 @@ cmCacheManager::CacheEntry* cmCacheManager::GetCacheEntry( return nullptr; } -const cmCacheManager::CacheEntry* cmCacheManager::GetCacheEntry( - const std::string& key) const +cmCacheManager::CacheEntry const* cmCacheManager::GetCacheEntry( + std::string const& key) const { auto i = this->Cache.find(key); if (i != this->Cache.end()) { @@ -497,9 +497,9 @@ const cmCacheManager::CacheEntry* cmCacheManager::GetCacheEntry( return nullptr; } -cmValue cmCacheManager::GetInitializedCacheValue(const std::string& key) const +cmValue cmCacheManager::GetInitializedCacheValue(std::string const& key) const { - if (const auto* entry = this->GetCacheEntry(key)) { + if (auto const* entry = this->GetCacheEntry(key)) { if (entry->Initialized) { return cmValue(entry->GetValue()); } @@ -522,7 +522,7 @@ void cmCacheManager::PrintCache(std::ostream& out) const "=================================================\n"; } -void cmCacheManager::AddCacheEntry(const std::string& key, cmValue value, +void cmCacheManager::AddCacheEntry(std::string const& key, cmValue value, cmValue helpString, cmStateEnums::CacheEntryType type) { @@ -563,7 +563,7 @@ std::vector cmCacheManager::CacheEntry::GetPropertyList() const return this->Properties.GetKeys(); } -cmValue cmCacheManager::CacheEntry::GetProperty(const std::string& prop) const +cmValue cmCacheManager::CacheEntry::GetProperty(std::string const& prop) const { if (prop == "TYPE") { return cmValue(cmState::CacheEntryTypeToString(this->Type)); @@ -575,13 +575,13 @@ cmValue cmCacheManager::CacheEntry::GetProperty(const std::string& prop) const } bool cmCacheManager::CacheEntry::GetPropertyAsBool( - const std::string& prop) const + std::string const& prop) const { return this->GetProperty(prop).IsOn(); } -void cmCacheManager::CacheEntry::SetProperty(const std::string& prop, - const std::string& value) +void cmCacheManager::CacheEntry::SetProperty(std::string const& prop, + std::string const& value) { if (prop == "TYPE") { this->Type = cmState::StringToCacheEntryType(value); @@ -592,12 +592,12 @@ void cmCacheManager::CacheEntry::SetProperty(const std::string& prop, } } -void cmCacheManager::CacheEntry::SetProperty(const std::string& p, bool v) +void cmCacheManager::CacheEntry::SetProperty(std::string const& p, bool v) { this->SetProperty(p, v ? std::string{ "ON" } : std::string{ "OFF" }); } -void cmCacheManager::CacheEntry::RemoveProperty(const std::string& prop) +void cmCacheManager::CacheEntry::RemoveProperty(std::string const& prop) { if (prop == "TYPE") { this->Type = cmState::StringToCacheEntryType("STRING"); @@ -608,8 +608,8 @@ void cmCacheManager::CacheEntry::RemoveProperty(const std::string& prop) } } -void cmCacheManager::CacheEntry::AppendProperty(const std::string& prop, - const std::string& value, +void cmCacheManager::CacheEntry::AppendProperty(std::string const& prop, + std::string const& value, bool asString) { if (prop == "TYPE") { diff --git a/Source/cmCacheManager.h b/Source/cmCacheManager.h index ae32759..725a00a 100644 --- a/Source/cmCacheManager.h +++ b/Source/cmCacheManager.h @@ -30,19 +30,19 @@ class cmCacheManager friend class cmCacheManager; public: - const std::string& GetValue() const { return this->Value; } + std::string const& GetValue() const { return this->Value; } void SetValue(cmValue); cmStateEnums::CacheEntryType GetType() const { return this->Type; } void SetType(cmStateEnums::CacheEntryType ty) { this->Type = ty; } std::vector GetPropertyList() const; - cmValue GetProperty(const std::string& property) const; - bool GetPropertyAsBool(const std::string& property) const; - void SetProperty(const std::string& property, const std::string& value); - void SetProperty(const std::string& property, bool value); - void RemoveProperty(const std::string& property); - void AppendProperty(const std::string& property, const std::string& value, + cmValue GetProperty(std::string const& property) const; + bool GetPropertyAsBool(std::string const& property) const; + void SetProperty(std::string const& property, std::string const& value); + void SetProperty(std::string const& property, bool value); + void RemoveProperty(std::string const& property); + void AppendProperty(std::string const& property, std::string const& value, bool asString = false); private: @@ -54,15 +54,15 @@ class cmCacheManager public: //! Load a cache for given makefile. Loads from path/CMakeCache.txt. - bool LoadCache(const std::string& path, bool internal, + bool LoadCache(std::string const& path, bool internal, std::set& excludes, std::set& includes); //! Save cache for given makefile. Saves to output path/CMakeCache.txt - bool SaveCache(const std::string& path, cmMessenger* messenger); + bool SaveCache(std::string const& path, cmMessenger* messenger); //! Delete the cache given - bool DeleteCache(const std::string& path); + bool DeleteCache(std::string const& path); //! Print the cache to a stream void PrintCache(std::ostream&) const; @@ -71,11 +71,11 @@ public: bool IsCacheLoaded() const { return this->CacheLoaded; } //! Get a value from the cache given a key - cmValue GetInitializedCacheValue(const std::string& key) const; + cmValue GetInitializedCacheValue(std::string const& key) const; - cmValue GetCacheEntryValue(const std::string& key) const + cmValue GetCacheEntryValue(std::string const& key) const { - if (const auto* entry = this->GetCacheEntry(key)) { + if (auto const* entry = this->GetCacheEntry(key)) { return cmValue(entry->GetValue()); } return nullptr; @@ -90,7 +90,7 @@ public: cmStateEnums::CacheEntryType GetCacheEntryType(std::string const& key) const { - if (const auto* entry = this->GetCacheEntry(key)) { + if (auto const* entry = this->GetCacheEntry(key)) { return entry->GetType(); } return cmStateEnums::UNINITIALIZED; @@ -99,7 +99,7 @@ public: std::vector GetCacheEntryPropertyList( std::string const& key) const { - if (const auto* entry = this->GetCacheEntry(key)) { + if (auto const* entry = this->GetCacheEntry(key)) { return entry->GetPropertyList(); } return {}; @@ -108,7 +108,7 @@ public: cmValue GetCacheEntryProperty(std::string const& key, std::string const& propName) const { - if (const auto* entry = this->GetCacheEntry(key)) { + if (auto const* entry = this->GetCacheEntry(key)) { return entry->GetProperty(propName); } return nullptr; @@ -117,7 +117,7 @@ public: bool GetCacheEntryPropertyAsBool(std::string const& key, std::string const& propName) const { - if (const auto* entry = this->GetCacheEntry(key)) { + if (auto const* entry = this->GetCacheEntry(key)) { return entry->GetPropertyAsBool(propName); } return false; @@ -173,34 +173,34 @@ public: unsigned int GetCacheMinorVersion() const { return this->CacheMinorVersion; } //! Add an entry into the cache - void AddCacheEntry(const std::string& key, const std::string& value, - const std::string& helpString, + void AddCacheEntry(std::string const& key, std::string const& value, + std::string const& helpString, cmStateEnums::CacheEntryType type) { this->AddCacheEntry(key, cmValue{ value }, cmValue{ helpString }, type); } - void AddCacheEntry(const std::string& key, cmValue value, - const std::string& helpString, + void AddCacheEntry(std::string const& key, cmValue value, + std::string const& helpString, cmStateEnums::CacheEntryType type) { this->AddCacheEntry(key, value, cmValue{ helpString }, type); } - void AddCacheEntry(const std::string& key, cmValue value, cmValue helpString, + void AddCacheEntry(std::string const& key, cmValue value, cmValue helpString, cmStateEnums::CacheEntryType type); //! Remove an entry from the cache - void RemoveCacheEntry(const std::string& key); + void RemoveCacheEntry(std::string const& key); private: //! Get a cache entry object for a key - CacheEntry* GetCacheEntry(const std::string& key); - const CacheEntry* GetCacheEntry(const std::string& key) const; + CacheEntry* GetCacheEntry(std::string const& key); + CacheEntry const* GetCacheEntry(std::string const& key) const; //! Clean out the CMakeFiles directory if no CMakeCache.txt - void CleanCMakeFiles(const std::string& path); + void CleanCMakeFiles(std::string const& path); static void OutputHelpString(std::ostream& fout, - const std::string& helpString); + std::string const& helpString); static void OutputWarningComment(std::ostream& fout, std::string const& message, bool wrapSpaces); @@ -213,10 +213,10 @@ private: static void OutputValueNoNewlines(std::ostream& fout, std::string const& value); - static const char* PersistentProperties[]; - bool ReadPropertyEntry(const std::string& key, const CacheEntry& e); - void WritePropertyEntries(std::ostream& os, const std::string& entryKey, - const CacheEntry& e, cmMessenger* messenger) const; + static char const* PersistentProperties[]; + bool ReadPropertyEntry(std::string const& key, CacheEntry const& e); + void WritePropertyEntries(std::ostream& os, std::string const& entryKey, + CacheEntry const& e, cmMessenger* messenger) const; std::map Cache; bool CacheLoaded = false; diff --git a/Source/cmCallVisualStudioMacro.cxx b/Source/cmCallVisualStudioMacro.cxx index 292b9a3..9980bd1 100644 --- a/Source/cmCallVisualStudioMacro.cxx +++ b/Source/cmCallVisualStudioMacro.cxx @@ -53,8 +53,8 @@ static bool LogErrorsAsMessages; } //! Using the given instance of Visual Studio, call the named macro -HRESULT InstanceCallMacro(IDispatch* vsIDE, const std::string& macro, - const std::string& args) +HRESULT InstanceCallMacro(IDispatch* vsIDE, std::string const& macro, + std::string const& args) { HRESULT hr = E_POINTER; @@ -112,15 +112,15 @@ HRESULT InstanceCallMacro(IDispatch* vsIDE, const std::string& macro, " wReserved: " << excep.wReserved << '\n'; /* clang-format on */ if (excep.bstrSource) { - oss << " bstrSource: " << (const char*)(_bstr_t)excep.bstrSource + oss << " bstrSource: " << (char const*)(_bstr_t)excep.bstrSource << '\n'; } if (excep.bstrDescription) { oss << " bstrDescription: " - << (const char*)(_bstr_t)excep.bstrDescription << '\n'; + << (char const*)(_bstr_t)excep.bstrDescription << '\n'; } if (excep.bstrHelpFile) { - oss << " bstrHelpFile: " << (const char*)(_bstr_t)excep.bstrHelpFile + oss << " bstrHelpFile: " << (char const*)(_bstr_t)excep.bstrHelpFile << '\n'; } /* clang-format off */ @@ -305,7 +305,7 @@ HRESULT GetRunningInstances(std::map& mrot) //! Do the two file names refer to the same Visual Studio solution? Or are //! we perhaps looking for any and all solutions? -bool FilesSameSolution(const std::string& slnFile, const std::string& slnName) +bool FilesSameSolution(std::string const& slnFile, std::string const& slnName) { if (slnFile == "ALL"_s || slnName == "ALL"_s) { return true; @@ -324,7 +324,7 @@ bool FilesSameSolution(const std::string& slnFile, const std::string& slnName) //! Find instances of Visual Studio with the given solution file //! open. Pass "ALL" for slnFile to gather all running instances //! of Visual Studio. -HRESULT FindVisualStudioInstances(const std::string& slnFile, +HRESULT FindVisualStudioInstances(std::string const& slnFile, std::vector& instances) { std::map mrot; @@ -363,7 +363,7 @@ HRESULT FindVisualStudioInstances(const std::string& slnFile, #endif // defined(HAVE_COMDEF_H) int cmCallVisualStudioMacro::GetNumberOfRunningVisualStudioInstances( - const std::string& slnFile) + std::string const& slnFile) { int count = 0; @@ -396,10 +396,10 @@ int cmCallVisualStudioMacro::GetNumberOfRunningVisualStudioInstances( //! Get all running objects from the Windows running object table. //! Save them in a map by their display names. -int cmCallVisualStudioMacro::CallMacro(const std::string& slnFile, - const std::string& macro, - const std::string& args, - const bool logErrorsAsMessages) +int cmCallVisualStudioMacro::CallMacro(std::string const& slnFile, + std::string const& macro, + std::string const& args, + bool const logErrorsAsMessages) { int err = 1; // no comdef.h diff --git a/Source/cmCallVisualStudioMacro.h b/Source/cmCallVisualStudioMacro.h index 78f22ae..9e92a0e 100644 --- a/Source/cmCallVisualStudioMacro.h +++ b/Source/cmCallVisualStudioMacro.h @@ -18,14 +18,14 @@ public: //! Call the named macro in instances of Visual Studio with the //! given solution file open. Pass "ALL" for slnFile to call the //! macro in each Visual Studio instance. - static int CallMacro(const std::string& slnFile, const std::string& macro, - const std::string& args, bool logErrorsAsMessages); + static int CallMacro(std::string const& slnFile, std::string const& macro, + std::string const& args, bool logErrorsAsMessages); //! Count the number of running instances of Visual Studio with the //! given solution file open. Pass "ALL" for slnFile to count all //! running Visual Studio instances. static int GetNumberOfRunningVisualStudioInstances( - const std::string& slnFile); + std::string const& slnFile); protected: private: diff --git a/Source/cmCommandLineArgument.h b/Source/cmCommandLineArgument.h index 15a1f70..65480e1 100644 --- a/Source/cmCommandLineArgument.h +++ b/Source/cmCommandLineArgument.h @@ -225,41 +225,41 @@ private: class ArgumentLambdaHelper; template - class ArgumentLambdaHelper + class ArgumentLambdaHelper { public: - static std::function + static std::function generateSetToTrue(bool& value1) { - return [&value1](const std::string&, CallState&&...) -> bool { + return [&value1](std::string const&, CallState&&...) -> bool { value1 = true; return true; }; } - static std::function + static std::function generateSetToTrue(bool& value1, bool& value2) { - return [&value1, &value2](const std::string&, CallState&&...) -> bool { + return [&value1, &value2](std::string const&, CallState&&...) -> bool { value1 = true; value2 = true; return true; }; } - static std::function + static std::function generateSetToValue(std::string& value1) { - return [&value1](const std::string& arg, CallState&&...) -> bool { + return [&value1](std::string const& arg, CallState&&...) -> bool { value1 = arg; return true; }; } - static std::function + static std::function generateSetToValue(cm::optional& value1) { - return [&value1](const std::string& arg, CallState&&...) -> bool { + return [&value1](std::string const& arg, CallState&&...) -> bool { value1 = arg; return true; }; diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx index 9f25904..9421ab2 100644 --- a/Source/cmCommonTargetGenerator.cxx +++ b/Source/cmCommonTargetGenerator.cxx @@ -48,8 +48,8 @@ std::vector const& cmCommonTargetGenerator::GetConfigNames() const return this->ConfigNames; } -cmValue cmCommonTargetGenerator::GetFeature(const std::string& feature, - const std::string& config) +cmValue cmCommonTargetGenerator::GetFeature(std::string const& feature, + std::string const& config) { return this->GeneratorTarget->GetFeature(feature, config); } @@ -57,7 +57,7 @@ cmValue cmCommonTargetGenerator::GetFeature(const std::string& feature, void cmCommonTargetGenerator::AppendFortranFormatFlags( std::string& flags, cmSourceFile const& source) { - const std::string srcfmt = source.GetSafeProperty("Fortran_FORMAT"); + std::string const srcfmt = source.GetSafeProperty("Fortran_FORMAT"); cmOutputConverter::FortranFormat format = cmOutputConverter::GetFortranFormat(srcfmt); if (format == cmOutputConverter::FortranFormatNone) { @@ -65,7 +65,7 @@ void cmCommonTargetGenerator::AppendFortranFormatFlags( this->GeneratorTarget->GetSafeProperty("Fortran_FORMAT"); format = cmOutputConverter::GetFortranFormat(tgtfmt); } - const char* var = nullptr; + char const* var = nullptr; switch (format) { case cmOutputConverter::FortranFormatFixed: var = "CMAKE_Fortran_FORMAT_FIXED_FLAG"; @@ -86,7 +86,7 @@ void cmCommonTargetGenerator::AppendFortranPreprocessFlags( std::string& flags, cmSourceFile const& source, PreprocessFlagsRequired requires_pp) { - const std::string srcpp = source.GetSafeProperty("Fortran_PREPROCESS"); + std::string const srcpp = source.GetSafeProperty("Fortran_PREPROCESS"); cmOutputConverter::FortranPreprocess preprocess = cmOutputConverter::GetFortranPreprocess(srcpp); if (preprocess == cmOutputConverter::FortranPreprocess::Unset) { @@ -94,7 +94,7 @@ void cmCommonTargetGenerator::AppendFortranPreprocessFlags( this->GeneratorTarget->GetSafeProperty("Fortran_PREPROCESS"); preprocess = cmOutputConverter::GetFortranPreprocess(tgtpp); } - const char* var = nullptr; + char const* var = nullptr; switch (preprocess) { case cmOutputConverter::FortranPreprocess::Needed: if (requires_pp == PreprocessFlagsRequired::YES) { @@ -113,11 +113,11 @@ void cmCommonTargetGenerator::AppendFortranPreprocessFlags( } } -std::string cmCommonTargetGenerator::GetFlags(const std::string& l, - const std::string& config, - const std::string& arch) +std::string cmCommonTargetGenerator::GetFlags(std::string const& l, + std::string const& config, + std::string const& arch) { - const std::string key = config + arch; + std::string const key = config + arch; auto i = this->Configs[key].FlagsByLanguage.find(l); if (i == this->Configs[key].FlagsByLanguage.end()) { @@ -132,8 +132,8 @@ std::string cmCommonTargetGenerator::GetFlags(const std::string& l, return i->second; } -std::string cmCommonTargetGenerator::GetDefines(const std::string& l, - const std::string& config) +std::string cmCommonTargetGenerator::GetDefines(std::string const& l, + std::string const& config) { auto i = this->Configs[config].DefinesByLanguage.find(l); if (i == this->Configs[config].DefinesByLanguage.end()) { @@ -151,7 +151,7 @@ std::string cmCommonTargetGenerator::GetDefines(const std::string& l, } std::string cmCommonTargetGenerator::GetIncludes(std::string const& l, - const std::string& config) + std::string const& config) { auto i = this->Configs[config].IncludesByLanguage.find(l); if (i == this->Configs[config].IncludesByLanguage.end()) { @@ -165,7 +165,7 @@ std::string cmCommonTargetGenerator::GetIncludes(std::string const& l, cmCommonTargetGenerator::LinkedTargetDirs cmCommonTargetGenerator::GetLinkedTargetDirectories( - const std::string& lang, const std::string& config) const + std::string const& lang, std::string const& config) const { LinkedTargetDirs dirs; std::set forward_emitted; @@ -240,7 +240,7 @@ cmCommonTargetGenerator::GetLinkedTargetDirectories( } std::string cmCommonTargetGenerator::ComputeTargetCompilePDB( - const std::string& config) const + std::string const& config) const { std::string compilePdbPath; if (this->GeneratorTarget->GetType() > cmStateEnums::OBJECT_LIBRARY) { @@ -267,7 +267,7 @@ std::string cmCommonTargetGenerator::ComputeTargetCompilePDB( return compilePdbPath; } -std::string cmCommonTargetGenerator::GetManifests(const std::string& config) +std::string cmCommonTargetGenerator::GetManifests(std::string const& config) { std::vector manifest_srcs; this->GeneratorTarget->GetManifests(manifest_srcs, config); @@ -304,8 +304,8 @@ std::string cmCommonTargetGenerator::GetAIXExports(std::string const&) } void cmCommonTargetGenerator::AppendOSXVerFlag(std::string& flags, - const std::string& lang, - const char* name, bool so) + std::string const& lang, + char const* name, bool so) { // Lookup the flag to specify the version. std::string fvar = cmStrCat("CMAKE_", lang, "_OSX_", name, "_VERSION_FLAG"); @@ -494,7 +494,7 @@ std::string cmCommonTargetGenerator::GenerateCodeCheckRules( } std::string cmCommonTargetGenerator::GetLinkerLauncher( - const std::string& config) + std::string const& config) { std::string lang = this->GeneratorTarget->GetLinkerLanguage(config); std::string propName = lang + "_LINKER_LAUNCHER"; @@ -521,7 +521,7 @@ std::string cmCommonTargetGenerator::GetLinkerLauncher( } bool cmCommonTargetGenerator::HaveRequiredLanguages( - const std::vector& sources, + std::vector const& sources, std::set& languagesNeeded) const { for (cmSourceFile const* sf : sources) { @@ -530,8 +530,8 @@ bool cmCommonTargetGenerator::HaveRequiredLanguages( auto* makefile = this->Makefile; auto* state = makefile->GetState(); - auto unary = [&state, &makefile](const std::string& lang) -> bool { - const bool valid = state->GetLanguageEnabled(lang); + auto unary = [&state, &makefile](std::string const& lang) -> bool { + bool const valid = state->GetLanguageEnabled(lang); if (!valid) { makefile->IssueMessage( MessageType::FATAL_ERROR, diff --git a/Source/cmCommonTargetGenerator.h b/Source/cmCommonTargetGenerator.h index 0452649..3ec4c75 100644 --- a/Source/cmCommonTargetGenerator.h +++ b/Source/cmCommonTargetGenerator.h @@ -31,7 +31,7 @@ public: protected: // Feature query methods. - cmValue GetFeature(const std::string& feature, const std::string& config); + cmValue GetFeature(std::string const& feature, std::string const& config); cmGeneratorTarget* GeneratorTarget; cmMakefile* Makefile; @@ -53,19 +53,19 @@ protected: PreprocessFlagsRequired requires_pp = PreprocessFlagsRequired::YES); virtual void AddIncludeFlags(std::string& flags, std::string const& lang, - const std::string& config) = 0; + std::string const& config) = 0; virtual std::string GetClangTidyReplacementsFilePath( std::string const& directory, cmSourceFile const& source, std::string const& config) const = 0; - void AppendOSXVerFlag(std::string& flags, const std::string& lang, - const char* name, bool so); + void AppendOSXVerFlag(std::string& flags, std::string const& lang, + char const* name, bool so); - std::string GetFlags(const std::string& l, const std::string& config, - const std::string& arch = std::string()); - std::string GetDefines(const std::string& l, const std::string& config); - std::string GetIncludes(std::string const& l, const std::string& config); - std::string GetManifests(const std::string& config); + std::string GetFlags(std::string const& l, std::string const& config, + std::string const& arch = std::string()); + std::string GetDefines(std::string const& l, std::string const& config); + std::string GetIncludes(std::string const& l, std::string const& config); + std::string GetManifests(std::string const& config); std::string GetAIXExports(std::string const& config); std::string GenerateCodeCheckRules( cmSourceFile const& source, std::string& compilerLauncher, @@ -81,13 +81,13 @@ protected: std::vector Forward; }; - LinkedTargetDirs GetLinkedTargetDirectories(const std::string& lang, - const std::string& config) const; - std::string ComputeTargetCompilePDB(const std::string& config) const; + LinkedTargetDirs GetLinkedTargetDirectories(std::string const& lang, + std::string const& config) const; + std::string ComputeTargetCompilePDB(std::string const& config) const; - std::string GetLinkerLauncher(const std::string& config); + std::string GetLinkerLauncher(std::string const& config); - bool HaveRequiredLanguages(const std::vector& sources, + bool HaveRequiredLanguages(std::vector const& sources, std::set& languagesNeeded) const; private: diff --git a/Source/cmComputeComponentGraph.cxx b/Source/cmComputeComponentGraph.cxx index 16540c3..1efdb8d 100644 --- a/Source/cmComputeComponentGraph.cxx +++ b/Source/cmComputeComponentGraph.cxx @@ -7,7 +7,7 @@ #include #include -const size_t cmComputeComponentGraph::INVALID_COMPONENT = +size_t const cmComputeComponentGraph::INVALID_COMPONENT = std::numeric_limits::max(); cmComputeComponentGraph::cmComputeComponentGraph(Graph const& input) diff --git a/Source/cmComputeComponentGraph.h b/Source/cmComputeComponentGraph.h index 878e36d..db78ad7 100644 --- a/Source/cmComputeComponentGraph.h +++ b/Source/cmComputeComponentGraph.h @@ -54,7 +54,7 @@ public: return this->TarjanComponents; } - static const size_t INVALID_COMPONENT; + static size_t const INVALID_COMPONENT; private: void TransferEdges(); diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx index 106dd84..f29697e 100644 --- a/Source/cmComputeLinkDepends.cxx +++ b/Source/cmComputeLinkDepends.cxx @@ -222,9 +222,9 @@ struct LinkLibraryFeatureAttributeSet }; std::map LinkLibraryFeatureAttributes; -const LinkLibraryFeatureAttributeSet& GetLinkLibraryFeatureAttributes( +LinkLibraryFeatureAttributeSet const& GetLinkLibraryFeatureAttributes( cmMakefile* makefile, std::string const& linkLanguage, - const std::string& feature) + std::string const& feature) { auto it = LinkLibraryFeatureAttributes.find(feature); if (it != LinkLibraryFeatureAttributes.end()) { @@ -315,10 +315,10 @@ const LinkLibraryFeatureAttributeSet& GetLinkLibraryFeatureAttributes( } // LINK_GROUP helpers -const cm::string_view LG_BEGIN = "Makefile; + auto const* makefile = target->Makefile; switch (target->GetPolicyStatusCMP0156()) { case cmPolicies::WARN: @@ -443,13 +443,13 @@ public: } } - void AddGroups(const std::map>& groups) + void AddGroups(std::map> const& groups) { if (!groups.empty()) { this->Groups = &groups; // record all libraries as part of groups to ensure correct // deduplication: libraries as part of groups are always kept. - for (const auto& g : groups) { + for (auto const& g : groups) { for (auto index : g.second) { this->Emitted.insert(index); } @@ -457,7 +457,7 @@ public: } } - void AddLibraries(const std::vector& libEntries) + void AddLibraries(std::vector const& libEntries) { if (this->Order == Reverse) { std::vector entries; @@ -487,7 +487,7 @@ public: } } - void AddObjects(const std::vector& objectEntries) + void AddObjects(std::vector const& objectEntries) { // Place explicitly linked object files in the front. The linker will // always use them anyway, and they may depend on symbols from libraries. @@ -514,12 +514,12 @@ public: // expand groups if (this->Groups) { - for (const auto& g : *this->Groups) { - const LinkEntry& groupEntry = this->Entries[g.first]; + for (auto const& g : *this->Groups) { + LinkEntry const& groupEntry = this->Entries[g.first]; auto it = this->FinalEntries.begin(); while (true) { it = std::find_if(it, this->FinalEntries.end(), - [&groupEntry](const LinkEntry& entry) -> bool { + [&groupEntry](LinkEntry const& entry) -> bool { return groupEntry.Item == entry.Item; }); if (it == this->FinalEntries.end()) { @@ -574,7 +574,7 @@ private: } template - void AddLibraries(const Range& libEntries) + void AddLibraries(Range const& libEntries) { for (auto index : libEntries) { LinkEntry const& entry = this->Entries[index]; @@ -586,21 +586,21 @@ private: OrderKind Order = Reverse; DeduplicationKind Deduplication = Shared; - const cmGeneratorTarget* Target; - const std::string& LinkLanguage; + cmGeneratorTarget const* Target; + std::string const& LinkLanguage; EntryVector& Entries; EntryVector& FinalEntries; std::set Emitted; - const std::map>* Groups = nullptr; + std::map> const* Groups = nullptr; }; } std::string const& cmComputeLinkDepends::LinkEntry::DEFAULT = cmLinkItem::DEFAULT; -cmComputeLinkDepends::cmComputeLinkDepends(const cmGeneratorTarget* target, - const std::string& config, - const std::string& linkLanguage, +cmComputeLinkDepends::cmComputeLinkDepends(cmGeneratorTarget const* target, + std::string const& config, + std::string const& linkLanguage, LinkLibrariesStrategy strategy) : Target(target) , Makefile(this->Target->Target->GetMakefile()) @@ -861,7 +861,7 @@ void cmComputeLinkDepends::FollowLinkEntry(BFSEntry qe) // Follow the target dependencies. if (cmLinkInterface const* iface = entry.Target->GetLinkInterface(this->Config, this->Target)) { - const bool isIface = + bool const isIface = entry.Target->GetType() == cmStateEnums::INTERFACE_LIBRARY; // This target provides its own link interface information. this->AddLinkEntries(depender_index, iface->Libraries); @@ -948,7 +948,7 @@ void cmComputeLinkDepends::HandleSharedDependency(SharedDepEntry const& dep) } void cmComputeLinkDepends::AddVarLinkEntries( - cm::optional const& depender_index, const char* value) + cm::optional const& depender_index, char const* value) { // This is called to add the dependencies named by // _LIB_DEPENDS. The variable contains a semicolon-separated @@ -1039,7 +1039,7 @@ void cmComputeLinkDepends::AddLinkEntries( // emit a warning if an undefined feature is used as part of // an imported target if (item.Feature != LinkEntry::DEFAULT && depender_index) { - const auto& depender = this->EntryList[*depender_index]; + auto const& depender = this->EntryList[*depender_index]; if (depender.Target && depender.Target->IsImported() && !IsFeatureSupported(this->Makefile, this->LinkLanguage, item.Feature)) { @@ -1089,8 +1089,8 @@ void cmComputeLinkDepends::AddLinkEntries( } if (depender_index && group) { - const auto& depender = this->EntryList[*depender_index]; - const auto& groupFeature = this->EntryList[group->first].Feature; + auto const& depender = this->EntryList[*depender_index]; + auto const& groupFeature = this->EntryList[group->first].Feature; if (depender.Target && depender.Target->IsImported() && !IsGroupFeatureSupported(this->Makefile, this->LinkLanguage, groupFeature)) { @@ -1122,7 +1122,7 @@ void cmComputeLinkDepends::AddLinkEntries( entry.Target->GetType() == cmStateEnums::TargetType::INTERFACE_LIBRARY)) { supportedItem = false; - const auto& groupFeature = this->EntryList[group->first].Feature; + auto const& groupFeature = this->EntryList[group->first].Feature; this->CMakeInstance->IssueMessage( MessageType::AUTHOR_WARNING, cmStrCat( @@ -1164,9 +1164,9 @@ void cmComputeLinkDepends::AddLinkEntries( if (supportedItem) { if (group) { - const auto& currentFeature = this->EntryList[group->first].Feature; - for (const auto& g : this->GroupItems) { - const auto& groupFeature = this->EntryList[g.first].Feature; + auto const& currentFeature = this->EntryList[group->first].Feature; + for (auto const& g : this->GroupItems) { + auto const& groupFeature = this->EntryList[g.first].Feature; if (groupFeature == currentFeature) { continue; } @@ -1242,7 +1242,7 @@ void cmComputeLinkDepends::AddLinkEntries( std::vector indexes; bool entryHandled = false; // search any occurrence of the library in already defined groups - for (const auto& g : this->GroupItems) { + for (auto const& g : this->GroupItems) { for (auto index : g.second) { if (entry.Item.Value == this->EntryList[index].Item.Value) { indexes.push_back(g.first); @@ -1302,7 +1302,7 @@ void cmComputeLinkDepends::AddLinkObjects(std::vector const& objs) } cmLinkItem cmComputeLinkDepends::ResolveLinkItem( - cm::optional const& depender_index, const std::string& name) + cm::optional const& depender_index, std::string const& name) { // Look for a target in the scope of the depender. cmGeneratorTarget const* from = this->Target; @@ -1364,7 +1364,7 @@ void cmComputeLinkDepends::UpdateGroupDependencies() continue; } // search the item in the defined groups - for (const auto& groupItems : this->GroupItems) { + for (auto const& groupItems : this->GroupItems) { auto pos = std::find(groupItems.second.cbegin(), groupItems.second.cend(), index); if (pos != groupItems.second.cend()) { diff --git a/Source/cmComputeLinkDepends.h b/Source/cmComputeLinkDepends.h index 10552b8..9283d0c 100644 --- a/Source/cmComputeLinkDepends.h +++ b/Source/cmComputeLinkDepends.h @@ -40,13 +40,13 @@ class cmComputeLinkDepends { public: cmComputeLinkDepends(cmGeneratorTarget const* target, - const std::string& config, - const std::string& linkLanguage, + std::string const& config, + std::string const& linkLanguage, LinkLibrariesStrategy strategy); ~cmComputeLinkDepends(); - cmComputeLinkDepends(const cmComputeLinkDepends&) = delete; - cmComputeLinkDepends& operator=(const cmComputeLinkDepends&) = delete; + cmComputeLinkDepends(cmComputeLinkDepends const&) = delete; + cmComputeLinkDepends& operator=(cmComputeLinkDepends const&) = delete; // Basic information about each link item. struct LinkEntry @@ -109,14 +109,14 @@ private: cm::optional const& groupIndex); void AddLinkObject(cmLinkItem const& item); void AddVarLinkEntries(cm::optional const& depender_index, - const char* value); + char const* value); void AddDirectLinkEntries(); template void AddLinkEntries(cm::optional const& depender_index, std::vector const& libs); void AddLinkObjects(std::vector const& objs); cmLinkItem ResolveLinkItem(cm::optional const& depender_index, - const std::string& name); + std::string const& name); // One entry for each unique item. std::vector EntryList; @@ -130,7 +130,7 @@ private: { size_t Index; cm::optional GroupIndex; - const char* LibDepends; + char const* LibDepends; }; std::queue BFSQueue; void FollowLinkEntry(BFSEntry qe); diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index fb22ce6..c411022 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -250,7 +250,7 @@ because this need be done only for shared libraries without soname-s. */ cmComputeLinkInformation::cmComputeLinkInformation( - const cmGeneratorTarget* target, const std::string& config) + cmGeneratorTarget const* target, std::string const& config) // Store context information. : Target(target) , Makefile(target->Target->GetMakefile()) @@ -324,7 +324,7 @@ cmComputeLinkInformation::cmComputeLinkInformation( // Get options needed to specify RPATHs. this->RuntimeUseChrpath = false; if (this->Target->GetType() != cmStateEnums::STATIC_LIBRARY) { - const char* tType = ((this->Target->GetType() == cmStateEnums::EXECUTABLE) + char const* tType = ((this->Target->GetType() == cmStateEnums::EXECUTABLE) ? "EXECUTABLE" : "SHARED_LIBRARY"); std::string rtVar = @@ -425,7 +425,7 @@ cmComputeLinkInformation::cmComputeLinkInformation( cmComputeLinkInformation::~cmComputeLinkInformation() = default; namespace { -const std::string& DEFAULT = cmComputeLinkDepends::LinkEntry::DEFAULT; +std::string const& DEFAULT = cmComputeLinkDepends::LinkEntry::DEFAULT; } void cmComputeLinkInformation::AppendValues( @@ -460,8 +460,8 @@ cmComputeLinkInformation::GetDirectoriesWithBacktraces() std::vector> targetLinkDirectories = this->Target->GetLinkDirectories(this->Config, this->LinkLanguage); - const std::vector& orderedDirectories = this->GetDirectories(); - for (const std::string& dir : orderedDirectories) { + std::vector const& orderedDirectories = this->GetDirectories(); + for (std::string const& dir : orderedDirectories) { auto result = std::find(targetLinkDirectories.begin(), targetLinkDirectories.end(), dir); if (result != targetLinkDirectories.end()) { @@ -510,13 +510,13 @@ cmComputeLinkInformation::GetXcFrameworkHeaderPaths() const return this->XcFrameworkHeaderPaths; } -const std::set& +std::set const& cmComputeLinkInformation::GetSharedLibrariesLinked() const { return this->SharedLibrariesLinked; } -const std::vector& +std::vector const& cmComputeLinkInformation::GetExternalObjectTargets() const { return this->ExternalObjectTargets; @@ -570,7 +570,7 @@ bool cmComputeLinkInformation::Compute() // Add the link line items. for (cmComputeLinkDepends::LinkEntry const& linkEntry : linkEntries) { if (linkEntry.Kind == cmComputeLinkDepends::LinkEntry::Group) { - const auto& groupFeature = this->GetGroupFeature(linkEntry.Feature); + auto const& groupFeature = this->GetGroupFeature(linkEntry.Feature); if (groupFeature.Supported) { if (linkEntry.Item.Value == "" && currentFeature) { // emit feature suffix, if any @@ -653,8 +653,8 @@ bool cmComputeLinkInformation::Compute() } namespace { -void FinalizeFeatureFormat(std::string& format, const std::string& activeTag, - const std::string& otherTag) +void FinalizeFeatureFormat(std::string& format, std::string const& activeTag, + std::string const& otherTag) { auto pos = format.find(otherTag); if (pos != std::string::npos) { @@ -670,7 +670,7 @@ void FinalizeFeatureFormat(std::string& format, const std::string& activeTag, } } -bool IsValidFeatureFormat(const std::string& format) +bool IsValidFeatureFormat(std::string const& format) { return format.find("") != std::string::npos || format.find("") != std::string::npos || @@ -680,9 +680,9 @@ bool IsValidFeatureFormat(const std::string& format) class FeaturePlaceHolderExpander : public cmPlaceholderExpander { public: - FeaturePlaceHolderExpander(const std::string* library, - const std::string* libItem = nullptr, - const std::string* linkItem = nullptr) + FeaturePlaceHolderExpander(std::string const* library, + std::string const* libItem = nullptr, + std::string const* linkItem = nullptr) : Library(library) , LibItem(libItem) , LinkItem(linkItem) @@ -705,9 +705,9 @@ private: return variable; } - const std::string* Library = nullptr; - const std::string* LibItem = nullptr; - const std::string* LinkItem = nullptr; + std::string const* Library = nullptr; + std::string const* LibItem = nullptr; + std::string const* LinkItem = nullptr; }; } @@ -1112,7 +1112,7 @@ void cmComputeLinkInformation::AddItem(LinkEntry const& entry) BT const& item = entry.Item; // Compute the proper name to use to link this library. - const std::string& config = this->Config; + std::string const& config = this->Config; bool impexe = (tgt && tgt->IsExecutableWithExports()); if (impexe && !tgt->HasImportLibrary(config) && !this->LoaderFlag) { // Skip linking to executables on platforms with no import @@ -1248,7 +1248,7 @@ void cmComputeLinkInformation::AddItem(LinkEntry const& entry) void cmComputeLinkInformation::AddSharedDepItem(LinkEntry const& entry) { BT const& item = entry.Item; - const cmGeneratorTarget* tgt = entry.Target; + cmGeneratorTarget const* tgt = entry.Target; // Record dependencies on DLLs. if (tgt && tgt->GetType() == cmStateEnums::SHARED_LIBRARY && @@ -1338,7 +1338,7 @@ void cmComputeLinkInformation::AddSharedDepItem(LinkEntry const& entry) if (order) { if (tgt) { std::string soName = tgt->GetSOName(this->Config); - const char* soname = soName.empty() ? nullptr : soName.c_str(); + char const* soname = soName.empty() ? nullptr : soName.c_str(); order->AddRuntimeLibrary(lib, soname); } else { order->AddRuntimeLibrary(lib); @@ -1367,7 +1367,7 @@ void cmComputeLinkInformation::ComputeLinkTypeInfo() // Lookup link type selection flags. cmValue static_link_type_flag = nullptr; cmValue shared_link_type_flag = nullptr; - const char* target_type_str = nullptr; + char const* target_type_str = nullptr; switch (this->Target->GetType()) { case cmStateEnums::EXECUTABLE: target_type_str = "EXE"; @@ -1520,7 +1520,7 @@ std::string cmComputeLinkInformation::CreateExtensionRegex( { // Build a list of extension choices. std::string libext = "("; - const char* sep = ""; + char const* sep = ""; for (std::string const& i : exts) { // Separate this choice from the previous one. libext += sep; @@ -1613,7 +1613,7 @@ void cmComputeLinkInformation::AddTargetItem(LinkEntry const& entry) return; } - const bool isImportedFrameworkFolderOnApple = + bool const isImportedFrameworkFolderOnApple = target->IsImportedFrameworkFolderOnApple(this->Config); if (target->IsFrameworkOnApple() || isImportedFrameworkFolderOnApple) { // Add the framework directory and the framework item itself @@ -1758,7 +1758,7 @@ void cmComputeLinkInformation::AddUserItem(LinkEntry const& entry) // foo ==> -lfoo // libfoo.a ==> -Wl,-Bstatic -lfoo - const cm::string_view LINKER{ "LINKER:" }; + cm::string_view const LINKER{ "LINKER:" }; BT const& item = entry.Item; if (item.Value[0] == '-' || item.Value[0] == '$' || item.Value[0] == '`') { @@ -1881,7 +1881,7 @@ void cmComputeLinkInformation::AddFrameworkItem(LinkEntry const& entry) return; } - const std::string& fw_path = fwDescriptor->Directory; + std::string const& fw_path = fwDescriptor->Directory; if (!fw_path.empty()) { // Add the directory portion to the framework search path. this->AddFrameworkPath(fw_path); @@ -2106,7 +2106,7 @@ void cmComputeLinkInformation::AddLibraryRuntimeInfo( // Try to get the soname of the library. Only files with this name // could possibly conflict. std::string soName = target->GetSOName(this->Config); - const char* soname = soName.empty() ? nullptr : soName.c_str(); + char const* soname = soName.empty() ? nullptr : soName.c_str(); // Include this library in the runtime path ordering. this->OrderRuntimeSearchPath->AddRuntimeLibrary(fullPath, soname); diff --git a/Source/cmComputeLinkInformation.h b/Source/cmComputeLinkInformation.h index 23594b0..d5badd3 100644 --- a/Source/cmComputeLinkInformation.h +++ b/Source/cmComputeLinkInformation.h @@ -34,9 +34,9 @@ private: public: cmComputeLinkInformation(cmGeneratorTarget const* target, - const std::string& config); - cmComputeLinkInformation(const cmComputeLinkInformation&) = delete; - cmComputeLinkInformation& operator=(const cmComputeLinkInformation&) = + std::string const& config); + cmComputeLinkInformation(cmComputeLinkInformation const&) = delete; + cmComputeLinkInformation& operator=(cmComputeLinkInformation const&) = delete; ~cmComputeLinkInformation(); bool Compute(); @@ -68,7 +68,7 @@ public: cmSourceFile const* ObjectSource = nullptr; bool HasFeature() const { return this->Feature != nullptr; } - const std::string& GetFeatureName() const + std::string const& GetFeatureName() const { return HasFeature() ? this->Feature->Name : cmComputeLinkDepends::LinkEntry::DEFAULT; @@ -124,7 +124,7 @@ public: std::string GetConfig() const { return this->Config; } - const cmGeneratorTarget* GetTarget() { return this->Target; } + cmGeneratorTarget const* GetTarget() { return this->Target; } private: using LinkEntry = cmComputeLinkDepends::LinkEntry; @@ -253,7 +253,7 @@ private: bool ArchivesMayBeShared; void AddLibraryRuntimeInfo(std::string const& fullPath, - const cmGeneratorTarget* target); + cmGeneratorTarget const* target); void AddLibraryRuntimeInfo(std::string const& fullPath); class FeatureDescriptor @@ -261,10 +261,10 @@ private: public: FeatureDescriptor() = default; - const std::string Name; - const bool Supported = false; - const std::string Prefix; - const std::string Suffix; + std::string const Name; + bool const Supported = false; + std::string const Prefix; + std::string const Suffix; std::string GetDecoratedItem(std::string const& library, ItemIsPath isPath) const; std::string GetDecoratedItem(std::string const& library, diff --git a/Source/cmComputeTargetDepends.cxx b/Source/cmComputeTargetDepends.cxx index 3cc1500..8a4798d 100644 --- a/Source/cmComputeTargetDepends.cxx +++ b/Source/cmComputeTargetDepends.cxx @@ -177,8 +177,8 @@ void cmComputeTargetDepends::CollectTargets() { // Collect all targets from all generators. auto const& lgens = this->GlobalGenerator->GetLocalGenerators(); - for (const auto& lgen : lgens) { - for (const auto& ti : lgen->GetGeneratorTargets()) { + for (auto const& lgen : lgens) { + for (auto const& ti : lgen->GetGeneratorTargets()) { size_t index = this->Targets.size(); this->TargetIndex[ti.get()] = index; this->Targets.push_back(ti.get()); @@ -262,8 +262,8 @@ void cmComputeTargetDepends::CollectTargetDepends(size_t depender_index) } void cmComputeTargetDepends::AddInterfaceDepends( - size_t depender_index, const cmGeneratorTarget* dependee, - cmListFileBacktrace const& dependee_backtrace, const std::string& config, + size_t depender_index, cmGeneratorTarget const* dependee, + cmListFileBacktrace const& dependee_backtrace, std::string const& config, std::set& emitted) { cmGeneratorTarget const* depender = this->Targets[depender_index]; @@ -292,7 +292,7 @@ void cmComputeTargetDepends::AddInterfaceDepends( void cmComputeTargetDepends::AddInterfaceDepends( size_t depender_index, cmLinkItem const& dependee_name, - const std::string& config, std::set& emitted) + std::string const& config, std::set& emitted) { cmGeneratorTarget const* depender = this->Targets[depender_index]; cmGeneratorTarget const* dependee = dependee_name.Target; @@ -507,7 +507,7 @@ void cmComputeTargetDepends::OptimizeLinkDependencies( } void cmComputeTargetDepends::DisplayGraph(Graph const& graph, - const std::string& name) + std::string const& name) { fprintf(stderr, "The %s target dependency graph is:\n", name.c_str()); size_t n = graph.size(); @@ -555,7 +555,7 @@ void cmComputeTargetDepends::DisplaySideEffects() } void cmComputeTargetDepends::DisplayComponents( - cmComputeComponentGraph const& ccg, const std::string& name) + cmComputeComponentGraph const& ccg, std::string const& name) { fprintf(stderr, "The strongly connected components for the %s graph are:\n", name.c_str()); diff --git a/Source/cmComputeTargetDepends.h b/Source/cmComputeTargetDepends.h index 3ed041b..0082500 100644 --- a/Source/cmComputeTargetDepends.h +++ b/Source/cmComputeTargetDepends.h @@ -69,12 +69,12 @@ private: bool ComputeFinalDepends(cmComputeComponentGraph const& ccg); void AddInterfaceDepends(size_t depender_index, cmLinkItem const& dependee_name, - const std::string& config, + std::string const& config, std::set& emitted); void AddInterfaceDepends(size_t depender_index, cmGeneratorTarget const* dependee, cmListFileBacktrace const& dependee_backtrace, - const std::string& config, + std::string const& config, std::set& emitted); void AddObjectDepends(size_t depender_index, cmSourceFile const* o, std::set& emitted); @@ -96,12 +96,12 @@ private: Graph IntermediateGraph; Graph FinalGraph; std::vector SideEffects; - void DisplayGraph(Graph const& graph, const std::string& name); + void DisplayGraph(Graph const& graph, std::string const& name); void DisplaySideEffects(); // Deal with connected components. void DisplayComponents(cmComputeComponentGraph const& ccg, - const std::string& name); + std::string const& name); bool CheckComponents(cmComputeComponentGraph const& ccg); void ComplainAboutBadComponent(cmComputeComponentGraph const& ccg, size_t c, bool strong = false); diff --git a/Source/cmConditionEvaluator.cxx b/Source/cmConditionEvaluator.cxx index a9c6a86..ca385e8 100644 --- a/Source/cmConditionEvaluator.cxx +++ b/Source/cmConditionEvaluator.cxx @@ -104,9 +104,9 @@ std::string bool2string(bool const value) static_cast('0' + static_cast(value))); } -bool looksLikeSpecialVariable(const std::string& var, +bool looksLikeSpecialVariable(std::string const& var, cm::static_string_view prefix, - const std::size_t varNameLen) + std::size_t const varNameLen) { // NOTE Expecting a variable name at least 1 char length: // + `{` + + `}` @@ -198,13 +198,13 @@ public: CurrentAndTwoMoreIter make3ArgsIterator() { return *this; } template - void ReduceOneArg(const bool value, Iter args) + void ReduceOneArg(bool const value, Iter args) { *args.current = cmExpandedCommandArgument(bool2string(value), true); this->erase(args.next); } - void ReduceTwoArgs(const bool value, CurrentAndTwoMoreIter args) + void ReduceTwoArgs(bool const value, CurrentAndTwoMoreIter args) { *args.current = cmExpandedCommandArgument(bool2string(value), true); this->erase(args.nextnext); @@ -239,7 +239,7 @@ cmConditionEvaluator::cmConditionEvaluator(cmMakefile& makefile, // directly. AND OR take variables or the values 0 or 1. bool cmConditionEvaluator::IsTrue( - const std::vector& args, std::string& errorString, + std::vector const& args, std::string& errorString, MessageType& status) { errorString.clear(); @@ -257,7 +257,7 @@ bool cmConditionEvaluator::IsTrue( // parens using handlerFn_t = bool (cmConditionEvaluator::*)( cmArgumentList&, std::string&, MessageType&); - const std::array handlers = { { + std::array const handlers = { { &cmConditionEvaluator::HandleLevel0, // parenthesis &cmConditionEvaluator::HandleLevel1, // predicates &cmConditionEvaluator::HandleLevel2, // binary ops @@ -303,7 +303,7 @@ cmValue cmConditionEvaluator::GetDefinitionIfUnquoted( //========================================================================= cmValue cmConditionEvaluator::GetVariableOrString( - const cmExpandedCommandArgument& argument) const + cmExpandedCommandArgument const& argument) const { cmValue def = this->GetDefinitionIfUnquoted(argument); @@ -317,7 +317,7 @@ cmValue cmConditionEvaluator::GetVariableOrString( //========================================================================= bool cmConditionEvaluator::IsKeyword( cm::static_string_view keyword, - const cmExpandedCommandArgument& argument) const + cmExpandedCommandArgument const& argument) const { if (argument.WasQuoted()) { return false; @@ -341,7 +341,7 @@ bool cmConditionEvaluator::GetBooleanValue( // Check for numbers. if (!arg.empty()) { char* end; - const double d = std::strtod(arg.GetValue().c_str(), &end); + double const d = std::strtod(arg.GetValue().c_str(), &end); if (*end == '\0') { // The whole string is a number. Use C conversion to bool. return static_cast(d); @@ -355,7 +355,7 @@ bool cmConditionEvaluator::GetBooleanValue( template inline int cmConditionEvaluator::matchKeysImpl( - const cmExpandedCommandArgument&) + cmExpandedCommandArgument const&) { // Zero means "not found" return 0; @@ -363,7 +363,7 @@ inline int cmConditionEvaluator::matchKeysImpl( template inline int cmConditionEvaluator::matchKeysImpl( - const cmExpandedCommandArgument& arg, T current, Keys... key) + cmExpandedCommandArgument const& arg, T current, Keys... key) { if (this->IsKeyword(current, arg)) { // Stop searching as soon as smth has found @@ -374,7 +374,7 @@ inline int cmConditionEvaluator::matchKeysImpl( template inline int cmConditionEvaluator::matchKeys( - const cmExpandedCommandArgument& arg, Keys... key) + cmExpandedCommandArgument const& arg, Keys... key) { // Get index of the matched key (1-based) return matchKeysImpl<1>(arg, key...); @@ -403,12 +403,12 @@ bool cmConditionEvaluator::HandleLevel0(cmArgumentList& newArgs, // store the reduced args in this vector auto argOpen = std::next(arg); - const std::vector subExpr( + std::vector const subExpr( argOpen, std::prev(argClose)); // now recursively invoke IsTrue to handle the values inside the // parenthetical expression - const auto value = this->IsTrue(subExpr, errorString, status); + auto const value = this->IsTrue(subExpr, errorString, status); *arg = cmExpandedCommandArgument(bool2string(value), true); argOpen = std::next(arg); // remove the now evaluated parenthetical expression @@ -490,17 +490,17 @@ bool cmConditionEvaluator::HandleLevel1(cmArgumentList& newArgs, std::string&, } // is a variable defined else if (this->IsKeyword(keyDEFINED, *args.current)) { - const auto& var = args.next->GetValue(); - const auto varNameLen = var.size(); + auto const& var = args.next->GetValue(); + auto const varNameLen = var.size(); auto result = false; if (looksLikeSpecialVariable(var, "ENV"_s, varNameLen)) { - const auto env = args.next->GetValue().substr(4, varNameLen - 5); + auto const env = args.next->GetValue().substr(4, varNameLen - 5); result = cmSystemTools::HasEnv(env); } else if (looksLikeSpecialVariable(var, "CACHE"_s, varNameLen)) { - const auto cache = args.next->GetValue().substr(6, varNameLen - 7); + auto const cache = args.next->GetValue().substr(6, varNameLen - 7); result = static_cast( this->Makefile.GetState()->GetCacheEntryValue(cache)); } @@ -560,7 +560,7 @@ bool cmConditionEvaluator::HandleLevel2(cmArgumentList& newArgs, this->Makefile.ClearMatches(); - const auto& rex = args.nextnext->GetValue(); + auto const& rex = args.nextnext->GetValue(); cmsys::RegularExpression regEntry; if (!regEntry.compile(rex)) { std::ostringstream error; @@ -570,7 +570,7 @@ bool cmConditionEvaluator::HandleLevel2(cmArgumentList& newArgs, return false; } - const auto match = regEntry.find(*def); + auto const match = regEntry.find(*def); if (match) { this->Makefile.StoreMatches(regEntry); } @@ -605,9 +605,9 @@ bool cmConditionEvaluator::HandleLevel2(cmArgumentList& newArgs, keySTRLESS_EQUAL, keySTRGREATER, keySTRGREATER_EQUAL, keySTREQUAL))) { - const cmValue lhs = this->GetVariableOrString(*args.current); - const cmValue rhs = this->GetVariableOrString(*args.nextnext); - const auto val = (*lhs).compare(*rhs); + cmValue const lhs = this->GetVariableOrString(*args.current); + cmValue const rhs = this->GetVariableOrString(*args.nextnext); + auto const val = (*lhs).compare(*rhs); // clang-format off const auto result = cmRt2CtSelector< std::less, std::less_equal, @@ -622,10 +622,10 @@ bool cmConditionEvaluator::HandleLevel2(cmArgumentList& newArgs, this->matchKeys(*args.next, keyVERSION_LESS, keyVERSION_LESS_EQUAL, keyVERSION_GREATER, keyVERSION_GREATER_EQUAL, keyVERSION_EQUAL))) { - const auto op = MATCH2CMPOP[matchNo - 1]; - const cmValue lhs = this->GetVariableOrString(*args.current); - const cmValue rhs = this->GetVariableOrString(*args.nextnext); - const auto result = cmSystemTools::VersionCompare(op, lhs, rhs); + auto const op = MATCH2CMPOP[matchNo - 1]; + cmValue const lhs = this->GetVariableOrString(*args.current); + cmValue const rhs = this->GetVariableOrString(*args.nextnext); + auto const result = cmSystemTools::VersionCompare(op, lhs, rhs); newArgs.ReduceTwoArgs(result, args); } @@ -654,7 +654,7 @@ bool cmConditionEvaluator::HandleLevel2(cmArgumentList& newArgs, cmValue lhs = this->GetVariableOrString(*args.current); cmValue rhs = this->GetVariableOrString(*args.nextnext); - const auto result = cmCMakePath{ *lhs } == cmCMakePath{ *rhs }; + auto const result = cmCMakePath{ *lhs } == cmCMakePath{ *rhs }; newArgs.ReduceTwoArgs(result, args); } @@ -681,7 +681,7 @@ bool cmConditionEvaluator::HandleLevel3(cmArgumentList& newArgs, std::string&, for (auto args = newArgs.make2ArgsIterator(); args.next != newArgs.end(); args.advance(newArgs)) { if (this->IsKeyword(keyNOT, *args.current)) { - const auto rhs = this->GetBooleanValue(*args.next); + auto const rhs = this->GetBooleanValue(*args.next); newArgs.ReduceOneArg(!rhs, args); } } @@ -699,8 +699,8 @@ bool cmConditionEvaluator::HandleLevel4(cmArgumentList& newArgs, std::string&, int matchNo; if ((matchNo = this->matchKeys(*args.next, keyAND, keyOR))) { - const auto lhs = this->GetBooleanValue(*args.current); - const auto rhs = this->GetBooleanValue(*args.nextnext); + auto const lhs = this->GetBooleanValue(*args.current); + auto const rhs = this->GetBooleanValue(*args.nextnext); // clang-format off const auto result = cmRt2CtSelector< diff --git a/Source/cmConditionEvaluator.h b/Source/cmConditionEvaluator.h index fe20635..20effee 100644 --- a/Source/cmConditionEvaluator.h +++ b/Source/cmConditionEvaluator.h @@ -25,30 +25,30 @@ public: // this is a shared function for both If and Else to determine if the // arguments were valid, and if so, was the response true. If there is // an error, the errorString will be set. - bool IsTrue(const std::vector& args, + bool IsTrue(std::vector const& args, std::string& errorString, MessageType& status); private: class cmArgumentList; cmValue GetDefinitionIfUnquoted( - const cmExpandedCommandArgument& argument) const; + cmExpandedCommandArgument const& argument) const; - cmValue GetVariableOrString(const cmExpandedCommandArgument& argument) const; + cmValue GetVariableOrString(cmExpandedCommandArgument const& argument) const; bool IsKeyword(cm::static_string_view keyword, - const cmExpandedCommandArgument& argument) const; + cmExpandedCommandArgument const& argument) const; bool GetBooleanValue(cmExpandedCommandArgument& arg) const; template - int matchKeysImpl(const cmExpandedCommandArgument&); + int matchKeysImpl(cmExpandedCommandArgument const&); template - int matchKeysImpl(const cmExpandedCommandArgument&, T, Keys...); + int matchKeysImpl(cmExpandedCommandArgument const&, T, Keys...); template - int matchKeys(const cmExpandedCommandArgument&, Keys...); + int matchKeys(cmExpandedCommandArgument const&, Keys...); bool HandleLevel0(cmArgumentList& newArgs, std::string& errorString, MessageType& status); diff --git a/Source/cmConfigureFileCommand.cxx b/Source/cmConfigureFileCommand.cxx index bf83b38..f021034 100644 --- a/Source/cmConfigureFileCommand.cxx +++ b/Source/cmConfigureFileCommand.cxx @@ -28,7 +28,7 @@ bool cmConfigureFileCommand(std::vector const& args, } std::string const& inFile = args[0]; - const std::string inputFile = cmSystemTools::CollapseFullPath( + std::string const inputFile = cmSystemTools::CollapseFullPath( inFile, status.GetMakefile().GetCurrentSourceDirectory()); // If the input location is a directory, error out. diff --git a/Source/cmConfigureLog.cxx b/Source/cmConfigureLog.cxx index a6658e2..edbf49c 100644 --- a/Source/cmConfigureLog.cxx +++ b/Source/cmConfigureLog.cxx @@ -28,7 +28,7 @@ cmConfigureLog::cmConfigureLog(std::string logDir, , LogVersions(std::move(logVersions)) { // Always emit events for the latest log version. - static const unsigned long LatestLogVersion = 1; + static unsigned long const LatestLogVersion = 1; if (!cm::contains(this->LogVersions, LatestLogVersion)) { this->LogVersions.emplace_back(LatestLogVersion); } @@ -196,7 +196,7 @@ void cmConfigureLog::WriteValue(cm::string_view key, void cmConfigureLog::WriteValue(cm::string_view key, std::map const& map) { - static const std::string rawKeyChars = // + static std::string const rawKeyChars = // "ABCDEFGHIJKLMNOPQRSTUVWXYZ" // "abcdefghijklmnopqrstuvwxyz" // "0123456789" // diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index fdebc4b..c79c6b1 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -36,7 +36,7 @@ #include "cmake.h" namespace { -constexpr const char* unique_binary_directory = "CMAKE_BINARY_DIR_USE_MKDTEMP"; +constexpr char const* unique_binary_directory = "CMAKE_BINARY_DIR_USE_MKDTEMP"; constexpr size_t lang_property_start = 0; constexpr size_t lang_property_size = 4; constexpr size_t pie_property_start = 4; @@ -135,14 +135,14 @@ ArgumentParser::Continue TryCompileCompileDefs(Arguments& args, } cmArgumentParser makeTryCompileParser( - const cmArgumentParser& base) + cmArgumentParser const& base) { return cmArgumentParser{ base }.Bind("OUTPUT_VARIABLE"_s, &Arguments::OutputVariable); } cmArgumentParser makeTryRunParser( - const cmArgumentParser& base) + cmArgumentParser const& base) { return cmArgumentParser{ base } .Bind("COMPILE_OUTPUT_VARIABLE"_s, &Arguments::CompileOutputVariable) @@ -254,8 +254,8 @@ ArgumentParser::Continue cmCoreTryCompile::Arguments::SetSourceType( } Arguments cmCoreTryCompile::ParseArgs( - const cmRange::const_iterator>& args, - const cmArgumentParser& parser, + cmRange::const_iterator> const& args, + cmArgumentParser const& parser, std::vector& unparsedArguments) { Arguments arguments{ this->Makefile }; @@ -263,7 +263,7 @@ Arguments cmCoreTryCompile::ParseArgs( if (!arguments.MaybeReportError(*(this->Makefile)) && !unparsedArguments.empty()) { std::string m = "Unknown arguments:"; - for (const auto& i : unparsedArguments) { + for (auto const& i : unparsedArguments) { m = cmStrCat(m, "\n \"", i, '"'); } this->Makefile->IssueMessage(MessageType::AUTHOR_WARNING, m); @@ -275,7 +275,7 @@ Arguments cmCoreTryCompile::ParseArgs( cmRange::const_iterator> args, bool isTryRun) { std::vector unparsedArguments; - const auto& second = *(++args.begin()); + auto const& second = *(++args.begin()); if (!isTryRun && second == "PROJECT") { // New PROJECT signature (try_compile only). @@ -534,8 +534,8 @@ cm::optional cmCoreTryCompile::TryCompileCode( if (arguments.SourceFromContent) { auto const k = arguments.SourceFromContent->size(); for (auto i = decltype(k){ 0 }; i < k; i += 2) { - const auto& name = (*arguments.SourceFromContent)[i + 0].first; - const auto& content = (*arguments.SourceFromContent)[i + 1].first; + auto const& name = (*arguments.SourceFromContent)[i + 0].first; + auto const& content = (*arguments.SourceFromContent)[i + 1].first; auto out = this->WriteSource(name, content, "SOURCE_FROM_CONTENT"); if (out.empty()) { return cm::nullopt; @@ -547,9 +547,9 @@ cm::optional cmCoreTryCompile::TryCompileCode( if (arguments.SourceFromVar) { auto const k = arguments.SourceFromVar->size(); for (auto i = decltype(k){ 0 }; i < k; i += 2) { - const auto& name = (*arguments.SourceFromVar)[i + 0].first; - const auto& var = (*arguments.SourceFromVar)[i + 1].first; - const auto& content = this->Makefile->GetDefinition(var); + auto const& name = (*arguments.SourceFromVar)[i + 0].first; + auto const& var = (*arguments.SourceFromVar)[i + 1].first; + auto const& content = this->Makefile->GetDefinition(var); auto out = this->WriteSource(name, content, "SOURCE_FROM_VAR"); if (out.empty()) { return cm::nullopt; @@ -561,11 +561,11 @@ cm::optional cmCoreTryCompile::TryCompileCode( if (arguments.SourceFromFile) { auto const k = arguments.SourceFromFile->size(); for (auto i = decltype(k){ 0 }; i < k; i += 2) { - const auto& dst = (*arguments.SourceFromFile)[i + 0].first; - const auto& src = (*arguments.SourceFromFile)[i + 1].first; + auto const& dst = (*arguments.SourceFromFile)[i + 0].first; + auto const& src = (*arguments.SourceFromFile)[i + 1].first; if (!cmSystemTools::GetFilenamePath(dst).empty()) { - const auto& msg = + auto const& msg = cmStrCat("SOURCE_FROM_FILE given invalid filename \"", dst, '"'); this->Makefile->IssueMessage(MessageType::FATAL_ERROR, msg); return cm::nullopt; @@ -574,7 +574,7 @@ cm::optional cmCoreTryCompile::TryCompileCode( auto dstPath = cmStrCat(this->BinaryDirectory, '/', dst); auto const result = cmSystemTools::CopyFileAlways(src, dstPath); if (!result.IsSuccess()) { - const auto& msg = cmStrCat("SOURCE_FROM_FILE failed to copy \"", src, + auto const& msg = cmStrCat("SOURCE_FROM_FILE failed to copy \"", src, "\": ", result.GetString()); this->Makefile->IssueMessage(MessageType::FATAL_ERROR, msg); return cm::nullopt; @@ -825,11 +825,11 @@ cm::optional cmCoreTryCompile::TryCompileCode( fname.c_str()); // Create all relevant alias targets if (arguments.LinkLibraries) { - const auto& aliasTargets = this->Makefile->GetAliasTargets(); + auto const& aliasTargets = this->Makefile->GetAliasTargets(); for (std::string const& i : *arguments.LinkLibraries) { auto alias = aliasTargets.find(i); if (alias != aliasTargets.end()) { - const auto& aliasTarget = + auto const& aliasTarget = this->Makefile->FindTargetToUse(alias->second); // Create equivalent library/executable alias if (aliasTarget->GetType() == cmStateEnums::EXECUTABLE) { @@ -1021,7 +1021,7 @@ cm::optional cmCoreTryCompile::TryCompileCode( if (!arguments.LinkOptions.empty()) { std::vector options; options.reserve(arguments.LinkOptions.size()); - for (const auto& option : arguments.LinkOptions) { + for (auto const& option : arguments.LinkOptions) { options.emplace_back(cmOutputConverter::EscapeForCMake(option)); } @@ -1204,7 +1204,7 @@ cm::optional cmCoreTryCompile::TryCompileCode( if (!this->SrcFileSignature && this->Makefile->GetState()->GetGlobalPropertyAsBool( "PROPAGATE_TOP_LEVEL_INCLUDES_TO_TRY_COMPILE")) { - const std::string var = "CMAKE_PROJECT_TOP_LEVEL_INCLUDES"; + std::string const var = "CMAKE_PROJECT_TOP_LEVEL_INCLUDES"; if (cmValue val = this->Makefile->GetDefinition(var)) { std::string flag = cmStrCat("-D", var, "=\'", *val, '\''); arguments.CMakeFlags.emplace_back(std::move(flag)); @@ -1338,7 +1338,7 @@ void cmCoreTryCompile::CleanupFiles(std::string const& binDir) dir.Load(binDir); std::set deletedFiles; for (unsigned long i = 0; i < dir.GetNumberOfFiles(); ++i) { - const char* fileName = dir.GetFile(i); + char const* fileName = dir.GetFile(i); if (strcmp(fileName, ".") != 0 && strcmp(fileName, "..") != 0 && // Do not delete NFS temporary files. !cmHasPrefix(fileName, ".nfs")) { @@ -1381,7 +1381,7 @@ void cmCoreTryCompile::CleanupFiles(std::string const& binDir) } } -void cmCoreTryCompile::FindOutputFile(const std::string& targetName) +void cmCoreTryCompile::FindOutputFile(std::string const& targetName) { this->FindErrorMessage.clear(); this->OutputFile.clear(); @@ -1426,7 +1426,7 @@ std::string cmCoreTryCompile::WriteSource(std::string const& filename, char const* command) const { if (!cmSystemTools::GetFilenamePath(filename).empty()) { - const auto& msg = + auto const& msg = cmStrCat(command, " given invalid filename \"", filename, '"'); this->Makefile->IssueMessage(MessageType::FATAL_ERROR, msg); return {}; @@ -1435,7 +1435,7 @@ std::string cmCoreTryCompile::WriteSource(std::string const& filename, auto filepath = cmStrCat(this->BinaryDirectory, '/', filename); cmsys::ofstream file{ filepath.c_str(), std::ios::out }; if (!file) { - const auto& msg = + auto const& msg = cmStrCat(command, " failed to open \"", filename, "\" for writing"); this->Makefile->IssueMessage(MessageType::FATAL_ERROR, msg); return {}; @@ -1443,7 +1443,7 @@ std::string cmCoreTryCompile::WriteSource(std::string const& filename, file << content; if (!file) { - const auto& msg = cmStrCat(command, " failed to write \"", filename, '"'); + auto const& msg = cmStrCat(command, " failed to write \"", filename, '"'); this->Makefile->IssueMessage(MessageType::FATAL_ERROR, msg); return {}; } diff --git a/Source/cmCoreTryCompile.h b/Source/cmCoreTryCompile.h index 6a26e88..265b71d 100644 --- a/Source/cmCoreTryCompile.h +++ b/Source/cmCoreTryCompile.h @@ -146,7 +146,7 @@ public: TryCompileCode. The result is stored in OutputFile. If nothing is found, the error message is stored in FindErrorMessage. */ - void FindOutputFile(const std::string& targetName); + void FindOutputFile(std::string const& targetName); static void WriteTryCompileEventFields( cmConfigureLog& log, cmTryCompileResult const& compileResult); @@ -162,7 +162,7 @@ private: char const* command) const; Arguments ParseArgs( - const cmRange::const_iterator>& args, - const cmArgumentParser& parser, + cmRange::const_iterator> const& args, + cmArgumentParser const& parser, std::vector& unparsedArguments); }; diff --git a/Source/cmCreateTestSourceList.cxx b/Source/cmCreateTestSourceList.cxx index 11e5f1b..29ff530 100644 --- a/Source/cmCreateTestSourceList.cxx +++ b/Source/cmCreateTestSourceList.cxx @@ -46,7 +46,7 @@ bool cmCreateTestSourceList(std::vector const& args, // Name of the source list - const char* sourceList = i->c_str(); + char const* sourceList = i->c_str(); ++i; // Name of the test driver diff --git a/Source/cmCryptoHash.cxx b/Source/cmCryptoHash.cxx index 1b5c3a1..58ea676 100644 --- a/Source/cmCryptoHash.cxx +++ b/Source/cmCryptoHash.cxx @@ -131,7 +131,7 @@ bool cmCryptoHash::IntFromHexDigit(char input, char& output) } std::string cmCryptoHash::ByteHashToString( - const std::vector& hash) + std::vector const& hash) { // Map from 4-bit index to hexadecimal representation. static char const hex[16] = { '0', '1', '2', '3', '4', '5', '6', '7', @@ -153,7 +153,7 @@ std::vector cmCryptoHash::ByteHashString(cm::string_view input) return this->Finalize(); } -std::vector cmCryptoHash::ByteHashFile(const std::string& file) +std::vector cmCryptoHash::ByteHashFile(std::string const& file) { cmsys::ifstream fin(file.c_str(), std::ios::in | std::ios::binary); if (fin) { @@ -192,7 +192,7 @@ std::string cmCryptoHash::HashString(cm::string_view input) return ByteHashToString(this->ByteHashString(input)); } -std::string cmCryptoHash::HashFile(const std::string& file) +std::string cmCryptoHash::HashFile(std::string const& file) { return ByteHashToString(this->ByteHashFile(file)); } diff --git a/Source/cmCryptoHash.h b/Source/cmCryptoHash.h index bb026a2..63aa1d3 100644 --- a/Source/cmCryptoHash.h +++ b/Source/cmCryptoHash.h @@ -52,7 +52,7 @@ public: static bool IntFromHexDigit(char input, char& output); /// @brief Converts a byte hash to a sequence of hex character pairs - static std::string ByteHashToString(const std::vector& hash); + static std::string ByteHashToString(std::vector const& hash); /// @brief Calculates a binary hash from string input data /// @return Binary hash vector @@ -62,7 +62,7 @@ public: /// @see ByteHashString() /// @return Non empty binary hash vector if the file was read successfully. /// An empty vector otherwise. - std::vector ByteHashFile(const std::string& file); + std::vector ByteHashFile(std::string const& file); /// @brief Calculates a hash string from string input data /// @return Sequence of hex characters pairs for each byte of the binary hash @@ -72,7 +72,7 @@ public: /// @see HashString() /// @return Non empty hash string if the file was read successfully. /// An empty string otherwise. - std::string HashFile(const std::string& file); + std::string HashFile(std::string const& file); /// @brief Returns the name of the hash type. /// @return The name of the hash type associated with this hash generator. diff --git a/Source/cmCurl.cxx b/Source/cmCurl.cxx index b9133ed..3e71251 100644 --- a/Source/cmCurl.cxx +++ b/Source/cmCurl.cxx @@ -111,7 +111,7 @@ cm::optional cmCurlPrintTLSVersion(int curl_tls_version) return s; } -std::string cmCurlSetCAInfo(::CURL* curl, const std::string& cafile) +std::string cmCurlSetCAInfo(::CURL* curl, std::string const& cafile) { std::string e; std::string env_ca; @@ -166,8 +166,8 @@ std::string cmCurlSetCAInfo(::CURL* curl, const std::string& cafile) return e; } -std::string cmCurlSetNETRCOption(::CURL* curl, const std::string& netrc_level, - const std::string& netrc_file) +std::string cmCurlSetNETRCOption(::CURL* curl, std::string const& netrc_level, + std::string const& netrc_file) { std::string e; CURL_NETRC_OPTION curl_netrc_level = CURL_NETRC_LAST; diff --git a/Source/cmCurl.h b/Source/cmCurl.h index 2088e3d..f07b271 100644 --- a/Source/cmCurl.h +++ b/Source/cmCurl.h @@ -14,9 +14,9 @@ void cmCurlInitOnce(); cm::optional cmCurlParseTLSVersion(cm::string_view tls_version); cm::optional cmCurlPrintTLSVersion(int curl_tls_version); -std::string cmCurlSetCAInfo(::CURL* curl, const std::string& cafile = {}); -std::string cmCurlSetNETRCOption(::CURL* curl, const std::string& netrc_level, - const std::string& netrc_file); +std::string cmCurlSetCAInfo(::CURL* curl, std::string const& cafile = {}); +std::string cmCurlSetNETRCOption(::CURL* curl, std::string const& netrc_level, + std::string const& netrc_file); std::string cmCurlFixFileURL(std::string url); ::CURL* cm_curl_easy_init(); diff --git a/Source/cmCustomCommand.cxx b/Source/cmCustomCommand.cxx index afb9517..460573a 100644 --- a/Source/cmCustomCommand.cxx +++ b/Source/cmCustomCommand.cxx @@ -9,7 +9,7 @@ #include "cmStateSnapshot.h" -const std::vector& cmCustomCommand::GetOutputs() const +std::vector const& cmCustomCommand::GetOutputs() const { return this->Outputs; } @@ -24,7 +24,7 @@ void cmCustomCommand::SetOutputs(std::string output) this->Outputs = { std::move(output) }; } -const std::vector& cmCustomCommand::GetByproducts() const +std::vector const& cmCustomCommand::GetByproducts() const { return this->Byproducts; } @@ -34,7 +34,7 @@ void cmCustomCommand::SetByproducts(std::vector byproducts) this->Byproducts = std::move(byproducts); } -const std::vector& cmCustomCommand::GetDepends() const +std::vector const& cmCustomCommand::GetDepends() const { return this->Depends; } @@ -48,7 +48,7 @@ void cmCustomCommand::SetDepends(std::vector depends) Depends = std::move(depends); } -const std::string& cmCustomCommand::GetMainDependency() const +std::string const& cmCustomCommand::GetMainDependency() const { assert(this->HasMainDependency_); return this->Depends[0]; @@ -67,7 +67,7 @@ void cmCustomCommand::SetMainDependency(std::string main_dependency) } } -const cmCustomCommandLines& cmCustomCommand::GetCommandLines() const +cmCustomCommandLines const& cmCustomCommand::GetCommandLines() const { return this->CommandLines; } @@ -77,24 +77,24 @@ void cmCustomCommand::SetCommandLines(cmCustomCommandLines commandLines) this->CommandLines = std::move(commandLines); } -const char* cmCustomCommand::GetComment() const +char const* cmCustomCommand::GetComment() const { - const char* no_comment = nullptr; + char const* no_comment = nullptr; return this->HaveComment ? this->Comment.c_str() : no_comment; } -void cmCustomCommand::SetComment(const char* comment) +void cmCustomCommand::SetComment(char const* comment) { this->Comment = comment ? comment : ""; this->HaveComment = (comment != nullptr); } -void cmCustomCommand::AppendCommands(const cmCustomCommandLines& commandLines) +void cmCustomCommand::AppendCommands(cmCustomCommandLines const& commandLines) { cm::append(this->CommandLines, commandLines); } -void cmCustomCommand::AppendDepends(const std::vector& depends) +void cmCustomCommand::AppendDepends(std::vector const& depends) { cm::append(this->Depends, depends); } @@ -154,12 +154,12 @@ void cmCustomCommand::SetUsesTerminal(bool b) this->UsesTerminal = b; } -void cmCustomCommand::SetRole(const std::string& role) +void cmCustomCommand::SetRole(std::string const& role) { this->Role = role; } -const std::string& cmCustomCommand::GetRole() const +std::string const& cmCustomCommand::GetRole() const { return this->Role; } @@ -184,22 +184,22 @@ void cmCustomCommand::SetDependsExplicitOnly(bool b) this->DependsExplicitOnly = b; } -const std::string& cmCustomCommand::GetDepfile() const +std::string const& cmCustomCommand::GetDepfile() const { return this->Depfile; } -void cmCustomCommand::SetDepfile(const std::string& depfile) +void cmCustomCommand::SetDepfile(std::string const& depfile) { this->Depfile = depfile; } -const std::string& cmCustomCommand::GetJobPool() const +std::string const& cmCustomCommand::GetJobPool() const { return this->JobPool; } -void cmCustomCommand::SetJobPool(const std::string& job_pool) +void cmCustomCommand::SetJobPool(std::string const& job_pool) { this->JobPool = job_pool; } @@ -222,19 +222,18 @@ void cmCustomCommand::SetJobserverAware(bool b) CM_FOR_EACH_CUSTOM_COMMAND_POLICY(DEFINE_CC_POLICY_ACCESSOR) #undef DEFINE_CC_POLICY_ACCESSOR -void cmCustomCommand::RecordPolicyValues(const cmStateSnapshot& snapshot) -{ +void cmCustomCommand::RecordPolicyValues(cmStateSnapshot const& snapshot){ #define SET_CC_POLICY(P) this->P##Status = snapshot.GetPolicy(cmPolicies::P); CM_FOR_EACH_CUSTOM_COMMAND_POLICY(SET_CC_POLICY) #undef SET_CC_POLICY } -const std::string& cmCustomCommand::GetTarget() const +std::string const& cmCustomCommand::GetTarget() const { return this->Target; } -void cmCustomCommand::SetTarget(const std::string& target) +void cmCustomCommand::SetTarget(std::string const& target) { this->Target = target; } diff --git a/Source/cmCustomCommand.h b/Source/cmCustomCommand.h index 9fc4dfb..91d55bd 100644 --- a/Source/cmCustomCommand.h +++ b/Source/cmCustomCommand.h @@ -28,20 +28,20 @@ class cmCustomCommand { public: /** Get the output file produced by the command. */ - const std::vector& GetOutputs() const; + std::vector const& GetOutputs() const; void SetOutputs(std::vector outputs); void SetOutputs(std::string output); /** Get the extra files produced by the command. */ - const std::vector& GetByproducts() const; + std::vector const& GetByproducts() const; void SetByproducts(std::vector byproducts); /** Get the vector that holds the list of dependencies. */ - const std::vector& GetDepends() const; + std::vector const& GetDepends() const; void SetDepends(std::vector depends); bool HasMainDependency() const { return this->HasMainDependency_; } - const std::string& GetMainDependency() const; + std::string const& GetMainDependency() const; void SetMainDependency(std::string main_dependency); /** Get the working directory. */ @@ -50,18 +50,18 @@ public: return this->WorkingDirectory; } - void SetWorkingDirectory(const char* workingDirectory) + void SetWorkingDirectory(char const* workingDirectory) { this->WorkingDirectory = (workingDirectory ? workingDirectory : ""); } /** Get the list of command lines. */ - const cmCustomCommandLines& GetCommandLines() const; + cmCustomCommandLines const& GetCommandLines() const; void SetCommandLines(cmCustomCommandLines commandLines); /** Get the comment string for the command. */ - const char* GetComment() const; - void SetComment(const char* comment); + char const* GetComment() const; + void SetComment(char const* comment); /** Get a value indicating if the command uses UTF-8 output pipes. */ bool GetStdPipesUTF8() const { return this->StdPipesUTF8; } @@ -71,10 +71,10 @@ public: } /** Append to the list of command lines. */ - void AppendCommands(const cmCustomCommandLines& commandLines); + void AppendCommands(cmCustomCommandLines const& commandLines); /** Append to the list of dependencies. */ - void AppendDepends(const std::vector& depends); + void AppendDepends(std::vector const& depends); /** Set/Get whether old-style escaping should be used. */ bool GetEscapeOldStyle() const; @@ -108,12 +108,12 @@ public: void SetDependsExplicitOnly(bool b); /** Set/Get the depfile (used by the Ninja generator) */ - const std::string& GetDepfile() const; - void SetDepfile(const std::string& depfile); + std::string const& GetDepfile() const; + void SetDepfile(std::string const& depfile); /** Set/Get the job_pool (used by the Ninja generator) */ - const std::string& GetJobPool() const; - void SetJobPool(const std::string& job_pool); + std::string const& GetJobPool() const; + void SetJobPool(std::string const& job_pool); /** Set/Get whether this custom command should be given access to the jobserver (if possible). */ @@ -126,15 +126,15 @@ public: #undef DECLARE_CC_POLICY_ACCESSOR /** Record policy values from state snapshot */ - void RecordPolicyValues(const cmStateSnapshot& snapshot); + void RecordPolicyValues(cmStateSnapshot const& snapshot); /** Set/Get the associated target */ - const std::string& GetTarget() const; - void SetTarget(const std::string& target); + std::string const& GetTarget() const; + void SetTarget(std::string const& target); /** Set/Get the custom command rolee */ - const std::string& GetRole() const; - void SetRole(const std::string& role); + std::string const& GetRole() const; + void SetRole(std::string const& role); /** Record if the custom command can be used for code generation. */ bool GetCodegen() const { return Codegen; } diff --git a/Source/cmCustomCommandGenerator.cxx b/Source/cmCustomCommandGenerator.cxx index 2dea338..d70ac39 100644 --- a/Source/cmCustomCommandGenerator.cxx +++ b/Source/cmCustomCommandGenerator.cxx @@ -150,7 +150,7 @@ std::string EvaluateDepfile(std::string const& path, return cge->Evaluate(lg, config); } -std::string EvaluateComment(const char* comment, +std::string EvaluateComment(char const* comment, cmGeneratorExpression const& ge, cmLocalGenerator* lg, std::string const& config) { @@ -162,7 +162,7 @@ std::string EvaluateComment(const char* comment, cmCustomCommandGenerator::cmCustomCommandGenerator( cmCustomCommand const& cc, std::string config, cmLocalGenerator* lg, bool transformDepfile, cm::optional crossConfig, - std::function + std::function computeInternalDepfile) : CC(&cc) , OutputConfig(crossConfig ? *crossConfig : config) @@ -181,7 +181,7 @@ cmCustomCommandGenerator::cmCustomCommandGenerator( bool const distinctConfigs = this->OutputConfig != this->CommandConfig; - const cmCustomCommandLines& cmdlines = this->CC->GetCommandLines(); + cmCustomCommandLines const& cmdlines = this->CC->GetCommandLines(); for (cmCustomCommandLine const& cmdline : cmdlines) { cmCustomCommandLine argv; // For the command itself, we default to the COMMAND_CONFIG. @@ -258,7 +258,7 @@ cmCustomCommandGenerator::cmCustomCommandGenerator( this->Depends = EvaluateDepends(cc.GetDepends(), ge, this->LG, this->OutputConfig, this->CommandConfig); - const std::string& workingdirectory = this->CC->GetWorkingDirectory(); + std::string const& workingdirectory = this->CC->GetWorkingDirectory(); if (!workingdirectory.empty()) { this->WorkingDirectory = EvaluateSplitConfigGenex( workingdirectory, ge, this->LG, true, this->OutputConfig, @@ -320,7 +320,7 @@ std::vector cmCustomCommandGenerator::GetCrossCompilingEmulator( return this->EmulatorsWithArguments[c]; } -const char* cmCustomCommandGenerator::GetArgv0Location(unsigned int c) const +char const* cmCustomCommandGenerator::GetArgv0Location(unsigned int c) const { // If the command is the plain name of an executable target, we replace it // with the path to the executable artifact in the command config. @@ -353,14 +353,14 @@ std::string cmCustomCommandGenerator::GetCommand(unsigned int c) const if (!emulator.empty()) { return emulator[0]; } - if (const char* location = this->GetArgv0Location(c)) { + if (char const* location = this->GetArgv0Location(c)) { return std::string(location); } return this->CommandLines[c][0]; } -static std::string escapeForShellOldStyle(const std::string& str) +static std::string escapeForShellOldStyle(std::string const& str) { std::string result; #if defined(_WIN32) && !defined(__CYGWIN__) @@ -373,7 +373,7 @@ static std::string escapeForShellOldStyle(const std::string& str) } return str; #else - for (const char* ch = str.c_str(); *ch != '\0'; ++ch) { + for (char const* ch = str.c_str(); *ch != '\0'; ++ch) { if (*ch == ' ') { result += '\\'; } @@ -406,7 +406,7 @@ void cmCustomCommandGenerator::AppendArguments(unsigned int c, cmCustomCommandLine const& commandLine = this->CommandLines[c]; for (unsigned int j = offset; j < commandLine.size(); ++j) { std::string arg; - if (const char* location = j == 0 ? this->GetArgv0Location(c) : nullptr) { + if (char const* location = j == 0 ? this->GetArgv0Location(c) : nullptr) { // GetCommand returned the emulator instead of the argv0 location, // so transform the latter now. arg = location; @@ -426,7 +426,7 @@ void cmCustomCommandGenerator::AppendArguments(unsigned int c, std::string cmCustomCommandGenerator::GetDepfile() const { - const auto& depfile = this->CC->GetDepfile(); + auto const& depfile = this->CC->GetDepfile(); if (depfile.empty()) { return ""; } @@ -450,7 +450,7 @@ std::string cmCustomCommandGenerator::GetFullDepfile() const } std::string cmCustomCommandGenerator::GetInternalDepfileName( - const std::string& /*config*/, const std::string& depfile) const + std::string const& /*config*/, std::string const& depfile) const { cmCryptoHash hash(cmCryptoHash::AlgoSHA256); std::string extension; @@ -482,7 +482,7 @@ std::string cmCustomCommandGenerator::GetInternalDepfile() const cm::optional cmCustomCommandGenerator::GetComment() const { - const char* comment = this->CC->GetComment(); + char const* comment = this->CC->GetComment(); if (!comment) { return cm::nullopt; } diff --git a/Source/cmCustomCommandGenerator.h b/Source/cmCustomCommandGenerator.h index 43bdd10..ec64423 100644 --- a/Source/cmCustomCommandGenerator.h +++ b/Source/cmCustomCommandGenerator.h @@ -20,8 +20,8 @@ class cmLocalGenerator; class cmCustomCommandGenerator { - std::string GetInternalDepfileName(const std::string&, - const std::string&) const; + std::string GetInternalDepfileName(std::string const&, + std::string const&) const; cmCustomCommand const* CC; std::string OutputConfig; @@ -37,22 +37,22 @@ class cmCustomCommandGenerator std::vector Depends; std::string WorkingDirectory; std::set>> Utilities; - std::function + std::function ComputeInternalDepfile; void FillEmulatorsWithArguments(); std::vector GetCrossCompilingEmulator(unsigned int c) const; - const char* GetArgv0Location(unsigned int c) const; + char const* GetArgv0Location(unsigned int c) const; public: cmCustomCommandGenerator( cmCustomCommand const& cc, std::string config, cmLocalGenerator* lg, bool transformDepfile = true, cm::optional crossConfig = {}, - std::function + std::function computeInternalDepfile = {}); - cmCustomCommandGenerator(const cmCustomCommandGenerator&) = delete; + cmCustomCommandGenerator(cmCustomCommandGenerator const&) = delete; cmCustomCommandGenerator(cmCustomCommandGenerator&&) = default; - cmCustomCommandGenerator& operator=(const cmCustomCommandGenerator&) = + cmCustomCommandGenerator& operator=(cmCustomCommandGenerator const&) = delete; cmCustomCommandGenerator& operator=(cmCustomCommandGenerator&&) = default; cmCustomCommand const& GetCC() const { return *(this->CC); } @@ -70,6 +70,6 @@ public: std::string GetFullDepfile() const; std::string GetInternalDepfile() const; - const std::string& GetOutputConfig() const { return this->OutputConfig; } - const std::string& GetCommandConfig() const { return this->CommandConfig; } + std::string const& GetOutputConfig() const { return this->OutputConfig; } + std::string const& GetCommandConfig() const { return this->CommandConfig; } }; diff --git a/Source/cmDebugTools.h b/Source/cmDebugTools.h index c3e05a6..a2fc610 100644 --- a/Source/cmDebugTools.h +++ b/Source/cmDebugTools.h @@ -13,7 +13,7 @@ namespace cm { namespace { template -T dbg_impl(const char* fname, int line, const char* expr, T value) +T dbg_impl(char const* fname, int line, char const* expr, T value) { if (!cmSystemTools::GetEnvVar("CMAKE_NO_DBG")) { std::cerr << fname << ':' << line << ": " << expr << " = " << value diff --git a/Source/cmDebuggerAdapter.cxx b/Source/cmDebuggerAdapter.cxx index c3587a1..e5171b6 100644 --- a/Source/cmDebuggerAdapter.cxx +++ b/Source/cmDebuggerAdapter.cxx @@ -128,7 +128,7 @@ cmDebuggerAdapter::cmDebuggerAdapter( // Handle errors reported by the Session. These errors include protocol // parsing errors and receiving messages with no handler. - Session->onError([this](const char* msg) { + Session->onError([this](char const* msg) { if (SessionLog) { dap::writef(SessionLog, "dap::Session error: %s\n", msg); } @@ -144,7 +144,7 @@ cmDebuggerAdapter::cmDebuggerAdapter( }); // https://microsoft.github.io/debug-adapter-protocol/specification#Requests_Initialize - Session->registerHandler([this](const dap::CMakeInitializeRequest& req) { + Session->registerHandler([this](dap::CMakeInitializeRequest const& req) { SupportsVariableType = req.supportsVariableType.value(false); dap::CMakeInitializeResponse response; response.supportsConfigurationDoneRequest = true; @@ -159,12 +159,12 @@ cmDebuggerAdapter::cmDebuggerAdapter( // https://microsoft.github.io/debug-adapter-protocol/specification#Events_Initialized Session->registerSentHandler( - [&](const dap::ResponseOrError&) { + [&](dap::ResponseOrError const&) { Session->send(dap::InitializedEvent()); }); // https://microsoft.github.io/debug-adapter-protocol/specification#Requests_Threads - Session->registerHandler([this](const dap::ThreadsRequest& req) { + Session->registerHandler([this](dap::ThreadsRequest const& req) { (void)req; std::unique_lock lock(Mutex); dap::ThreadsResponse response; @@ -182,7 +182,7 @@ cmDebuggerAdapter::cmDebuggerAdapter( }); // https://microsoft.github.io/debug-adapter-protocol/specification#Requests_StackTrace - Session->registerHandler([this](const dap::StackTraceRequest& request) + Session->registerHandler([this](dap::StackTraceRequest const& request) -> dap::ResponseOrError { std::unique_lock lock(Mutex); @@ -196,7 +196,7 @@ cmDebuggerAdapter::cmDebuggerAdapter( }); // https://microsoft.github.io/debug-adapter-protocol/specification#Requests_Scopes - Session->registerHandler([this](const dap::ScopesRequest& request) + Session->registerHandler([this](dap::ScopesRequest const& request) -> dap::ResponseOrError { std::unique_lock lock(Mutex); return DefaultThread->GetScopesResponse(request.frameId, @@ -204,27 +204,27 @@ cmDebuggerAdapter::cmDebuggerAdapter( }); // https://microsoft.github.io/debug-adapter-protocol/specification#Requests_Variables - Session->registerHandler([this](const dap::VariablesRequest& request) + Session->registerHandler([this](dap::VariablesRequest const& request) -> dap::ResponseOrError { return DefaultThread->GetVariablesResponse(request); }); // https://microsoft.github.io/debug-adapter-protocol/specification#Requests_Pause - Session->registerHandler([this](const dap::PauseRequest& req) { + Session->registerHandler([this](dap::PauseRequest const& req) { (void)req; PauseRequest.store(true); return dap::PauseResponse(); }); // https://microsoft.github.io/debug-adapter-protocol/specification#Requests_Continue - Session->registerHandler([this](const dap::ContinueRequest& req) { + Session->registerHandler([this](dap::ContinueRequest const& req) { (void)req; ContinueSem->Notify(); return dap::ContinueResponse(); }); // https://microsoft.github.io/debug-adapter-protocol/specification#Requests_Next - Session->registerHandler([this](const dap::NextRequest& req) { + Session->registerHandler([this](dap::NextRequest const& req) { (void)req; NextStepFrom.store(DefaultThread->GetStackFrameSize()); ContinueSem->Notify(); @@ -232,7 +232,7 @@ cmDebuggerAdapter::cmDebuggerAdapter( }); // https://microsoft.github.io/debug-adapter-protocol/specification#Requests_StepIn - Session->registerHandler([this](const dap::StepInRequest& req) { + Session->registerHandler([this](dap::StepInRequest const& req) { (void)req; // This would stop after stepped in, single line stepped or stepped out. StepInRequest.store(true); @@ -241,7 +241,7 @@ cmDebuggerAdapter::cmDebuggerAdapter( }); // https://microsoft.github.io/debug-adapter-protocol/specification#Requests_StepOut - Session->registerHandler([this](const dap::StepOutRequest& req) { + Session->registerHandler([this](dap::StepOutRequest const& req) { (void)req; StepOutDepth.store(DefaultThread->GetStackFrameSize() - 1); ContinueSem->Notify(); @@ -249,13 +249,13 @@ cmDebuggerAdapter::cmDebuggerAdapter( }); // https://microsoft.github.io/debug-adapter-protocol/specification#Requests_Launch - Session->registerHandler([](const dap::LaunchRequest& req) { + Session->registerHandler([](dap::LaunchRequest const& req) { (void)req; return dap::LaunchResponse(); }); // Handler for disconnect requests - Session->registerHandler([this](const dap::DisconnectRequest& request) { + Session->registerHandler([this](dap::DisconnectRequest const& request) { (void)request; BreakpointManager->ClearAll(); ExceptionManager->ClearAll(); @@ -266,7 +266,7 @@ cmDebuggerAdapter::cmDebuggerAdapter( return dap::DisconnectResponse(); }); - Session->registerHandler([this](const dap::EvaluateRequest& request) { + Session->registerHandler([this](dap::EvaluateRequest const& request) { dap::EvaluateResponse response; if (request.frameId.has_value()) { std::shared_ptr frame = @@ -286,7 +286,7 @@ cmDebuggerAdapter::cmDebuggerAdapter( // The ConfigurationDone request is made by the client once all configuration // requests have been made. // https://microsoft.github.io/debug-adapter-protocol/specification#Requests_ConfigurationDone - Session->registerHandler([this](const dap::ConfigurationDoneRequest& req) { + Session->registerHandler([this](dap::ConfigurationDoneRequest const& req) { (void)req; ConfigurationDoneEvent->Fire(); return dap::ConfigurationDoneResponse(); @@ -397,7 +397,7 @@ void cmDebuggerAdapter::OnBeginFunctionCall(cmMakefile* mf, dap::array hitBreakpoints; hitBreakpoints.resize(hits.size()); std::transform(hits.begin(), hits.end(), hitBreakpoints.begin(), - [&](const int64_t& id) { return dap::integer(id); }); + [&](int64_t const& id) { return dap::integer(id); }); stoppedEvent.reason = "breakpoint"; stoppedEvent.hitBreakpointIds = hitBreakpoints; } diff --git a/Source/cmDebuggerBreakpointManager.cxx b/Source/cmDebuggerBreakpointManager.cxx index db18c6e..bd932cc 100644 --- a/Source/cmDebuggerBreakpointManager.cxx +++ b/Source/cmDebuggerBreakpointManager.cxx @@ -22,7 +22,7 @@ cmDebuggerBreakpointManager::cmDebuggerBreakpointManager( : DapSession(dapSession) { // https://microsoft.github.io/debug-adapter-protocol/specification#Requests_SetBreakpoints - DapSession->registerHandler([&](const dap::SetBreakpointsRequest& request) { + DapSession->registerHandler([&](dap::SetBreakpointsRequest const& request) { return HandleSetBreakpointsRequest(request); }); } @@ -76,8 +76,8 @@ cmDebuggerBreakpointManager::HandleSetBreakpointsRequest( auto sourcePath = cmSystemTools::GetActualCaseForPath(request.source.path.value()); - const dap::array defaultValue{}; - const auto& breakpoints = request.breakpoints.value(defaultValue); + dap::array const defaultValue{}; + auto const& breakpoints = request.breakpoints.value(defaultValue); if (Breakpoints.find(sourcePath) != Breakpoints.end()) { Breakpoints[sourcePath].clear(); @@ -173,7 +173,7 @@ std::vector cmDebuggerBreakpointManager::GetBreakpoints( std::string const& sourcePath, int64_t line) { std::unique_lock lock(Mutex); - const auto& all = Breakpoints[sourcePath]; + auto const& all = Breakpoints[sourcePath]; std::vector breakpoints; if (all.empty()) { return breakpoints; @@ -182,7 +182,7 @@ std::vector cmDebuggerBreakpointManager::GetBreakpoints( auto it = all.begin(); while ((it = std::find_if( - it, all.end(), [&](const cmDebuggerSourceBreakpoint& breakpoint) { + it, all.end(), [&](cmDebuggerSourceBreakpoint const& breakpoint) { return (breakpoint.GetIsValid() && breakpoint.GetLine() == line); })) != all.end()) { breakpoints.emplace_back(it->GetId()); diff --git a/Source/cmDebuggerExceptionManager.cxx b/Source/cmDebuggerExceptionManager.cxx index 470e44c..9633add 100644 --- a/Source/cmDebuggerExceptionManager.cxx +++ b/Source/cmDebuggerExceptionManager.cxx @@ -20,12 +20,12 @@ cmDebuggerExceptionManager::cmDebuggerExceptionManager( { // https://microsoft.github.io/debug-adapter-protocol/specification#Requests_SetExceptionBreakpoints DapSession->registerHandler( - [&](const dap::SetExceptionBreakpointsRequest& request) { + [&](dap::SetExceptionBreakpointsRequest const& request) { return HandleSetExceptionBreakpointsRequest(request); }); // https://microsoft.github.io/debug-adapter-protocol/specification#Requests_ExceptionInfo - DapSession->registerHandler([&](const dap::ExceptionInfoRequest& request) { + DapSession->registerHandler([&](dap::ExceptionInfoRequest const& request) { (void)request; return HandleExceptionInfoRequest(); }); @@ -61,7 +61,7 @@ cmDebuggerExceptionManager::HandleSetExceptionBreakpointsRequest( std::unique_lock lock(Mutex); dap::SetExceptionBreakpointsResponse response; RaiseExceptions.clear(); - for (const auto& filter : request.filters) { + for (auto const& filter : request.filters) { RaiseExceptions[filter] = true; } diff --git a/Source/cmDebuggerThread.h b/Source/cmDebuggerThread.h index 81664b5..cf79514 100644 --- a/Source/cmDebuggerThread.h +++ b/Source/cmDebuggerThread.h @@ -46,7 +46,7 @@ class cmDebuggerThread public: cmDebuggerThread(int64_t id, std::string name); int64_t GetId() const { return this->Id; } - const std::string& GetName() const { return this->Name; } + std::string const& GetName() const { return this->Name; } void PushStackFrame(cmMakefile* mf, std::string const& sourcePath, cmListFileFunction const& lff); void PopStackFrame(); diff --git a/Source/cmDebuggerThreadManager.cxx b/Source/cmDebuggerThreadManager.cxx index 0f15b6b..030f098 100644 --- a/Source/cmDebuggerThreadManager.cxx +++ b/Source/cmDebuggerThreadManager.cxx @@ -32,10 +32,10 @@ void cmDebuggerThreadManager::EndThread( cm::optional cmDebuggerThreadManager::GetThreadStackTraceResponse( - const dap::StackTraceRequest& request) + dap::StackTraceRequest const& request) { auto it = find_if(Threads.begin(), Threads.end(), - [&](const std::shared_ptr& t) { + [&](std::shared_ptr const& t) { return t->GetId() == request.threadId; }); diff --git a/Source/cmDebuggerThreadManager.h b/Source/cmDebuggerThreadManager.h index 6d27a5c..606adea 100644 --- a/Source/cmDebuggerThreadManager.h +++ b/Source/cmDebuggerThreadManager.h @@ -33,7 +33,7 @@ public: std::shared_ptr StartThread(std::string const& name); void EndThread(std::shared_ptr const& thread); cm::optional GetThreadStackTraceResponse( - const dap::StackTraceRequest& request); + dap::StackTraceRequest const& request); }; } // namespace cmDebugger diff --git a/Source/cmDebuggerVariables.cxx b/Source/cmDebuggerVariables.cxx index 8e3c2be..fd655de 100644 --- a/Source/cmDebuggerVariables.cxx +++ b/Source/cmDebuggerVariables.cxx @@ -15,11 +15,11 @@ namespace cmDebugger { namespace { -const dap::VariablePresentationHint PrivatePropertyHint = { {}, +dap::VariablePresentationHint const PrivatePropertyHint = { {}, "property", {}, "private" }; -const dap::VariablePresentationHint PrivateDataHint = { {}, +dap::VariablePresentationHint const PrivateDataHint = { {}, "data", {}, "private" }; diff --git a/Source/cmDebuggerVariables.h b/Source/cmDebuggerVariables.h index 0c4a416..abf436f 100644 --- a/Source/cmDebuggerVariables.h +++ b/Source/cmDebuggerVariables.h @@ -43,7 +43,7 @@ struct cmDebuggerVariableEntry , Type("string") { } - cmDebuggerVariableEntry(std::string name, const char* value) + cmDebuggerVariableEntry(std::string name, char const* value) : Name(std::move(name)) , Value(value ? value : "") , Type("string") @@ -88,7 +88,7 @@ class cmDebuggerVariables friend class cmDebuggerVariablesManager; protected: - const bool SupportsVariableType; + bool const SupportsVariableType; std::shared_ptr VariablesManager; void EnumerateSubVariablesIfAny( dap::array& toBeReturned) const; diff --git a/Source/cmDebuggerVariablesHelper.cxx b/Source/cmDebuggerVariablesHelper.cxx index deaa3c2..c84cfde 100644 --- a/Source/cmDebuggerVariablesHelper.cxx +++ b/Source/cmDebuggerVariablesHelper.cxx @@ -622,7 +622,7 @@ std::shared_ptr cmDebuggerVariablesHelper::CreateIfAny( return ret; }); - if (const auto* ic = gen->GetInstallComponents()) { + if (auto const* ic = gen->GetInstallComponents()) { variables->AddSubVariables(CreateIfAny( variablesManager, "InstallComponents", supportsVariableType, *ic)); } diff --git a/Source/cmDefinePropertyCommand.cxx b/Source/cmDefinePropertyCommand.cxx index 31ee665..57ebae8 100644 --- a/Source/cmDefinePropertyCommand.cxx +++ b/Source/cmDefinePropertyCommand.cxx @@ -100,12 +100,12 @@ bool cmDefinePropertyCommand(std::vector const& args, } // Make sure the variable is not reserved. - static constexpr const char* reservedPrefixes[] = { + static constexpr char const* reservedPrefixes[] = { "CMAKE_", "_CMAKE_", }; if (std::any_of(std::begin(reservedPrefixes), std::end(reservedPrefixes), - [&initializeFromVariable](const char* prefix) { + [&initializeFromVariable](char const* prefix) { return cmHasPrefix(initializeFromVariable, prefix); })) { status.SetError(cmStrCat("variable name \"", initializeFromVariable, diff --git a/Source/cmDefinitions.cxx b/Source/cmDefinitions.cxx index 453c0d1..396d90d 100644 --- a/Source/cmDefinitions.cxx +++ b/Source/cmDefinitions.cxx @@ -10,7 +10,7 @@ cmDefinitions::Def cmDefinitions::NoDef; -cmDefinitions::Def const& cmDefinitions::GetInternal(const std::string& key, +cmDefinitions::Def const& cmDefinitions::GetInternal(std::string const& key, StackIter begin, StackIter end, bool raise) { @@ -33,20 +33,20 @@ cmDefinitions::Def const& cmDefinitions::GetInternal(const std::string& key, return begin->Map.emplace(key, def).first->second; } -cmValue cmDefinitions::Get(const std::string& key, StackIter begin, +cmValue cmDefinitions::Get(std::string const& key, StackIter begin, StackIter end) { Def const& def = cmDefinitions::GetInternal(key, begin, end, false); return def.Value ? cmValue(def.Value.str_if_stable()) : nullptr; } -void cmDefinitions::Raise(const std::string& key, StackIter begin, +void cmDefinitions::Raise(std::string const& key, StackIter begin, StackIter end) { cmDefinitions::GetInternal(key, begin, end, true); } -bool cmDefinitions::HasKey(const std::string& key, StackIter begin, +bool cmDefinitions::HasKey(std::string const& key, StackIter begin, StackIter end) { for (StackIter it = begin; it != end; ++it) { @@ -97,12 +97,12 @@ std::vector cmDefinitions::ClosureKeys(StackIter begin, return defined; } -void cmDefinitions::Set(const std::string& key, cm::string_view value) +void cmDefinitions::Set(std::string const& key, cm::string_view value) { this->Map[key] = Def(value); } -void cmDefinitions::Unset(const std::string& key) +void cmDefinitions::Unset(std::string const& key) { this->Map[key] = Def(); } diff --git a/Source/cmDefinitions.h b/Source/cmDefinitions.h index 11d8947..a5b2a73 100644 --- a/Source/cmDefinitions.h +++ b/Source/cmDefinitions.h @@ -28,11 +28,11 @@ class cmDefinitions public: // -- Static member functions - static cmValue Get(const std::string& key, StackIter begin, StackIter end); + static cmValue Get(std::string const& key, StackIter begin, StackIter end); - static void Raise(const std::string& key, StackIter begin, StackIter end); + static void Raise(std::string const& key, StackIter begin, StackIter end); - static bool HasKey(const std::string& key, StackIter begin, StackIter end); + static bool HasKey(std::string const& key, StackIter begin, StackIter end); static std::vector ClosureKeys(StackIter begin, StackIter end); @@ -41,10 +41,10 @@ public: // -- Member functions /** Set a value associated with a key. */ - void Set(const std::string& key, cm::string_view value); + void Set(std::string const& key, cm::string_view value); /** Unset a definition. */ - void Unset(const std::string& key); + void Unset(std::string const& key); private: /** String with existence boolean. */ @@ -62,6 +62,6 @@ private: std::unordered_map Map; - static Def const& GetInternal(const std::string& key, StackIter begin, + static Def const& GetInternal(std::string const& key, StackIter begin, StackIter end, bool raise); }; diff --git a/Source/cmDepends.cxx b/Source/cmDepends.cxx index 34f67d0..a8a12d7 100644 --- a/Source/cmDepends.cxx +++ b/Source/cmDepends.cxx @@ -61,8 +61,8 @@ bool cmDepends::Finalize(std::ostream& /*unused*/, std::ostream& /*unused*/) return true; } -bool cmDepends::Check(const std::string& makeFile, - const std::string& internalFile, +bool cmDepends::Check(std::string const& makeFile, + std::string const& internalFile, DependencyMap& validDeps) { // Check whether dependencies must be regenerated. @@ -78,7 +78,7 @@ bool cmDepends::Check(const std::string& makeFile, return okay; } -void cmDepends::Clear(const std::string& file) const +void cmDepends::Clear(std::string const& file) const { // Print verbose output. if (this->Verbose) { @@ -92,8 +92,8 @@ void cmDepends::Clear(const std::string& file) const "# This may be replaced when dependencies are built.\n"; } -bool cmDepends::WriteDependencies(const std::set& /*unused*/, - const std::string& /*unused*/, +bool cmDepends::WriteDependencies(std::set const& /*unused*/, + std::string const& /*unused*/, std::ostream& /*unused*/, std::ostream& /*unused*/) { @@ -102,7 +102,7 @@ bool cmDepends::WriteDependencies(const std::set& /*unused*/, } bool cmDepends::CheckDependencies(std::istream& internalDepends, - const std::string& internalDependsFileName, + std::string const& internalDependsFileName, DependencyMap& validDeps) { // Read internal depends file time @@ -227,7 +227,7 @@ bool cmDepends::CheckDependencies(std::istream& internalDepends, return okay; } -void cmDepends::SetIncludePathFromLanguage(const std::string& lang) +void cmDepends::SetIncludePathFromLanguage(std::string const& lang) { // Look for the new per "TARGET_" variant first: std::string includePathVar = diff --git a/Source/cmDepends.h b/Source/cmDepends.h index 76af4db..b748a54 100644 --- a/Source/cmDepends.h +++ b/Source/cmDepends.h @@ -43,10 +43,10 @@ public: } /** Set the specific language to be scanned. */ - void SetLanguage(const std::string& lang) { this->Language = lang; } + void SetLanguage(std::string const& lang) { this->Language = lang; } /** Set the target build directory. */ - void SetTargetDirectory(const std::string& dir) + void SetTargetDirectory(std::string const& dir) { this->TargetDirectory = dir; } @@ -65,11 +65,11 @@ public: they must be generated Clear has already been called to wipe out the old dependencies. Dependencies which are still valid will be stored in validDeps. */ - bool Check(const std::string& makeFile, const std::string& internalFile, + bool Check(std::string const& makeFile, std::string const& internalFile, DependencyMap& validDeps); /** Clear dependencies for the target file so they will be regenerated. */ - void Clear(const std::string& file) const; + void Clear(std::string const& file) const; /** Set the file comparison object */ void SetFileTimeCache(cmFileTimeCache* fc) { this->FileTimeCache = fc; } @@ -77,8 +77,8 @@ public: protected: // Write dependencies for the target file to the given stream. // Return true for success and false for failure. - virtual bool WriteDependencies(const std::set& sources, - const std::string& obj, + virtual bool WriteDependencies(std::set const& sources, + std::string const& obj, std::ostream& makeDepends, std::ostream& internalDepends); @@ -86,7 +86,7 @@ protected: // Return false if dependencies must be regenerated and true // otherwise. virtual bool CheckDependencies(std::istream& internalDepends, - const std::string& internalDependsFileName, + std::string const& internalDependsFileName, DependencyMap& validDeps); // Finalize the dependency information for the target. @@ -108,5 +108,5 @@ protected: // The include file search path. std::vector IncludePath; - void SetIncludePathFromLanguage(const std::string& lang); + void SetIncludePathFromLanguage(std::string const& lang); }; diff --git a/Source/cmDependsC.cxx b/Source/cmDependsC.cxx index a39bb37..6c1f5b7 100644 --- a/Source/cmDependsC.cxx +++ b/Source/cmDependsC.cxx @@ -26,8 +26,8 @@ cmDependsC::cmDependsC() = default; cmDependsC::cmDependsC(cmLocalUnixMakefileGenerator3* lg, - const std::string& targetDir, const std::string& lang, - const DependencyMap* validDeps) + std::string const& targetDir, std::string const& lang, + DependencyMap const* validDeps) : cmDepends(lg, targetDir) , ValidDeps(validDeps) { @@ -73,8 +73,8 @@ cmDependsC::~cmDependsC() this->WriteCacheFile(); } -bool cmDependsC::WriteDependencies(const std::set& sources, - const std::string& obj, +bool cmDependsC::WriteDependencies(std::set const& sources, + std::string const& obj, std::ostream& makeDepends, std::ostream& internalDepends) { @@ -215,7 +215,7 @@ bool cmDependsC::WriteDependencies(const std::set& sources, std::string obj_m = this->LocalGenerator->ConvertToMakefilePath(obj_i); internalDepends << obj_i << '\n'; if (!dependencies.empty()) { - const auto& lineContinue = static_cast( + auto const& lineContinue = static_cast( this->LocalGenerator->GetGlobalGenerator()) ->LineContinueDirective; bool supportLongLineDepend = static_cast( @@ -340,8 +340,8 @@ void cmDependsC::WriteCacheFile() const } } -void cmDependsC::Scan(std::istream& is, const std::string& directory, - const std::string& fullName) +void cmDependsC::Scan(std::istream& is, std::string const& directory, + std::string const& fullName) { cmIncludeLines& newCacheEntry = this->FileCache[fullName]; newCacheEntry.Used = true; @@ -406,7 +406,7 @@ void cmDependsC::SetupTransforms() // Construct the regular expression to match lines to be // transformed. std::string xform = "^([ \t]*[#%][ \t]*(include|import)[ \t]*)("; - const char* sep = ""; + char const* sep = ""; for (auto const& tr : this->TransformRules) { xform += sep; xform += tr.first; diff --git a/Source/cmDependsC.h b/Source/cmDependsC.h index c79da1a..0f30a11 100644 --- a/Source/cmDependsC.h +++ b/Source/cmDependsC.h @@ -26,8 +26,8 @@ public: /** Checking instances need to know the build directory name and the relative path from the build directory to the target file. */ cmDependsC(); - cmDependsC(cmLocalUnixMakefileGenerator3* lg, const std::string& targetDir, - const std::string& lang, const DependencyMap* validDeps); + cmDependsC(cmLocalUnixMakefileGenerator3* lg, std::string const& targetDir, + std::string const& lang, DependencyMap const* validDeps); /** Virtual destructor to cleanup subclasses properly. */ ~cmDependsC() override; @@ -37,13 +37,13 @@ public: protected: // Implement writing/checking methods required by superclass. - bool WriteDependencies(const std::set& sources, - const std::string& obj, std::ostream& makeDepends, + bool WriteDependencies(std::set const& sources, + std::string const& obj, std::ostream& makeDepends, std::ostream& internalDepends) override; // Method to scan a single file. - void Scan(std::istream& is, const std::string& directory, - const std::string& fullName); + void Scan(std::istream& is, std::string const& directory, + std::string const& fullName); // Regular expression to identify C preprocessor include directives. cmsys::RegularExpression IncludeRegexLine; @@ -80,7 +80,7 @@ public: }; protected: - const DependencyMap* ValidDeps = nullptr; + DependencyMap const* ValidDeps = nullptr; std::set Encountered; std::queue Unscanned; diff --git a/Source/cmDependsCompiler.cxx b/Source/cmDependsCompiler.cxx index 408f19f..9a0a02b 100644 --- a/Source/cmDependsCompiler.cxx +++ b/Source/cmDependsCompiler.cxx @@ -25,9 +25,9 @@ #include "cmSystemTools.h" bool cmDependsCompiler::CheckDependencies( - const std::string& internalDepFile, const std::vector& depFiles, + std::string const& internalDepFile, std::vector const& depFiles, cmDepends::DependencyMap& dependencies, - const std::function& isValidPath) + std::function const& isValidPath) { bool status = true; bool forceReadDeps = true; @@ -74,10 +74,10 @@ bool cmDependsCompiler::CheckDependencies( // dependencies files cmFileTime depFileTime; for (auto dep = depFiles.begin(); dep != depFiles.end(); dep++) { - const auto& source = *dep++; - const auto& target = *dep++; - const auto& format = *dep++; - const auto& depFile = *dep; + auto const& source = *dep++; + auto const& target = *dep++; + auto const& format = *dep++; + auto const& depFile = *dep; if (!cmSystemTools::FileExists(depFile)) { continue; @@ -185,11 +185,11 @@ bool cmDependsCompiler::CheckDependencies( } void cmDependsCompiler::WriteDependencies( - const cmDepends::DependencyMap& dependencies, std::ostream& makeDepends, + cmDepends::DependencyMap const& dependencies, std::ostream& makeDepends, std::ostream& internalDepends) { // dependencies file consumed by make tool - const auto& lineContinue = static_cast( + auto const& lineContinue = static_cast( this->LocalGenerator->GetGlobalGenerator()) ->LineContinueDirective; bool supportLongLineDepend = static_cast( @@ -204,7 +204,7 @@ void cmDependsCompiler::WriteDependencies( this->LocalGenerator->MaybeRelativeToTopBinDir(node.first)); auto& deps = node.second; std::transform(deps.cbegin(), deps.cend(), deps.begin(), - [this](const std::string& dep) { + [this](std::string const& dep) { return this->LocalGenerator->ConvertToMakefilePath( this->LocalGenerator->MaybeRelativeToTopBinDir(dep)); }); @@ -213,7 +213,7 @@ void cmDependsCompiler::WriteDependencies( if (supportLongLineDepend) { makeDepends << target << ": "; } - for (const auto& dep : deps) { + for (auto const& dep : deps) { if (supportLongLineDepend) { if (first_dep) { first_dep = false; @@ -231,14 +231,14 @@ void cmDependsCompiler::WriteDependencies( } // add phony targets - for (const auto& target : phonyTargets) { + for (auto const& target : phonyTargets) { makeDepends << std::endl << target << ':' << std::endl; } // internal dependencies file - for (const auto& node : dependencies) { + for (auto const& node : dependencies) { internalDepends << node.first << std::endl; - for (const auto& dep : node.second) { + for (auto const& dep : node.second) { internalDepends << ' ' << dep << std::endl; } internalDepends << std::endl; @@ -246,7 +246,7 @@ void cmDependsCompiler::WriteDependencies( } void cmDependsCompiler::ClearDependencies( - const std::vector& depFiles) + std::vector const& depFiles) { for (auto dep = depFiles.begin(); dep != depFiles.end(); dep++) { dep += 3; diff --git a/Source/cmDependsCompiler.h b/Source/cmDependsCompiler.h index 838156d..f3893fe 100644 --- a/Source/cmDependsCompiler.h +++ b/Source/cmDependsCompiler.h @@ -41,18 +41,18 @@ public: dependencies didn't changed and false if not. Up-to-date Dependencies will be stored in deps. */ bool CheckDependencies( - const std::string& internalDepFile, - const std::vector& depFiles, + std::string const& internalDepFile, + std::vector const& depFiles, cmDepends::DependencyMap& dependencies, - const std::function& isValidPath); + std::function const& isValidPath); /** Write dependencies for the target file. */ - void WriteDependencies(const cmDepends::DependencyMap& dependencies, + void WriteDependencies(cmDepends::DependencyMap const& dependencies, std::ostream& makeDepends, std::ostream& internalDepends); /** Clear dependencies for the target so they will be regenerated. */ - void ClearDependencies(const std::vector& depFiles); + void ClearDependencies(std::vector const& depFiles); private: bool Verbose = false; diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx index 8b070ad..553d029 100644 --- a/Source/cmDependsFortran.cxx +++ b/Source/cmDependsFortran.cxx @@ -56,8 +56,8 @@ public: using ObjectInfoMap = std::map; ObjectInfoMap ObjectInfo; - cmFortranSourceInfo& CreateObjectInfo(const std::string& obj, - const std::string& src) + cmFortranSourceInfo& CreateObjectInfo(std::string const& obj, + std::string const& src) { auto i = this->ObjectInfo.find(obj); if (i == this->ObjectInfo.end()) { @@ -100,8 +100,8 @@ cmDependsFortran::cmDependsFortran(cmLocalUnixMakefileGenerator3* lg) cmDependsFortran::~cmDependsFortran() = default; -bool cmDependsFortran::WriteDependencies(const std::set& sources, - const std::string& obj, +bool cmDependsFortran::WriteDependencies(std::set const& sources, + std::string const& obj, std::ostream& /*makeDepends*/, std::ostream& /*internalDepends*/) { @@ -156,7 +156,7 @@ bool cmDependsFortran::Finalize(std::ostream& makeDepends, } // Get the directory in which stamp files will be stored. - const std::string& stamp_dir = this->TargetDirectory; + std::string const& stamp_dir = this->TargetDirectory; // Get the directory in which module files will be created. cmMakefile* mf = this->LocalGenerator->GetMakefile(); @@ -281,7 +281,7 @@ void cmDependsFortran::MatchLocalModules() } void cmDependsFortran::MatchRemoteModules(std::istream& fin, - const std::string& stampDir) + std::string const& stampDir) { std::string line; bool doing_provides = false; @@ -311,8 +311,8 @@ void cmDependsFortran::MatchRemoteModules(std::istream& fin, } } -void cmDependsFortran::ConsiderModule(const std::string& name, - const std::string& stampDir) +void cmDependsFortran::ConsiderModule(std::string const& name, + std::string const& stampDir) { // Locate each required module. auto required = this->Internal->TargetRequires.find(name); @@ -340,7 +340,7 @@ bool cmDependsFortran::WriteDependenciesReal(std::string const& obj, std::string obj_m = cmSystemTools::ConvertToOutputPath(obj_i); internalDepends << obj_i << "\n " << src << '\n'; if (!info.Includes.empty()) { - const auto& lineContinue = static_cast( + auto const& lineContinue = static_cast( this->LocalGenerator->GetGlobalGenerator()) ->LineContinueDirective; bool supportLongLineDepend = static_cast( @@ -482,7 +482,7 @@ bool cmDependsFortran::FindModule(std::string const& name, std::string& module) return false; } -bool cmDependsFortran::CopyModule(const std::vector& args) +bool cmDependsFortran::CopyModule(std::vector const& args) { // Implements // @@ -543,7 +543,7 @@ bool cmDependsFortran::CopyModule(const std::vector& args) // Helper function to look for a short sequence in a stream. If this // is later used for longer sequences it should be re-written using an // efficient string search algorithm such as Boyer-Moore. -static bool cmFortranStreamContainsSequence(std::istream& ifs, const char* seq, +static bool cmFortranStreamContainsSequence(std::istream& ifs, char const* seq, int len) { assert(len > 0); @@ -592,9 +592,9 @@ static bool cmFortranStreamsDiffer(std::istream& ifs1, std::istream& ifs2) return true; } -bool cmDependsFortran::ModulesDiffer(const std::string& modFile, - const std::string& stampFile, - const std::string& compilerId) +bool cmDependsFortran::ModulesDiffer(std::string const& modFile, + std::string const& stampFile, + std::string const& compilerId) { /* gnu >= 4.9: @@ -661,8 +661,8 @@ bool cmDependsFortran::ModulesDiffer(const std::string& modFile, bool okay = !finModFile.read(reinterpret_cast(hdr), 2).fail(); finModFile.seekg(0); if (!okay || hdr[0] != 0x1f || hdr[1] != 0x8b) { - const char seq[1] = { '\n' }; - const int seqlen = 1; + char const seq[1] = { '\n' }; + int const seqlen = 1; if (!cmFortranStreamContainsSequence(finModFile, seq, seqlen)) { // The module is of unexpected format. Assume it is different. @@ -677,8 +677,8 @@ bool cmDependsFortran::ModulesDiffer(const std::string& modFile, } } } else if (compilerId == "Intel" || compilerId == "IntelLLVM") { - const char seq[2] = { '\n', '\0' }; - const int seqlen = 2; + char const seq[2] = { '\n', '\0' }; + int const seqlen = 2; // Skip the leading byte which appears to be a version number. // We do not need to check for an error because the sequence search diff --git a/Source/cmDependsFortran.h b/Source/cmDependsFortran.h index 763f7bb..c4397f2 100644 --- a/Source/cmDependsFortran.h +++ b/Source/cmDependsFortran.h @@ -41,13 +41,13 @@ public: /** Callback from build system after a .mod file has been generated by a Fortran90 compiler to copy the .mod file to the corresponding stamp file. */ - static bool CopyModule(const std::vector& args); + static bool CopyModule(std::vector const& args); /** Determine if a mod file and the corresponding mod.stamp file are representing different module information. */ - static bool ModulesDiffer(const std::string& modFile, - const std::string& stampFile, - const std::string& compilerId); + static bool ModulesDiffer(std::string const& modFile, + std::string const& stampFile, + std::string const& compilerId); protected: // Finalize the dependency information for the target. @@ -57,13 +57,13 @@ protected: // Find all the modules required by the target. bool LocateModules(); void MatchLocalModules(); - void MatchRemoteModules(std::istream& fin, const std::string& stampDir); - void ConsiderModule(const std::string& name, const std::string& stampDir); + void MatchRemoteModules(std::istream& fin, std::string const& stampDir); + void ConsiderModule(std::string const& name, std::string const& stampDir); bool FindModule(std::string const& name, std::string& module); // Implement writing/checking methods required by superclass. - bool WriteDependencies(const std::set& sources, - const std::string& file, std::ostream& makeDepends, + bool WriteDependencies(std::set const& sources, + std::string const& file, std::ostream& makeDepends, std::ostream& internalDepends) override; // Actually write the dependencies to the streams. diff --git a/Source/cmDependsJava.cxx b/Source/cmDependsJava.cxx index b17b2ba..454ba9f 100644 --- a/Source/cmDependsJava.cxx +++ b/Source/cmDependsJava.cxx @@ -8,8 +8,8 @@ cmDependsJava::cmDependsJava() = default; cmDependsJava::~cmDependsJava() = default; -bool cmDependsJava::WriteDependencies(const std::set& sources, - const std::string& /*obj*/, +bool cmDependsJava::WriteDependencies(std::set const& sources, + std::string const& /*obj*/, std::ostream& /*makeDepends*/, std::ostream& /*internalDepends*/) { @@ -24,7 +24,7 @@ bool cmDependsJava::WriteDependencies(const std::set& sources, bool cmDependsJava::CheckDependencies( std::istream& /*internalDepends*/, - const std::string& /*internalDependsFileName*/, DependencyMap& /*validDeps*/) + std::string const& /*internalDependsFileName*/, DependencyMap& /*validDeps*/) { return true; } diff --git a/Source/cmDependsJava.h b/Source/cmDependsJava.h index 1db7ce1..0ecf832 100644 --- a/Source/cmDependsJava.h +++ b/Source/cmDependsJava.h @@ -28,10 +28,10 @@ public: protected: // Implement writing/checking methods required by superclass. - bool WriteDependencies(const std::set& sources, - const std::string& file, std::ostream& makeDepends, + bool WriteDependencies(std::set const& sources, + std::string const& file, std::ostream& makeDepends, std::ostream& internalDepends) override; bool CheckDependencies(std::istream& internalDepends, - const std::string& internalDependsFileName, + std::string const& internalDependsFileName, DependencyMap& validDeps) override; }; diff --git a/Source/cmDependsJavaParserHelper.cxx b/Source/cmDependsJavaParserHelper.cxx index e2718e4..b729bbb 100644 --- a/Source/cmDependsJavaParserHelper.cxx +++ b/Source/cmDependsJavaParserHelper.cxx @@ -36,7 +36,7 @@ cmDependsJavaParserHelper::~cmDependsJavaParserHelper() } void cmDependsJavaParserHelper::CurrentClass::AddFileNamesForPrinting( - std::vector* files, const char* prefix, const char* sep) const + std::vector* files, char const* prefix, char const* sep) const { std::string rname; if (prefix) { @@ -62,7 +62,7 @@ void cmDependsJavaParserHelper::DeallocateParserType(char** pt) this->UnionsAvailable--; } -void cmDependsJavaParserHelper::AddClassFound(const char* sclass) +void cmDependsJavaParserHelper::AddClassFound(char const* sclass) { if (!sclass) { return; @@ -75,7 +75,7 @@ void cmDependsJavaParserHelper::AddClassFound(const char* sclass) this->ClassesFound.emplace_back(sclass); } -void cmDependsJavaParserHelper::AddPackagesImport(const char* sclass) +void cmDependsJavaParserHelper::AddPackagesImport(char const* sclass) { for (std::string const& pi : this->PackagesImport) { if (pi == sclass) { @@ -85,7 +85,7 @@ void cmDependsJavaParserHelper::AddPackagesImport(const char* sclass) this->PackagesImport.emplace_back(sclass); } -void cmDependsJavaParserHelper::SafePrintMissing(const char* str, int line, +void cmDependsJavaParserHelper::SafePrintMissing(char const* str, int line, int cnt) { if (str) { @@ -103,15 +103,15 @@ void cmDependsJavaParserHelper::SafePrintMissing(const char* str, int line, std::cout << "- " << strlen(str) << std::endl; } } -void cmDependsJavaParserHelper::Print(const char* place, const char* str) const +void cmDependsJavaParserHelper::Print(char const* place, char const* str) const { if (this->Verbose) { std::cout << "[" << place << "=" << str << "]" << std::endl; } } -void cmDependsJavaParserHelper::CombineUnions(char** out, const char* in1, - char** in2, const char* sep) +void cmDependsJavaParserHelper::CombineUnions(char** out, char const* in1, + char** in2, char const* sep) { size_t len = 1; if (in1) { @@ -160,7 +160,7 @@ void cmDependsJavaParserHelper::PrepareElement( } void cmDependsJavaParserHelper::AllocateParserType( - cmDependsJavaParserHelper::ParserType* pt, const char* str, int len) + cmDependsJavaParserHelper::ParserType* pt, char const* str, int len) { pt->str = nullptr; if (len == 0) { @@ -177,7 +177,7 @@ void cmDependsJavaParserHelper::AllocateParserType( this->Allocates.push_back(std::move(up)); } -void cmDependsJavaParserHelper::StartClass(const char* cls) +void cmDependsJavaParserHelper::StartClass(char const* cls) { CurrentClass cl; cl.Name = cls; @@ -224,7 +224,7 @@ std::vector cmDependsJavaParserHelper::GetFilesProduced() return files; } -int cmDependsJavaParserHelper::ParseString(const char* str, int verb) +int cmDependsJavaParserHelper::ParseString(char const* str, int verb) { if (!str) { return 0; @@ -295,7 +295,7 @@ int cmDependsJavaParserHelper::LexInput(char* buf, int maxlen) buf[0] = '\n'; return 0; } -void cmDependsJavaParserHelper::Error(const char* str) +void cmDependsJavaParserHelper::Error(char const* str) { unsigned long pos = static_cast(this->InputBufferPos); fprintf(stderr, "JPError: %s (%lu / Line: %d)\n", str, pos, @@ -306,8 +306,8 @@ void cmDependsJavaParserHelper::Error(const char* str) << "]" << std::endl; } -void cmDependsJavaParserHelper::UpdateCombine(const char* str1, - const char* str2) +void cmDependsJavaParserHelper::UpdateCombine(char const* str1, + char const* str2) { if (this->CurrentCombine.empty() && str1) { this->CurrentCombine = str1; @@ -316,7 +316,7 @@ void cmDependsJavaParserHelper::UpdateCombine(const char* str1, this->CurrentCombine += str2; } -int cmDependsJavaParserHelper::ParseFile(const char* file) +int cmDependsJavaParserHelper::ParseFile(char const* file) { if (!cmSystemTools::FileExists(file)) { return 0; diff --git a/Source/cmDependsJavaParserHelper.h b/Source/cmDependsJavaParserHelper.h index 4057bb7..b5f19f7 100644 --- a/Source/cmDependsJavaParserHelper.h +++ b/Source/cmDependsJavaParserHelper.h @@ -24,33 +24,33 @@ public: cmDependsJavaParserHelper(); ~cmDependsJavaParserHelper(); - cmDependsJavaParserHelper(const cmDependsJavaParserHelper&) = delete; - cmDependsJavaParserHelper& operator=(const cmDependsJavaParserHelper&) = + cmDependsJavaParserHelper(cmDependsJavaParserHelper const&) = delete; + cmDependsJavaParserHelper& operator=(cmDependsJavaParserHelper const&) = delete; - int ParseString(const char* str, int verb); - int ParseFile(const char* file); + int ParseString(char const* str, int verb); + int ParseFile(char const* file); // For the lexer: void AllocateParserType(cmDependsJavaParserHelper::ParserType* pt, - const char* str, int len = 0); + char const* str, int len = 0); int LexInput(char* buf, int maxlen); - void Error(const char* str); + void Error(char const* str); // For yacc - void AddClassFound(const char* sclass); + void AddClassFound(char const* sclass); void PrepareElement(ParserType* me); void DeallocateParserType(char** pt); void CheckEmpty(int line, int cnt, ParserType* pt); - void StartClass(const char* cls); + void StartClass(char const* cls); void EndClass(); - void AddPackagesImport(const char* sclass); - void SetCurrentPackage(const char* pkg) { this->CurrentPackage = pkg; } - const char* GetCurrentPackage() { return this->CurrentPackage.c_str(); } - void SetCurrentCombine(const char* cmb) { this->CurrentCombine = cmb; } - const char* GetCurrentCombine() { return this->CurrentCombine.c_str(); } - void UpdateCombine(const char* str1, const char* str2); + void AddPackagesImport(char const* sclass); + void SetCurrentPackage(char const* pkg) { this->CurrentPackage = pkg; } + char const* GetCurrentPackage() { return this->CurrentPackage.c_str(); } + void SetCurrentCombine(char const* cmb) { this->CurrentCombine = cmb; } + char const* GetCurrentCombine() { return this->CurrentCombine.c_str(); } + void UpdateCombine(char const* str1, char const* str2); std::vector& GetClassesFound() { return this->ClassesFound; } @@ -63,7 +63,7 @@ private: std::string Name; std::vector NestedClasses; void AddFileNamesForPrinting(std::vector* files, - const char* prefix, const char* sep) const; + char const* prefix, char const* sep) const; }; std::string CurrentPackage; std::string::size_type InputBufferPos; @@ -85,9 +85,9 @@ private: void PrintClasses(); - void Print(const char* place, const char* str) const; - void CombineUnions(char** out, const char* in1, char** in2, const char* sep); - void SafePrintMissing(const char* str, int line, int cnt); + void Print(char const* place, char const* str) const; + void CombineUnions(char** out, char const* in1, char** in2, char const* sep); + void SafePrintMissing(char const* str, int line, int cnt); void CleanupParser(); }; diff --git a/Source/cmDocumentation.cxx b/Source/cmDocumentation.cxx index db2a606..0e10dad 100644 --- a/Source/cmDocumentation.cxx +++ b/Source/cmDocumentation.cxx @@ -19,7 +19,7 @@ #include "cmVersion.h" namespace { -const cmDocumentationEntry cmDocumentationStandardOptions[21] = { +cmDocumentationEntry const cmDocumentationStandardOptions[21] = { { "-h,-H,--help,-help,-usage,/?", "Print usage information and exit." }, { "--version,-version,/V []", "Print version number and exit." }, { "--help []", "Print help for one keyword and exit." }, @@ -49,18 +49,18 @@ const cmDocumentationEntry cmDocumentationStandardOptions[21] = { { "--help-variables []", "Print cmake-variables manual and exit." } }; -const cmDocumentationEntry cmDocumentationCPackGeneratorsHeader = { +cmDocumentationEntry const cmDocumentationCPackGeneratorsHeader = { {}, "The following generators are available on this platform:" }; -const cmDocumentationEntry cmDocumentationCMakeGeneratorsHeader = { +cmDocumentationEntry const cmDocumentationCMakeGeneratorsHeader = { {}, "The following generators are available on this platform (* marks " "default):" }; -bool isOption(const char* arg) +bool isOption(char const* arg) { return ((arg[0] == '-') || (strcmp(arg, "/V") == 0) || (strcmp(arg, "/?") == 0)); @@ -183,7 +183,7 @@ void cmDocumentation::WarnFormFromFilename( std::string cmDocumentation::GeneralizeKeyword(std::string cname) { - std::map> conversions; + std::map const> conversions; std::vector languages = { "C", "CXX", "CSharp", "CUDA", "OBJC", "OBJCXX", "Fortran", "HIP", "ISPC", "Swift", @@ -233,8 +233,8 @@ void cmDocumentation::addCPackStandardDocSections() this->AllSections.emplace("Generators", std::move(sec)); } -bool cmDocumentation::CheckOptions(int argc, const char* const* argv, - const char* exitOpt) +bool cmDocumentation::CheckOptions(int argc, char const* const* argv, + char const* exitOpt) { // Providing zero arguments gives usage information. if (argc == 1) { @@ -244,7 +244,7 @@ bool cmDocumentation::CheckOptions(int argc, const char* const* argv, return true; } - auto get_opt_argument = [=](const int nextIdx, std::string& target) -> bool { + auto get_opt_argument = [=](int const nextIdx, std::string& target) -> bool { if ((nextIdx < argc) && !isOption(argv[nextIdx])) { target = argv[nextIdx]; return true; @@ -389,24 +389,24 @@ bool cmDocumentation::CheckOptions(int argc, const char* const* argv, return result; } -void cmDocumentation::SetName(const std::string& name) +void cmDocumentation::SetName(std::string const& name) { this->NameString = name; } -void cmDocumentation::SetSection(const char* name, +void cmDocumentation::SetSection(char const* name, cmDocumentationSection section) { this->SectionAtName(name) = std::move(section); } -cmDocumentationSection& cmDocumentation::SectionAtName(const char* name) +cmDocumentationSection& cmDocumentation::SectionAtName(char const* name) { return this->AllSections.emplace(name, cmDocumentationSection{ name }) .first->second; } -void cmDocumentation::AppendSection(const char* name, +void cmDocumentation::AppendSection(char const* name, cmDocumentationEntry& docs) { @@ -415,7 +415,7 @@ void cmDocumentation::AppendSection(const char* name, this->AppendSection(name, docsVec); } -void cmDocumentation::PrependSection(const char* name, +void cmDocumentation::PrependSection(char const* name, cmDocumentationEntry& docs) { @@ -619,7 +619,7 @@ bool cmDocumentation::PrintHelpListPolicies(std::ostream& os) bool cmDocumentation::PrintHelpListGenerators(std::ostream& os) { - const auto si = this->AllSections.find("Generators"); + auto const si = this->AllSections.find("Generators"); if (si != this->AllSections.end()) { this->Formatter.PrintSection(os, si->second); } @@ -647,7 +647,7 @@ bool cmDocumentation::PrintHelpListVariables(std::ostream& os) bool cmDocumentation::PrintUsage(std::ostream& os) { - const auto si = this->AllSections.find("Usage"); + auto const si = this->AllSections.find("Usage"); if (si != this->AllSections.end()) { this->Formatter.PrintSection(os, si->second); } @@ -673,7 +673,7 @@ bool cmDocumentation::PrintHelp(std::ostream& os) return true; } -const char* cmDocumentation::GetNameString() const +char const* cmDocumentation::GetNameString() const { if (!this->NameString.empty()) { return this->NameString.c_str(); @@ -689,8 +689,8 @@ bool cmDocumentation::PrintOldCustomModules(std::ostream& os) cmSystemTools::GetFilenameLastExtension(filename)); std::string name = cmSystemTools::GetFilenameWithoutLastExtension(filename); - const char* summary = "cmake --help-custom-modules no longer supported\n"; - const char* detail = + char const* summary = "cmake --help-custom-modules no longer supported\n"; + char const* detail = "CMake versions prior to 3.0 exposed their internal module help page\n" "generation functionality through the --help-custom-modules option.\n" "CMake versions 3.0 and above use other means to generate their module\n" diff --git a/Source/cmDocumentation.h b/Source/cmDocumentation.h index 3e6bdfb..2b28034 100644 --- a/Source/cmDocumentation.h +++ b/Source/cmDocumentation.h @@ -54,8 +54,8 @@ public: * all arguments after the -E are ignored and not searched for * help arguments. */ - bool CheckOptions(int argc, const char* const* argv, - const char* exitOpt = nullptr); + bool CheckOptions(int argc, char const* const* argv, + char const* exitOpt = nullptr); /** * Print help requested on the command line. Call after @@ -71,13 +71,13 @@ public: void SetShowGenerators(bool showGen) { this->ShowGenerators = showGen; } /** Set the program name for standard document generation. */ - void SetName(const std::string& name); + void SetName(std::string const& name); /** Set a section of the documentation. Typical sections include Name, Usage, Description, Options */ - void SetSection(const char* sectionName, cmDocumentationSection section); + void SetSection(char const* sectionName, cmDocumentationSection section); template - void SetSection(const char* sectionName, const Iterable& docs) + void SetSection(char const* sectionName, Iterable const& docs) { cmDocumentationSection sec{ sectionName }; sec.Append(docs); @@ -86,17 +86,17 @@ public: /** Add the documentation to the beginning/end of the section */ template - void PrependSection(const char* sectionName, const Iterable& docs) + void PrependSection(char const* sectionName, Iterable const& docs) { this->SectionAtName(sectionName).Prepend(docs); } - void PrependSection(const char* sectionName, cmDocumentationEntry& docs); + void PrependSection(char const* sectionName, cmDocumentationEntry& docs); template - void AppendSection(const char* sectionName, const Iterable& docs) + void AppendSection(char const* sectionName, Iterable const& docs) { this->SectionAtName(sectionName).Append(docs); } - void AppendSection(const char* sectionName, cmDocumentationEntry& docs); + void AppendSection(char const* sectionName, cmDocumentationEntry& docs); /** Add common (to all tools) documentation section(s) */ void addCommonStandardDocSections(); @@ -135,13 +135,13 @@ private: bool PrintHelpListGenerators(std::ostream& os); bool PrintOldCustomModules(std::ostream& os); - const char* GetNameString() const; + char const* GetNameString() const; bool ShowGenerators; std::string NameString; std::map AllSections; - cmDocumentationSection& SectionAtName(const char* name); + cmDocumentationSection& SectionAtName(char const* name); std::string CurrentArgument; diff --git a/Source/cmDocumentationEntry.h b/Source/cmDocumentationEntry.h index 2a26ecd..22219f0 100644 --- a/Source/cmDocumentationEntry.h +++ b/Source/cmDocumentationEntry.h @@ -10,7 +10,7 @@ struct cmDocumentationEntry { #if __cplusplus <= 201103L - cmDocumentationEntry(const std::string& name, const std::string& brief) + cmDocumentationEntry(std::string const& name, std::string const& brief) : Name{ name } , Brief{ brief } { diff --git a/Source/cmDocumentationFormatter.cxx b/Source/cmDocumentationFormatter.cxx index 0c22259..bd9cc82 100644 --- a/Source/cmDocumentationFormatter.cxx +++ b/Source/cmDocumentationFormatter.cxx @@ -18,14 +18,14 @@ #include "cmStringAlgorithms.h" namespace { -const auto EOL = "\n"_s; -const auto SPACE = " "_s; -const auto TWO_SPACES = " "_s; -const auto MAX_WIDTH_PADDING = +auto const EOL = "\n"_s; +auto const SPACE = " "_s; +auto const TWO_SPACES = " "_s; +auto const MAX_WIDTH_PADDING = std::string(cmDocumentationFormatter::TEXT_WIDTH, ' '); void FormatLine(std::back_insert_iterator> outIt, - const cm::string_view text, const cm::string_view padding) + cm::string_view const text, cm::string_view const padding) { auto tokens = cmTokenizedView(text, ' ', cmTokenizerMode::New); if (tokens.empty()) { @@ -43,9 +43,9 @@ void FormatLine(std::back_insert_iterator> outIt, for (auto token : tokens) { // It's no need to add a space if this is a very first // word on a line. - const auto needSpace = currentWidth > padding.size(); + auto const needSpace = currentWidth > padding.size(); // Evaluate the size of a current token + possibly spaces before it. - const auto tokenWithSpaceSize = token.size() + std::size_t(needSpace) + + auto const tokenWithSpaceSize = token.size() + std::size_t(needSpace) + std::size_t(needSpace && newSentence); // Check if a current word fits on a line. // Also, take in account: @@ -89,7 +89,7 @@ std::string cmDocumentationFormatter::Format(std::string text) const assert(this->TextIndent < this->TEXT_WIDTH); - const auto padding = + auto const padding = cm::string_view(MAX_WIDTH_PADDING.c_str(), this->TextIndent); std::vector tokens; @@ -106,8 +106,8 @@ std::string cmDocumentationFormatter::Format(std::string text) const , end = text.find('\n', start) ) // clang-format on { - const auto isLastLine = end == std::string::npos; - const auto line = isLastLine + auto const isLastLine = end == std::string::npos; + auto const line = isLastLine ? cm::string_view{ text.c_str() + start } : cm::string_view{ text.c_str() + start, end - start }; @@ -148,17 +148,17 @@ std::string cmDocumentationFormatter::Format(std::string text) const void cmDocumentationFormatter::PrintSection( std::ostream& os, cmDocumentationSection const& section) { - const std::size_t PREFIX_SIZE = + std::size_t const PREFIX_SIZE = sizeof(cmDocumentationEntry::CustomNamePrefix) + 1u; // length of the "= " literal (see below) - const std::size_t SUFFIX_SIZE = 2u; + std::size_t const SUFFIX_SIZE = 2u; // legacy magic number ;-) - const std::size_t NAME_SIZE = 29u; + std::size_t const NAME_SIZE = 29u; - const std::size_t PADDING_SIZE = PREFIX_SIZE + SUFFIX_SIZE; - const std::size_t TITLE_SIZE = NAME_SIZE + PADDING_SIZE; + std::size_t const PADDING_SIZE = PREFIX_SIZE + SUFFIX_SIZE; + std::size_t const TITLE_SIZE = NAME_SIZE + PADDING_SIZE; - const auto savedIndent = this->TextIndent; + auto const savedIndent = this->TextIndent; os << section.GetName() << '\n'; diff --git a/Source/cmDocumentationSection.h b/Source/cmDocumentationSection.h index b5e24fe..672ec16 100644 --- a/Source/cmDocumentationSection.h +++ b/Source/cmDocumentationSection.h @@ -19,7 +19,7 @@ class cmDocumentationSection { public: /** Create a cmSection, with a special name for man-output mode. */ - explicit cmDocumentationSection(const char* name) + explicit cmDocumentationSection(char const* name) : Name(name) { } @@ -34,19 +34,19 @@ public: std::string GetName() const { return this->Name; } /** Return a pointer to the first entry of this section. */ - const std::vector& GetEntries() const + std::vector const& GetEntries() const { return this->Entries; } /** Append an entry to this section. */ - void Append(const cmDocumentationEntry& entry) + void Append(cmDocumentationEntry const& entry) { this->Entries.push_back(entry); } template - void Append(const Iterable& entries) + void Append(Iterable const& entries) { this->Entries.insert(std::end(this->Entries), std::begin(entries), std::end(entries)); @@ -54,7 +54,7 @@ public: /** prepend some documentation to this section */ template - void Prepend(const Iterable& entries) + void Prepend(Iterable const& entries) { this->Entries.insert(std::begin(this->Entries), std::begin(entries), std::end(entries)); diff --git a/Source/cmDuration.cxx b/Source/cmDuration.cxx index 8ca5d8d..f281561 100644 --- a/Source/cmDuration.cxx +++ b/Source/cmDuration.cxx @@ -4,7 +4,7 @@ #include "cmDuration.h" template -T cmDurationTo(const cmDuration& duration) +T cmDurationTo(cmDuration const& duration) { /* This works because the comparison operators for duration rely on * std::common_type. @@ -23,5 +23,5 @@ T cmDurationTo(const cmDuration& duration) .count(); } -template int cmDurationTo(const cmDuration&); -template unsigned int cmDurationTo(const cmDuration&); +template int cmDurationTo(cmDuration const&); +template unsigned int cmDurationTo(cmDuration const&); diff --git a/Source/cmDuration.h b/Source/cmDuration.h index ccd1cc1..884293d 100644 --- a/Source/cmDuration.h +++ b/Source/cmDuration.h @@ -16,9 +16,9 @@ using cmDuration = std::chrono::duration>; * the permissible valid values for T. */ template -T cmDurationTo(const cmDuration& duration); +T cmDurationTo(cmDuration const& duration); #ifndef CMDURATION_CPP -extern template int cmDurationTo(const cmDuration&); -extern template unsigned int cmDurationTo(const cmDuration&); +extern template int cmDurationTo(cmDuration const&); +extern template unsigned int cmDurationTo(cmDuration const&); #endif diff --git a/Source/cmDynamicLoader.cxx b/Source/cmDynamicLoader.cxx index a3731c1..e198f89 100644 --- a/Source/cmDynamicLoader.cxx +++ b/Source/cmDynamicLoader.cxx @@ -11,10 +11,10 @@ class cmDynamicLoaderCache { public: ~cmDynamicLoaderCache(); - void CacheFile(const char* path, cmsys::DynamicLoader::LibraryHandle /*p*/); - bool GetCacheFile(const char* path, + void CacheFile(char const* path, cmsys::DynamicLoader::LibraryHandle /*p*/); + bool GetCacheFile(char const* path, cmsys::DynamicLoader::LibraryHandle& /*p*/); - bool FlushCache(const char* path); + bool FlushCache(char const* path); void FlushCache(); static cmDynamicLoaderCache& GetInstance(); @@ -28,7 +28,7 @@ cmDynamicLoaderCache cmDynamicLoaderCache::Instance; cmDynamicLoaderCache::~cmDynamicLoaderCache() = default; -void cmDynamicLoaderCache::CacheFile(const char* path, +void cmDynamicLoaderCache::CacheFile(char const* path, cmsys::DynamicLoader::LibraryHandle p) { cmsys::DynamicLoader::LibraryHandle h; @@ -38,7 +38,7 @@ void cmDynamicLoaderCache::CacheFile(const char* path, this->CacheMap[path] = p; } -bool cmDynamicLoaderCache::GetCacheFile(const char* path, +bool cmDynamicLoaderCache::GetCacheFile(char const* path, cmsys::DynamicLoader::LibraryHandle& p) { auto it = this->CacheMap.find(path); @@ -49,7 +49,7 @@ bool cmDynamicLoaderCache::GetCacheFile(const char* path, return false; } -bool cmDynamicLoaderCache::FlushCache(const char* path) +bool cmDynamicLoaderCache::FlushCache(char const* path) { auto it = this->CacheMap.find(path); bool ret = false; @@ -75,7 +75,7 @@ cmDynamicLoaderCache& cmDynamicLoaderCache::GetInstance() } cmsys::DynamicLoader::LibraryHandle cmDynamicLoader::OpenLibrary( - const char* libname) + char const* libname) { cmsys::DynamicLoader::LibraryHandle lh; if (cmDynamicLoaderCache::GetInstance().GetCacheFile(libname, lh)) { diff --git a/Source/cmDynamicLoader.h b/Source/cmDynamicLoader.h index 53ea5cb..71c47d1 100644 --- a/Source/cmDynamicLoader.h +++ b/Source/cmDynamicLoader.h @@ -18,7 +18,7 @@ public: // Load a dynamic library into the current process. // The returned cmsys::DynamicLoader::LibraryHandle can be used to access // the symbols in the library. - static cmsys::DynamicLoader::LibraryHandle OpenLibrary(const char*); + static cmsys::DynamicLoader::LibraryHandle OpenLibrary(char const*); // Description: // Flush the cache of dynamic loader. diff --git a/Source/cmDyndepCollation.cxx b/Source/cmDyndepCollation.cxx index f42136f..800b395 100644 --- a/Source/cmDyndepCollation.cxx +++ b/Source/cmDyndepCollation.cxx @@ -239,7 +239,7 @@ Json::Value CollationInformationBmiInstallation(cmGeneratorTarget const* gt, tdi_bmi_info["permissions"] = bmi_gen->GetFilePermissions(); tdi_bmi_info["destination"] = bmi_gen->GetDestination(config); - const char* msg_level = ""; + char const* msg_level = ""; switch (bmi_gen->GetMessageLevel()) { case cmInstallGenerator::MessageDefault: break; diff --git a/Source/cmELF.cxx b/Source/cmELF.cxx index 99d0ba4..17a48dc 100644 --- a/Source/cmELF.cxx +++ b/Source/cmELF.cxx @@ -107,7 +107,7 @@ public: virtual unsigned long GetDynamicEntryPosition(int j) = 0; virtual cmELF::DynamicEntryList GetDynamicEntries() = 0; virtual std::vector EncodeDynamicEntries( - const cmELF::DynamicEntryList&) = 0; + cmELF::DynamicEntryList const&) = 0; virtual StringEntry const* GetDynamicSectionString(unsigned int tag) = 0; virtual bool IsMips() const = 0; virtual void PrintInfo(std::ostream& os) const = 0; @@ -164,7 +164,7 @@ protected: int DynamicSectionIndex; // Helper methods for subclasses. - void SetErrorMessage(const char* msg) + void SetErrorMessage(char const* msg) { this->External->ErrorMessage = msg; this->ELFType = cmELF::FileTypeInvalid; @@ -182,7 +182,7 @@ struct cmELFTypes32 using ELF_Dyn = Elf32_Dyn; using ELF_Half = Elf32_Half; using tagtype = ::uint32_t; - static const char* GetName() { return "32-bit"; } + static char const* GetName() { return "32-bit"; } }; // Configure the implementation template for 64-bit ELF files. @@ -193,7 +193,7 @@ struct cmELFTypes64 using ELF_Dyn = Elf64_Dyn; using ELF_Half = Elf64_Half; using tagtype = ::uint64_t; - static const char* GetName() { return "64-bit"; } + static char const* GetName() { return "64-bit"; } }; // Parser implementation template. @@ -224,7 +224,7 @@ public: cmELF::DynamicEntryList GetDynamicEntries() override; std::vector EncodeDynamicEntries( - const cmELF::DynamicEntryList&) override; + cmELF::DynamicEntryList const&) override; // Lookup a string from the dynamic section with the given tag. StringEntry const* GetDynamicSectionString(unsigned int tag) override; @@ -533,7 +533,7 @@ cmELF::DynamicEntryList cmELFInternalImpl::GetDynamicEntries() template std::vector cmELFInternalImpl::EncodeDynamicEntries( - const cmELF::DynamicEntryList& entries) + cmELF::DynamicEntryList const& entries) { std::vector result; result.reserve(sizeof(ELF_Dyn) * entries.size()); @@ -655,11 +655,11 @@ cmELF::StringEntry const* cmELFInternalImpl::GetDynamicSectionString( //============================================================================ // External class implementation. -const long cmELF::TagRPath = DT_RPATH; -const long cmELF::TagRunPath = DT_RUNPATH; -const long cmELF::TagMipsRldMapRel = DT_MIPS_RLD_MAP_REL; +long const cmELF::TagRPath = DT_RPATH; +long const cmELF::TagRunPath = DT_RUNPATH; +long const cmELF::TagMipsRldMapRel = DT_MIPS_RLD_MAP_REL; -cmELF::cmELF(const char* fname) +cmELF::cmELF(char const* fname) { // Try to open the file. auto fin = cm::make_unique(fname, std::ios::binary); @@ -766,7 +766,7 @@ cmELF::DynamicEntryList cmELF::GetDynamicEntries() const } std::vector cmELF::EncodeDynamicEntries( - const cmELF::DynamicEntryList& dentries) const + cmELF::DynamicEntryList const& dentries) const { if (this->Valid()) { return this->Internal->EncodeDynamicEntries(dentries); diff --git a/Source/cmELF.h b/Source/cmELF.h index dd37c65..5df6013 100644 --- a/Source/cmELF.h +++ b/Source/cmELF.h @@ -20,13 +20,13 @@ class cmELF { public: /** Construct with the name of the ELF input file to parse. */ - cmELF(const char* fname); + cmELF(char const* fname); /** Destruct. */ ~cmELF(); - cmELF(const cmELF&) = delete; - cmELF& operator=(const cmELF&) = delete; + cmELF(cmELF const&) = delete; + cmELF& operator=(cmELF const&) = delete; /** Get the error message if any. */ std::string const& GetErrorMessage() const { return this->ErrorMessage; } @@ -86,7 +86,7 @@ public: /** Encodes a DYNAMIC section header entry list into a char vector according to the type of ELF file this is */ std::vector EncodeDynamicEntries( - const DynamicEntryList& entries) const; + DynamicEntryList const& entries) const; /** Returns true if the ELF file has a dynamic section **/ bool HasDynamicSection() const; @@ -109,7 +109,7 @@ public: /** Interesting dynamic tags. If the tag is 0, it does not exist in the host ELF implementation */ - static const long TagRPath, TagRunPath, TagMipsRldMapRel; + static long const TagRPath, TagRunPath, TagMipsRldMapRel; private: friend class cmELFInternal; diff --git a/Source/cmExecProgramCommand.cxx b/Source/cmExecProgramCommand.cxx index 21ea463..5fe3d63 100644 --- a/Source/cmExecProgramCommand.cxx +++ b/Source/cmExecProgramCommand.cxx @@ -16,7 +16,7 @@ using Encoding = cmProcessOutput::Encoding; namespace { bool RunCommand(std::string command, std::string& output, int& retVal, - const char* directory = nullptr, bool verbose = true, + char const* directory = nullptr, bool verbose = true, Encoding encoding = cmProcessOutput::Auto); } @@ -123,7 +123,7 @@ bool cmExecProgramCommand(std::vector const& args, namespace { bool RunCommand(std::string command, std::string& output, int& retVal, - const char* dir, bool verbose, Encoding encoding) + char const* dir, bool verbose, Encoding encoding) { if (cmSystemTools::GetRunCommandOutput()) { verbose = false; @@ -188,7 +188,7 @@ bool RunCommand(std::string command, std::string& output, int& retVal, cmsysProcess_SetOption(cp, cmsysProcess_Option_HideWindow, 1); } cmsysProcess_SetOption(cp, cmsysProcess_Option_Verbatim, 1); - const char* cmd[] = { command.c_str(), nullptr }; + char const* cmd[] = { command.c_str(), nullptr }; cmsysProcess_SetCommand(cp, cmd); #else std::string commandInDir; @@ -206,7 +206,7 @@ bool RunCommand(std::string command, std::string& output, int& retVal, } fflush(stdout); fflush(stderr); - const char* cmd[] = { "/bin/sh", "-c", command.c_str(), nullptr }; + char const* cmd[] = { "/bin/sh", "-c", command.c_str(), nullptr }; cmsysProcess_SetCommand(cp, cmd); #endif diff --git a/Source/cmExecuteProcessCommand.cxx b/Source/cmExecuteProcessCommand.cxx index 97ee05c..20a54b3 100644 --- a/Source/cmExecuteProcessCommand.cxx +++ b/Source/cmExecuteProcessCommand.cxx @@ -43,7 +43,7 @@ bool cmExecuteProcessCommandIsWhitespace(char c) return (cmIsSpace(c) || c == '\n' || c == '\r'); } -FILE* FopenCLOEXEC(std::string const& path, const char* mode) +FILE* FopenCLOEXEC(std::string const& path, char const* mode) { FILE* f = cmsys::SystemTools::Fopen(path, mode); #ifndef _WIN32 @@ -59,7 +59,7 @@ FILE* FopenCLOEXEC(std::string const& path, const char* mode) void cmExecuteProcessCommandFixText(std::vector& output, bool strip_trailing_whitespace); -void cmExecuteProcessCommandAppend(std::vector& output, const char* data, +void cmExecuteProcessCommandAppend(std::vector& output, char const* data, std::size_t length); } @@ -294,7 +294,7 @@ bool cmExecuteProcessCommand(std::vector const& args, } if (echo_stdout || echo_stderr) { std::string command; - for (const auto& cmd : arguments.Commands) { + for (auto const& cmd : arguments.Commands) { command += "'"; command += cmJoin(cmd, "' '"); command += "'"; @@ -536,7 +536,7 @@ bool cmExecuteProcessCommand(std::vector const& args, ret = false; } else { int lastIndex = static_cast(arguments.Commands.size() - 1); - const std::string processStatus = queryProcessStatusByIndex(lastIndex); + std::string const processStatus = queryProcessStatusByIndex(lastIndex); if (!processStatus.empty()) { status.SetError("last command failed"); ret = false; @@ -583,7 +583,7 @@ void cmExecuteProcessCommandFixText(std::vector& output, output.push_back('\0'); } -void cmExecuteProcessCommandAppend(std::vector& output, const char* data, +void cmExecuteProcessCommandAppend(std::vector& output, char const* data, std::size_t length) { #if defined(__APPLE__) diff --git a/Source/cmExecutionStatus.h b/Source/cmExecutionStatus.h index e023971..be11dfa 100644 --- a/Source/cmExecutionStatus.h +++ b/Source/cmExecutionStatus.h @@ -41,7 +41,7 @@ public: this->ReturnInvoked = true; } bool GetReturnInvoked() const { return this->ReturnInvoked; } - const std::vector& GetReturnVariables() const + std::vector const& GetReturnVariables() const { return this->Variables; } diff --git a/Source/cmExpandedCommandArgument.cxx b/Source/cmExpandedCommandArgument.cxx index 1f14fc4..07e7e4a 100644 --- a/Source/cmExpandedCommandArgument.cxx +++ b/Source/cmExpandedCommandArgument.cxx @@ -23,7 +23,7 @@ bool cmExpandedCommandArgument::WasQuoted() const return this->Quoted; } -bool cmExpandedCommandArgument::operator==(const char* value) const +bool cmExpandedCommandArgument::operator==(char const* value) const { return this->Value == value; } diff --git a/Source/cmExpandedCommandArgument.h b/Source/cmExpandedCommandArgument.h index 1ff6ed1..f1d4157 100644 --- a/Source/cmExpandedCommandArgument.h +++ b/Source/cmExpandedCommandArgument.h @@ -23,7 +23,7 @@ public: bool WasQuoted() const; - bool operator==(const char* value) const; + bool operator==(char const* value) const; bool operator==(std::string const& value) const; bool empty() const; diff --git a/Source/cmExperimental.cxx b/Source/cmExperimental.cxx index 4a87566..45b71be 100644 --- a/Source/cmExperimental.cxx +++ b/Source/cmExperimental.cxx @@ -96,7 +96,7 @@ cmExperimental::FeatureData& DataForFeature(cmExperimental::Feature f) } } -const cmExperimental::FeatureData& cmExperimental::DataForFeature(Feature f) +cmExperimental::FeatureData const& cmExperimental::DataForFeature(Feature f) { return ::DataForFeature(f); } diff --git a/Source/cmExperimental.h b/Source/cmExperimental.h index b9fa1f2..2616e99 100644 --- a/Source/cmExperimental.h +++ b/Source/cmExperimental.h @@ -46,7 +46,7 @@ public: bool Warned; }; - static const FeatureData& DataForFeature(Feature f); + static FeatureData const& DataForFeature(Feature f); static cm::optional FeatureByName(std::string const& name); static bool HasSupportEnabled(cmMakefile const& mf, Feature f); }; diff --git a/Source/cmExportCommand.cxx b/Source/cmExportCommand.cxx index 7c5b26b..8e50c52 100644 --- a/Source/cmExportCommand.cxx +++ b/Source/cmExportCommand.cxx @@ -47,7 +47,7 @@ static bool HandlePackage(std::vector const& args, cmExecutionStatus& status); static void StorePackageRegistry(cmMakefile& mf, std::string const& package, - const char* content, const char* hash); + char const* content, char const* hash); bool cmExportCommand(std::vector const& args, cmExecutionStatus& status) @@ -383,7 +383,7 @@ static bool HandlePackage(std::vector const& args, status.SetError("PACKAGE must be given a package name."); return false; } - const char* packageExpr = "^[A-Za-z0-9_.-]+$"; + char const* packageExpr = "^[A-Za-z0-9_.-]+$"; cmsys::RegularExpression packageRegex(packageExpr); if (!packageRegex.find(package)) { std::ostringstream e; @@ -416,7 +416,7 @@ static bool HandlePackage(std::vector const& args, // We store the current build directory in the registry as a value // named by a hash of its own content. This is deterministic and is // unique with high probability. - const std::string& outDir = mf.GetCurrentBinaryDirectory(); + std::string const& outDir = mf.GetCurrentBinaryDirectory(); cmCryptoHash hasher(cmCryptoHash::AlgoMD5); std::string hash = hasher.HashString(outDir); StorePackageRegistry(mf, package, outDir.c_str(), hash.c_str()); @@ -443,7 +443,7 @@ static void ReportRegistryError(cmMakefile& mf, std::string const& msg, } static void StorePackageRegistry(cmMakefile& mf, std::string const& package, - const char* content, const char* hash) + char const* content, char const* hash) { std::string key = cmStrCat("Software\\Kitware\\CMake\\Packages\\", package); HKEY hKey; @@ -470,7 +470,7 @@ static void StorePackageRegistry(cmMakefile& mf, std::string const& package, } #else static void StorePackageRegistry(cmMakefile& mf, std::string const& package, - const char* content, const char* hash) + char const* content, char const* hash) { # if defined(__HAIKU__) char dir[B_PATH_NAME_LENGTH]; diff --git a/Source/cmExportPackageInfoGenerator.cxx b/Source/cmExportPackageInfoGenerator.cxx index ef85c92..211347e 100644 --- a/Source/cmExportPackageInfoGenerator.cxx +++ b/Source/cmExportPackageInfoGenerator.cxx @@ -26,7 +26,7 @@ #include "cmTarget.h" #include "cmValue.h" -static const std::string kCPS_VERSION_STR = "0.13.0"; +static std::string const kCPS_VERSION_STR = "0.13.0"; cmExportPackageInfoGenerator::cmExportPackageInfoGenerator( std::string packageName, std::string version, std::string versionCompat, diff --git a/Source/cmExportSet.cxx b/Source/cmExportSet.cxx index b32bb8d..69ed797 100644 --- a/Source/cmExportSet.cxx +++ b/Source/cmExportSet.cxx @@ -21,7 +21,7 @@ cmExportSet::cmExportSet(std::string name) cmExportSet::~cmExportSet() = default; cmExportSet::PackageDependency& cmExportSet::GetPackageDependencyForSetup( - const std::string& name) + std::string const& name) { auto& dep = this->PackageDependencies[name]; if (!dep.SpecifiedIndex) { @@ -39,7 +39,7 @@ bool cmExportSet::Compute(cmLocalGenerator* lg) auto const interfaceFileSets = tgtExport->Target->Target->GetAllInterfaceFileSets(); auto const fileSetInTargetExport = - [&tgtExport, lg](const std::string& fileSetName) -> bool { + [&tgtExport, lg](std::string const& fileSetName) -> bool { auto* fileSet = tgtExport->Target->Target->GetFileSet(fileSetName); if (!tgtExport->FileSetGenerators.count(fileSet)) { @@ -72,8 +72,8 @@ void cmExportSet::AddInstallation(cmInstallExportGenerator const* installation) this->Installations.push_back(installation); } -void cmExportSet::SetXcFrameworkLocation(const std::string& name, - const std::string& location) +void cmExportSet::SetXcFrameworkLocation(std::string const& name, + std::string const& location) { for (auto& te : this->TargetExports) { if (name == te->TargetName) { @@ -82,7 +82,7 @@ void cmExportSet::SetXcFrameworkLocation(const std::string& name, } } -cmExportSet& cmExportSetMap::operator[](const std::string& name) +cmExportSet& cmExportSetMap::operator[](std::string const& name) { auto it = this->find(name); if (it == this->end()) // Export set not found diff --git a/Source/cmExportSet.h b/Source/cmExportSet.h index f2fc4a7..2a1d1ed 100644 --- a/Source/cmExportSet.h +++ b/Source/cmExportSet.h @@ -24,8 +24,8 @@ public: /// Destructor ~cmExportSet(); - cmExportSet(const cmExportSet&) = delete; - cmExportSet& operator=(const cmExportSet&) = delete; + cmExportSet(cmExportSet const&) = delete; + cmExportSet& operator=(cmExportSet const&) = delete; bool Compute(cmLocalGenerator* lg); @@ -33,8 +33,8 @@ public: void AddInstallation(cmInstallExportGenerator const* installation); - void SetXcFrameworkLocation(const std::string& name, - const std::string& location); + void SetXcFrameworkLocation(std::string const& name, + std::string const& location); std::string const& GetName() const { return this->Name; } @@ -64,9 +64,9 @@ public: cm::optional FindPackageIndex; }; - PackageDependency& GetPackageDependencyForSetup(const std::string& name); + PackageDependency& GetPackageDependencyForSetup(std::string const& name); - const std::map& GetPackageDependencies() + std::map const& GetPackageDependencies() const { return this->PackageDependencies; @@ -89,5 +89,5 @@ public: * The operator is overloaded because cmExportSet has no default constructor: * we do not want unnamed export sets. */ - cmExportSet& operator[](const std::string& name); + cmExportSet& operator[](std::string const& name); }; diff --git a/Source/cmExprParserHelper.cxx b/Source/cmExprParserHelper.cxx index cc8b8b7..c0343c0 100644 --- a/Source/cmExprParserHelper.cxx +++ b/Source/cmExprParserHelper.cxx @@ -21,7 +21,7 @@ cmExprParserHelper::cmExprParserHelper() cmExprParserHelper::~cmExprParserHelper() = default; -int cmExprParserHelper::ParseString(const char* str, int verb) +int cmExprParserHelper::ParseString(char const* str, int verb) { if (!str) { return 0; @@ -91,7 +91,7 @@ int cmExprParserHelper::LexInput(char* buf, int maxlen) return (0); } -void cmExprParserHelper::Error(const char* str) +void cmExprParserHelper::Error(char const* str) { unsigned long pos = static_cast(this->InputBufferPos); std::ostringstream ostr; diff --git a/Source/cmExprParserHelper.h b/Source/cmExprParserHelper.h index 919e492..4dd7821 100644 --- a/Source/cmExprParserHelper.h +++ b/Source/cmExprParserHelper.h @@ -20,16 +20,16 @@ public: cmExprParserHelper(); ~cmExprParserHelper(); - int ParseString(const char* str, int verb); + int ParseString(char const* str, int verb); int LexInput(char* buf, int maxlen); - void Error(const char* str); + void Error(char const* str); void SetResult(KWIML_INT_int64_t value); KWIML_INT_int64_t GetResult() const { return this->Result; } - const char* GetError() { return this->ErrorString.c_str(); } + char const* GetError() { return this->ErrorString.c_str(); } void UnexpectedChar(char c); @@ -42,12 +42,12 @@ private: int CurrentLine; int Verbose; - void Print(const char* place, const char* str); + void Print(char const* place, char const* str); void SetError(std::string errorString); KWIML_INT_int64_t Result; - const char* FileName; + char const* FileName; long FileLine; std::string ErrorString; std::string WarningString; diff --git a/Source/cmExternalMakefileProjectGenerator.cxx b/Source/cmExternalMakefileProjectGenerator.cxx index 5fecb35..b7f4c31 100644 --- a/Source/cmExternalMakefileProjectGenerator.cxx +++ b/Source/cmExternalMakefileProjectGenerator.cxx @@ -15,7 +15,7 @@ void cmExternalMakefileProjectGenerator::EnableLanguage( } std::string cmExternalMakefileProjectGenerator::CreateFullGeneratorName( - const std::string& globalGenerator, const std::string& extraGenerator) + std::string const& globalGenerator, std::string const& extraGenerator) { if (globalGenerator.empty()) { return {}; @@ -27,7 +27,7 @@ std::string cmExternalMakefileProjectGenerator::CreateFullGeneratorName( } bool cmExternalMakefileProjectGenerator::Open( - const std::string& /*bindir*/, const std::string& /*projectName*/, + std::string const& /*bindir*/, std::string const& /*projectName*/, bool /*dryRun*/) { return false; @@ -60,7 +60,7 @@ cmExternalMakefileProjectGeneratorFactory::GetSupportedGlobalGenerators() const } void cmExternalMakefileProjectGeneratorFactory::AddSupportedGlobalGenerator( - const std::string& base) + std::string const& base) { this->SupportedGlobalGenerators.push_back(base); } diff --git a/Source/cmExternalMakefileProjectGenerator.h b/Source/cmExternalMakefileProjectGenerator.h index 311a2ef..322d0c2 100644 --- a/Source/cmExternalMakefileProjectGenerator.h +++ b/Source/cmExternalMakefileProjectGenerator.h @@ -38,7 +38,7 @@ public: } //! Return the list of global generators supported by this extra generator - const std::vector& GetSupportedGlobalGenerators() const + std::vector const& GetSupportedGlobalGenerators() const { return this->SupportedGlobalGenerators; } @@ -47,22 +47,22 @@ public: * extra generator name */ static std::string CreateFullGeneratorName( - const std::string& globalGenerator, const std::string& extraGenerator); + std::string const& globalGenerator, std::string const& extraGenerator); //! Generate the project files, the Makefiles have already been generated virtual void Generate() = 0; - void SetName(const std::string& n) { this->Name = n; } + void SetName(std::string const& n) { this->Name = n; } std::string GetName() const { return this->Name; } - virtual bool Open(const std::string& bindir, const std::string& projectName, + virtual bool Open(std::string const& bindir, std::string const& projectName, bool dryRun); protected: //! Contains the names of the global generators support by this generator. std::vector SupportedGlobalGenerators; //! the global generator which creates the makefiles - const cmGlobalGenerator* GlobalGenerator = nullptr; + cmGlobalGenerator const* GlobalGenerator = nullptr; std::string Name; }; @@ -81,7 +81,7 @@ public: virtual std::unique_ptr CreateExternalMakefileProjectGenerator() const = 0; - void AddSupportedGlobalGenerator(const std::string& base); + void AddSupportedGlobalGenerator(std::string const& base); private: std::string Name; @@ -94,8 +94,8 @@ class cmExternalMakefileProjectGeneratorSimpleFactory : public cmExternalMakefileProjectGeneratorFactory { public: - cmExternalMakefileProjectGeneratorSimpleFactory(const std::string& n, - const std::string& doc) + cmExternalMakefileProjectGeneratorSimpleFactory(std::string const& n, + std::string const& doc) : cmExternalMakefileProjectGeneratorFactory(n, doc) { } diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx index bc58447..090b273 100644 --- a/Source/cmExtraCodeBlocksGenerator.cxx +++ b/Source/cmExtraCodeBlocksGenerator.cxx @@ -74,7 +74,7 @@ void cmExtraCodeBlocksGenerator::Generate() /* create the project file */ void cmExtraCodeBlocksGenerator::CreateProjectFile( - const std::vector& lgs) + std::vector const& lgs) { std::string outputDir = lgs[0]->GetCurrentBinaryDirectory(); std::string projectName = lgs[0]->GetProjectName(); @@ -97,20 +97,20 @@ struct Tree std::string path; // only one component of the path std::vector folders; std::set files; - void InsertPath(const std::vector& split, + void InsertPath(std::vector const& split, std::vector::size_type start, - const std::string& fileName); + std::string const& fileName); void BuildVirtualFolder(cmXMLWriter& xml) const; void BuildVirtualFolderImpl(std::string& virtualFolders, - const std::string& prefix) const; - void BuildUnit(cmXMLWriter& xml, const std::string& fsPath) const; - void BuildUnitImpl(cmXMLWriter& xml, const std::string& virtualFolderPath, - const std::string& fsPath) const; + std::string const& prefix) const; + void BuildUnit(cmXMLWriter& xml, std::string const& fsPath) const; + void BuildUnitImpl(cmXMLWriter& xml, std::string const& virtualFolderPath, + std::string const& fsPath) const; }; -void Tree::InsertPath(const std::vector& split, +void Tree::InsertPath(std::vector const& split, std::vector::size_type start, - const std::string& fileName) + std::string const& fileName) { if (start == split.size()) { this->files.insert(fileName); @@ -152,7 +152,7 @@ void Tree::BuildVirtualFolder(cmXMLWriter& xml) const } void Tree::BuildVirtualFolderImpl(std::string& virtualFolders, - const std::string& prefix) const + std::string const& prefix) const { virtualFolders += "CMake Files\\" + prefix + this->path + "\\;"; for (Tree const& folder : this->folders) { @@ -160,7 +160,7 @@ void Tree::BuildVirtualFolderImpl(std::string& virtualFolders, } } -void Tree::BuildUnit(cmXMLWriter& xml, const std::string& fsPath) const +void Tree::BuildUnit(cmXMLWriter& xml, std::string const& fsPath) const { for (std::string const& f : this->files) { xml.StartElement("Unit"); @@ -178,8 +178,8 @@ void Tree::BuildUnit(cmXMLWriter& xml, const std::string& fsPath) const } void Tree::BuildUnitImpl(cmXMLWriter& xml, - const std::string& virtualFolderPath, - const std::string& fsPath) const + std::string const& virtualFolderPath, + std::string const& fsPath) const { for (std::string const& f : this->files) { xml.StartElement("Unit"); @@ -200,9 +200,9 @@ void Tree::BuildUnitImpl(cmXMLWriter& xml, } void cmExtraCodeBlocksGenerator::CreateNewProjectFile( - const std::vector& lgs, const std::string& filename) + std::vector const& lgs, std::string const& filename) { - const cmMakefile* mf = lgs[0]->GetMakefile(); + cmMakefile const* mf = lgs[0]->GetMakefile(); cmGeneratedFileStream fout(filename); if (!fout) { return; @@ -225,7 +225,7 @@ void cmExtraCodeBlocksGenerator::CreateNewProjectFile( continue; } - const std::string& relative = cmSystemTools::RelativePath( + std::string const& relative = cmSystemTools::RelativePath( it.second[0]->GetSourceDirectory(), listFile); std::vector split; cmSystemTools::SplitPath(relative, split, false); @@ -239,7 +239,7 @@ void cmExtraCodeBlocksGenerator::CreateNewProjectFile( // // Also we can disable external (outside the project) files by setting ON // CMAKE_CODEBLOCKS_EXCLUDE_EXTERNAL_FILES variable. - const bool excludeExternal = it.second[0]->GetMakefile()->IsOn( + bool const excludeExternal = it.second[0]->GetMakefile()->IsOn( "CMAKE_CODEBLOCKS_EXCLUDE_EXTERNAL_FILES"); if (!split.empty() && (!excludeExternal || (relative.find("..") == std::string::npos)) && @@ -251,8 +251,8 @@ void cmExtraCodeBlocksGenerator::CreateNewProjectFile( // figure out the compiler std::string compiler = this->GetCBCompilerId(mf); - const std::string& make = mf->GetRequiredDefinition("CMAKE_MAKE_PROGRAM"); - const std::string& makeArgs = + std::string const& make = mf->GetRequiredDefinition("CMAKE_MAKE_PROGRAM"); + std::string const& makeArgs = mf->GetSafeDefinition("CMAKE_CODEBLOCKS_MAKE_ARGUMENTS"); cmXMLWriter xml(fout); @@ -288,8 +288,8 @@ void cmExtraCodeBlocksGenerator::CreateNewProjectFile( // add all executable and library targets and some of the GLOBAL // and UTILITY targets for (cmLocalGenerator* lg : lgs) { - const auto& targets = lg->GetGeneratorTargets(); - for (const auto& target : targets) { + auto const& targets = lg->GetGeneratorTargets(); + for (auto const& target : targets) { std::string targetName = target->GetName(); switch (target->GetType()) { case cmStateEnums::GLOBAL_TARGET: { @@ -346,8 +346,8 @@ void cmExtraCodeBlocksGenerator::CreateNewProjectFile( for (cmLocalGenerator* lg : lgs) { cmMakefile* makefile = lg->GetMakefile(); - const auto& targets = lg->GetGeneratorTargets(); - for (const auto& target : targets) { + auto const& targets = lg->GetGeneratorTargets(); + for (auto const& target : targets) { switch (target->GetType()) { case cmStateEnums::EXECUTABLE: case cmStateEnums::STATIC_LIBRARY: @@ -379,11 +379,11 @@ void cmExtraCodeBlocksGenerator::CreateNewProjectFile( std::string const& fullPath = s->ResolveFullPath(); // Check file position relative to project root dir. - const std::string relative = + std::string const relative = cmSystemTools::RelativePath(lg->GetSourceDirectory(), fullPath); // Do not add this file if it has ".." in relative path and // if CMAKE_CODEBLOCKS_EXCLUDE_EXTERNAL_FILES variable is on. - const bool excludeExternal = lg->GetMakefile()->IsOn( + bool const excludeExternal = lg->GetMakefile()->IsOn( "CMAKE_CODEBLOCKS_EXCLUDE_EXTERNAL_FILES"); if (excludeExternal && (relative.find("..") != std::string::npos)) { @@ -483,9 +483,9 @@ std::string cmExtraCodeBlocksGenerator::CreateDummyTargetFile( // Generate the xml code for one target. void cmExtraCodeBlocksGenerator::AppendTarget( - cmXMLWriter& xml, const std::string& targetName, cmGeneratorTarget* target, - const std::string& make, const cmLocalGenerator* lg, - const std::string& compiler, const std::string& makeFlags) + cmXMLWriter& xml, std::string const& targetName, cmGeneratorTarget* target, + std::string const& make, cmLocalGenerator const* lg, + std::string const& compiler, std::string const& makeFlags) { cmMakefile const* makefile = lg->GetMakefile(); std::string makefileName = @@ -626,7 +626,7 @@ void cmExtraCodeBlocksGenerator::AppendTarget( } // Translate the cmake compiler id into the CodeBlocks compiler id -std::string cmExtraCodeBlocksGenerator::GetCBCompilerId(const cmMakefile* mf) +std::string cmExtraCodeBlocksGenerator::GetCBCompilerId(cmMakefile const* mf) { // allow the user to overwrite the detected compiler std::string userCompiler = @@ -719,8 +719,8 @@ int cmExtraCodeBlocksGenerator::GetCBTargetType(cmGeneratorTarget* target) // Create the command line for building the given target using the selected // make std::string cmExtraCodeBlocksGenerator::BuildMakeCommand( - const std::string& make, const std::string& makefile, - const std::string& target, const std::string& makeFlags) + std::string const& make, std::string const& makefile, + std::string const& target, std::string const& makeFlags) { std::string command = make; if (!makeFlags.empty()) { diff --git a/Source/cmExtraCodeBlocksGenerator.h b/Source/cmExtraCodeBlocksGenerator.h index cada5dd..b7ddd78 100644 --- a/Source/cmExtraCodeBlocksGenerator.h +++ b/Source/cmExtraCodeBlocksGenerator.h @@ -29,24 +29,24 @@ public: private: struct CbpUnit { - std::vector Targets; + std::vector Targets; }; - void CreateProjectFile(const std::vector& lgs); + void CreateProjectFile(std::vector const& lgs); - void CreateNewProjectFile(const std::vector& lgs, - const std::string& filename); + void CreateNewProjectFile(std::vector const& lgs, + std::string const& filename); std::string CreateDummyTargetFile(cmLocalGenerator* lg, cmGeneratorTarget* target) const; - std::string GetCBCompilerId(const cmMakefile* mf); + std::string GetCBCompilerId(cmMakefile const* mf); int GetCBTargetType(cmGeneratorTarget* target); - std::string BuildMakeCommand(const std::string& make, - const std::string& makefile, - const std::string& target, - const std::string& makeFlags); - void AppendTarget(cmXMLWriter& xml, const std::string& targetName, - cmGeneratorTarget* target, const std::string& make, - const cmLocalGenerator* lg, const std::string& compiler, - const std::string& makeFlags); + std::string BuildMakeCommand(std::string const& make, + std::string const& makefile, + std::string const& target, + std::string const& makeFlags); + void AppendTarget(cmXMLWriter& xml, std::string const& targetName, + cmGeneratorTarget* target, std::string const& make, + cmLocalGenerator const* lg, std::string const& compiler, + std::string const& makeFlags); }; diff --git a/Source/cmExtraCodeLiteGenerator.cxx b/Source/cmExtraCodeLiteGenerator.cxx index 5d2b045..bc6cf18 100644 --- a/Source/cmExtraCodeLiteGenerator.cxx +++ b/Source/cmExtraCodeLiteGenerator.cxx @@ -55,7 +55,7 @@ void cmExtraCodeLiteGenerator::Generate() std::string workspaceFileName; std::string workspaceSourcePath; - const std::map>& projectMap = + std::map> const& projectMap = this->GlobalGenerator->GetProjectMap(); // loop projects and locate the root project. @@ -63,7 +63,7 @@ void cmExtraCodeLiteGenerator::Generate() // root makefile for (auto const& it : projectMap) { cmLocalGenerator* lg = it.second[0]; - const cmMakefile* mf = lg->GetMakefile(); + cmMakefile const* mf = lg->GetMakefile(); this->ConfigName = this->GetConfigurationName(mf); if (lg->GetCurrentBinaryDirectory() == lg->GetBinaryDirectory()) { @@ -117,9 +117,9 @@ std::vector cmExtraCodeLiteGenerator::CreateProjectsByTarget( { std::vector retval; // for each target in the workspace create a codelite project - const auto& lgs = this->GlobalGenerator->GetLocalGenerators(); - for (const auto& lg : lgs) { - for (const auto& lt : lg->GetGeneratorTargets()) { + auto const& lgs = this->GlobalGenerator->GetLocalGenerators(); + for (auto const& lg : lgs) { + for (auto const& lt : lg->GetGeneratorTargets()) { cmStateEnums::TargetType type = lt->GetType(); std::string const& outputDir = lg->GetCurrentBinaryDirectory(); std::string targetName = lt->GetName(); @@ -181,7 +181,7 @@ std::vector cmExtraCodeLiteGenerator::CreateProjectsByProjectMaps( /* create the project file */ void cmExtraCodeLiteGenerator::CreateProjectFile( - const std::vector& lgs) + std::vector const& lgs) { std::string const& outputDir = lgs[0]->GetCurrentBinaryDirectory(); std::string projectName = lgs[0]->GetProjectName(); @@ -192,7 +192,7 @@ void cmExtraCodeLiteGenerator::CreateProjectFile( } std::string cmExtraCodeLiteGenerator::CollectSourceFiles( - const cmMakefile* makefile, const cmGeneratorTarget* gt, + cmMakefile const* makefile, cmGeneratorTarget const* gt, std::map& cFiles, std::set& otherFiles) { @@ -241,9 +241,9 @@ std::string cmExtraCodeLiteGenerator::CollectSourceFiles( } void cmExtraCodeLiteGenerator::CreateNewProjectFile( - const std::vector& lgs, const std::string& filename) + std::vector const& lgs, std::string const& filename) { - const cmMakefile* mf = lgs[0]->GetMakefile(); + cmMakefile const* mf = lgs[0]->GetMakefile(); cmGeneratedFileStream fout(filename); if (!fout) { return; @@ -266,7 +266,7 @@ void cmExtraCodeLiteGenerator::CreateNewProjectFile( for (cmLocalGenerator* lg : lgs) { cmMakefile* makefile = lg->GetMakefile(); - for (const auto& target : lg->GetGeneratorTargets()) { + for (auto const& target : lg->GetGeneratorTargets()) { projectType = this->CollectSourceFiles(makefile, target.get(), cFiles, otherFiles); } @@ -287,7 +287,7 @@ void cmExtraCodeLiteGenerator::FindMatchingHeaderfiles( std::set& otherFiles) { - const std::vector& headerExts = + std::vector const& headerExts = this->GlobalGenerator->GetCMakeInstance()->GetHeaderExtensions(); // The following loop tries to add header files matching to implementation @@ -320,7 +320,7 @@ void cmExtraCodeLiteGenerator::FindMatchingHeaderfiles( void cmExtraCodeLiteGenerator::CreateFoldersAndFiles( std::set& cFiles, cmXMLWriter& xml, - const std::string& projectPath) + std::string const& projectPath) { std::vector tmp_path; std::vector components; @@ -386,7 +386,7 @@ void cmExtraCodeLiteGenerator::CreateFoldersAndFiles( void cmExtraCodeLiteGenerator::CreateFoldersAndFiles( std::map& cFiles, cmXMLWriter& xml, - const std::string& projectPath) + std::string const& projectPath) { std::set s; for (auto const& it : cFiles) { @@ -398,8 +398,8 @@ void cmExtraCodeLiteGenerator::CreateFoldersAndFiles( void cmExtraCodeLiteGenerator::CreateProjectSourceEntries( std::map& cFiles, std::set& otherFiles, cmXMLWriter* _xml, - const std::string& projectPath, const cmMakefile* mf, - const std::string& projectType, const std::string& targetName) + std::string const& projectPath, cmMakefile const* mf, + std::string const& projectType, std::string const& targetName) { cmXMLWriter& xml(*_xml); this->FindMatchingHeaderfiles(cFiles, otherFiles); @@ -537,9 +537,9 @@ void cmExtraCodeLiteGenerator::CreateProjectSourceEntries( } void cmExtraCodeLiteGenerator::CreateNewProjectFile( - const cmGeneratorTarget* gt, const std::string& filename) + cmGeneratorTarget const* gt, std::string const& filename) { - const cmMakefile* mf = gt->Makefile; + cmMakefile const* mf = gt->Makefile; cmGeneratedFileStream fout(filename); if (!fout) { return; @@ -584,7 +584,7 @@ void cmExtraCodeLiteGenerator::CreateNewProjectFile( } std::string cmExtraCodeLiteGenerator::GetCodeLiteCompilerName( - const cmMakefile* mf) const + cmMakefile const* mf) const { // figure out which language to use // for now care only for C and C++ @@ -610,7 +610,7 @@ std::string cmExtraCodeLiteGenerator::GetCodeLiteCompilerName( } std::string cmExtraCodeLiteGenerator::GetConfigurationName( - const cmMakefile* mf) const + cmMakefile const* mf) const { std::string confName = mf->GetSafeDefinition("CMAKE_BUILD_TYPE"); // Trim the configuration name from whitespaces (left and right) @@ -623,10 +623,10 @@ std::string cmExtraCodeLiteGenerator::GetConfigurationName( } std::string cmExtraCodeLiteGenerator::GetBuildCommand( - const cmMakefile* mf, const std::string& targetName) const + cmMakefile const* mf, std::string const& targetName) const { - const std::string& generator = mf->GetSafeDefinition("CMAKE_GENERATOR"); - const std::string& make = mf->GetRequiredDefinition("CMAKE_MAKE_PROGRAM"); + std::string const& generator = mf->GetSafeDefinition("CMAKE_GENERATOR"); + std::string const& make = mf->GetRequiredDefinition("CMAKE_MAKE_PROGRAM"); std::string buildCommand = make; // Default std::ostringstream ss; if (generator == "NMake Makefiles" || generator == "Ninja") { @@ -645,7 +645,7 @@ std::string cmExtraCodeLiteGenerator::GetBuildCommand( } std::string cmExtraCodeLiteGenerator::GetCleanCommand( - const cmMakefile* mf, const std::string& targetName) const + cmMakefile const* mf, std::string const& targetName) const { std::string generator = mf->GetSafeDefinition("CMAKE_GENERATOR"); std::ostringstream ss; @@ -659,18 +659,18 @@ std::string cmExtraCodeLiteGenerator::GetCleanCommand( } std::string cmExtraCodeLiteGenerator::GetRebuildCommand( - const cmMakefile* mf, const std::string& targetName) const + cmMakefile const* mf, std::string const& targetName) const { return this->GetCleanCommand(mf, targetName) + " && " + this->GetBuildCommand(mf, targetName); } std::string cmExtraCodeLiteGenerator::GetSingleFileBuildCommand( - const cmMakefile* mf) const + cmMakefile const* mf) const { std::string buildCommand; - const std::string& make = mf->GetRequiredDefinition("CMAKE_MAKE_PROGRAM"); - const std::string& generator = mf->GetSafeDefinition("CMAKE_GENERATOR"); + std::string const& make = mf->GetRequiredDefinition("CMAKE_MAKE_PROGRAM"); + std::string const& generator = mf->GetSafeDefinition("CMAKE_GENERATOR"); if (generator == "Unix Makefiles" || generator == "MinGW Makefiles") { std::ostringstream ss; #if defined(_WIN32) diff --git a/Source/cmExtraCodeLiteGenerator.h b/Source/cmExtraCodeLiteGenerator.h index 2bb1c04..a3d1004 100644 --- a/Source/cmExtraCodeLiteGenerator.h +++ b/Source/cmExtraCodeLiteGenerator.h @@ -24,19 +24,19 @@ protected: std::string WorkspacePath; unsigned int CpuCount = 2; - std::string GetCodeLiteCompilerName(const cmMakefile* mf) const; - std::string GetConfigurationName(const cmMakefile* mf) const; - std::string GetBuildCommand(const cmMakefile* mf, - const std::string& targetName) const; - std::string GetCleanCommand(const cmMakefile* mf, - const std::string& targetName) const; - std::string GetRebuildCommand(const cmMakefile* mf, - const std::string& targetName) const; - std::string GetSingleFileBuildCommand(const cmMakefile* mf) const; + std::string GetCodeLiteCompilerName(cmMakefile const* mf) const; + std::string GetConfigurationName(cmMakefile const* mf) const; + std::string GetBuildCommand(cmMakefile const* mf, + std::string const& targetName) const; + std::string GetCleanCommand(cmMakefile const* mf, + std::string const& targetName) const; + std::string GetRebuildCommand(cmMakefile const* mf, + std::string const& targetName) const; + std::string GetSingleFileBuildCommand(cmMakefile const* mf) const; std::vector CreateProjectsByTarget(cmXMLWriter* xml); std::vector CreateProjectsByProjectMaps(cmXMLWriter* xml); - std::string CollectSourceFiles(const cmMakefile* makefile, - const cmGeneratorTarget* gt, + std::string CollectSourceFiles(cmMakefile const* makefile, + cmGeneratorTarget const* gt, std::map& cFiles, std::set& otherFiles); void FindMatchingHeaderfiles(std::map& cFiles, @@ -44,14 +44,14 @@ protected: void CreateProjectSourceEntries(std::map& cFiles, std::set& otherFiles, cmXMLWriter* xml, - const std::string& projectPath, - const cmMakefile* mf, - const std::string& projectType, - const std::string& targetName); + std::string const& projectPath, + cmMakefile const* mf, + std::string const& projectType, + std::string const& targetName); void CreateFoldersAndFiles(std::set& cFiles, cmXMLWriter& xml, - const std::string& projectPath); + std::string const& projectPath); void CreateFoldersAndFiles(std::map& cFiles, - cmXMLWriter& xml, const std::string& projectPath); + cmXMLWriter& xml, std::string const& projectPath); public: cmExtraCodeLiteGenerator(); @@ -59,10 +59,10 @@ public: static cmExternalMakefileProjectGeneratorFactory* GetFactory(); void Generate() override; - void CreateProjectFile(const std::vector& lgs); + void CreateProjectFile(std::vector const& lgs); - void CreateNewProjectFile(const std::vector& lgs, - const std::string& filename); - void CreateNewProjectFile(const cmGeneratorTarget* lg, - const std::string& filename); + void CreateNewProjectFile(std::vector const& lgs, + std::string const& filename); + void CreateNewProjectFile(cmGeneratorTarget const* lg, + std::string const& filename); }; diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx index a11ed68..182b586 100644 --- a/Source/cmExtraEclipseCDT4Generator.cxx +++ b/Source/cmExtraEclipseCDT4Generator.cxx @@ -30,7 +30,7 @@ #include "cmXMLWriter.h" #include "cmake.h" -static void AppendAttribute(cmXMLWriter& xml, const char* keyval) +static void AppendAttribute(cmXMLWriter& xml, char const* keyval) { xml.StartElement("attribute"); xml.Attribute("key", keyval); @@ -39,7 +39,7 @@ static void AppendAttribute(cmXMLWriter& xml, const char* keyval) } template -void AppendDictionary(cmXMLWriter& xml, const char* key, T const& value) +void AppendDictionary(cmXMLWriter& xml, char const* key, T const& value) { xml.StartElement("dictionary"); xml.Element("key", key); @@ -102,8 +102,8 @@ void cmExtraEclipseCDT4Generator::EnableLanguage( void cmExtraEclipseCDT4Generator::Generate() { - const auto& lg = this->GlobalGenerator->GetLocalGenerators()[0]; - const cmMakefile* mf = lg->GetMakefile(); + auto const& lg = this->GlobalGenerator->GetLocalGenerators()[0]; + cmMakefile const* mf = lg->GetMakefile(); std::string eclipseVersion = mf->GetSafeDefinition("CMAKE_ECLIPSE_VERSION"); cmsys::RegularExpression regex(".*([0-9]+\\.[0-9]+).*"); @@ -179,10 +179,10 @@ void cmExtraEclipseCDT4Generator::Generate() void cmExtraEclipseCDT4Generator::CreateSettingsResourcePrefsFile() { - const auto& lg = this->GlobalGenerator->GetLocalGenerators()[0]; + auto const& lg = this->GlobalGenerator->GetLocalGenerators()[0]; cmMakefile* mf = lg->GetMakefile(); - const std::string filename = + std::string const filename = this->HomeOutputDirectory + "/.settings/org.eclipse.core.resources.prefs"; cmGeneratedFileStream fout(filename); @@ -202,12 +202,12 @@ void cmExtraEclipseCDT4Generator::CreateSourceProjectFile() assert(this->HomeDirectory != this->HomeOutputDirectory); // set up the project name: -Source@ - const auto& lg = this->GlobalGenerator->GetLocalGenerators()[0]; + auto const& lg = this->GlobalGenerator->GetLocalGenerators()[0]; std::string name = cmExtraEclipseCDT4Generator::GenerateProjectName( lg->GetProjectName(), "Source", cmExtraEclipseCDT4Generator::GetPathBasename(this->HomeDirectory)); - const std::string filename = this->HomeDirectory + "/.project"; + std::string const filename = this->HomeDirectory + "/.project"; cmGeneratedFileStream fout(filename); if (!fout) { return; @@ -234,7 +234,7 @@ void cmExtraEclipseCDT4Generator::CreateSourceProjectFile() } void cmExtraEclipseCDT4Generator::AddEnvVar(std::ostream& out, - const char* envVar, + char const* envVar, cmLocalGenerator& lg) { cmMakefile* mf = lg.GetMakefile(); @@ -243,7 +243,7 @@ void cmExtraEclipseCDT4Generator::AddEnvVar(std::ostream& out, // figure out which one to use: std::string envVarValue; - const bool envVarSet = cmSystemTools::GetEnv(envVar, envVarValue); + bool const envVarSet = cmSystemTools::GetEnv(envVar, envVarValue); std::string cacheEntryName = cmStrCat("CMAKE_ECLIPSE_ENVVAR_", envVar); cmValue cacheValue = lg.GetState()->GetInitializedCacheValue(cacheEntryName); @@ -285,10 +285,10 @@ void cmExtraEclipseCDT4Generator::AddEnvVar(std::ostream& out, void cmExtraEclipseCDT4Generator::CreateProjectFile() { - const auto& lg = this->GlobalGenerator->GetLocalGenerators()[0]; + auto const& lg = this->GlobalGenerator->GetLocalGenerators()[0]; cmMakefile* mf = lg->GetMakefile(); - const std::string filename = this->HomeOutputDirectory + "/.project"; + std::string const filename = this->HomeOutputDirectory + "/.project"; cmGeneratedFileStream fout(filename); if (!fout) { @@ -475,7 +475,7 @@ void cmExtraEclipseCDT4Generator::WriteGroups( if (!children.empty()) { this->WriteGroups(children, linkName, xml); } - std::vector sFiles = sg.GetSourceFiles(); + std::vector sFiles = sg.GetSourceFiles(); for (cmSourceFile const* file : sFiles) { std::string const& fullPath = file->GetFullPath(); @@ -496,11 +496,11 @@ void cmExtraEclipseCDT4Generator::CreateLinksForTargets(cmXMLWriter& xml) cmExtraEclipseCDT4Generator::AppendLinkedResource( xml, linkName, "virtual:/virtual", VirtualFolder); - for (const auto& lg : this->GlobalGenerator->GetLocalGenerators()) { + for (auto const& lg : this->GlobalGenerator->GetLocalGenerators()) { cmMakefile* makefile = lg->GetMakefile(); - const auto& targets = lg->GetGeneratorTargets(); + auto const& targets = lg->GetGeneratorTargets(); - for (const auto& target : targets) { + for (auto const& target : targets) { std::string linkName2 = cmStrCat(linkName, '/'); switch (target->GetType()) { case cmStateEnums::EXECUTABLE: @@ -508,7 +508,7 @@ void cmExtraEclipseCDT4Generator::CreateLinksForTargets(cmXMLWriter& xml) case cmStateEnums::SHARED_LIBRARY: case cmStateEnums::MODULE_LIBRARY: case cmStateEnums::OBJECT_LIBRARY: { - const char* prefix = + char const* prefix = (target->GetType() == cmStateEnums::EXECUTABLE ? "[exe] " : "[lib] "); linkName2 += prefix; @@ -543,7 +543,7 @@ void cmExtraEclipseCDT4Generator::CreateLinksForTargets(cmXMLWriter& xml) } void cmExtraEclipseCDT4Generator::CreateLinksToSubprojects( - cmXMLWriter& xml, const std::string& baseDir) + cmXMLWriter& xml, std::string const& baseDir) { if (!this->GenerateLinkedResources) { return; @@ -574,7 +574,7 @@ void cmExtraEclipseCDT4Generator::CreateLinksToSubprojects( } void cmExtraEclipseCDT4Generator::AppendIncludeDirectories( - cmXMLWriter& xml, const std::vector& includeDirs, + cmXMLWriter& xml, std::vector const& includeDirs, std::set& emittedDirs) { for (std::string const& inc : includeDirs) { @@ -607,10 +607,10 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const { std::set emitted; - const auto& lg = this->GlobalGenerator->GetLocalGenerators()[0]; - const cmMakefile* mf = lg->GetMakefile(); + auto const& lg = this->GlobalGenerator->GetLocalGenerators()[0]; + cmMakefile const* mf = lg->GetMakefile(); - const std::string filename = this->HomeOutputDirectory + "/.cproject"; + std::string const filename = this->HomeOutputDirectory + "/.cproject"; cmGeneratedFileStream fout(filename); if (!fout) { @@ -753,7 +753,7 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const // add pre-processor definitions to allow eclipse to gray out sections emitted.clear(); - for (const auto& lgen : this->GlobalGenerator->GetLocalGenerators()) { + for (auto const& lgen : this->GlobalGenerator->GetLocalGenerators()) { if (cmValue cdefs = lgen->GetMakefile()->GetProperty("COMPILE_DEFINITIONS")) { @@ -860,9 +860,9 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const // include dirs emitted.clear(); - for (const auto& lgen : this->GlobalGenerator->GetLocalGenerators()) { - const auto& targets = lgen->GetGeneratorTargets(); - for (const auto& target : targets) { + for (auto const& lgen : this->GlobalGenerator->GetLocalGenerators()) { + auto const& targets = lgen->GetGeneratorTargets(); + for (auto const& target : targets) { if (target->GetType() == cmStateEnums::INTERFACE_LIBRARY) { continue; } @@ -897,8 +897,8 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const xml.Attribute("moduleId", "org.eclipse.cdt.make.core.buildtargets"); xml.StartElement("buildTargets"); emitted.clear(); - const std::string& make = mf->GetRequiredDefinition("CMAKE_MAKE_PROGRAM"); - const std::string& makeArgs = + std::string const& make = mf->GetRequiredDefinition("CMAKE_MAKE_PROGRAM"); + std::string const& makeArgs = mf->GetSafeDefinition("CMAKE_ECLIPSE_MAKE_ARGUMENTS"); cmGlobalGenerator* generator = @@ -915,15 +915,15 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const // add all executable and library targets and some of the GLOBAL // and UTILITY targets - for (const auto& lgen : this->GlobalGenerator->GetLocalGenerators()) { - const auto& targets = lgen->GetGeneratorTargets(); + for (auto const& lgen : this->GlobalGenerator->GetLocalGenerators()) { + auto const& targets = lgen->GetGeneratorTargets(); std::string subdir = lgen->MaybeRelativeToTopBinDir(lgen->GetCurrentBinaryDirectory()); if (subdir == ".") { subdir.clear(); } - for (const auto& target : targets) { + for (auto const& target : targets) { std::string targetName = target->GetName(); switch (target->GetType()) { case cmStateEnums::GLOBAL_TARGET: { @@ -954,7 +954,7 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const case cmStateEnums::SHARED_LIBRARY: case cmStateEnums::MODULE_LIBRARY: case cmStateEnums::OBJECT_LIBRARY: { - const char* prefix = + char const* prefix = (target->GetType() == cmStateEnums::EXECUTABLE ? "[exe] " : "[lib] "); cmExtraEclipseCDT4Generator::AppendTarget(xml, targetName, make, @@ -1002,7 +1002,7 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const std::vector objectFileTargets; lg->GetIndividualFileTargets(objectFileTargets); for (std::string const& f : objectFileTargets) { - const char* prefix = "[obj] "; + char const* prefix = "[obj] "; if (f.back() == 's') { prefix = "[to asm] "; } else if (f.back() == 'i') { @@ -1044,7 +1044,7 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const } std::string cmExtraEclipseCDT4Generator::GetEclipsePath( - const std::string& path) + std::string const& path) { #if defined(__CYGWIN__) std::string cmd = "cygpath -m " + path; @@ -1061,7 +1061,7 @@ std::string cmExtraEclipseCDT4Generator::GetEclipsePath( } std::string cmExtraEclipseCDT4Generator::GetPathBasename( - const std::string& path) + std::string const& path) { std::string outputBasename = path; while (!outputBasename.empty() && @@ -1077,17 +1077,17 @@ std::string cmExtraEclipseCDT4Generator::GetPathBasename( } std::string cmExtraEclipseCDT4Generator::GenerateProjectName( - const std::string& name, const std::string& type, const std::string& path) + std::string const& name, std::string const& type, std::string const& path) { return name + (type.empty() ? "" : "-") + type + "@" + path; } // Helper functions void cmExtraEclipseCDT4Generator::AppendStorageScanners( - cmXMLWriter& xml, const cmMakefile& makefile) + cmXMLWriter& xml, cmMakefile const& makefile) { // we need the "make" and the C (or C++) compiler which are used, Alex - const std::string& make = + std::string const& make = makefile.GetRequiredDefinition("CMAKE_MAKE_PROGRAM"); std::string compiler = makefile.GetSafeDefinition("CMAKE_C_COMPILER"); std::string arg1 = makefile.GetSafeDefinition("CMAKE_C_COMPILER_ARG1"); @@ -1137,9 +1137,9 @@ void cmExtraEclipseCDT4Generator::AppendStorageScanners( // without it, "asm" would be the first targets in the list, with the "to" // they are the last targets, which makes more sense. void cmExtraEclipseCDT4Generator::AppendTarget( - cmXMLWriter& xml, const std::string& target, const std::string& make, - const std::string& makeArgs, const std::string& path, const char* prefix, - const char* makeTarget) + cmXMLWriter& xml, std::string const& target, std::string const& make, + std::string const& makeArgs, std::string const& path, char const* prefix, + char const* makeTarget) { xml.StartElement("target"); xml.Attribute("name", prefix + target); @@ -1155,10 +1155,10 @@ void cmExtraEclipseCDT4Generator::AppendTarget( } void cmExtraEclipseCDT4Generator::AppendScannerProfile( - cmXMLWriter& xml, const std::string& profileID, bool openActionEnabled, - const std::string& openActionFilePath, bool pParserEnabled, - const std::string& scannerInfoProviderID, - const std::string& runActionArguments, const std::string& runActionCommand, + cmXMLWriter& xml, std::string const& profileID, bool openActionEnabled, + std::string const& openActionFilePath, bool pParserEnabled, + std::string const& scannerInfoProviderID, + std::string const& runActionArguments, std::string const& runActionCommand, bool runActionUseDefault, bool sipParserEnabled) { xml.StartElement("profile"); @@ -1190,11 +1190,11 @@ void cmExtraEclipseCDT4Generator::AppendScannerProfile( } void cmExtraEclipseCDT4Generator::AppendLinkedResource(cmXMLWriter& xml, - const std::string& name, - const std::string& path, + std::string const& name, + std::string const& path, LinkType linkType) { - const char* locationTag = "location"; + char const* locationTag = "location"; int typeTag = 2; if (linkType == VirtualFolder) // ... and not a linked folder { diff --git a/Source/cmExtraEclipseCDT4Generator.h b/Source/cmExtraEclipseCDT4Generator.h index c4ed577..4bcf25a 100644 --- a/Source/cmExtraEclipseCDT4Generator.h +++ b/Source/cmExtraEclipseCDT4Generator.h @@ -52,44 +52,44 @@ private: void CreateCProjectFile() const; // If built with cygwin cmake, convert posix to windows path. - static std::string GetEclipsePath(const std::string& path); + static std::string GetEclipsePath(std::string const& path); // Extract basename. - static std::string GetPathBasename(const std::string& path); + static std::string GetPathBasename(std::string const& path); // Generate the project name as: -@ - static std::string GenerateProjectName(const std::string& name, - const std::string& type, - const std::string& path); + static std::string GenerateProjectName(std::string const& name, + std::string const& type, + std::string const& path); // Helper functions static void AppendStorageScanners(cmXMLWriter& xml, - const cmMakefile& makefile); - static void AppendTarget(cmXMLWriter& xml, const std::string& target, - const std::string& make, - const std::string& makeArguments, - const std::string& path, const char* prefix = "", - const char* makeTarget = nullptr); + cmMakefile const& makefile); + static void AppendTarget(cmXMLWriter& xml, std::string const& target, + std::string const& make, + std::string const& makeArguments, + std::string const& path, char const* prefix = "", + char const* makeTarget = nullptr); static void AppendScannerProfile( - cmXMLWriter& xml, const std::string& profileID, bool openActionEnabled, - const std::string& openActionFilePath, bool pParserEnabled, - const std::string& scannerInfoProviderID, - const std::string& runActionArguments, const std::string& runActionCommand, + cmXMLWriter& xml, std::string const& profileID, bool openActionEnabled, + std::string const& openActionFilePath, bool pParserEnabled, + std::string const& scannerInfoProviderID, + std::string const& runActionArguments, std::string const& runActionCommand, bool runActionUseDefault, bool sipParserEnabled); - static void AppendLinkedResource(cmXMLWriter& xml, const std::string& name, - const std::string& path, LinkType linkType); + static void AppendLinkedResource(cmXMLWriter& xml, std::string const& name, + std::string const& path, LinkType linkType); static void AppendIncludeDirectories( - cmXMLWriter& xml, const std::vector& includeDirs, + cmXMLWriter& xml, std::vector const& includeDirs, std::set& emittedDirs); - static void AddEnvVar(std::ostream& out, const char* envVar, + static void AddEnvVar(std::ostream& out, char const* envVar, cmLocalGenerator& lg); void WriteGroups(std::vector const& sourceGroups, std::string& linkName, cmXMLWriter& xml); - void CreateLinksToSubprojects(cmXMLWriter& xml, const std::string& baseDir); + void CreateLinksToSubprojects(cmXMLWriter& xml, std::string const& baseDir); void CreateLinksForTargets(cmXMLWriter& xml); std::vector SrcLinkedResources; diff --git a/Source/cmExtraKateGenerator.cxx b/Source/cmExtraKateGenerator.cxx index 6e6d009..05b450a 100644 --- a/Source/cmExtraKateGenerator.cxx +++ b/Source/cmExtraKateGenerator.cxx @@ -44,8 +44,8 @@ cmExternalMakefileProjectGeneratorFactory* cmExtraKateGenerator::GetFactory() void cmExtraKateGenerator::Generate() { - const auto& lg = this->GlobalGenerator->GetLocalGenerators()[0]; - const cmMakefile* mf = lg->GetMakefile(); + auto const& lg = this->GlobalGenerator->GetLocalGenerators()[0]; + cmMakefile const* mf = lg->GetMakefile(); this->ProjectName = this->GenerateProjectName( lg->GetProjectName(), mf->GetSafeDefinition("CMAKE_BUILD_TYPE"), this->GetPathBasename(lg->GetBinaryDirectory())); @@ -58,7 +58,7 @@ void cmExtraKateGenerator::Generate() } void cmExtraKateGenerator::CreateKateProjectFile( - const cmLocalGenerator& lg) const + cmLocalGenerator const& lg) const { std::string filename = cmStrCat(lg.GetBinaryDirectory(), "/.kateproject"); cmGeneratedFileStream fout(filename); @@ -77,15 +77,15 @@ void cmExtraKateGenerator::CreateKateProjectFile( fout << "}\n"; } -void cmExtraKateGenerator::WriteTargets(const cmLocalGenerator& lg, +void cmExtraKateGenerator::WriteTargets(cmLocalGenerator const& lg, cmGeneratedFileStream& fout) const { cmMakefile const* mf = lg.GetMakefile(); - const std::string& make = mf->GetRequiredDefinition("CMAKE_MAKE_PROGRAM"); - const std::string& makeArgs = + std::string const& make = mf->GetRequiredDefinition("CMAKE_MAKE_PROGRAM"); + std::string const& makeArgs = mf->GetSafeDefinition("CMAKE_KATE_MAKE_ARGUMENTS"); std::string const& homeOutputDir = lg.GetBinaryDirectory(); - const auto configs = mf->GetGeneratorConfigs(cmMakefile::IncludeEmptyConfig); + auto const configs = mf->GetGeneratorConfigs(cmMakefile::IncludeEmptyConfig); /* clang-format off */ fout << @@ -116,12 +116,12 @@ void cmExtraKateGenerator::WriteTargets(const cmLocalGenerator& lg, // add all executable and library targets and some of the GLOBAL // and UTILITY targets - for (const auto& localGen : this->GlobalGenerator->GetLocalGenerators()) { - const auto& targets = localGen->GetGeneratorTargets(); - const std::string currentDir = localGen->GetCurrentBinaryDirectory(); + for (auto const& localGen : this->GlobalGenerator->GetLocalGenerators()) { + auto const& targets = localGen->GetGeneratorTargets(); + std::string const currentDir = localGen->GetCurrentBinaryDirectory(); bool topLevel = (currentDir == localGen->GetBinaryDirectory()); - for (const auto& target : targets) { + for (auto const& target : targets) { std::string const& targetName = target->GetName(); switch (target->GetType()) { case cmStateEnums::GLOBAL_TARGET: { @@ -194,14 +194,14 @@ void cmExtraKateGenerator::WriteTargets(const cmLocalGenerator& lg, } void cmExtraKateGenerator::AppendTarget( - cmGeneratedFileStream& fout, const std::string& target, - const std::vector& configs, const std::string& make, - const std::string& makeArgs, const std::string& path, - const std::string& homeOutputDir) const + cmGeneratedFileStream& fout, std::string const& target, + std::vector const& configs, std::string const& make, + std::string const& makeArgs, std::string const& path, + std::string const& homeOutputDir) const { static char JsonSep = ' '; - for (const std::string& conf : configs) { + for (std::string const& conf : configs) { fout << "\t\t\t" << JsonSep << R"({"name":")" << target << ((configs.size() > 1) ? (std::string(":") + conf) : std::string()) << "\", " @@ -218,7 +218,7 @@ void cmExtraKateGenerator::AppendTarget( } void cmExtraKateGenerator::CreateDummyKateProjectFile( - const cmLocalGenerator& lg) const + cmLocalGenerator const& lg) const { std::string filename = cmStrCat(lg.GetBinaryDirectory(), '/', this->ProjectName, ".kateproject"); @@ -232,15 +232,15 @@ void cmExtraKateGenerator::CreateDummyKateProjectFile( } std::string cmExtraKateGenerator::GenerateFilesString( - const cmLocalGenerator& lg) const + cmLocalGenerator const& lg) const { - const cmMakefile* mf = lg.GetMakefile(); + cmMakefile const* mf = lg.GetMakefile(); std::string mode = cmSystemTools::UpperCase(mf->GetSafeDefinition("CMAKE_KATE_FILES_MODE")); - static const std::string gitString = "\"git\": 1 "; - static const std::string svnString = "\"svn\": 1 "; - static const std::string hgString = "\"hg\": 1 "; - static const std::string fossilString = "\"fossil\": 1 "; + static std::string const gitString = "\"git\": 1 "; + static std::string const svnString = "\"svn\": 1 "; + static std::string const hgString = "\"hg\": 1 "; + static std::string const fossilString = "\"fossil\": 1 "; if (mode == "SVN") { return svnString; @@ -289,18 +289,18 @@ std::string cmExtraKateGenerator::GenerateFilesString( std::set files; std::string tmp; - const auto& lgs = this->GlobalGenerator->GetLocalGenerators(); + auto const& lgs = this->GlobalGenerator->GetLocalGenerators(); - for (const auto& lgen : lgs) { + for (auto const& lgen : lgs) { cmMakefile* makefile = lgen->GetMakefile(); - const std::vector& listFiles = makefile->GetListFiles(); + std::vector const& listFiles = makefile->GetListFiles(); for (std::string const& listFile : listFiles) { if (listFile.find("/CMakeFiles/") == std::string::npos) { files.insert(listFile); } } - for (const auto& sf : makefile->GetSourceFiles()) { + for (auto const& sf : makefile->GetSourceFiles()) { if (sf->GetIsGenerated()) { continue; } @@ -310,7 +310,7 @@ std::string cmExtraKateGenerator::GenerateFilesString( } } - const char* sep = ""; + char const* sep = ""; tmp = "\"list\": ["; for (std::string const& f : files) { tmp += sep; @@ -325,14 +325,14 @@ std::string cmExtraKateGenerator::GenerateFilesString( } std::string cmExtraKateGenerator::GenerateProjectName( - const std::string& name, const std::string& type, - const std::string& path) const + std::string const& name, std::string const& type, + std::string const& path) const { return name + (type.empty() ? "" : "-") + type + '@' + path; } std::string cmExtraKateGenerator::GetPathBasename( - const std::string& path) const + std::string const& path) const { std::string outputBasename = path; while (!outputBasename.empty() && diff --git a/Source/cmExtraKateGenerator.h b/Source/cmExtraKateGenerator.h index 203fa2f..206c812 100644 --- a/Source/cmExtraKateGenerator.h +++ b/Source/cmExtraKateGenerator.h @@ -25,21 +25,21 @@ public: void Generate() override; private: - void CreateKateProjectFile(const cmLocalGenerator& lg) const; - void CreateDummyKateProjectFile(const cmLocalGenerator& lg) const; - void WriteTargets(const cmLocalGenerator& lg, + void CreateKateProjectFile(cmLocalGenerator const& lg) const; + void CreateDummyKateProjectFile(cmLocalGenerator const& lg) const; + void WriteTargets(cmLocalGenerator const& lg, cmGeneratedFileStream& fout) const; - void AppendTarget(cmGeneratedFileStream& fout, const std::string& target, - const std::vector& configs, - const std::string& make, const std::string& makeArgs, - const std::string& path, - const std::string& homeOutputDir) const; - - std::string GenerateFilesString(const cmLocalGenerator& lg) const; - std::string GetPathBasename(const std::string& path) const; - std::string GenerateProjectName(const std::string& name, - const std::string& type, - const std::string& path) const; + void AppendTarget(cmGeneratedFileStream& fout, std::string const& target, + std::vector const& configs, + std::string const& make, std::string const& makeArgs, + std::string const& path, + std::string const& homeOutputDir) const; + + std::string GenerateFilesString(cmLocalGenerator const& lg) const; + std::string GetPathBasename(std::string const& path) const; + std::string GenerateProjectName(std::string const& name, + std::string const& type, + std::string const& path) const; std::string ProjectName; bool UseNinja; diff --git a/Source/cmExtraSublimeTextGenerator.cxx b/Source/cmExtraSublimeTextGenerator.cxx index 37c4a7c..8c3fcde 100644 --- a/Source/cmExtraSublimeTextGenerator.cxx +++ b/Source/cmExtraSublimeTextGenerator.cxx @@ -81,35 +81,35 @@ void cmExtraSublimeTextGenerator::Generate() } void cmExtraSublimeTextGenerator::CreateProjectFile( - const std::vector& lgs) + std::vector const& lgs) { std::string outputDir = lgs[0]->GetCurrentBinaryDirectory(); std::string projectName = lgs[0]->GetProjectName(); - const std::string filename = + std::string const filename = outputDir + "/" + projectName + ".sublime-project"; this->CreateNewProjectFile(lgs, filename); } void cmExtraSublimeTextGenerator::CreateNewProjectFile( - const std::vector& lgs, const std::string& filename) + std::vector const& lgs, std::string const& filename) { - const cmMakefile* mf = lgs[0]->GetMakefile(); + cmMakefile const* mf = lgs[0]->GetMakefile(); cmGeneratedFileStream fout(filename); if (!fout) { return; } - const std::string& sourceRootRelativeToOutput = cmSystemTools::RelativePath( + std::string const& sourceRootRelativeToOutput = cmSystemTools::RelativePath( lgs[0]->GetBinaryDirectory(), lgs[0]->GetSourceDirectory()); // Write the folder entries to the project file fout << "{\n"; fout << "\t\"folders\":\n\t[\n\t"; if (!sourceRootRelativeToOutput.empty()) { fout << "\t{\n\t\t\t\"path\": \"" << sourceRootRelativeToOutput << "\""; - const std::string& outputRelativeToSourceRoot = + std::string const& outputRelativeToSourceRoot = cmSystemTools::RelativePath(lgs[0]->GetSourceDirectory(), lgs[0]->GetBinaryDirectory()); if ((!outputRelativeToSourceRoot.empty()) && @@ -170,10 +170,10 @@ void cmExtraSublimeTextGenerator::CreateNewProjectFile( } void cmExtraSublimeTextGenerator::AppendAllTargets( - const std::vector& lgs, const cmMakefile* mf, + std::vector const& lgs, cmMakefile const* mf, cmGeneratedFileStream& fout, MapSourceFileFlags& sourceFileFlags) { - const std::string& make = mf->GetRequiredDefinition("CMAKE_MAKE_PROGRAM"); + std::string const& make = mf->GetRequiredDefinition("CMAKE_MAKE_PROGRAM"); std::string compiler; if (!lgs.empty()) { this->AppendTarget(fout, "all", lgs[0], nullptr, make.c_str(), mf, @@ -186,8 +186,8 @@ void cmExtraSublimeTextGenerator::AppendAllTargets( // and UTILITY targets for (cmLocalGenerator* lg : lgs) { cmMakefile* makefile = lg->GetMakefile(); - const auto& targets = lg->GetGeneratorTargets(); - for (const auto& target : targets) { + auto const& targets = lg->GetGeneratorTargets(); + for (auto const& target : targets) { std::string targetName = target->GetName(); switch (target->GetType()) { case cmStateEnums::GLOBAL_TARGET: { @@ -236,9 +236,9 @@ void cmExtraSublimeTextGenerator::AppendAllTargets( } void cmExtraSublimeTextGenerator::AppendTarget( - cmGeneratedFileStream& fout, const std::string& targetName, - cmLocalGenerator* lg, cmGeneratorTarget* target, const char* make, - const cmMakefile* makefile, const char* /*compiler*/, + cmGeneratedFileStream& fout, std::string const& targetName, + cmLocalGenerator* lg, cmGeneratorTarget* target, char const* make, + cmMakefile const* makefile, char const* /*compiler*/, MapSourceFileFlags& sourceFileFlags, bool firstTarget) { @@ -266,7 +266,7 @@ void cmExtraSublimeTextGenerator::AppendTarget( cmsys::RegularExpression flagRegex; // Regular expression to extract compiler flags from a string // https://gist.github.com/3944250 - const char* regexString = + char const* regexString = R"((^|[ ])-[DIOUWfgs][^= ]+(=\"[^"]+\"|=[^"][^ ]+)?)"; flagRegex.compile(regexString); std::string workString = @@ -311,8 +311,8 @@ void cmExtraSublimeTextGenerator::AppendTarget( // Create the command line for building the given target using the selected // make std::string cmExtraSublimeTextGenerator::BuildMakeCommand( - const std::string& make, const std::string& makefile, - const std::string& target) + std::string const& make, std::string const& makefile, + std::string const& target) { std::string command = cmStrCat('"', make, '"'); std::string generator = this->GlobalGenerator->GetName(); @@ -365,12 +365,12 @@ std::string cmExtraSublimeTextGenerator::ComputeFlagsForObject( cmGeneratorExpressionInterpreter genexInterpreter(lg, config, gtgt, language); - const std::string COMPILE_FLAGS("COMPILE_FLAGS"); + std::string const COMPILE_FLAGS("COMPILE_FLAGS"); if (cmValue cflags = source->GetProperty(COMPILE_FLAGS)) { lg->AppendFlags(flags, genexInterpreter.Evaluate(*cflags, COMPILE_FLAGS)); } - const std::string COMPILE_OPTIONS("COMPILE_OPTIONS"); + std::string const COMPILE_OPTIONS("COMPILE_OPTIONS"); if (cmValue coptions = source->GetProperty(COMPILE_OPTIONS)) { lg->AppendCompileOptions( flags, genexInterpreter.Evaluate(*coptions, COMPILE_OPTIONS)); @@ -387,14 +387,14 @@ std::string cmExtraSublimeTextGenerator::ComputeDefines( { std::set defines; cmMakefile* makefile = lg->GetMakefile(); - const std::string& language = source->GetOrDetermineLanguage(); - const std::string& config = makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"); + std::string const& language = source->GetOrDetermineLanguage(); + std::string const& config = makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"); cmGeneratorExpressionInterpreter genexInterpreter(lg, config, target, language); // Add preprocessor definitions for this target and configuration. lg->GetTargetDefines(target, config, language, defines); - const std::string COMPILE_DEFINITIONS("COMPILE_DEFINITIONS"); + std::string const COMPILE_DEFINITIONS("COMPILE_DEFINITIONS"); if (cmValue compile_defs = source->GetProperty(COMPILE_DEFINITIONS)) { lg->AppendDefines( defines, genexInterpreter.Evaluate(*compile_defs, COMPILE_DEFINITIONS)); @@ -420,13 +420,13 @@ std::string cmExtraSublimeTextGenerator::ComputeIncludes( { std::vector includes; cmMakefile* makefile = lg->GetMakefile(); - const std::string& language = source->GetOrDetermineLanguage(); - const std::string& config = makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"); + std::string const& language = source->GetOrDetermineLanguage(); + std::string const& config = makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"); cmGeneratorExpressionInterpreter genexInterpreter(lg, config, target, language); // Add include directories for this source file - const std::string INCLUDE_DIRECTORIES("INCLUDE_DIRECTORIES"); + std::string const INCLUDE_DIRECTORIES("INCLUDE_DIRECTORIES"); if (cmValue cincludes = source->GetProperty(INCLUDE_DIRECTORIES)) { lg->AppendIncludeDirectories( includes, genexInterpreter.Evaluate(*cincludes, INCLUDE_DIRECTORIES), @@ -442,8 +442,8 @@ std::string cmExtraSublimeTextGenerator::ComputeIncludes( return includesString; } -bool cmExtraSublimeTextGenerator::Open(const std::string& bindir, - const std::string& projectName, +bool cmExtraSublimeTextGenerator::Open(std::string const& bindir, + std::string const& projectName, bool dryRun) { cmValue sublExecutable = diff --git a/Source/cmExtraSublimeTextGenerator.h b/Source/cmExtraSublimeTextGenerator.h index 671b65a..61a854a 100644 --- a/Source/cmExtraSublimeTextGenerator.h +++ b/Source/cmExtraSublimeTextGenerator.h @@ -29,30 +29,30 @@ public: void Generate() override; private: - void CreateProjectFile(const std::vector& lgs); + void CreateProjectFile(std::vector const& lgs); - void CreateNewProjectFile(const std::vector& lgs, - const std::string& filename); + void CreateNewProjectFile(std::vector const& lgs, + std::string const& filename); /** Appends all targets as build systems to the project file and get all * include directories and compiler definitions used. */ - void AppendAllTargets(const std::vector& lgs, - const cmMakefile* mf, cmGeneratedFileStream& fout, + void AppendAllTargets(std::vector const& lgs, + cmMakefile const* mf, cmGeneratedFileStream& fout, MapSourceFileFlags& sourceFileFlags); /** Returns the build command that needs to be executed to build the * specified target. */ - std::string BuildMakeCommand(const std::string& make, - const std::string& makefile, - const std::string& target); + std::string BuildMakeCommand(std::string const& make, + std::string const& makefile, + std::string const& target); /** Appends the specified target to the generated project file as a Sublime * Text build system. */ - void AppendTarget(cmGeneratedFileStream& fout, const std::string& targetName, + void AppendTarget(cmGeneratedFileStream& fout, std::string const& targetName, cmLocalGenerator* lg, cmGeneratorTarget* target, - const char* make, const cmMakefile* makefile, - const char* compiler, MapSourceFileFlags& sourceFileFlags, + char const* make, cmMakefile const* makefile, + char const* compiler, MapSourceFileFlags& sourceFileFlags, bool firstTarget); /** * Compute the flags for compilation of object files for a given @a language. @@ -68,7 +68,7 @@ private: std::string ComputeIncludes(cmSourceFile* source, cmLocalGenerator* lg, cmGeneratorTarget* gtgt); - bool Open(const std::string& bindir, const std::string& projectName, + bool Open(std::string const& bindir, std::string const& projectName, bool dryRun) override; bool ExcludeBuildFolder; diff --git a/Source/cmFLTKWrapUICommand.cxx b/Source/cmFLTKWrapUICommand.cxx index 373a3cf..6be932d 100644 --- a/Source/cmFLTKWrapUICommand.cxx +++ b/Source/cmFLTKWrapUICommand.cxx @@ -23,7 +23,7 @@ class cmListFileBacktrace; class cmTarget; static void FinalAction(cmMakefile& makefile, std::string const& name, - const cmListFileBacktrace& lfbt) + cmListFileBacktrace const& lfbt) { // people should add the srcs to the target themselves, but the old command // didn't support that, so check and see if they added the files in and if @@ -131,7 +131,7 @@ bool cmFLTKWrapUICommand(std::vector const& args, mf.AddDefinition(varName, sourceListValue); mf.AddGeneratorAction( - [target](cmLocalGenerator& lg, const cmListFileBacktrace& lfbt) { + [target](cmLocalGenerator& lg, cmListFileBacktrace const& lfbt) { FinalAction(*lg.GetMakefile(), target, lfbt); }); return true; diff --git a/Source/cmFSPermissions.h b/Source/cmFSPermissions.h index 78f2240..0a24784 100644 --- a/Source/cmFSPermissions.h +++ b/Source/cmFSPermissions.h @@ -12,29 +12,29 @@ namespace cmFSPermissions { // Table of permissions flags. #if defined(_WIN32) && !defined(__CYGWIN__) -static const mode_t mode_owner_read = S_IREAD; -static const mode_t mode_owner_write = S_IWRITE; -static const mode_t mode_owner_execute = S_IEXEC; -static const mode_t mode_group_read = 040; -static const mode_t mode_group_write = 020; -static const mode_t mode_group_execute = 010; -static const mode_t mode_world_read = 04; -static const mode_t mode_world_write = 02; -static const mode_t mode_world_execute = 01; -static const mode_t mode_setuid = 04000; -static const mode_t mode_setgid = 02000; +static mode_t const mode_owner_read = S_IREAD; +static mode_t const mode_owner_write = S_IWRITE; +static mode_t const mode_owner_execute = S_IEXEC; +static mode_t const mode_group_read = 040; +static mode_t const mode_group_write = 020; +static mode_t const mode_group_execute = 010; +static mode_t const mode_world_read = 04; +static mode_t const mode_world_write = 02; +static mode_t const mode_world_execute = 01; +static mode_t const mode_setuid = 04000; +static mode_t const mode_setgid = 02000; #else -static const mode_t mode_owner_read = S_IRUSR; -static const mode_t mode_owner_write = S_IWUSR; -static const mode_t mode_owner_execute = S_IXUSR; -static const mode_t mode_group_read = S_IRGRP; -static const mode_t mode_group_write = S_IWGRP; -static const mode_t mode_group_execute = S_IXGRP; -static const mode_t mode_world_read = S_IROTH; -static const mode_t mode_world_write = S_IWOTH; -static const mode_t mode_world_execute = S_IXOTH; -static const mode_t mode_setuid = S_ISUID; -static const mode_t mode_setgid = S_ISGID; +static mode_t const mode_owner_read = S_IRUSR; +static mode_t const mode_owner_write = S_IWUSR; +static mode_t const mode_owner_execute = S_IXUSR; +static mode_t const mode_group_read = S_IRGRP; +static mode_t const mode_group_write = S_IWGRP; +static mode_t const mode_group_execute = S_IXGRP; +static mode_t const mode_world_read = S_IROTH; +static mode_t const mode_world_write = S_IWOTH; +static mode_t const mode_world_execute = S_IXOTH; +static mode_t const mode_setuid = S_ISUID; +static mode_t const mode_setgid = S_ISGID; #endif bool stringToModeT(std::string const& arg, mode_t& permissions); diff --git a/Source/cmFileAPI.cxx b/Source/cmFileAPI.cxx index b45c285..ba2167b 100644 --- a/Source/cmFileAPI.cxx +++ b/Source/cmFileAPI.cxx @@ -457,10 +457,10 @@ Json::Value const& cmFileAPI::AddReplyIndexObject(Object const& o) return indexEntry; } -const char* cmFileAPI::ObjectKindName(ObjectKind kind) +char const* cmFileAPI::ObjectKindName(ObjectKind kind) { // Keep in sync with ObjectKind enum. - static const char* objectKindNames[] = { + static char const* objectKindNames[] = { "codemodel", // "configureLog", // "cache", // diff --git a/Source/cmFileAPI.h b/Source/cmFileAPI.h index ace19ee..057c481 100644 --- a/Source/cmFileAPI.h +++ b/Source/cmFileAPI.h @@ -180,7 +180,7 @@ private: static Json::Value BuildReplyError(std::string const& error); Json::Value const& AddReplyIndexObject(Object const& o); - static const char* ObjectKindName(ObjectKind kind); + static char const* ObjectKindName(ObjectKind kind); static std::string ObjectName(Object const& o); static Json::Value BuildVersion(unsigned int major, unsigned int minor); diff --git a/Source/cmFileAPICMakeFiles.cxx b/Source/cmFileAPICMakeFiles.cxx index bc80319..acdf55d 100644 --- a/Source/cmFileAPICMakeFiles.cxx +++ b/Source/cmFileAPICMakeFiles.cxx @@ -76,7 +76,7 @@ Json::Value CMakeFiles::DumpInputs() cmGlobalGenerator* gg = this->FileAPI.GetCMakeInstance()->GetGlobalGenerator(); - for (const auto& lg : gg->GetLocalGenerators()) { + for (auto const& lg : gg->GetLocalGenerators()) { cmMakefile const* mf = lg->GetMakefile(); for (std::string const& file : mf->GetListFiles()) { inputs.append(this->DumpInput(file)); diff --git a/Source/cmFileAPICodemodel.cxx b/Source/cmFileAPICodemodel.cxx index 496f12a..ae2e80f 100644 --- a/Source/cmFileAPICodemodel.cxx +++ b/Source/cmFileAPICodemodel.cxx @@ -257,7 +257,7 @@ class CodemodelConfig struct Project { cmStateSnapshot Snapshot; - static const Json::ArrayIndex NoParentIndex = + static Json::ArrayIndex const NoParentIndex = static_cast(-1); Json::ArrayIndex ParentIndex = NoParentIndex; Json::Value ChildIndexes = Json::arrayValue; @@ -505,7 +505,7 @@ class Target Json::Value DumpDependencies(); Json::Value DumpDependency(cmTargetDepend const& td); Json::Value DumpFolder(); - Json::Value DumpLauncher(const char* name, const char* type); + Json::Value DumpLauncher(char const* name, char const* type); Json::Value DumpLaunchers(); Json::Value DumpDebugger(); @@ -544,7 +544,7 @@ Json::Value Codemodel::DumpConfigurations() Json::Value configurations = Json::arrayValue; cmGlobalGenerator* gg = this->FileAPI.GetCMakeInstance()->GetGlobalGenerator(); - const auto& makefiles = gg->GetMakefiles(); + auto const& makefiles = gg->GetMakefiles(); if (!makefiles.empty()) { std::vector const& configs = makefiles[0]->GetGeneratorConfigs(cmMakefile::IncludeEmptyConfig); @@ -591,7 +591,7 @@ void CodemodelConfig::ProcessDirectories() // Add directories in forward order to process parents before children. this->Directories.reserve(localGens.size()); - for (const auto& lg : localGens) { + for (auto const& lg : localGens) { auto directoryIndex = static_cast(this->Directories.size()); this->Directories.emplace_back(); @@ -610,7 +610,7 @@ void CodemodelConfig::ProcessDirectories() Directory& d = *di; // Accumulate the presence of install rules on the way up. - for (const auto& gen : + for (auto const& gen : d.LocalGenerator->GetMakefile()->GetInstallGenerators()) { if (!dynamic_cast(gen.get())) { d.HasInstallRule = true; @@ -673,7 +673,7 @@ Json::Value CodemodelConfig::DumpTargets() std::vector targetList; cmGlobalGenerator* gg = this->FileAPI.GetCMakeInstance()->GetGlobalGenerator(); - for (const auto& lg : gg->GetLocalGenerators()) { + for (auto const& lg : gg->GetLocalGenerators()) { cm::append(targetList, lg->GetGeneratorTargets()); } std::sort(targetList.begin(), targetList.end(), @@ -889,7 +889,7 @@ Json::Value DirectoryObject::DumpPaths() Json::Value DirectoryObject::DumpInstallers() { Json::Value installers = Json::arrayValue; - for (const auto& gen : this->LG->GetMakefile()->GetInstallGenerators()) { + for (auto const& gen : this->LG->GetMakefile()->GetInstallGenerators()) { Json::Value installer = this->DumpInstaller(gen.get()); if (!installer.empty()) { installers.append(std::move(installer)); // NOLINT(*) @@ -1367,12 +1367,12 @@ CompileData Target::BuildCompileData(cmSourceFile* sf) cmGeneratorExpressionInterpreter genexInterpreter(lg, this->Config, this->GT, fd.Language); - const std::string COMPILE_FLAGS("COMPILE_FLAGS"); + std::string const COMPILE_FLAGS("COMPILE_FLAGS"); if (cmValue cflags = sf->GetProperty(COMPILE_FLAGS)) { std::string flags = genexInterpreter.Evaluate(*cflags, COMPILE_FLAGS); fd.Flags.emplace_back(std::move(flags), JBTIndex()); } - const std::string COMPILE_OPTIONS("COMPILE_OPTIONS"); + std::string const COMPILE_OPTIONS("COMPILE_OPTIONS"); for (BT tmpOpt : sf->GetCompileOptions()) { tmpOpt.Value = genexInterpreter.Evaluate(tmpOpt.Value, COMPILE_OPTIONS); // After generator evaluation we need to use the AppendCompileOptions @@ -1389,8 +1389,8 @@ CompileData Target::BuildCompileData(cmSourceFile* sf) this->GT->GetPchArchs(this->Config, fd.Language); std::unordered_map pchSources; - for (const std::string& arch : pchArchs) { - const std::string pchSource = + for (std::string const& arch : pchArchs) { + std::string const pchSource = this->GT->GetPchSource(this->Config, fd.Language, arch); if (!pchSource.empty()) { pchSources.insert(std::make_pair(pchSource, arch)); @@ -1422,7 +1422,7 @@ CompileData Target::BuildCompileData(cmSourceFile* sf) // Add include directories from source file properties. { - const std::string INCLUDE_DIRECTORIES("INCLUDE_DIRECTORIES"); + std::string const INCLUDE_DIRECTORIES("INCLUDE_DIRECTORIES"); for (BT tmpInclude : sf->GetIncludeDirectories()) { tmpInclude.Value = genexInterpreter.Evaluate(tmpInclude.Value, INCLUDE_DIRECTORIES); @@ -1444,7 +1444,7 @@ CompileData Target::BuildCompileData(cmSourceFile* sf) } } - const std::string COMPILE_DEFINITIONS("COMPILE_DEFINITIONS"); + std::string const COMPILE_DEFINITIONS("COMPILE_DEFINITIONS"); std::set> fileDefines; for (BT tmpDef : sf->GetCompileDefinitions()) { tmpDef.Value = @@ -1454,14 +1454,14 @@ CompileData Target::BuildCompileData(cmSourceFile* sf) // so we handle situations where backtrace entries have lists. std::set tmp; lg->AppendDefines(tmp, tmpDef.Value); - for (const std::string& i : tmp) { + for (std::string const& i : tmp) { BT def(i, tmpDef.Backtrace); fileDefines.insert(def); } } std::set configFileDefines; - const std::string defPropName = + std::string const defPropName = "COMPILE_DEFINITIONS_" + cmSystemTools::UpperCase(this->Config); if (cmValue config_defs = sf->GetProperty(defPropName)) { lg->AppendDefines( @@ -1901,7 +1901,7 @@ Json::Value Target::DumpArtifacts() this->GT->GetObjectSources(objectSources, this->Config); std::string const obj_dir = this->GT->GetObjectDirectory(this->Config); for (cmSourceFile const* sf : objectSources) { - const std::string& obj = this->GT->GetObjectName(sf); + std::string const& obj = this->GT->GetObjectName(sf); Json::Value artifact = Json::objectValue; artifact["path"] = RelativeIfUnder(this->TopBuild, obj_dir + obj); artifacts.append(std::move(artifact)); // NOLINT(*) @@ -2090,7 +2090,7 @@ Json::Value Target::DumpFolder() return folder; } -Json::Value Target::DumpLauncher(const char* name, const char* type) +Json::Value Target::DumpLauncher(char const* name, char const* type) { cmValue property = this->GT->GetProperty(name); Json::Value launcher; diff --git a/Source/cmFileAPICommand.cxx b/Source/cmFileAPICommand.cxx index d051c9c..f0b336c 100644 --- a/Source/cmFileAPICommand.cxx +++ b/Source/cmFileAPICommand.cxx @@ -30,7 +30,7 @@ bool isCharDigit(char ch) std::string processObjectKindVersions(cmFileAPI& fileApi, cmFileAPI::ObjectKind objectKind, cm::string_view keyword, - const std::vector& versions) + std::vector const& versions) { // The "versions" vector is empty only when the keyword was not present. // It is an error to provide the keyword with no versions after it, and that @@ -40,8 +40,8 @@ std::string processObjectKindVersions(cmFileAPI& fileApi, } // The first supported version listed is what we use - for (const std::string& ver : versions) { - const char* vStart = ver.c_str(); + for (std::string const& ver : versions) { + char const* vStart = ver.c_str(); int majorVersion = std::atoi(vStart); int minorVersion = 0; std::string::size_type pos = ver.find('.'); @@ -106,7 +106,7 @@ bool handleQueryCommand(std::vector const& args, status.SetError("QUERY subcommand given a non-integer API_VERSION."); return false; } - const int apiVersion = std::atoi(arguments.ApiVersion.c_str()); + int const apiVersion = std::atoi(arguments.ApiVersion.c_str()); if (apiVersion != 1) { status.SetError( cmStrCat("QUERY subcommand given an unsupported API_VERSION \"", @@ -136,9 +136,9 @@ bool handleQueryCommand(std::vector const& args, }; if (!std::all_of(errors.begin(), errors.end(), - [](const std::string& s) -> bool { return s.empty(); })) { + [](std::string const& s) -> bool { return s.empty(); })) { std::string message("QUERY subcommand was given invalid arguments:"); - for (const std::string& s : errors) { + for (std::string const& s : errors) { if (!s.empty()) { message = cmStrCat(message, "\n ", s); } diff --git a/Source/cmFileAPIToolchains.cxx b/Source/cmFileAPIToolchains.cxx index a51ae20..2dc718c 100644 --- a/Source/cmFileAPIToolchains.cxx +++ b/Source/cmFileAPIToolchains.cxx @@ -73,14 +73,14 @@ Json::Value Toolchains::DumpToolchains() Json::Value Toolchains::DumpToolchain(std::string const& lang) { - static const std::vector CompilerVariables{ + static std::vector const CompilerVariables{ { "path", "COMPILER", false }, { "id", "COMPILER_ID", false }, { "version", "COMPILER_VERSION", false }, { "target", "COMPILER_TARGET", false }, }; - static const std::vector CompilerImplicitVariables{ + static std::vector const CompilerImplicitVariables{ { "includeDirectories", "IMPLICIT_INCLUDE_DIRECTORIES", true }, { "linkDirectories", "IMPLICIT_LINK_DIRECTORIES", true }, { "linkFrameworkDirectories", "IMPLICIT_LINK_FRAMEWORK_DIRECTORIES", @@ -88,11 +88,11 @@ Json::Value Toolchains::DumpToolchain(std::string const& lang) { "linkLibraries", "IMPLICIT_LINK_LIBRARIES", true }, }; - static const ToolchainVariable SourceFileExtensionsVariable{ + static ToolchainVariable const SourceFileExtensionsVariable{ "sourceFileExtensions", "SOURCE_FILE_EXTENSIONS", true }; - const auto& mf = + auto const& mf = this->FileAPI.GetCMakeInstance()->GetGlobalGenerator()->GetMakefiles()[0]; Json::Value toolchain = Json::objectValue; toolchain["language"] = lang; @@ -110,7 +110,7 @@ Json::Value Toolchains::DumpToolchainVariables( std::vector const& variables) { Json::Value object = Json::objectValue; - for (const auto& variable : variables) { + for (auto const& variable : variables) { this->DumpToolchainVariable(mf, object, lang, variable); } return object; diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 9eec090..19afd4f 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -525,7 +525,7 @@ bool HandleStringsCommand(std::vector const& args, current_str += static_cast(c); } else if (encoding == encoding_utf8) { // Check for UTF-8 encoded string (up to 4 octets) - static const unsigned char utf8_check_table[3][2] = { + static unsigned char const utf8_check_table[3][2] = { { 0xE0, 0xC0 }, { 0xF0, 0xE0 }, { 0xF8, 0xF0 }, @@ -638,7 +638,7 @@ bool HandleStringsCommand(std::vector const& args, } // Encode the result in a CMake list. - const char* sep = ""; + char const* sep = ""; std::string output; for (std::string const& sr : strings) { // Separate the strings in the output to make it a list. @@ -685,7 +685,7 @@ bool HandleGlobImpl(std::vector const& args, bool recurse, std::vector files; bool configureDepends = false; bool warnConfigureLate = false; - const cmake::WorkingMode workingMode = cm->GetWorkingMode(); + cmake::WorkingMode const workingMode = cm->GetWorkingMode(); while (i != args.end()) { if (*i == "LIST_DIRECTORIES") { ++i; // skip LIST_DIRECTORIES @@ -878,7 +878,7 @@ bool HandleMakeDirectoryCommand(std::vector const& args, for (std::string const& arg : cmMakeRange(args).advance(1)) // Get rid of subcommand { - const std::string* cdir = &arg; + std::string const* cdir = &arg; if (!cmsys::SystemTools::FileIsFullPath(arg)) { expr = cmStrCat(status.GetMakefile().GetCurrentSourceDirectory(), '/', arg); @@ -966,9 +966,9 @@ bool HandleDifferentCommand(std::vector const& args, */ // Evaluate arguments. - const char* file_lhs = nullptr; - const char* file_rhs = nullptr; - const char* var = nullptr; + char const* file_lhs = nullptr; + char const* file_rhs = nullptr; + char const* var = nullptr; enum Doing { DoingNone, @@ -1004,7 +1004,7 @@ bool HandleDifferentCommand(std::vector const& args, } // Compare the files. - const char* result = + char const* result = cmSystemTools::FilesDiffer(file_lhs, file_rhs) ? "1" : "0"; status.GetMakefile().AddDefinition(var, result); return true; @@ -1412,9 +1412,9 @@ bool HandleRelativePathCommand(std::vector const& args, return false; } - const std::string& outVar = args[1]; - const std::string& directoryName = args[2]; - const std::string& fileName = args[3]; + std::string const& outVar = args[1]; + std::string const& directoryName = args[2]; + std::string const& fileName = args[3]; if (!cmSystemTools::FileIsFullPath(directoryName)) { std::string errstring = @@ -1641,9 +1641,9 @@ bool HandleRemoveRecurse(std::vector const& args, return HandleRemoveImpl(args, true, status); } -std::string ToNativePath(const std::string& path) +std::string ToNativePath(std::string const& path) { - const auto& outPath = cmSystemTools::ConvertToOutputPath(path); + auto const& outPath = cmSystemTools::ConvertToOutputPath(path); if (outPath.size() > 1 && outPath.front() == '\"' && outPath.back() == '\"') { return outPath.substr(1, outPath.size() - 2); @@ -1651,7 +1651,7 @@ std::string ToNativePath(const std::string& path) return outPath; } -std::string ToCMakePath(const std::string& path) +std::string ToCMakePath(std::string const& path) { auto temp = path; cmSystemTools::ConvertToUnixSlashes(temp); @@ -1693,8 +1693,8 @@ bool HandleNativePathCommand(std::vector const& args, #if !defined(CMAKE_BOOTSTRAP) -const bool TLS_VERIFY_DEFAULT = true; -const std::string TLS_VERSION_DEFAULT = "1.2"; +bool const TLS_VERIFY_DEFAULT = true; +std::string const TLS_VERSION_DEFAULT = "1.2"; // Stuff for curl download/upload using cmFileCommandVectorOfChar = std::vector; @@ -1704,7 +1704,7 @@ size_t cmWriteToFileCallback(void* ptr, size_t size, size_t nmemb, void* data) int realsize = static_cast(size * nmemb); cmsys::ofstream* fout = static_cast(data); if (fout) { - const char* chPtr = static_cast(ptr); + char const* chPtr = static_cast(ptr); fout->write(chPtr, realsize); } return realsize; @@ -1714,7 +1714,7 @@ size_t cmWriteToMemoryCallback(void* ptr, size_t size, size_t nmemb, void* data) { int realsize = static_cast(size * nmemb); - const char* chPtr = static_cast(ptr); + char const* chPtr = static_cast(ptr); cm::append(*static_cast(data), chPtr, chPtr + realsize); return realsize; @@ -1750,17 +1750,17 @@ int cmFileCommandCurlDebugCallback(CURL*, curl_infotype type, char* chPtr, } # if defined(LIBCURL_VERSION_NUM) && LIBCURL_VERSION_NUM >= 0x072000 -const CURLoption CM_CURLOPT_XFERINFOFUNCTION = CURLOPT_XFERINFOFUNCTION; +CURLoption const CM_CURLOPT_XFERINFOFUNCTION = CURLOPT_XFERINFOFUNCTION; using cm_curl_off_t = curl_off_t; # else -const CURLoption CM_CURLOPT_XFERINFOFUNCTION = CURLOPT_PROGRESSFUNCTION; +CURLoption const CM_CURLOPT_XFERINFOFUNCTION = CURLOPT_PROGRESSFUNCTION; using cm_curl_off_t = double; # endif class cURLProgressHelper { public: - cURLProgressHelper(cmMakefile* mf, const char* text) + cURLProgressHelper(cmMakefile* mf, char const* text) : Makefile(mf) , Text(text) { @@ -1849,8 +1849,8 @@ public: } } - cURLEasyGuard(const cURLEasyGuard&) = delete; - cURLEasyGuard& operator=(const cURLEasyGuard&) = delete; + cURLEasyGuard(cURLEasyGuard const&) = delete; + cURLEasyGuard& operator=(cURLEasyGuard const&) = delete; void release() { this->Easy = nullptr; } @@ -2193,7 +2193,7 @@ bool HandleDownloadCommand(std::vector const& args, check_curl_result(res, "DOWNLOAD cannot set TLS/SSL Verify off: "); } - for (const auto& range : curl_ranges) { + for (auto const& range : curl_ranges) { std::string curl_range = range.first + '-' + (range.second.has_value() ? range.second.value() : ""); res = ::curl_easy_setopt(curl, CURLOPT_RANGE, curl_range.c_str()); @@ -2732,11 +2732,11 @@ bool HandleUploadCommand(std::vector const& args, #endif } -void AddEvaluationFile(const std::string& inputName, - const std::string& targetName, - const std::string& outputExpr, - const std::string& condition, bool inputIsContent, - const std::string& newLineCharacter, mode_t permissions, +void AddEvaluationFile(std::string const& inputName, + std::string const& targetName, + std::string const& outputExpr, + std::string const& condition, bool inputIsContent, + std::string const& newLineCharacter, mode_t permissions, cmExecutionStatus& status) { cmListFileBacktrace lfbt = status.GetMakefile().GetBacktrace(); @@ -2814,7 +2814,7 @@ bool HandleGenerateCommand(std::vector const& args, status.SetError("GENERATE requires INPUT or CONTENT option."); return false; } - const bool inputIsContent = arguments.ParsedKeywords[1] == "CONTENT"_s; + bool const inputIsContent = arguments.ParsedKeywords[1] == "CONTENT"_s; if (!inputIsContent && arguments.ParsedKeywords[1] != "INPUT") { status.SetError("Unknown argument to GENERATE subcommand."); return false; @@ -2942,7 +2942,7 @@ bool HandleLockCommand(std::vector const& args, release = true; } else if (args[i] == "GUARD") { ++i; - const char* merr = "expected FUNCTION, FILE or PROCESS after GUARD"; + char const* merr = "expected FUNCTION, FILE or PROCESS after GUARD"; if (i >= args.size()) { status.GetMakefile().IssueMessage(MessageType::FATAL_ERROR, merr); return false; @@ -3047,7 +3047,7 @@ bool HandleLockCommand(std::vector const& args, } } - const std::string result = fileLockResult.GetOutputMessage(); + std::string const result = fileLockResult.GetOutputMessage(); if (resultVariable.empty() && !fileLockResult.IsOk()) { status.GetMakefile().IssueMessage( @@ -3089,7 +3089,7 @@ bool HandleTimestampCommand(std::vector const& args, filename); } - const std::string& outputVariable = args[argsIndex++]; + std::string const& outputVariable = args[argsIndex++]; std::string formatString; if (args.size() > argsIndex && args[argsIndex] != "UTC") { @@ -3127,9 +3127,9 @@ bool HandleSizeCommand(std::vector const& args, unsigned int argsIndex = 1; - const std::string& filename = args[argsIndex++]; + std::string const& filename = args[argsIndex++]; - const std::string& outputVariable = args[argsIndex++]; + std::string const& outputVariable = args[argsIndex++]; if (!cmSystemTools::FileExists(filename, true)) { status.SetError( @@ -3152,8 +3152,8 @@ bool HandleReadSymlinkCommand(std::vector const& args, return false; } - const std::string& filename = args[1]; - const std::string& outputVariable = args[2]; + std::string const& filename = args[1]; + std::string const& outputVariable = args[2]; std::string result; if (!cmSystemTools::ReadSymlink(filename, result)) { @@ -3555,9 +3555,9 @@ bool HandleConfigureCommand(std::vector const& args, makeFile.AddCMakeOutputFile(outputFile); // Create output directory - const std::string::size_type slashPos = outputFile.rfind('/'); + std::string::size_type const slashPos = outputFile.rfind('/'); if (slashPos != std::string::npos) { - const std::string path = outputFile.substr(0, slashPos); + std::string const path = outputFile.substr(0, slashPos); cmSystemTools::MakeDirectory(path); } @@ -3644,7 +3644,7 @@ bool HandleArchiveCreateCommand(std::vector const& args, return true; } - const char* knownFormats[] = { + char const* knownFormats[] = { "7zip", "gnutar", "pax", "paxr", "raw", "zip" }; @@ -3656,7 +3656,7 @@ bool HandleArchiveCreateCommand(std::vector const& args, return false; } - const char* zipFileFormats[] = { "7zip", "zip" }; + char const* zipFileFormats[] = { "7zip", "zip" }; if (!parsedArgs.Compression.empty() && cm::contains(zipFileFormats, parsedArgs.Format)) { status.SetError(cmStrCat("archive format ", parsedArgs.Format, @@ -3832,7 +3832,7 @@ bool ValidateAndConvertPermissions( if (!permissions) { return true; } - for (const auto& i : *permissions) { + for (auto const& i : *permissions) { if (!cmFSPermissions::stringToModeT(i, perms)) { status.SetError(i + " is an invalid permission specifier"); cmSystemTools::SetFatalErrorOccurred(); @@ -3842,7 +3842,7 @@ bool ValidateAndConvertPermissions( return true; } -bool SetPermissions(const std::string& filename, const mode_t& perms, +bool SetPermissions(std::string const& filename, mode_t const& perms, cmExecutionStatus& status) { if (!cmSystemTools::SetPermissions(filename, perms)) { @@ -3922,7 +3922,7 @@ bool HandleChmodCommandImpl(std::vector const& args, bool recurse, if (recurse) { std::vector tempPathEntries; - for (const auto& i : pathEntries) { + for (auto const& i : pathEntries) { if (cmSystemTools::FileIsDirectory(i)) { globber.FindFiles(i + "/*"); tempPathEntries = globber.GetFiles(); @@ -3938,7 +3938,7 @@ bool HandleChmodCommandImpl(std::vector const& args, bool recurse, } // chmod - for (const auto& i : allPathEntries) { + for (auto const& i : allPathEntries) { if (!(cmSystemTools::FileExists(i) || cmSystemTools::FileIsDirectory(i))) { status.SetError(cmStrCat("does not exist:\n ", i)); cmSystemTools::SetFatalErrorOccurred(); @@ -3947,7 +3947,7 @@ bool HandleChmodCommandImpl(std::vector const& args, bool recurse, if (cmSystemTools::FileExists(i, true)) { bool success = true; - const mode_t& filePermissions = + mode_t const& filePermissions = parsedArgs.FilePermissions ? fperms : perms; if (filePermissions) { success = SetPermissions(i, filePermissions, status); @@ -3959,7 +3959,7 @@ bool HandleChmodCommandImpl(std::vector const& args, bool recurse, else if (cmSystemTools::FileIsDirectory(i)) { bool success = true; - const mode_t& directoryPermissions = + mode_t const& directoryPermissions = parsedArgs.DirectoryPermissions ? dperms : perms; if (directoryPermissions) { success = SetPermissions(i, directoryPermissions, status); diff --git a/Source/cmFileCopier.cxx b/Source/cmFileCopier.cxx index 47d3d51..642aa93 100644 --- a/Source/cmFileCopier.cxx +++ b/Source/cmFileCopier.cxx @@ -28,7 +28,7 @@ using namespace cmFSPermissions; -cmFileCopier::cmFileCopier(cmExecutionStatus& status, const char* name) +cmFileCopier::cmFileCopier(cmExecutionStatus& status, char const* name) : Status(status) , Makefile(&status.GetMakefile()) , Name(name) @@ -38,13 +38,13 @@ cmFileCopier::cmFileCopier(cmExecutionStatus& status, const char* name) cmFileCopier::~cmFileCopier() = default; cmFileCopier::MatchProperties cmFileCopier::CollectMatchProperties( - const std::string& file) + std::string const& file) { // Match rules are case-insensitive on some platforms. #if defined(_WIN32) || defined(__APPLE__) || defined(__CYGWIN__) - const std::string file_to_match = cmSystemTools::LowerCase(file); + std::string const file_to_match = cmSystemTools::LowerCase(file); #else - const std::string& file_to_match = file; + std::string const& file_to_match = file; #endif // Collect properties from all matching rules. @@ -63,7 +63,7 @@ cmFileCopier::MatchProperties cmFileCopier::CollectMatchProperties( return result; } -bool cmFileCopier::SetPermissions(const std::string& toFile, +bool cmFileCopier::SetPermissions(std::string const& toFile, mode_t permissions) { if (permissions) { @@ -116,7 +116,7 @@ std::string const& cmFileCopier::ToName(std::string const& fromName) return fromName; } -bool cmFileCopier::ReportMissing(const std::string& fromFile) +bool cmFileCopier::ReportMissing(std::string const& fromFile) { // The input file does not exist and installation is not optional. this->Status.SetError(cmStrCat(this->Name, " cannot find \"", fromFile, @@ -171,7 +171,7 @@ bool cmFileCopier::GetDefaultDirectoryPermissions(mode_t** mode) "CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS"); if (cmNonempty(default_dir_install_permissions)) { cmList items{ *default_dir_install_permissions }; - for (const auto& arg : items) { + for (auto const& arg : items) { if (!this->CheckPermissions(arg, **mode)) { this->Status.SetError( " Set with CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS variable."); @@ -438,8 +438,8 @@ bool cmFileCopier::Run(std::vector const& args) return true; } -bool cmFileCopier::Install(const std::string& fromFile, - const std::string& toFile) +bool cmFileCopier::Install(std::string const& fromFile, + std::string const& toFile) { if (fromFile.empty()) { this->Status.SetError( @@ -525,8 +525,8 @@ bool cmFileCopier::InstallSymlinkChain(std::string& fromFile, return true; } -bool cmFileCopier::InstallSymlink(const std::string& fromFile, - const std::string& toFile) +bool cmFileCopier::InstallSymlink(std::string const& fromFile, + std::string const& toFile) { // Read the original symlink. std::string symlinkTarget; @@ -589,8 +589,8 @@ bool cmFileCopier::InstallSymlink(const std::string& fromFile, return true; } -bool cmFileCopier::InstallFile(const std::string& fromFile, - const std::string& toFile, +bool cmFileCopier::InstallFile(std::string const& fromFile, + std::string const& toFile, MatchProperties match_properties) { // Determine whether we will copy the file. @@ -647,8 +647,8 @@ bool cmFileCopier::InstallFile(const std::string& fromFile, return this->SetPermissions(toFile, permissions); } -bool cmFileCopier::InstallDirectory(const std::string& source, - const std::string& destination, +bool cmFileCopier::InstallDirectory(std::string const& source, + std::string const& destination, MatchProperties match_properties) { // Inform the user about this directory installation. diff --git a/Source/cmFileCopier.h b/Source/cmFileCopier.h index 1fd2062..43c5416 100644 --- a/Source/cmFileCopier.h +++ b/Source/cmFileCopier.h @@ -19,7 +19,7 @@ class cmMakefile; // File installation helper class. struct cmFileCopier { - cmFileCopier(cmExecutionStatus& status, const char* name = "COPY"); + cmFileCopier(cmExecutionStatus& status, char const* name = "COPY"); virtual ~cmFileCopier(); bool Run(std::vector const& args); @@ -27,7 +27,7 @@ struct cmFileCopier protected: cmExecutionStatus& Status; cmMakefile* Makefile; - const char* Name; + char const* Name; bool Always = false; cmFileTimeCache FileTimes; @@ -58,22 +58,22 @@ protected: std::vector MatchRules; // Get the properties from rules matching this input file. - MatchProperties CollectMatchProperties(const std::string& file); + MatchProperties CollectMatchProperties(std::string const& file); - bool SetPermissions(const std::string& toFile, mode_t permissions); + bool SetPermissions(std::string const& toFile, mode_t permissions); // Translate an argument to a permissions bit. bool CheckPermissions(std::string const& arg, mode_t& permissions); bool InstallSymlinkChain(std::string& fromFile, std::string& toFile); - bool InstallSymlink(const std::string& fromFile, const std::string& toFile); - virtual bool InstallFile(const std::string& fromFile, - const std::string& toFile, + bool InstallSymlink(std::string const& fromFile, std::string const& toFile); + virtual bool InstallFile(std::string const& fromFile, + std::string const& toFile, MatchProperties match_properties); - bool InstallDirectory(const std::string& source, - const std::string& destination, + bool InstallDirectory(std::string const& source, + std::string const& destination, MatchProperties match_properties); - virtual bool Install(const std::string& fromFile, const std::string& toFile); + virtual bool Install(std::string const& fromFile, std::string const& toFile); virtual std::string const& ToName(std::string const& fromName); enum Type @@ -82,8 +82,8 @@ protected: TypeDir, TypeLink }; - virtual void ReportCopy(const std::string&, Type, bool) {} - virtual bool ReportMissing(const std::string& fromFile); + virtual void ReportCopy(std::string const&, Type, bool) {} + virtual bool ReportMissing(std::string const& fromFile); MatchRule* CurrentMatchRule = nullptr; bool UseGivenPermissionsFile = false; diff --git a/Source/cmFileInstaller.cxx b/Source/cmFileInstaller.cxx index 5cfb2cf..12e8ba2 100644 --- a/Source/cmFileInstaller.cxx +++ b/Source/cmFileInstaller.cxx @@ -55,7 +55,7 @@ std::string const& cmFileInstaller::ToName(std::string const& fromName) return this->Rename.empty() ? fromName : this->Rename; } -void cmFileInstaller::ReportCopy(const std::string& toFile, Type type, +void cmFileInstaller::ReportCopy(std::string const& toFile, Type type, bool copy) { if (!this->MessageNever && (copy || !this->MessageLazy)) { @@ -68,12 +68,12 @@ void cmFileInstaller::ReportCopy(const std::string& toFile, Type type, this->ManifestAppend(toFile); } } -bool cmFileInstaller::ReportMissing(const std::string& fromFile) +bool cmFileInstaller::ReportMissing(std::string const& fromFile) { return (this->Optional || this->cmFileCopier::ReportMissing(fromFile)); } -bool cmFileInstaller::Install(const std::string& fromFile, - const std::string& toFile) +bool cmFileInstaller::Install(std::string const& fromFile, + std::string const& toFile) { // Support installing from empty source to make a directory. if (this->InstallType == cmInstallType_DIRECTORY && fromFile.empty()) { @@ -82,8 +82,8 @@ bool cmFileInstaller::Install(const std::string& fromFile, return this->cmFileCopier::Install(fromFile, toFile); } -bool cmFileInstaller::InstallFile(const std::string& fromFile, - const std::string& toFile, +bool cmFileInstaller::InstallFile(std::string const& fromFile, + std::string const& toFile, MatchProperties match_properties) { if (this->InstallMode == cmInstallMode::COPY) { @@ -228,7 +228,7 @@ bool cmFileInstaller::Parse(std::vector const& args) return false; } - static const std::map install_mode_dict{ + static std::map const install_mode_dict{ { "ABS_SYMLINK"_s, cmInstallMode::ABS_SYMLINK }, { "ABS_SYMLINK_OR_COPY"_s, cmInstallMode::ABS_SYMLINK_OR_COPY }, { "REL_SYMLINK"_s, cmInstallMode::REL_SYMLINK }, @@ -351,7 +351,7 @@ bool cmFileInstaller::CheckValue(std::string const& arg) return true; } -bool cmFileInstaller::GetTargetTypeFromString(const std::string& stype) +bool cmFileInstaller::GetTargetTypeFromString(std::string const& stype) { if (stype == "EXECUTABLE") { this->InstallType = cmInstallType_EXECUTABLE; diff --git a/Source/cmFileInstaller.h b/Source/cmFileInstaller.h index 0b6f15d..f6e1331 100644 --- a/Source/cmFileInstaller.h +++ b/Source/cmFileInstaller.h @@ -33,11 +33,11 @@ protected: std::string const& ToName(std::string const& fromName) override; - void ReportCopy(const std::string& toFile, Type type, bool copy) override; - bool ReportMissing(const std::string& fromFile) override; - bool Install(const std::string& fromFile, - const std::string& toFile) override; - bool InstallFile(const std::string& fromFile, const std::string& toFile, + void ReportCopy(std::string const& toFile, Type type, bool copy) override; + bool ReportMissing(std::string const& fromFile) override; + bool Install(std::string const& fromFile, + std::string const& toFile) override; + bool InstallFile(std::string const& fromFile, std::string const& toFile, MatchProperties match_properties) override; bool Parse(std::vector const& args) override; enum @@ -49,6 +49,6 @@ protected: bool CheckKeyword(std::string const& arg) override; bool CheckValue(std::string const& arg) override; void DefaultFilePermissions() override; - bool GetTargetTypeFromString(const std::string& stype); + bool GetTargetTypeFromString(std::string const& stype); bool HandleInstallDestination(); }; diff --git a/Source/cmFileLock.cxx b/Source/cmFileLock.cxx index 64fbc1f..f605299 100644 --- a/Source/cmFileLock.cxx +++ b/Source/cmFileLock.cxx @@ -22,7 +22,7 @@ cmFileLock::cmFileLock(cmFileLock&& other) noexcept cmFileLock::~cmFileLock() { if (!this->Filename.empty()) { - const cmFileLockResult result = this->Release(); + cmFileLockResult const result = this->Release(); static_cast(result); assert(result.IsOk()); } @@ -40,7 +40,7 @@ cmFileLock& cmFileLock::operator=(cmFileLock&& other) noexcept return *this; } -cmFileLockResult cmFileLock::Lock(const std::string& filename, +cmFileLockResult cmFileLock::Lock(std::string const& filename, unsigned long timeout) { if (filename.empty()) { @@ -72,7 +72,7 @@ cmFileLockResult cmFileLock::Lock(const std::string& filename, return result; } -bool cmFileLock::IsLocked(const std::string& filename) const +bool cmFileLock::IsLocked(std::string const& filename) const { return filename == this->Filename; } diff --git a/Source/cmFileLock.h b/Source/cmFileLock.h index e17f8bc..8c5df38 100644 --- a/Source/cmFileLock.h +++ b/Source/cmFileLock.h @@ -34,7 +34,7 @@ public: * @brief Lock the file. * @param timeoutSec Lock timeout. If -1 try until success or fatal error. */ - cmFileLockResult Lock(const std::string& filename, unsigned long timeoutSec); + cmFileLockResult Lock(std::string const& filename, unsigned long timeoutSec); /** * @brief Unlock the file. @@ -46,7 +46,7 @@ public: * @details This function helps to find double locks (deadlocks) and to do * explicit unlocks. */ - bool IsLocked(const std::string& filename) const; + bool IsLocked(std::string const& filename) const; private: cmFileLockResult OpenFile(); diff --git a/Source/cmFileLockPool.cxx b/Source/cmFileLockPool.cxx index c23a99c..fa88f83 100644 --- a/Source/cmFileLockPool.cxx +++ b/Source/cmFileLockPool.cxx @@ -35,7 +35,7 @@ void cmFileLockPool::PopFileScope() this->FileScopes.pop_back(); } -cmFileLockResult cmFileLockPool::LockFunctionScope(const std::string& filename, +cmFileLockResult cmFileLockPool::LockFunctionScope(std::string const& filename, unsigned long timeoutSec) { if (this->IsAlreadyLocked(filename)) { @@ -47,7 +47,7 @@ cmFileLockResult cmFileLockPool::LockFunctionScope(const std::string& filename, return this->FunctionScopes.back().Lock(filename, timeoutSec); } -cmFileLockResult cmFileLockPool::LockFileScope(const std::string& filename, +cmFileLockResult cmFileLockPool::LockFileScope(std::string const& filename, unsigned long timeoutSec) { if (this->IsAlreadyLocked(filename)) { @@ -57,7 +57,7 @@ cmFileLockResult cmFileLockPool::LockFileScope(const std::string& filename, return this->FileScopes.back().Lock(filename, timeoutSec); } -cmFileLockResult cmFileLockPool::LockProcessScope(const std::string& filename, +cmFileLockResult cmFileLockPool::LockProcessScope(std::string const& filename, unsigned long timeoutSec) { if (this->IsAlreadyLocked(filename)) { @@ -66,17 +66,17 @@ cmFileLockResult cmFileLockPool::LockProcessScope(const std::string& filename, return this->ProcessScope.Lock(filename, timeoutSec); } -cmFileLockResult cmFileLockPool::Release(const std::string& filename) +cmFileLockResult cmFileLockPool::Release(std::string const& filename) { for (auto& funcScope : this->FunctionScopes) { - const cmFileLockResult result = funcScope.Release(filename); + cmFileLockResult const result = funcScope.Release(filename); if (!result.IsOk()) { return result; } } for (auto& fileScope : this->FileScopes) { - const cmFileLockResult result = fileScope.Release(filename); + cmFileLockResult const result = fileScope.Release(filename); if (!result.IsOk()) { return result; } @@ -85,17 +85,17 @@ cmFileLockResult cmFileLockPool::Release(const std::string& filename) return this->ProcessScope.Release(filename); } -bool cmFileLockPool::IsAlreadyLocked(const std::string& filename) const +bool cmFileLockPool::IsAlreadyLocked(std::string const& filename) const { for (auto const& funcScope : this->FunctionScopes) { - const bool result = funcScope.IsAlreadyLocked(filename); + bool const result = funcScope.IsAlreadyLocked(filename); if (result) { return true; } } for (auto const& fileScope : this->FileScopes) { - const bool result = fileScope.IsAlreadyLocked(filename); + bool const result = fileScope.IsAlreadyLocked(filename); if (result) { return true; } @@ -120,11 +120,11 @@ cmFileLockPool::ScopePool& cmFileLockPool::ScopePool::operator=( return *this; } -cmFileLockResult cmFileLockPool::ScopePool::Lock(const std::string& filename, +cmFileLockResult cmFileLockPool::ScopePool::Lock(std::string const& filename, unsigned long timeoutSec) { cmFileLock lock; - const cmFileLockResult result = lock.Lock(filename, timeoutSec); + cmFileLockResult const result = lock.Lock(filename, timeoutSec); if (result.IsOk()) { this->Locks.push_back(std::move(lock)); return cmFileLockResult::MakeOk(); @@ -133,7 +133,7 @@ cmFileLockResult cmFileLockPool::ScopePool::Lock(const std::string& filename, } cmFileLockResult cmFileLockPool::ScopePool::Release( - const std::string& filename) + std::string const& filename) { for (auto& lock : this->Locks) { if (lock.IsLocked(filename)) { @@ -144,7 +144,7 @@ cmFileLockResult cmFileLockPool::ScopePool::Release( } bool cmFileLockPool::ScopePool::IsAlreadyLocked( - const std::string& filename) const + std::string const& filename) const { return std::any_of(this->Locks.begin(), this->Locks.end(), [&filename](cmFileLock const& lock) -> bool { diff --git a/Source/cmFileLockPool.h b/Source/cmFileLockPool.h index f2f9f23..24ecd55 100644 --- a/Source/cmFileLockPool.h +++ b/Source/cmFileLockPool.h @@ -41,21 +41,21 @@ public: * @brief Lock the file in given scope. * @param timeoutSec Lock timeout. If -1 try until success or fatal error. */ - cmFileLockResult LockFunctionScope(const std::string& filename, + cmFileLockResult LockFunctionScope(std::string const& filename, unsigned long timeoutSec); - cmFileLockResult LockFileScope(const std::string& filename, + cmFileLockResult LockFileScope(std::string const& filename, unsigned long timeoutSec); - cmFileLockResult LockProcessScope(const std::string& filename, + cmFileLockResult LockProcessScope(std::string const& filename, unsigned long timeoutSec); //@} /** * @brief Unlock the file explicitly. */ - cmFileLockResult Release(const std::string& filename); + cmFileLockResult Release(std::string const& filename); private: - bool IsAlreadyLocked(const std::string& filename) const; + bool IsAlreadyLocked(std::string const& filename) const; class ScopePool { @@ -68,10 +68,10 @@ private: ScopePool& operator=(ScopePool const&) = delete; ScopePool& operator=(ScopePool&&) noexcept; - cmFileLockResult Lock(const std::string& filename, + cmFileLockResult Lock(std::string const& filename, unsigned long timeoutSec); - cmFileLockResult Release(const std::string& filename); - bool IsAlreadyLocked(const std::string& filename) const; + cmFileLockResult Release(std::string const& filename); + bool IsAlreadyLocked(std::string const& filename) const; private: using List = std::vector; diff --git a/Source/cmFileLockResult.cxx b/Source/cmFileLockResult.cxx index cbe4fec..a4d43f7 100644 --- a/Source/cmFileLockResult.cxx +++ b/Source/cmFileLockResult.cxx @@ -17,9 +17,9 @@ cmFileLockResult cmFileLockResult::MakeOk() cmFileLockResult cmFileLockResult::MakeSystem() { #if defined(_WIN32) - const Error lastError = GetLastError(); + Error const lastError = GetLastError(); #else - const Error lastError = errno; + Error const lastError = errno; #endif return { SYSTEM, lastError }; } @@ -63,7 +63,7 @@ std::string cmFileLockResult::GetOutputMessage() const if (FormatMessageA(flags, nullptr, this->ErrorValue, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPSTR)winmsg, WINMSG_BUF_LEN, nullptr)) { - const std::string message = winmsg; + std::string const message = winmsg; return message; } else { return "Internal error (FormatMessageA failed)"; diff --git a/Source/cmFileLockUnix.cxx b/Source/cmFileLockUnix.cxx index 613c6ee..0d330a9 100644 --- a/Source/cmFileLockUnix.cxx +++ b/Source/cmFileLockUnix.cxx @@ -16,7 +16,7 @@ cmFileLockResult cmFileLock::Release() if (this->Filename.empty()) { return cmFileLockResult::MakeOk(); } - const int lockResult = this->LockFile(F_SETLK, F_UNLCK); + int const lockResult = this->LockFile(F_SETLK, F_UNLCK); this->Filename = ""; diff --git a/Source/cmFileLockWin32.cxx b/Source/cmFileLockWin32.cxx index 8a4dadc..62dc124 100644 --- a/Source/cmFileLockWin32.cxx +++ b/Source/cmFileLockWin32.cxx @@ -7,7 +7,7 @@ #include "cmFileLock.h" #include "cmSystemTools.h" -static const unsigned long LOCK_LEN = static_cast(-1); +static unsigned long const LOCK_LEN = static_cast(-1); cmFileLock::cmFileLock() : Overlapped(cm::make_unique()) diff --git a/Source/cmFilePathChecksum.h b/Source/cmFilePathChecksum.h index a6f7bd3..09a99a6 100644 --- a/Source/cmFilePathChecksum.h +++ b/Source/cmFilePathChecksum.h @@ -23,7 +23,7 @@ class cmFilePathChecksum { public: /// Maximum number of characters to use from the path checksum - static const size_t partLengthDefault = 10; + static size_t const partLengthDefault = 10; /// @brief Parent directories are empty cmFilePathChecksum(); diff --git a/Source/cmFileSet.cxx b/Source/cmFileSet.cxx index a00c10e..58b7cbd 100644 --- a/Source/cmFileSet.cxx +++ b/Source/cmFileSet.cxx @@ -155,9 +155,9 @@ cmFileSet::CompileDirectoryEntries() const } std::vector cmFileSet::EvaluateDirectoryEntries( - const std::vector>& cges, - cmLocalGenerator* lg, const std::string& config, - const cmGeneratorTarget* target, + std::vector> const& cges, + cmLocalGenerator* lg, std::string const& config, + cmGeneratorTarget const* target, cmGeneratorExpressionDAGChecker* dagChecker) const { struct DirCacheEntry @@ -178,7 +178,7 @@ std::vector cmFileSet::EvaluateDirectoryEntries( auto dirCacheResult = dirCache.emplace(dir, DirCacheEntry()); auto& dirCacheEntry = dirCacheResult.first->second; - const auto isNewCacheEntry = dirCacheResult.second; + auto const isNewCacheEntry = dirCacheResult.second; if (isNewCacheEntry) { cmSystemTools::FileId fileId; @@ -215,11 +215,11 @@ std::vector cmFileSet::EvaluateDirectoryEntries( } void cmFileSet::EvaluateFileEntry( - const std::vector& dirs, + std::vector const& dirs, std::map>& filesPerDir, - const std::unique_ptr& cge, - cmLocalGenerator* lg, const std::string& config, - const cmGeneratorTarget* target, + std::unique_ptr const& cge, + cmLocalGenerator* lg, std::string const& config, + cmGeneratorTarget const* target, cmGeneratorExpressionDAGChecker* dagChecker) const { auto files = cge->Evaluate(lg, config, target, dagChecker); @@ -255,9 +255,9 @@ void cmFileSet::EvaluateFileEntry( } } -bool cmFileSet::IsValidName(const std::string& name) +bool cmFileSet::IsValidName(std::string const& name) { - static const cmsys::RegularExpression regex("^[a-z0-9][a-zA-Z0-9_]*$"); + static cmsys::RegularExpression const regex("^[a-z0-9][a-zA-Z0-9_]*$"); cmsys::RegularExpressionMatch match; return regex.find(name.c_str(), match); diff --git a/Source/cmFileSet.h b/Source/cmFileSet.h index 6ad4c9e..c590c0d 100644 --- a/Source/cmFileSet.h +++ b/Source/cmFileSet.h @@ -39,22 +39,22 @@ public: cmFileSet(cmake& cmakeInstance, std::string name, std::string type, cmFileSetVisibility visibility); - const std::string& GetName() const { return this->Name; } - const std::string& GetType() const { return this->Type; } + std::string const& GetName() const { return this->Name; } + std::string const& GetType() const { return this->Type; } cmFileSetVisibility GetVisibility() const { return this->Visibility; } void CopyEntries(cmFileSet const* fs); void ClearDirectoryEntries(); void AddDirectoryEntry(BT directories); - const std::vector>& GetDirectoryEntries() const + std::vector> const& GetDirectoryEntries() const { return this->DirectoryEntries; } void ClearFileEntries(); void AddFileEntry(BT files); - const std::vector>& GetFileEntries() const + std::vector> const& GetFileEntries() const { return this->FileEntries; } @@ -66,20 +66,20 @@ public: CompileDirectoryEntries() const; std::vector EvaluateDirectoryEntries( - const std::vector>& cges, - cmLocalGenerator* lg, const std::string& config, - const cmGeneratorTarget* target, + std::vector> const& cges, + cmLocalGenerator* lg, std::string const& config, + cmGeneratorTarget const* target, cmGeneratorExpressionDAGChecker* dagChecker = nullptr) const; void EvaluateFileEntry( - const std::vector& dirs, + std::vector const& dirs, std::map>& filesPerDir, - const std::unique_ptr& cge, - cmLocalGenerator* lg, const std::string& config, - const cmGeneratorTarget* target, + std::unique_ptr const& cge, + cmLocalGenerator* lg, std::string const& config, + cmGeneratorTarget const* target, cmGeneratorExpressionDAGChecker* dagChecker = nullptr) const; - static bool IsValidName(const std::string& name); + static bool IsValidName(std::string const& name); private: cmake& CMakeInstance; diff --git a/Source/cmFileTime.h b/Source/cmFileTime.h index ccc9633..a08f24a 100644 --- a/Source/cmFileTime.h +++ b/Source/cmFileTime.h @@ -24,8 +24,8 @@ public: #endif cmFileTime() = default; ~cmFileTime() = default; - cmFileTime(const cmFileTime&) = default; - cmFileTime& operator=(const cmFileTime&) = default; + cmFileTime(cmFileTime const&) = default; + cmFileTime& operator=(cmFileTime const&) = default; /** * @brief Loads the file time of fileName from the file system diff --git a/Source/cmFileTimeCache.h b/Source/cmFileTimeCache.h index 336136e..057fa2c 100644 --- a/Source/cmFileTimeCache.h +++ b/Source/cmFileTimeCache.h @@ -18,8 +18,8 @@ public: cmFileTimeCache(); ~cmFileTimeCache(); - cmFileTimeCache(const cmFileTimeCache&) = delete; - cmFileTimeCache& operator=(const cmFileTimeCache&) = delete; + cmFileTimeCache(cmFileTimeCache const&) = delete; + cmFileTimeCache& operator=(cmFileTimeCache const&) = delete; /** * @brief Loads the file time from the cache or the file system. diff --git a/Source/cmFindBase.cxx b/Source/cmFindBase.cxx index 5189519..953c433 100644 --- a/Source/cmFindBase.cxx +++ b/Source/cmFindBase.cxx @@ -156,10 +156,10 @@ bool cmFindBase::ParseArguments(std::vector const& argsIn) return false; } // ensure a macro is not specified as validator - const auto& validatorName = args[j]; + auto const& validatorName = args[j]; cmList macros{ this->Makefile->GetProperty("MACROS") }; if (std::find_if(macros.begin(), macros.end(), - [&validatorName](const std::string& item) { + [&validatorName](std::string const& item) { return cmSystemTools::Strucmp(validatorName.c_str(), item.c_str()) == 0; }) != macros.end()) { @@ -219,7 +219,7 @@ bool cmFindBase::ParseArguments(std::vector const& argsIn) return true; } -bool cmFindBase::Validate(const std::string& path) const +bool cmFindBase::Validate(std::string const& path) const { if (this->ValidatorName.empty()) { return true; @@ -357,7 +357,7 @@ struct entry_to_remove if (this->valid()) { long to_skip = this->count; long index_to_remove = 0; - for (const auto& path : entries) { + for (auto const& path : entries) { if (path == this->value && --to_skip == 0) { break; } @@ -376,10 +376,10 @@ void cmFindBase::FillCMakeSystemVariablePath() { cmSearchPath& paths = this->LabeledPaths[PathLabel::CMakeSystem]; - const bool install_prefix_in_list = + bool const install_prefix_in_list = !this->Makefile->IsOn("CMAKE_FIND_NO_INSTALL_PREFIX"); - const bool remove_install_prefix = this->NoCMakeInstallPath; - const bool add_install_prefix = !this->NoCMakeInstallPath && + bool const remove_install_prefix = this->NoCMakeInstallPath; + bool const add_install_prefix = !this->NoCMakeInstallPath && this->Makefile->IsDefinitionSet("CMAKE_FIND_USE_INSTALL_PREFIX"); // We have 3 possible states for `CMAKE_SYSTEM_PREFIX_PATH` and @@ -462,7 +462,7 @@ bool cmFindBase::CheckForVariableDefined() if (cached && cacheType != cmStateEnums::UNINITIALIZED) { this->VariableType = cacheType; - if (const auto& hs = + if (auto const& hs = state->GetCacheEntryProperty(this->VariableName, "HELPSTRING")) { this->VariableDocumentation = *hs; } @@ -487,7 +487,7 @@ void cmFindBase::NormalizeFindResult() if (this->Makefile->GetPolicyStatus(cmPolicies::CMP0125) == cmPolicies::NEW) { // ensure the path returned by find_* command is absolute - const auto& existingValue = + auto const& existingValue = this->Makefile->GetDefinition(this->VariableName); std::string value; if (!existingValue->empty()) { @@ -553,7 +553,7 @@ void cmFindBase::NormalizeFindResult() } } -void cmFindBase::StoreFindResult(const std::string& value) +void cmFindBase::StoreFindResult(std::string const& value) { bool force = this->Makefile->GetPolicyStatus(cmPolicies::CMP0125) == cmPolicies::NEW; diff --git a/Source/cmFindBase.h b/Source/cmFindBase.h index 75d9a6d..59b7485 100644 --- a/Source/cmFindBase.h +++ b/Source/cmFindBase.h @@ -34,7 +34,7 @@ public: /** * To check validity of a found path using user's validator, if any */ - bool Validate(const std::string& path) const; + bool Validate(std::string const& path) const; protected: friend class cmFindBaseDebugState; @@ -46,7 +46,7 @@ protected: bool CheckForVariableDefined(); void NormalizeFindResult(); - void StoreFindResult(const std::string& value); + void StoreFindResult(std::string const& value); // actual find command name std::string FindCommandName; diff --git a/Source/cmFindCommon.cxx b/Source/cmFindCommon.cxx index f57564e..91a0a54 100644 --- a/Source/cmFindCommon.cxx +++ b/Source/cmFindCommon.cxx @@ -186,7 +186,7 @@ void cmFindCommon::SelectDefaultMacMode() void cmFindCommon::SelectDefaultSearchModes() { - const std::array, 6> search_paths = { + std::array, 6> const search_paths = { { { this->NoPackageRootPath, "CMAKE_FIND_USE_PACKAGE_ROOT_PATH" }, { this->NoCMakePath, "CMAKE_FIND_USE_CMAKE_PATH" }, { this->NoCMakeEnvironmentPath, @@ -218,10 +218,10 @@ void cmFindCommon::RerootPaths(std::vector& paths, this->Makefile->GetDefinition("CMAKE_SYSROOT_COMPILE"); cmValue sysrootLink = this->Makefile->GetDefinition("CMAKE_SYSROOT_LINK"); cmValue rootPath = this->Makefile->GetDefinition("CMAKE_FIND_ROOT_PATH"); - const bool noSysroot = !cmNonempty(sysroot); - const bool noCompileSysroot = !cmNonempty(sysrootCompile); - const bool noLinkSysroot = !cmNonempty(sysrootLink); - const bool noRootPath = !cmNonempty(rootPath); + bool const noSysroot = !cmNonempty(sysroot); + bool const noCompileSysroot = !cmNonempty(sysrootCompile); + bool const noLinkSysroot = !cmNonempty(sysrootLink); + bool const noRootPath = !cmNonempty(rootPath); if (noSysroot && noCompileSysroot && noLinkSysroot && noRootPath) { return; } @@ -231,7 +231,7 @@ void cmFindCommon::RerootPaths(std::vector& paths, *debugBuffer, "Prepending the following roots to each prefix:\n"); } - auto debugRoot = [this, debugBuffer](const std::string& name, + auto debugRoot = [this, debugBuffer](std::string const& name, cmValue value) { if (this->DebugMode && debugBuffer) { *debugBuffer = cmStrCat(*debugBuffer, name, '\n'); @@ -312,11 +312,11 @@ void cmFindCommon::RerootPaths(std::vector& paths, void cmFindCommon::GetIgnoredPaths(std::vector& ignore) { - const std::array paths = { { "CMAKE_SYSTEM_IGNORE_PATH", + std::array const paths = { { "CMAKE_SYSTEM_IGNORE_PATH", "CMAKE_IGNORE_PATH" } }; // Construct the list of path roots with no trailing slashes. - for (const char* pathName : paths) { + for (char const* pathName : paths) { // Get the list of paths to ignore from the variable. cmList::append(ignore, this->Makefile->GetDefinition(pathName)); } @@ -335,11 +335,11 @@ void cmFindCommon::GetIgnoredPaths(std::set& ignore) void cmFindCommon::GetIgnoredPrefixPaths(std::vector& ignore) { - const std::array paths = { + std::array const paths = { { "CMAKE_SYSTEM_IGNORE_PREFIX_PATH", "CMAKE_IGNORE_PREFIX_PATH" } }; // Construct the list of path roots with no trailing slashes. - for (const char* pathName : paths) { + for (char const* pathName : paths) { // Get the list of paths to ignore from the variable. cmList::append(ignore, this->Makefile->GetDefinition(pathName)); } diff --git a/Source/cmFindCommon.h b/Source/cmFindCommon.h index 1abf567..f5ba991 100644 --- a/Source/cmFindCommon.h +++ b/Source/cmFindCommon.h @@ -43,7 +43,7 @@ protected: PathGroup(); public: - PathGroup(const std::string& label) + PathGroup(std::string const& label) : cmPathLabel(label) { } @@ -57,7 +57,7 @@ protected: PathLabel(); public: - PathLabel(const std::string& label) + PathLabel(std::string const& label) : cmPathLabel(label) { } diff --git a/Source/cmFindLibraryCommand.cxx b/Source/cmFindLibraryCommand.cxx index 15f2d9d..200193c 100644 --- a/Source/cmFindLibraryCommand.cxx +++ b/Source/cmFindLibraryCommand.cxx @@ -79,7 +79,7 @@ bool cmFindLibraryCommand::InitialPass(std::vector const& argsIn) return true; } -void cmFindLibraryCommand::AddArchitecturePaths(const char* suffix) +void cmFindLibraryCommand::AddArchitecturePaths(char const* suffix) { std::vector original; original.swap(this->SearchPaths); @@ -108,7 +108,7 @@ static bool cmLibDirsLinked(std::string const& l, std::string const& r) } void cmFindLibraryCommand::AddArchitecturePath( - std::string const& dir, std::string::size_type start_pos, const char* suffix, + std::string const& dir, std::string::size_type start_pos, char const* suffix, bool fresh) { std::string::size_type pos = dir.find("lib/", start_pos); @@ -246,7 +246,7 @@ struct cmFindLibraryHelper bool CheckDirectory(std::string const& path); bool CheckDirectoryForName(std::string const& path, Name& name); - bool Validate(const std::string& path) const + bool Validate(std::string const& path) const { return this->FindBase->Validate(path); } @@ -258,9 +258,9 @@ struct cmFindLibraryHelper if (this->DebugMode) { // To improve readability of the debug output, if there is only one // prefix/suffix, use the plain prefix/suffix instead of the regex. - const auto& prefix = (this->Prefixes.size() == 1) ? this->Prefixes[0] + auto const& prefix = (this->Prefixes.size() == 1) ? this->Prefixes[0] : this->PrefixRegexStr; - const auto& suffix = (this->Suffixes.size() == 1) ? this->Suffixes[0] + auto const& suffix = (this->Suffixes.size() == 1) ? this->Suffixes[0] : this->SuffixRegexStr; auto regexName = cmStrCat(prefix, name, suffix); @@ -359,7 +359,7 @@ void cmFindLibraryHelper::RegexFromList(std::string& out, cmList const& in, // Surround the list in parens so the '|' does not apply to anything // else and the result can be checked after matching. out += "("; - const char* sep = ""; + char const* sep = ""; for (auto const& s : in) { // Separate from previous item. out += sep; diff --git a/Source/cmFindLibraryCommand.h b/Source/cmFindLibraryCommand.h index f3874ff..057d0c0 100644 --- a/Source/cmFindLibraryCommand.h +++ b/Source/cmFindLibraryCommand.h @@ -26,10 +26,10 @@ public: bool InitialPass(std::vector const& args); protected: - void AddArchitecturePaths(const char* suffix); + void AddArchitecturePaths(char const* suffix); void AddArchitecturePath(std::string const& dir, std::string::size_type start_pos, - const char* suffix, bool fresh = true); + char const* suffix, bool fresh = true); std::string FindLibrary(); private: diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index 1e36526..eceda91 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -63,7 +63,7 @@ using pdt = cmFindPackageCommand::PackageDescriptionType; template