summaryrefslogtreecommitdiff
path: root/Source/cmGlobalNinjaGenerator.cxx
diff options
context:
space:
mode:
authorDaniel Pfeifer <daniel@pfeifer-mail.de>2016-05-26 22:21:15 +0200
committerDaniel Pfeifer <daniel@pfeifer-mail.de>2016-05-26 22:21:15 +0200
commit27ead963052b4c3f4e40ea9e6141ba9902ad310a (patch)
tree69996681031307b34c930d51e0b3406fedf74236 /Source/cmGlobalNinjaGenerator.cxx
parent618fb23fc9838d344e2033c64bfc1a3a55bb7f61 (diff)
downloadcmake-27ead963052b4c3f4e40ea9e6141ba9902ad310a.tar.gz
Remove unnecessary local copies.
Use clang-tidy's performance-unnecessary-copy-initialization checker. After applying the fix-its (which turns the copies into const&), revise the changes and see whether the copies can be removed entirely by using the original instead.
Diffstat (limited to 'Source/cmGlobalNinjaGenerator.cxx')
-rw-r--r--Source/cmGlobalNinjaGenerator.cxx7
1 files changed, 3 insertions, 4 deletions
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index a1c9d76e4e..143ad9213c 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -46,15 +46,14 @@ void cmGlobalNinjaGenerator::WriteComment(std::ostream& os,
if (comment.empty())
return;
- std::string replace = comment;
std::string::size_type lpos = 0;
std::string::size_type rpos;
os << "\n#############################################\n";
- while ((rpos = replace.find('\n', lpos)) != std::string::npos) {
- os << "# " << replace.substr(lpos, rpos - lpos) << "\n";
+ while ((rpos = comment.find('\n', lpos)) != std::string::npos) {
+ os << "# " << comment.substr(lpos, rpos - lpos) << "\n";
lpos = rpos + 1;
}
- os << "# " << replace.substr(lpos) << "\n\n";
+ os << "# " << comment.substr(lpos) << "\n\n";
}
std::string cmGlobalNinjaGenerator::EncodeRuleName(std::string const& name)