clang-tidy: fix readability-make-member-function-const warnings

This commit is contained in:
Ben Boeckel 2021-01-22 10:37:38 -05:00
parent 4470eb5179
commit 808b17b120
37 changed files with 108 additions and 91 deletions

View File

@ -24,7 +24,6 @@ readability-*,\
-readability-implicit-bool-conversion,\ -readability-implicit-bool-conversion,\
-readability-inconsistent-declaration-parameter-name,\ -readability-inconsistent-declaration-parameter-name,\
-readability-magic-numbers,\ -readability-magic-numbers,\
-readability-make-member-function-const,\
-readability-named-parameter,\ -readability-named-parameter,\
-readability-qualified-auto,\ -readability-qualified-auto,\
-readability-redundant-access-specifiers,\ -readability-redundant-access-specifiers,\

View File

@ -44,7 +44,7 @@ bool cmCPackIFWCommon::IsSetToEmpty(const std::string& op) const
: false; : false;
} }
bool cmCPackIFWCommon::IsVersionLess(const char* version) bool cmCPackIFWCommon::IsVersionLess(const char* version) const
{ {
if (!this->Generator) { if (!this->Generator) {
return false; return false;
@ -54,7 +54,7 @@ bool cmCPackIFWCommon::IsVersionLess(const char* version)
cmSystemTools::OP_LESS, this->Generator->FrameworkVersion.data(), 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) { if (!this->Generator) {
return false; return false;
@ -65,7 +65,7 @@ bool cmCPackIFWCommon::IsVersionGreater(const char* version)
version); version);
} }
bool cmCPackIFWCommon::IsVersionEqual(const char* version) bool cmCPackIFWCommon::IsVersionEqual(const char* version) const
{ {
if (!this->Generator) { if (!this->Generator) {
return false; return false;
@ -118,7 +118,7 @@ void cmCPackIFWCommon::ExpandListArgument(
} }
} }
void cmCPackIFWCommon::WriteGeneratedByToStrim(cmXMLWriter& xout) void cmCPackIFWCommon::WriteGeneratedByToStrim(cmXMLWriter& xout) const
{ {
if (!this->Generator) { if (!this->Generator) {
return; return;

View File

@ -34,17 +34,17 @@ public:
/** /**
* Compare \a version with QtIFW framework version * 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 * 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 * 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. /** 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 * If the number of elements is odd, then the first value is used as the
@ -64,7 +64,7 @@ public:
cmCPackIFWGenerator* Generator; cmCPackIFWGenerator* Generator;
protected: protected:
void WriteGeneratedByToStrim(cmXMLWriter& xout); void WriteGeneratedByToStrim(cmXMLWriter& xout) const;
}; };
#define cmCPackIFWLogger(logType, msg) \ #define cmCPackIFWLogger(logType, msg) \

View File

@ -199,7 +199,7 @@ bool cmCPackIFWRepository::PatchUpdatesXml()
return cmSystemTools::RenameFile(updatesPatchXml, updatesXml); return cmSystemTools::RenameFile(updatesPatchXml, updatesXml);
} }
void cmCPackIFWRepository::WriteRepositoryConfig(cmXMLWriter& xout) void cmCPackIFWRepository::WriteRepositoryConfig(cmXMLWriter& xout) const
{ {
xout.StartElement("Repository"); xout.StartElement("Repository");
@ -225,7 +225,7 @@ void cmCPackIFWRepository::WriteRepositoryConfig(cmXMLWriter& xout)
xout.EndElement(); xout.EndElement();
} }
void cmCPackIFWRepository::WriteRepositoryUpdate(cmXMLWriter& xout) void cmCPackIFWRepository::WriteRepositoryUpdate(cmXMLWriter& xout) const
{ {
xout.StartElement("Repository"); xout.StartElement("Repository");

View File

@ -76,8 +76,8 @@ public:
bool PatchUpdatesXml(); bool PatchUpdatesXml();
void WriteRepositoryConfig(cmXMLWriter& xout); void WriteRepositoryConfig(cmXMLWriter& xout) const;
void WriteRepositoryUpdate(cmXMLWriter& xout); void WriteRepositoryUpdate(cmXMLWriter& xout) const;
void WriteRepositoryUpdates(cmXMLWriter& xout); void WriteRepositoryUpdates(cmXMLWriter& xout);
RepositoriesVector RepositoryUpdate; RepositoriesVector RepositoryUpdate;

View File

@ -107,7 +107,7 @@ public:
this->PipeState = cmsysProcess_WaitForExit(this->Process, timeout); this->PipeState = cmsysProcess_WaitForExit(this->Process, timeout);
return this->PipeState; return this->PipeState;
} }
int GetProcessState() { return this->PipeState; } int GetProcessState() const { return this->PipeState; }
private: private:
int PipeState; int PipeState;

View File

@ -265,7 +265,7 @@ void cmCTestLaunch::LoadScrapeRules()
} }
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 = std::string fname =
cmStrCat(this->Reporter.LogDir, "Custom", purpose, ".txt"); cmStrCat(this->Reporter.LogDir, "Custom", purpose, ".txt");

View File

@ -60,7 +60,7 @@ private:
bool ScrapeRulesLoaded; bool ScrapeRulesLoaded;
void LoadScrapeRules(); void LoadScrapeRules();
void LoadScrapeRules(const char* purpose, void LoadScrapeRules(const char* purpose,
std::vector<cmsys::RegularExpression>& regexps); std::vector<cmsys::RegularExpression>& regexps) const;
bool ScrapeLog(std::string const& fname); bool ScrapeLog(std::string const& fname);
// Helper class to generate the xml fragment. // Helper class to generate the xml fragment.

View File

@ -150,7 +150,7 @@ void cmCTestLaunchReporter::WriteXML()
this->WriteXMLLabels(e2); this->WriteXMLLabels(e2);
} }
void cmCTestLaunchReporter::WriteXMLAction(cmXMLElement& e2) void cmCTestLaunchReporter::WriteXMLAction(cmXMLElement& e2) const
{ {
e2.Comment("Meta-information about the build action"); e2.Comment("Meta-information about the build action");
cmXMLElement e3(e2, "Action"); cmXMLElement e3(e2, "Action");

View File

@ -70,7 +70,7 @@ public:
// Methods to generate the xml fragment. // Methods to generate the xml fragment.
void WriteXML(); void WriteXML();
void WriteXMLAction(cmXMLElement&); void WriteXMLAction(cmXMLElement&) const;
void WriteXMLCommand(cmXMLElement&); void WriteXMLCommand(cmXMLElement&);
void WriteXMLResult(cmXMLElement&); void WriteXMLResult(cmXMLElement&);
void WriteXMLLabels(cmXMLElement&); void WriteXMLLabels(cmXMLElement&);

View File

@ -300,7 +300,7 @@ void cmCTestMemCheckHandler::PopulateCustomVectors(cmMakefile* mf)
this->CustomTestsIgnore); this->CustomTestsIgnore);
} }
int cmCTestMemCheckHandler::GetDefectCount() int cmCTestMemCheckHandler::GetDefectCount() const
{ {
return this->DefectCount; return this->DefectCount;
} }

View File

@ -29,7 +29,7 @@ public:
void Initialize() override; void Initialize() override;
int GetDefectCount(); int GetDefectCount() const;
protected: protected:
int PreProcessHandler() override; int PreProcessHandler() override;

View File

@ -358,7 +358,7 @@ void cmProcess::ResetStartTime()
this->StartTime = std::chrono::steady_clock::now(); this->StartTime = std::chrono::steady_clock::now();
} }
cmProcess::Exception cmProcess::GetExitException() cmProcess::Exception cmProcess::GetExitException() const
{ {
auto exception = Exception::None; auto exception = Exception::None;
#if defined(_WIN32) && !defined(__CYGWIN__) #if defined(_WIN32) && !defined(__CYGWIN__)
@ -430,7 +430,7 @@ cmProcess::Exception cmProcess::GetExitException()
return exception; return exception;
} }
std::string cmProcess::GetExitExceptionString() std::string cmProcess::GetExitExceptionString() const
{ {
std::string exception_str; std::string exception_str;
#if defined(_WIN32) #if defined(_WIN32)

View File

@ -67,8 +67,8 @@ public:
Other Other
}; };
Exception GetExitException(); Exception GetExitException() const;
std::string GetExitExceptionString(); std::string GetExitExceptionString() const;
std::unique_ptr<cmCTestRunTest> GetRunner() std::unique_ptr<cmCTestRunTest> GetRunner()
{ {

View File

@ -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::string cmComputeLinkInformation::CreateExtensionRegex(
std::vector<std::string> const& exts, LinkType type) std::vector<std::string> const& exts, LinkType type)
{ {

View File

@ -77,7 +77,7 @@ bool cmDepends::Check(const std::string& makeFile,
return okay; return okay;
} }
void cmDepends::Clear(const std::string& file) void cmDepends::Clear(const std::string& file) const
{ {
// Print verbose output. // Print verbose output.
if (this->Verbose) { if (this->Verbose) {

View File

@ -70,7 +70,7 @@ public:
DependencyMap& validDeps); DependencyMap& validDeps);
/** Clear dependencies for the target file so they will be regenerated. */ /** 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 */ /** Set the file comparison object */
void SetFileTimeCache(cmFileTimeCache* fc) { this->FileTimeCache = fc; } void SetFileTimeCache(cmFileTimeCache* fc) { this->FileTimeCache = fc; }

View File

@ -103,7 +103,7 @@ void cmDependsJavaParserHelper::SafePrintMissing(const char* str, int line,
std::cout << "- " << strlen(str) << std::endl; 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) { if (this->Verbose) {
std::cout << "[" << place << "=" << str << "]" << std::endl; std::cout << "[" << place << "=" << str << "]" << std::endl;

View File

@ -85,7 +85,7 @@ private:
void PrintClasses(); 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 CombineUnions(char** out, const char* in1, char** in2, const char* sep);
void SafePrintMissing(const char* str, int line, int cnt); void SafePrintMissing(const char* str, int line, int cnt);

View File

@ -27,7 +27,7 @@ public:
void SetResult(KWIML_INT_int64_t value); 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(); } const char* GetError() { return this->ErrorString.c_str(); }

View File

@ -57,7 +57,7 @@ private:
BOOL LockFile(DWORD flags); BOOL LockFile(DWORD flags);
#else #else
int File = -1; int File = -1;
int LockFile(int cmd, int type); int LockFile(int cmd, int type) const;
#endif #endif
std::string Filename; std::string Filename;

View File

@ -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; struct ::flock lock;
lock.l_start = 0; lock.l_start = 0;

View File

@ -80,8 +80,8 @@ std::string cmFindPathCommand::FindHeader()
return header; return header;
} }
std::string cmFindPathCommand::FindHeaderInFramework(std::string const& file, std::string cmFindPathCommand::FindHeaderInFramework(
std::string const& dir) std::string const& file, std::string const& dir) const
{ {
std::string fileName = file; std::string fileName = file;
std::string frameWorkName; std::string frameWorkName;

View File

@ -29,7 +29,7 @@ public:
private: private:
std::string FindHeaderInFramework(std::string const& file, std::string FindHeaderInFramework(std::string const& file,
std::string const& dir); std::string const& dir) const;
std::string FindHeader(); std::string FindHeader();
std::string FindNormalHeader(cmFindBaseDebugState& debug); std::string FindNormalHeader(cmFindBaseDebugState& debug);
std::string FindFrameworkHeader(cmFindBaseDebugState& debug); std::string FindFrameworkHeader(cmFindBaseDebugState& debug);

View File

@ -134,13 +134,13 @@ public:
std::set<std::string>& emitted); std::set<std::string>& emitted);
// Make tool supports dependency files generated by compiler // Make tool supports dependency files generated by compiler
bool SupportsCompilerDependencies() bool SupportsCompilerDependencies() const
{ {
return this->ToolSupportsCompilerDependencies; return this->ToolSupportsCompilerDependencies;
} }
// Make tool supports long line dependencies // Make tool supports long line dependencies
bool SupportsLongLineDependencies() bool SupportsLongLineDependencies() const
{ {
return this->ToolSupportsLongLineDependencies; return this->ToolSupportsLongLineDependencies;
} }

View File

@ -57,28 +57,38 @@ public:
bool MakeFilesFullPath(const char* modeName, bool MakeFilesFullPath(const char* modeName,
const std::vector<std::string>& relFiles, const std::vector<std::string>& relFiles,
std::vector<std::string>& absFiles); std::vector<std::string>& absFiles);
bool CheckCMP0006(bool& failure); bool CheckCMP0006(bool& failure) const;
std::string GetDestination(const cmInstallCommandArguments* args, std::string GetDestination(const cmInstallCommandArguments* args,
const std::string& varName, const std::string& varName,
const std::string& guess); const std::string& guess) const;
std::string GetRuntimeDestination(const cmInstallCommandArguments* args); std::string GetRuntimeDestination(
std::string GetSbinDestination(const cmInstallCommandArguments* args); const cmInstallCommandArguments* args) const;
std::string GetArchiveDestination(const cmInstallCommandArguments* args); std::string GetSbinDestination(const cmInstallCommandArguments* args) const;
std::string GetLibraryDestination(const cmInstallCommandArguments* args); std::string GetArchiveDestination(
std::string GetIncludeDestination(const cmInstallCommandArguments* args); const cmInstallCommandArguments* args) const;
std::string GetSysconfDestination(const cmInstallCommandArguments* args); std::string GetLibraryDestination(
std::string GetSharedStateDestination(const cmInstallCommandArguments* args); const cmInstallCommandArguments* args) const;
std::string GetLocalStateDestination(const cmInstallCommandArguments* args); std::string GetIncludeDestination(
std::string GetRunStateDestination(const cmInstallCommandArguments* args); const cmInstallCommandArguments* args) const;
std::string GetDataRootDestination(const cmInstallCommandArguments* args); std::string GetSysconfDestination(
std::string GetDataDestination(const cmInstallCommandArguments* args); const cmInstallCommandArguments* args) const;
std::string GetInfoDestination(const cmInstallCommandArguments* args); std::string GetSharedStateDestination(
std::string GetLocaleDestination(const cmInstallCommandArguments* args); const cmInstallCommandArguments* args) const;
std::string GetManDestination(const cmInstallCommandArguments* args); std::string GetLocalStateDestination(
std::string GetDocDestination(const cmInstallCommandArguments* args); 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, std::string GetDestinationForType(const cmInstallCommandArguments* args,
const std::string& type); const std::string& type) const;
cmExecutionStatus& Status; cmExecutionStatus& Status;
cmMakefile* Makefile; cmMakefile* Makefile;
@ -1477,7 +1487,7 @@ bool Helper::MakeFilesFullPath(const char* modeName,
return true; return true;
} }
bool Helper::CheckCMP0006(bool& failure) bool Helper::CheckCMP0006(bool& failure) const
{ {
switch (this->Makefile->GetPolicyStatus(cmPolicies::CMP0006)) { switch (this->Makefile->GetPolicyStatus(cmPolicies::CMP0006)) {
case cmPolicies::WARN: case cmPolicies::WARN:
@ -1504,7 +1514,7 @@ bool Helper::CheckCMP0006(bool& failure)
std::string Helper::GetDestination(const cmInstallCommandArguments* args, std::string Helper::GetDestination(const cmInstallCommandArguments* args,
const std::string& varName, const std::string& varName,
const std::string& guess) const std::string& guess) const
{ {
if (args && !args->GetDestination().empty()) { if (args && !args->GetDestination().empty()) {
return args->GetDestination(); return args->GetDestination();
@ -1517,54 +1527,55 @@ std::string Helper::GetDestination(const cmInstallCommandArguments* args,
} }
std::string Helper::GetRuntimeDestination( std::string Helper::GetRuntimeDestination(
const cmInstallCommandArguments* args) const cmInstallCommandArguments* args) const
{ {
return this->GetDestination(args, "CMAKE_INSTALL_BINDIR", "bin"); 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"); return this->GetDestination(args, "CMAKE_INSTALL_SBINDIR", "sbin");
} }
std::string Helper::GetArchiveDestination( std::string Helper::GetArchiveDestination(
const cmInstallCommandArguments* args) const cmInstallCommandArguments* args) const
{ {
return this->GetDestination(args, "CMAKE_INSTALL_LIBDIR", "lib"); return this->GetDestination(args, "CMAKE_INSTALL_LIBDIR", "lib");
} }
std::string Helper::GetLibraryDestination( std::string Helper::GetLibraryDestination(
const cmInstallCommandArguments* args) const cmInstallCommandArguments* args) const
{ {
return this->GetDestination(args, "CMAKE_INSTALL_LIBDIR", "lib"); return this->GetDestination(args, "CMAKE_INSTALL_LIBDIR", "lib");
} }
std::string Helper::GetIncludeDestination( std::string Helper::GetIncludeDestination(
const cmInstallCommandArguments* args) const cmInstallCommandArguments* args) const
{ {
return this->GetDestination(args, "CMAKE_INSTALL_INCLUDEDIR", "include"); return this->GetDestination(args, "CMAKE_INSTALL_INCLUDEDIR", "include");
} }
std::string Helper::GetSysconfDestination( std::string Helper::GetSysconfDestination(
const cmInstallCommandArguments* args) const cmInstallCommandArguments* args) const
{ {
return this->GetDestination(args, "CMAKE_INSTALL_SYSCONFDIR", "etc"); return this->GetDestination(args, "CMAKE_INSTALL_SYSCONFDIR", "etc");
} }
std::string Helper::GetSharedStateDestination( std::string Helper::GetSharedStateDestination(
const cmInstallCommandArguments* args) const cmInstallCommandArguments* args) const
{ {
return this->GetDestination(args, "CMAKE_INSTALL_SHAREDSTATEDIR", "com"); return this->GetDestination(args, "CMAKE_INSTALL_SHAREDSTATEDIR", "com");
} }
std::string Helper::GetLocalStateDestination( std::string Helper::GetLocalStateDestination(
const cmInstallCommandArguments* args) const cmInstallCommandArguments* args) const
{ {
return this->GetDestination(args, "CMAKE_INSTALL_LOCALSTATEDIR", "var"); return this->GetDestination(args, "CMAKE_INSTALL_LOCALSTATEDIR", "var");
} }
std::string Helper::GetRunStateDestination( std::string Helper::GetRunStateDestination(
const cmInstallCommandArguments* args) const cmInstallCommandArguments* args) const
{ {
return this->GetDestination(args, "CMAKE_INSTALL_RUNSTATEDIR", return this->GetDestination(args, "CMAKE_INSTALL_RUNSTATEDIR",
this->GetLocalStateDestination(nullptr) + this->GetLocalStateDestination(nullptr) +
@ -1572,44 +1583,49 @@ std::string Helper::GetRunStateDestination(
} }
std::string Helper::GetDataRootDestination( std::string Helper::GetDataRootDestination(
const cmInstallCommandArguments* args) const cmInstallCommandArguments* args) const
{ {
return this->GetDestination(args, "CMAKE_INSTALL_DATAROOTDIR", "share"); 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", return this->GetDestination(args, "CMAKE_INSTALL_DATADIR",
this->GetDataRootDestination(nullptr)); 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", return this->GetDestination(args, "CMAKE_INSTALL_INFODIR",
this->GetDataRootDestination(nullptr) + "/info"); 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", return this->GetDestination(args, "CMAKE_INSTALL_LOCALEDIR",
this->GetDataRootDestination(nullptr) + this->GetDataRootDestination(nullptr) +
"/locale"); "/locale");
} }
std::string Helper::GetManDestination(const cmInstallCommandArguments* args) std::string Helper::GetManDestination(
const cmInstallCommandArguments* args) const
{ {
return this->GetDestination(args, "CMAKE_INSTALL_MANDIR", return this->GetDestination(args, "CMAKE_INSTALL_MANDIR",
this->GetDataRootDestination(nullptr) + "/man"); 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", return this->GetDestination(args, "CMAKE_INSTALL_DOCDIR",
this->GetDataRootDestination(nullptr) + "/doc"); this->GetDataRootDestination(nullptr) + "/doc");
} }
std::string Helper::GetDestinationForType( std::string Helper::GetDestinationForType(
const cmInstallCommandArguments* args, const std::string& type) const cmInstallCommandArguments* args, const std::string& type) const
{ {
if (args && !args->GetDestination().empty()) { if (args && !args->GetDestination().empty()) {
return args->GetDestination(); return args->GetDestination();

View File

@ -53,9 +53,8 @@ bool cmInstallScriptGenerator::Compute(cmLocalGenerator* lg)
return true; return true;
} }
void cmInstallScriptGenerator::AddScriptInstallRule(std::ostream& os, void cmInstallScriptGenerator::AddScriptInstallRule(
Indent indent, std::ostream& os, Indent indent, std::string const& script) const
std::string const& script)
{ {
if (this->Code) { if (this->Code) {
os << indent << script << "\n"; os << indent << script << "\n";

View File

@ -30,7 +30,7 @@ protected:
void GenerateScriptForConfig(std::ostream& os, const std::string& config, void GenerateScriptForConfig(std::ostream& os, const std::string& config,
Indent indent) override; Indent indent) override;
void AddScriptInstallRule(std::ostream& os, Indent indent, void AddScriptInstallRule(std::ostream& os, Indent indent,
std::string const& script); std::string const& script) const;
std::string const Script; std::string const Script;
bool const Code; bool const Code;

View File

@ -30,7 +30,7 @@ struct cmListFileParser
bool ParseFunction(const char* name, long line); bool ParseFunction(const char* name, long line);
bool AddArgument(cmListFileLexer_Token* token, bool AddArgument(cmListFileLexer_Token* token,
cmListFileArgument::Delimiter delim); cmListFileArgument::Delimiter delim);
cm::optional<cmListFileContext> CheckNesting(); cm::optional<cmListFileContext> CheckNesting() const;
cmListFile* ListFile; cmListFile* ListFile;
cmListFileBacktrace Backtrace; cmListFileBacktrace Backtrace;
cmMessenger* Messenger; 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; std::vector<NestingState> stack;

View File

@ -2772,7 +2772,7 @@ inline void RegisterUnitySources(cmGeneratorTarget* target, cmSourceFile* sf,
void cmLocalGenerator::IncludeFileInUnitySources( void cmLocalGenerator::IncludeFileInUnitySources(
cmGeneratedFileStream& unity_file, std::string const& sf_full_path, 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()) { if (uniqueIdName && !uniqueIdName->empty()) {
std::string pathToHash; std::string pathToHash;

View File

@ -656,7 +656,7 @@ private:
void IncludeFileInUnitySources(cmGeneratedFileStream& unity_file, void IncludeFileInUnitySources(cmGeneratedFileStream& unity_file,
std::string const& sf_full_path, std::string const& sf_full_path,
cmProp beforeInclude, cmProp afterInclude, cmProp beforeInclude, cmProp afterInclude,
cmProp uniqueIdName); cmProp uniqueIdName) const;
std::vector<std::string> AddUnityFilesModeAuto( std::vector<std::string> AddUnityFilesModeAuto(
cmGeneratorTarget* target, std::string const& lang, cmGeneratorTarget* target, std::string const& lang,
std::vector<cmSourceFile*> const& filtered_sources, cmProp beforeInclude, std::vector<cmSourceFile*> const& filtered_sources, cmProp beforeInclude,

View File

@ -23,7 +23,7 @@
#include "cmSystemTools.h" #include "cmSystemTools.h"
std::string cmTimestamp::CurrentTime(const std::string& formatString, std::string cmTimestamp::CurrentTime(const std::string& formatString,
bool utcFlag) bool utcFlag) const
{ {
time_t currentTimeT = time(nullptr); time_t currentTimeT = time(nullptr);
std::string source_date_epoch; std::string source_date_epoch;
@ -45,7 +45,7 @@ std::string cmTimestamp::CurrentTime(const std::string& formatString,
std::string cmTimestamp::FileModificationTime(const char* path, std::string cmTimestamp::FileModificationTime(const char* path,
const std::string& formatString, const std::string& formatString,
bool utcFlag) bool utcFlag) const
{ {
std::string real_path = std::string real_path =
cmSystemTools::GetRealPathResolvingWindowsSubst(path); cmSystemTools::GetRealPathResolvingWindowsSubst(path);

View File

@ -14,11 +14,11 @@
class cmTimestamp class cmTimestamp
{ {
public: 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, std::string FileModificationTime(const char* path,
const std::string& formatString, const std::string& formatString,
bool utcFlag); bool utcFlag) const;
std::string CreateTimestampFromTimeT(time_t timeT, std::string formatString, std::string CreateTimestampFromTimeT(time_t timeT, std::string formatString,
bool utcFlag) const; bool utcFlag) const;

View File

@ -170,9 +170,9 @@ public:
private: private:
// -- Libuv callbacks // -- Libuv callbacks
static void UVExit(uv_process_t* handle, int64_t exitStatus, int termSignal); 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 UVPipeOutEnd(ssize_t error);
void UVPipeErrData(cmUVPipeBuffer::DataRange data); void UVPipeErrData(cmUVPipeBuffer::DataRange data) const;
void UVPipeErrEnd(ssize_t error); void UVPipeErrEnd(ssize_t error);
void UVTryFinish(); 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()); this->Result()->StdOut.append(data.begin(), data.end());
} }
@ -346,7 +346,7 @@ void cmUVReadOnlyProcess::UVPipeOutEnd(ssize_t error)
this->UVTryFinish(); this->UVTryFinish();
} }
void cmUVReadOnlyProcess::UVPipeErrData(cmUVPipeBuffer::DataRange data) void cmUVReadOnlyProcess::UVPipeErrData(cmUVPipeBuffer::DataRange data) const
{ {
std::string* str = this->Setup_.MergedOutput ? &this->Result()->StdOut std::string* str = this->Setup_.MergedOutput ? &this->Result()->StdOut
: &this->Result()->StdErr; : &this->Result()->StdErr;

View File

@ -28,7 +28,7 @@ cmXMLSafe& cmXMLSafe::Quotes(bool b)
return *this; return *this;
} }
std::string cmXMLSafe::str() std::string cmXMLSafe::str() const
{ {
std::ostringstream ss; std::ostringstream ss;
ss << *this; ss << *this;

View File

@ -24,7 +24,7 @@ public:
cmXMLSafe& Quotes(bool b = true); cmXMLSafe& Quotes(bool b = true);
/** Get the escaped data as a string. */ /** Get the escaped data as a string. */
std::string str(); std::string str() const;
private: private:
char const* Data; char const* Data;

View File

@ -127,7 +127,7 @@ private:
exit(1); exit(1);
} }
bool IsWhitespace() bool IsWhitespace() const
{ {
return (this->C == ' ' || this->C == '\t' || this->C == '\n' || return (this->C == ' ' || this->C == '\t' || this->C == '\n' ||
this->C == '\r'); this->C == '\r');