diff options
37 files changed, 108 insertions, 91 deletions
diff --git a/.clang-tidy b/.clang-tidy index ccb36ae..098c71f 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -24,7 +24,6 @@ readability-*,\ -readability-implicit-bool-conversion,\ -readability-inconsistent-declaration-parameter-name,\ -readability-magic-numbers,\ --readability-make-member-function-const,\ -readability-named-parameter,\ -readability-qualified-auto,\ -readability-redundant-access-specifiers,\ diff --git a/Source/CPack/IFW/cmCPackIFWCommon.cxx b/Source/CPack/IFW/cmCPackIFWCommon.cxx index 20d392d..87ebbfe 100644 --- a/Source/CPack/IFW/cmCPackIFWCommon.cxx +++ b/Source/CPack/IFW/cmCPackIFWCommon.cxx @@ -44,7 +44,7 @@ bool cmCPackIFWCommon::IsSetToEmpty(const std::string& op) const : false; } -bool cmCPackIFWCommon::IsVersionLess(const char* version) +bool cmCPackIFWCommon::IsVersionLess(const char* version) const { if (!this->Generator) { return false; @@ -54,7 +54,7 @@ bool cmCPackIFWCommon::IsVersionLess(const char* version) cmSystemTools::OP_LESS, this->Generator->FrameworkVersion.data(), version); } -bool cmCPackIFWCommon::IsVersionGreater(const char* version) +bool cmCPackIFWCommon::IsVersionGreater(const char* version) const { if (!this->Generator) { return false; @@ -65,7 +65,7 @@ bool cmCPackIFWCommon::IsVersionGreater(const char* version) version); } -bool cmCPackIFWCommon::IsVersionEqual(const char* version) +bool cmCPackIFWCommon::IsVersionEqual(const char* version) const { if (!this->Generator) { return false; @@ -118,7 +118,7 @@ void cmCPackIFWCommon::ExpandListArgument( } } -void cmCPackIFWCommon::WriteGeneratedByToStrim(cmXMLWriter& xout) +void cmCPackIFWCommon::WriteGeneratedByToStrim(cmXMLWriter& xout) const { if (!this->Generator) { return; diff --git a/Source/CPack/IFW/cmCPackIFWCommon.h b/Source/CPack/IFW/cmCPackIFWCommon.h index 95ed213..42deda4 100644 --- a/Source/CPack/IFW/cmCPackIFWCommon.h +++ b/Source/CPack/IFW/cmCPackIFWCommon.h @@ -34,17 +34,17 @@ public: /** * Compare \a version with QtIFW framework version */ - bool IsVersionLess(const char* version); + bool IsVersionLess(const char* version) const; /** * Compare \a version with QtIFW framework version */ - bool IsVersionGreater(const char* version); + bool IsVersionGreater(const char* version) const; /** * Compare \a version with QtIFW framework version */ - bool IsVersionEqual(const char* version); + bool IsVersionEqual(const char* 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 @@ -64,7 +64,7 @@ public: cmCPackIFWGenerator* Generator; protected: - void WriteGeneratedByToStrim(cmXMLWriter& xout); + void WriteGeneratedByToStrim(cmXMLWriter& xout) const; }; #define cmCPackIFWLogger(logType, msg) \ diff --git a/Source/CPack/IFW/cmCPackIFWRepository.cxx b/Source/CPack/IFW/cmCPackIFWRepository.cxx index 1287907..7ec2256 100644 --- a/Source/CPack/IFW/cmCPackIFWRepository.cxx +++ b/Source/CPack/IFW/cmCPackIFWRepository.cxx @@ -199,7 +199,7 @@ bool cmCPackIFWRepository::PatchUpdatesXml() return cmSystemTools::RenameFile(updatesPatchXml, updatesXml); } -void cmCPackIFWRepository::WriteRepositoryConfig(cmXMLWriter& xout) +void cmCPackIFWRepository::WriteRepositoryConfig(cmXMLWriter& xout) const { xout.StartElement("Repository"); @@ -225,7 +225,7 @@ void cmCPackIFWRepository::WriteRepositoryConfig(cmXMLWriter& xout) xout.EndElement(); } -void cmCPackIFWRepository::WriteRepositoryUpdate(cmXMLWriter& xout) +void cmCPackIFWRepository::WriteRepositoryUpdate(cmXMLWriter& xout) const { xout.StartElement("Repository"); diff --git a/Source/CPack/IFW/cmCPackIFWRepository.h b/Source/CPack/IFW/cmCPackIFWRepository.h index 21afd8b..0153452 100644 --- a/Source/CPack/IFW/cmCPackIFWRepository.h +++ b/Source/CPack/IFW/cmCPackIFWRepository.h @@ -76,8 +76,8 @@ public: bool PatchUpdatesXml(); - void WriteRepositoryConfig(cmXMLWriter& xout); - void WriteRepositoryUpdate(cmXMLWriter& xout); + void WriteRepositoryConfig(cmXMLWriter& xout) const; + void WriteRepositoryUpdate(cmXMLWriter& xout) const; void WriteRepositoryUpdates(cmXMLWriter& xout); RepositoriesVector RepositoryUpdate; diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx index 5fb52bf..3d7d031 100644 --- a/Source/CTest/cmCTestCoverageHandler.cxx +++ b/Source/CTest/cmCTestCoverageHandler.cxx @@ -107,7 +107,7 @@ public: this->PipeState = cmsysProcess_WaitForExit(this->Process, timeout); return this->PipeState; } - int GetProcessState() { return this->PipeState; } + int GetProcessState() const { return this->PipeState; } private: int PipeState; diff --git a/Source/CTest/cmCTestLaunch.cxx b/Source/CTest/cmCTestLaunch.cxx index b9ed033..15c443a 100644 --- a/Source/CTest/cmCTestLaunch.cxx +++ b/Source/CTest/cmCTestLaunch.cxx @@ -265,7 +265,7 @@ void cmCTestLaunch::LoadScrapeRules() } void cmCTestLaunch::LoadScrapeRules( - const char* purpose, std::vector<cmsys::RegularExpression>& regexps) + const char* purpose, std::vector<cmsys::RegularExpression>& regexps) const { std::string fname = cmStrCat(this->Reporter.LogDir, "Custom", purpose, ".txt"); diff --git a/Source/CTest/cmCTestLaunch.h b/Source/CTest/cmCTestLaunch.h index d18f66d..eabb608 100644 --- a/Source/CTest/cmCTestLaunch.h +++ b/Source/CTest/cmCTestLaunch.h @@ -60,7 +60,7 @@ private: bool ScrapeRulesLoaded; void LoadScrapeRules(); void LoadScrapeRules(const char* purpose, - std::vector<cmsys::RegularExpression>& regexps); + std::vector<cmsys::RegularExpression>& regexps) const; bool ScrapeLog(std::string const& fname); // Helper class to generate the xml fragment. diff --git a/Source/CTest/cmCTestLaunchReporter.cxx b/Source/CTest/cmCTestLaunchReporter.cxx index f89fc9b..5334a93 100644 --- a/Source/CTest/cmCTestLaunchReporter.cxx +++ b/Source/CTest/cmCTestLaunchReporter.cxx @@ -150,7 +150,7 @@ void cmCTestLaunchReporter::WriteXML() this->WriteXMLLabels(e2); } -void cmCTestLaunchReporter::WriteXMLAction(cmXMLElement& e2) +void cmCTestLaunchReporter::WriteXMLAction(cmXMLElement& e2) const { e2.Comment("Meta-information about the build action"); cmXMLElement e3(e2, "Action"); diff --git a/Source/CTest/cmCTestLaunchReporter.h b/Source/CTest/cmCTestLaunchReporter.h index 675a878..4be0d9b 100644 --- a/Source/CTest/cmCTestLaunchReporter.h +++ b/Source/CTest/cmCTestLaunchReporter.h @@ -70,7 +70,7 @@ public: // Methods to generate the xml fragment. void WriteXML(); - void WriteXMLAction(cmXMLElement&); + void WriteXMLAction(cmXMLElement&) const; void WriteXMLCommand(cmXMLElement&); void WriteXMLResult(cmXMLElement&); void WriteXMLLabels(cmXMLElement&); diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx index 6e8091b..125d003 100644 --- a/Source/CTest/cmCTestMemCheckHandler.cxx +++ b/Source/CTest/cmCTestMemCheckHandler.cxx @@ -300,7 +300,7 @@ void cmCTestMemCheckHandler::PopulateCustomVectors(cmMakefile* mf) this->CustomTestsIgnore); } -int cmCTestMemCheckHandler::GetDefectCount() +int cmCTestMemCheckHandler::GetDefectCount() const { return this->DefectCount; } diff --git a/Source/CTest/cmCTestMemCheckHandler.h b/Source/CTest/cmCTestMemCheckHandler.h index 7ab00db..b200c43 100644 --- a/Source/CTest/cmCTestMemCheckHandler.h +++ b/Source/CTest/cmCTestMemCheckHandler.h @@ -29,7 +29,7 @@ public: void Initialize() override; - int GetDefectCount(); + int GetDefectCount() const; protected: int PreProcessHandler() override; diff --git a/Source/CTest/cmProcess.cxx b/Source/CTest/cmProcess.cxx index c7cbd34..1f220af 100644 --- a/Source/CTest/cmProcess.cxx +++ b/Source/CTest/cmProcess.cxx @@ -358,7 +358,7 @@ void cmProcess::ResetStartTime() this->StartTime = std::chrono::steady_clock::now(); } -cmProcess::Exception cmProcess::GetExitException() +cmProcess::Exception cmProcess::GetExitException() const { auto exception = Exception::None; #if defined(_WIN32) && !defined(__CYGWIN__) @@ -430,7 +430,7 @@ cmProcess::Exception cmProcess::GetExitException() return exception; } -std::string cmProcess::GetExitExceptionString() +std::string cmProcess::GetExitExceptionString() const { std::string exception_str; #if defined(_WIN32) diff --git a/Source/CTest/cmProcess.h b/Source/CTest/cmProcess.h index 9eec952..a44aeb0 100644 --- a/Source/CTest/cmProcess.h +++ b/Source/CTest/cmProcess.h @@ -67,8 +67,8 @@ public: Other }; - Exception GetExitException(); - std::string GetExitExceptionString(); + Exception GetExitException() const; + std::string GetExitExceptionString() const; std::unique_ptr<cmCTestRunTest> GetRunner() { diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index 6e1fac0..f32f9e9 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -951,6 +951,9 @@ void cmComputeLinkInformation::AddLinkExtension(std::string const& e, } } +// XXX(clang-tidy): This method's const-ness is platform dependent, so we +// cannot make it `const` as `clang-tidy` wants us to. +// NOLINTNEXTLINE(readability-make-member-function-const) std::string cmComputeLinkInformation::CreateExtensionRegex( std::vector<std::string> const& exts, LinkType type) { diff --git a/Source/cmDepends.cxx b/Source/cmDepends.cxx index d092f4f..566c3bf 100644 --- a/Source/cmDepends.cxx +++ b/Source/cmDepends.cxx @@ -77,7 +77,7 @@ bool cmDepends::Check(const std::string& makeFile, return okay; } -void cmDepends::Clear(const std::string& file) +void cmDepends::Clear(const std::string& file) const { // Print verbose output. if (this->Verbose) { diff --git a/Source/cmDepends.h b/Source/cmDepends.h index 0240da9..6875902 100644 --- a/Source/cmDepends.h +++ b/Source/cmDepends.h @@ -70,7 +70,7 @@ public: DependencyMap& validDeps); /** Clear dependencies for the target file so they will be regenerated. */ - void Clear(const std::string& file); + void Clear(const std::string& file) const; /** Set the file comparison object */ void SetFileTimeCache(cmFileTimeCache* fc) { this->FileTimeCache = fc; } diff --git a/Source/cmDependsJavaParserHelper.cxx b/Source/cmDependsJavaParserHelper.cxx index fc1bbdd..0c5d310 100644 --- a/Source/cmDependsJavaParserHelper.cxx +++ b/Source/cmDependsJavaParserHelper.cxx @@ -103,7 +103,7 @@ void cmDependsJavaParserHelper::SafePrintMissing(const char* str, int line, std::cout << "- " << strlen(str) << std::endl; } } -void cmDependsJavaParserHelper::Print(const char* place, const char* str) +void cmDependsJavaParserHelper::Print(const char* place, const char* str) const { if (this->Verbose) { std::cout << "[" << place << "=" << str << "]" << std::endl; diff --git a/Source/cmDependsJavaParserHelper.h b/Source/cmDependsJavaParserHelper.h index 869b7d4..4057bb7 100644 --- a/Source/cmDependsJavaParserHelper.h +++ b/Source/cmDependsJavaParserHelper.h @@ -85,7 +85,7 @@ private: void PrintClasses(); - void Print(const char* place, const char* str); + 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); diff --git a/Source/cmExprParserHelper.h b/Source/cmExprParserHelper.h index 54dd6a4..919e492 100644 --- a/Source/cmExprParserHelper.h +++ b/Source/cmExprParserHelper.h @@ -27,7 +27,7 @@ public: void SetResult(KWIML_INT_int64_t value); - KWIML_INT_int64_t GetResult() { return this->Result; } + KWIML_INT_int64_t GetResult() const { return this->Result; } const char* GetError() { return this->ErrorString.c_str(); } diff --git a/Source/cmFileLock.h b/Source/cmFileLock.h index 2b125af..94baea1 100644 --- a/Source/cmFileLock.h +++ b/Source/cmFileLock.h @@ -57,7 +57,7 @@ private: BOOL LockFile(DWORD flags); #else int File = -1; - int LockFile(int cmd, int type); + int LockFile(int cmd, int type) const; #endif std::string Filename; diff --git a/Source/cmFileLockUnix.cxx b/Source/cmFileLockUnix.cxx index 1456ea8..613c6ee 100644 --- a/Source/cmFileLockUnix.cxx +++ b/Source/cmFileLockUnix.cxx @@ -64,7 +64,7 @@ cmFileLockResult cmFileLock::LockWithTimeout(unsigned long seconds) } } -int cmFileLock::LockFile(int cmd, int type) +int cmFileLock::LockFile(int cmd, int type) const { struct ::flock lock; lock.l_start = 0; diff --git a/Source/cmFindPathCommand.cxx b/Source/cmFindPathCommand.cxx index bece33b..3fb0826 100644 --- a/Source/cmFindPathCommand.cxx +++ b/Source/cmFindPathCommand.cxx @@ -80,8 +80,8 @@ std::string cmFindPathCommand::FindHeader() return header; } -std::string cmFindPathCommand::FindHeaderInFramework(std::string const& file, - std::string const& dir) +std::string cmFindPathCommand::FindHeaderInFramework( + std::string const& file, std::string const& dir) const { std::string fileName = file; std::string frameWorkName; diff --git a/Source/cmFindPathCommand.h b/Source/cmFindPathCommand.h index b9fe673..6101ea1 100644 --- a/Source/cmFindPathCommand.h +++ b/Source/cmFindPathCommand.h @@ -29,7 +29,7 @@ public: private: std::string FindHeaderInFramework(std::string const& file, - std::string const& dir); + std::string const& dir) const; std::string FindHeader(); std::string FindNormalHeader(cmFindBaseDebugState& debug); std::string FindFrameworkHeader(cmFindBaseDebugState& debug); diff --git a/Source/cmGlobalUnixMakefileGenerator3.h b/Source/cmGlobalUnixMakefileGenerator3.h index c15f491..7c950cc 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.h +++ b/Source/cmGlobalUnixMakefileGenerator3.h @@ -134,13 +134,13 @@ public: std::set<std::string>& emitted); // Make tool supports dependency files generated by compiler - bool SupportsCompilerDependencies() + bool SupportsCompilerDependencies() const { return this->ToolSupportsCompilerDependencies; } // Make tool supports long line dependencies - bool SupportsLongLineDependencies() + bool SupportsLongLineDependencies() const { return this->ToolSupportsLongLineDependencies; } diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx index ff08ee4..b04ad0c 100644 --- a/Source/cmInstallCommand.cxx +++ b/Source/cmInstallCommand.cxx @@ -57,28 +57,38 @@ public: bool MakeFilesFullPath(const char* modeName, const std::vector<std::string>& relFiles, std::vector<std::string>& absFiles); - bool CheckCMP0006(bool& failure); + bool CheckCMP0006(bool& failure) const; std::string GetDestination(const cmInstallCommandArguments* args, const std::string& varName, - const std::string& guess); - std::string GetRuntimeDestination(const cmInstallCommandArguments* args); - std::string GetSbinDestination(const cmInstallCommandArguments* args); - std::string GetArchiveDestination(const cmInstallCommandArguments* args); - std::string GetLibraryDestination(const cmInstallCommandArguments* args); - std::string GetIncludeDestination(const cmInstallCommandArguments* args); - std::string GetSysconfDestination(const cmInstallCommandArguments* args); - std::string GetSharedStateDestination(const cmInstallCommandArguments* args); - std::string GetLocalStateDestination(const cmInstallCommandArguments* args); - std::string GetRunStateDestination(const cmInstallCommandArguments* args); - std::string GetDataRootDestination(const cmInstallCommandArguments* args); - std::string GetDataDestination(const cmInstallCommandArguments* args); - std::string GetInfoDestination(const cmInstallCommandArguments* args); - std::string GetLocaleDestination(const cmInstallCommandArguments* args); - std::string GetManDestination(const cmInstallCommandArguments* args); - std::string GetDocDestination(const cmInstallCommandArguments* args); + const std::string& guess) const; + std::string GetRuntimeDestination( + const cmInstallCommandArguments* args) const; + std::string GetSbinDestination(const cmInstallCommandArguments* args) const; + std::string GetArchiveDestination( + const cmInstallCommandArguments* args) const; + std::string GetLibraryDestination( + const cmInstallCommandArguments* args) const; + std::string GetIncludeDestination( + const cmInstallCommandArguments* args) const; + std::string GetSysconfDestination( + const cmInstallCommandArguments* args) const; + std::string GetSharedStateDestination( + const cmInstallCommandArguments* args) const; + std::string GetLocalStateDestination( + const cmInstallCommandArguments* args) const; + std::string GetRunStateDestination( + const cmInstallCommandArguments* args) const; + std::string GetDataRootDestination( + const cmInstallCommandArguments* args) const; + std::string GetDataDestination(const cmInstallCommandArguments* args) const; + std::string GetInfoDestination(const cmInstallCommandArguments* args) const; + std::string GetLocaleDestination( + const cmInstallCommandArguments* args) const; + std::string GetManDestination(const cmInstallCommandArguments* args) const; + std::string GetDocDestination(const cmInstallCommandArguments* args) const; std::string GetDestinationForType(const cmInstallCommandArguments* args, - const std::string& type); + const std::string& type) const; cmExecutionStatus& Status; cmMakefile* Makefile; @@ -1477,7 +1487,7 @@ bool Helper::MakeFilesFullPath(const char* modeName, return true; } -bool Helper::CheckCMP0006(bool& failure) +bool Helper::CheckCMP0006(bool& failure) const { switch (this->Makefile->GetPolicyStatus(cmPolicies::CMP0006)) { case cmPolicies::WARN: @@ -1504,7 +1514,7 @@ bool Helper::CheckCMP0006(bool& failure) std::string Helper::GetDestination(const cmInstallCommandArguments* args, const std::string& varName, - const std::string& guess) + const std::string& guess) const { if (args && !args->GetDestination().empty()) { return args->GetDestination(); @@ -1517,54 +1527,55 @@ std::string Helper::GetDestination(const cmInstallCommandArguments* args, } std::string Helper::GetRuntimeDestination( - const cmInstallCommandArguments* args) + const cmInstallCommandArguments* args) const { return this->GetDestination(args, "CMAKE_INSTALL_BINDIR", "bin"); } -std::string Helper::GetSbinDestination(const cmInstallCommandArguments* args) +std::string Helper::GetSbinDestination( + const cmInstallCommandArguments* args) const { return this->GetDestination(args, "CMAKE_INSTALL_SBINDIR", "sbin"); } std::string Helper::GetArchiveDestination( - const cmInstallCommandArguments* args) + const cmInstallCommandArguments* args) const { return this->GetDestination(args, "CMAKE_INSTALL_LIBDIR", "lib"); } std::string Helper::GetLibraryDestination( - const cmInstallCommandArguments* args) + const cmInstallCommandArguments* args) const { return this->GetDestination(args, "CMAKE_INSTALL_LIBDIR", "lib"); } std::string Helper::GetIncludeDestination( - const cmInstallCommandArguments* args) + const cmInstallCommandArguments* args) const { return this->GetDestination(args, "CMAKE_INSTALL_INCLUDEDIR", "include"); } std::string Helper::GetSysconfDestination( - const cmInstallCommandArguments* args) + const cmInstallCommandArguments* args) const { return this->GetDestination(args, "CMAKE_INSTALL_SYSCONFDIR", "etc"); } std::string Helper::GetSharedStateDestination( - const cmInstallCommandArguments* args) + const cmInstallCommandArguments* args) const { return this->GetDestination(args, "CMAKE_INSTALL_SHAREDSTATEDIR", "com"); } std::string Helper::GetLocalStateDestination( - const cmInstallCommandArguments* args) + const cmInstallCommandArguments* args) const { return this->GetDestination(args, "CMAKE_INSTALL_LOCALSTATEDIR", "var"); } std::string Helper::GetRunStateDestination( - const cmInstallCommandArguments* args) + const cmInstallCommandArguments* args) const { return this->GetDestination(args, "CMAKE_INSTALL_RUNSTATEDIR", this->GetLocalStateDestination(nullptr) + @@ -1572,44 +1583,49 @@ std::string Helper::GetRunStateDestination( } std::string Helper::GetDataRootDestination( - const cmInstallCommandArguments* args) + const cmInstallCommandArguments* args) const { return this->GetDestination(args, "CMAKE_INSTALL_DATAROOTDIR", "share"); } -std::string Helper::GetDataDestination(const cmInstallCommandArguments* args) +std::string Helper::GetDataDestination( + const cmInstallCommandArguments* args) const { return this->GetDestination(args, "CMAKE_INSTALL_DATADIR", this->GetDataRootDestination(nullptr)); } -std::string Helper::GetInfoDestination(const cmInstallCommandArguments* args) +std::string Helper::GetInfoDestination( + const cmInstallCommandArguments* args) const { return this->GetDestination(args, "CMAKE_INSTALL_INFODIR", this->GetDataRootDestination(nullptr) + "/info"); } -std::string Helper::GetLocaleDestination(const cmInstallCommandArguments* args) +std::string Helper::GetLocaleDestination( + const cmInstallCommandArguments* args) const { return this->GetDestination(args, "CMAKE_INSTALL_LOCALEDIR", this->GetDataRootDestination(nullptr) + "/locale"); } -std::string Helper::GetManDestination(const cmInstallCommandArguments* args) +std::string Helper::GetManDestination( + const cmInstallCommandArguments* args) const { return this->GetDestination(args, "CMAKE_INSTALL_MANDIR", this->GetDataRootDestination(nullptr) + "/man"); } -std::string Helper::GetDocDestination(const cmInstallCommandArguments* args) +std::string Helper::GetDocDestination( + const cmInstallCommandArguments* args) const { return this->GetDestination(args, "CMAKE_INSTALL_DOCDIR", this->GetDataRootDestination(nullptr) + "/doc"); } std::string Helper::GetDestinationForType( - const cmInstallCommandArguments* args, const std::string& type) + const cmInstallCommandArguments* args, const std::string& type) const { if (args && !args->GetDestination().empty()) { return args->GetDestination(); diff --git a/Source/cmInstallScriptGenerator.cxx b/Source/cmInstallScriptGenerator.cxx index ce2472d..5b01791 100644 --- a/Source/cmInstallScriptGenerator.cxx +++ b/Source/cmInstallScriptGenerator.cxx @@ -53,9 +53,8 @@ bool cmInstallScriptGenerator::Compute(cmLocalGenerator* lg) return true; } -void cmInstallScriptGenerator::AddScriptInstallRule(std::ostream& os, - Indent indent, - std::string const& script) +void cmInstallScriptGenerator::AddScriptInstallRule( + std::ostream& os, Indent indent, std::string const& script) const { if (this->Code) { os << indent << script << "\n"; diff --git a/Source/cmInstallScriptGenerator.h b/Source/cmInstallScriptGenerator.h index 338d866..f7ee3f9 100644 --- a/Source/cmInstallScriptGenerator.h +++ b/Source/cmInstallScriptGenerator.h @@ -30,7 +30,7 @@ protected: void GenerateScriptForConfig(std::ostream& os, const std::string& config, Indent indent) override; void AddScriptInstallRule(std::ostream& os, Indent indent, - std::string const& script); + std::string const& script) const; std::string const Script; bool const Code; diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx index 36a1372..1464a14 100644 --- a/Source/cmListFileCache.cxx +++ b/Source/cmListFileCache.cxx @@ -30,7 +30,7 @@ struct cmListFileParser bool ParseFunction(const char* name, long line); bool AddArgument(cmListFileLexer_Token* token, cmListFileArgument::Delimiter delim); - cm::optional<cmListFileContext> CheckNesting(); + cm::optional<cmListFileContext> CheckNesting() const; cmListFile* ListFile; cmListFileBacktrace Backtrace; cmMessenger* Messenger; @@ -352,7 +352,7 @@ bool TopIs(std::vector<NestingState>& stack, NestingStateEnum state) } } -cm::optional<cmListFileContext> cmListFileParser::CheckNesting() +cm::optional<cmListFileContext> cmListFileParser::CheckNesting() const { std::vector<NestingState> stack; diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index a6d898d..9248cbb 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -2772,7 +2772,7 @@ inline void RegisterUnitySources(cmGeneratorTarget* target, cmSourceFile* sf, void cmLocalGenerator::IncludeFileInUnitySources( cmGeneratedFileStream& unity_file, std::string const& sf_full_path, - cmProp beforeInclude, cmProp afterInclude, cmProp uniqueIdName) + cmProp beforeInclude, cmProp afterInclude, cmProp uniqueIdName) const { if (uniqueIdName && !uniqueIdName->empty()) { std::string pathToHash; diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index a3610fd..7e4d590 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -656,7 +656,7 @@ private: void IncludeFileInUnitySources(cmGeneratedFileStream& unity_file, std::string const& sf_full_path, cmProp beforeInclude, cmProp afterInclude, - cmProp uniqueIdName); + cmProp uniqueIdName) const; std::vector<std::string> AddUnityFilesModeAuto( cmGeneratorTarget* target, std::string const& lang, std::vector<cmSourceFile*> const& filtered_sources, cmProp beforeInclude, diff --git a/Source/cmTimestamp.cxx b/Source/cmTimestamp.cxx index e03a567..b016530 100644 --- a/Source/cmTimestamp.cxx +++ b/Source/cmTimestamp.cxx @@ -23,7 +23,7 @@ #include "cmSystemTools.h" std::string cmTimestamp::CurrentTime(const std::string& formatString, - bool utcFlag) + bool utcFlag) const { time_t currentTimeT = time(nullptr); std::string source_date_epoch; @@ -45,7 +45,7 @@ std::string cmTimestamp::CurrentTime(const std::string& formatString, std::string cmTimestamp::FileModificationTime(const char* path, const std::string& formatString, - bool utcFlag) + bool utcFlag) const { std::string real_path = cmSystemTools::GetRealPathResolvingWindowsSubst(path); diff --git a/Source/cmTimestamp.h b/Source/cmTimestamp.h index 8941abe..0e2c200 100644 --- a/Source/cmTimestamp.h +++ b/Source/cmTimestamp.h @@ -14,11 +14,11 @@ class cmTimestamp { public: - std::string CurrentTime(const std::string& formatString, bool utcFlag); + std::string CurrentTime(const std::string& formatString, bool utcFlag) const; std::string FileModificationTime(const char* path, const std::string& formatString, - bool utcFlag); + bool utcFlag) const; std::string CreateTimestampFromTimeT(time_t timeT, std::string formatString, bool utcFlag) const; diff --git a/Source/cmWorkerPool.cxx b/Source/cmWorkerPool.cxx index f2c091f..7971009 100644 --- a/Source/cmWorkerPool.cxx +++ b/Source/cmWorkerPool.cxx @@ -170,9 +170,9 @@ public: private: // -- Libuv callbacks static void UVExit(uv_process_t* handle, int64_t exitStatus, int termSignal); - void UVPipeOutData(cmUVPipeBuffer::DataRange data); + void UVPipeOutData(cmUVPipeBuffer::DataRange data) const; void UVPipeOutEnd(ssize_t error); - void UVPipeErrData(cmUVPipeBuffer::DataRange data); + void UVPipeErrData(cmUVPipeBuffer::DataRange data) const; void UVPipeErrEnd(ssize_t error); void UVTryFinish(); @@ -330,7 +330,7 @@ void cmUVReadOnlyProcess::UVExit(uv_process_t* handle, int64_t exitStatus, } } -void cmUVReadOnlyProcess::UVPipeOutData(cmUVPipeBuffer::DataRange data) +void cmUVReadOnlyProcess::UVPipeOutData(cmUVPipeBuffer::DataRange data) const { this->Result()->StdOut.append(data.begin(), data.end()); } @@ -346,7 +346,7 @@ void cmUVReadOnlyProcess::UVPipeOutEnd(ssize_t error) this->UVTryFinish(); } -void cmUVReadOnlyProcess::UVPipeErrData(cmUVPipeBuffer::DataRange data) +void cmUVReadOnlyProcess::UVPipeErrData(cmUVPipeBuffer::DataRange data) const { std::string* str = this->Setup_.MergedOutput ? &this->Result()->StdOut : &this->Result()->StdErr; diff --git a/Source/cmXMLSafe.cxx b/Source/cmXMLSafe.cxx index 8cd5f6e..d31a239 100644 --- a/Source/cmXMLSafe.cxx +++ b/Source/cmXMLSafe.cxx @@ -28,7 +28,7 @@ cmXMLSafe& cmXMLSafe::Quotes(bool b) return *this; } -std::string cmXMLSafe::str() +std::string cmXMLSafe::str() const { std::ostringstream ss; ss << *this; diff --git a/Source/cmXMLSafe.h b/Source/cmXMLSafe.h index 9b4c539..21bd19a 100644 --- a/Source/cmXMLSafe.h +++ b/Source/cmXMLSafe.h @@ -24,7 +24,7 @@ public: cmXMLSafe& Quotes(bool b = true); /** Get the escaped data as a string. */ - std::string str(); + std::string str() const; private: char const* Data; diff --git a/Tests/CMakeLib/run_compile_commands.cxx b/Tests/CMakeLib/run_compile_commands.cxx index 0fd6cfb..0ebe00e 100644 --- a/Tests/CMakeLib/run_compile_commands.cxx +++ b/Tests/CMakeLib/run_compile_commands.cxx @@ -127,7 +127,7 @@ private: exit(1); } - bool IsWhitespace() + bool IsWhitespace() const { return (this->C == ' ' || this->C == '\t' || this->C == '\n' || this->C == '\r'); |