diff options
author | Matthias Maennich <matthias@maennich.net> | 2017-09-19 15:54:08 +0200 |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2017-09-28 07:23:40 -0400 |
commit | bb0ad1bea81f60cbbb2c66c2c0ab24ee12db0026 (patch) | |
tree | 06db4eb05a227219eef3e265fef60f601640d051 | |
parent | 8cc33aeaec2798c9ff5a3af23e361ee22fa2ba95 (diff) | |
download | cmake-bb0ad1bea81f60cbbb2c66c2c0ab24ee12db0026.tar.gz |
Fix some occurrences using string by value rather than by const&
Fix issues diagnosed by clang-tidy
- performance-unnecessary-value-param
- performance-unnecessary-copy-initialization
Signed-off-by: Matthias Maennich <matthias@maennich.net>
-rw-r--r-- | Source/CPack/cmCPackDragNDropGenerator.cxx | 3 | ||||
-rw-r--r-- | Source/CPack/cmCPackDragNDropGenerator.h | 4 | ||||
-rw-r--r-- | Source/cmGlobalXCodeGenerator.cxx | 4 | ||||
-rw-r--r-- | Source/cmGlobalXCodeGenerator.h | 3 | ||||
-rw-r--r-- | Source/cmXCodeObject.cxx | 2 | ||||
-rw-r--r-- | Source/cmXCodeObject.h | 2 | ||||
-rw-r--r-- | Source/cmXCodeScheme.cxx | 10 | ||||
-rw-r--r-- | Source/cmXCodeScheme.h | 10 |
8 files changed, 20 insertions, 18 deletions
diff --git a/Source/CPack/cmCPackDragNDropGenerator.cxx b/Source/CPack/cmCPackDragNDropGenerator.cxx index 88204c811d..4fbd194108 100644 --- a/Source/CPack/cmCPackDragNDropGenerator.cxx +++ b/Source/CPack/cmCPackDragNDropGenerator.cxx @@ -769,7 +769,8 @@ std::string cmCPackDragNDropGenerator::GetComponentInstallDirNameSuffix( bool cmCPackDragNDropGenerator::WriteLicense( cmGeneratedFileStream& outputStream, int licenseNumber, - std::string licenseLanguage, std::string licenseFile, std::string* error) + std::string licenseLanguage, const std::string& licenseFile, + std::string* error) { if (!licenseFile.empty() && !singleLicense) { licenseNumber = 5002; diff --git a/Source/CPack/cmCPackDragNDropGenerator.h b/Source/CPack/cmCPackDragNDropGenerator.h index 8565c6829d..d8c5c83374 100644 --- a/Source/CPack/cmCPackDragNDropGenerator.h +++ b/Source/CPack/cmCPackDragNDropGenerator.h @@ -45,8 +45,8 @@ private: bool singleLicense; bool WriteLicense(cmGeneratedFileStream& outputStream, int licenseNumber, - std::string licenseLanguage, std::string licenseFile, - std::string* error); + std::string licenseLanguage, + const std::string& licenseFile, std::string* error); bool BreakLongLine(const std::string& line, std::vector<std::string>& lines, std::string* error); void EscapeQuotesAndBackslashes(std::string& line); diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index e9950d997f..a1bec6bed0 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -573,7 +573,7 @@ void cmGlobalXCodeGenerator::ClearXCodeObjects() void cmGlobalXCodeGenerator::addObject(cmXCodeObject* obj) { if (obj->GetType() == cmXCodeObject::OBJECT) { - std::string id = obj->GetId(); + const std::string& id = obj->GetId(); // If this is a duplicate id, it's an error: // @@ -2748,7 +2748,7 @@ bool cmGlobalXCodeGenerator::CreateGroups( } cmXCodeObject* cmGlobalXCodeGenerator::CreatePBXGroup(cmXCodeObject* parent, - std::string name) + const std::string& name) { cmXCodeObject* parentChildren = nullptr; if (parent) diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index 81d1bd0376..e9ca91ce4b 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -106,7 +106,8 @@ protected: private: cmXCodeObject* CreateOrGetPBXGroup(cmGeneratorTarget* gtgt, cmSourceGroup* sg); - cmXCodeObject* CreatePBXGroup(cmXCodeObject* parent, std::string name); + cmXCodeObject* CreatePBXGroup(cmXCodeObject* parent, + const std::string& name); bool CreateGroups(std::vector<cmLocalGenerator*>& generators); std::string XCodeEscapePath(const std::string& p); std::string RelativeToSource(const char* p); diff --git a/Source/cmXCodeObject.cxx b/Source/cmXCodeObject.cxx index 957adb4f78..457f913e51 100644 --- a/Source/cmXCodeObject.cxx +++ b/Source/cmXCodeObject.cxx @@ -130,7 +130,7 @@ void cmXCodeObject::Print(std::ostream& out) } void cmXCodeObject::PrintAttribute(std::ostream& out, const int level, - const std::string separator, + const std::string& separator, const int factor, const std::string& name, const cmXCodeObject* object, const cmXCodeObject* parent) diff --git a/Source/cmXCodeObject.h b/Source/cmXCodeObject.h index b51aac74dd..ceed6012c3 100644 --- a/Source/cmXCodeObject.h +++ b/Source/cmXCodeObject.h @@ -95,7 +95,7 @@ public: static void Indent(int level, std::ostream& out); void Print(std::ostream& out); void PrintAttribute(std::ostream& out, const int level, - const std::string separator, const int factor, + const std::string& separator, const int factor, const std::string& name, const cmXCodeObject* object, const cmXCodeObject* parent); virtual void PrintComment(std::ostream&) {} diff --git a/Source/cmXCodeScheme.cxx b/Source/cmXCodeScheme.cxx index f460365e7a..98e814ba72 100644 --- a/Source/cmXCodeScheme.cxx +++ b/Source/cmXCodeScheme.cxx @@ -91,7 +91,7 @@ void cmXCodeScheme::WriteBuildAction(cmXMLWriter& xout, } void cmXCodeScheme::WriteTestAction(cmXMLWriter& xout, - std::string configuration, + const std::string& configuration, const std::string& container) { xout.StartElement("TestAction"); @@ -127,7 +127,7 @@ void cmXCodeScheme::WriteTestAction(cmXMLWriter& xout, } void cmXCodeScheme::WriteLaunchAction(cmXMLWriter& xout, - std::string configuration, + const std::string& configuration, const std::string& container) { xout.StartElement("LaunchAction"); @@ -164,7 +164,7 @@ void cmXCodeScheme::WriteLaunchAction(cmXMLWriter& xout, } void cmXCodeScheme::WriteProfileAction(cmXMLWriter& xout, - std::string configuration) + const std::string& configuration) { xout.StartElement("ProfileAction"); xout.BreakAttributes(); @@ -177,7 +177,7 @@ void cmXCodeScheme::WriteProfileAction(cmXMLWriter& xout, } void cmXCodeScheme::WriteAnalyzeAction(cmXMLWriter& xout, - std::string configuration) + const std::string& configuration) { xout.StartElement("AnalyzeAction"); xout.BreakAttributes(); @@ -186,7 +186,7 @@ void cmXCodeScheme::WriteAnalyzeAction(cmXMLWriter& xout, } void cmXCodeScheme::WriteArchiveAction(cmXMLWriter& xout, - std::string configuration) + const std::string& configuration) { xout.StartElement("ArchiveAction"); xout.BreakAttributes(); diff --git a/Source/cmXCodeScheme.h b/Source/cmXCodeScheme.h index def75b1246..e5e501a6fd 100644 --- a/Source/cmXCodeScheme.h +++ b/Source/cmXCodeScheme.h @@ -37,13 +37,13 @@ private: void WriteXCodeXCScheme(std::ostream& fout, const std::string& container); void WriteBuildAction(cmXMLWriter& xout, const std::string& container); - void WriteTestAction(cmXMLWriter& xout, std::string configuration, + void WriteTestAction(cmXMLWriter& xout, const std::string& configuration, const std::string& container); - void WriteLaunchAction(cmXMLWriter& xout, std::string configuration, + void WriteLaunchAction(cmXMLWriter& xout, const std::string& configuration, const std::string& container); - void WriteProfileAction(cmXMLWriter& xout, std::string configuration); - void WriteAnalyzeAction(cmXMLWriter& xout, std::string configuration); - void WriteArchiveAction(cmXMLWriter& xout, std::string configuration); + void WriteProfileAction(cmXMLWriter& xout, const std::string& configuration); + void WriteAnalyzeAction(cmXMLWriter& xout, const std::string& configuration); + void WriteArchiveAction(cmXMLWriter& xout, const std::string& configuration); void WriteBuildableReference(cmXMLWriter& xout, const cmXCodeObject* xcObj, const std::string& container); |