summaryrefslogtreecommitdiffstats
path: root/Source/cmListCommand.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2019-08-07 15:45:02 (GMT)
committerKitware Robot <kwrobot@kitware.com>2019-08-07 15:54:53 (GMT)
commitbbf4a5771f8113ce5b88968c4dd3def2fbcd9354 (patch)
treef24c69250b525f26c2d0cb100468f74d08bccabb /Source/cmListCommand.cxx
parentdd53122be5b142e97ac02d1dec62719db29bc39e (diff)
parent18b0330b86cae2771a54021e390f157a097c8a99 (diff)
downloadCMake-bbf4a5771f8113ce5b88968c4dd3def2fbcd9354.zip
CMake-bbf4a5771f8113ce5b88968c4dd3def2fbcd9354.tar.gz
CMake-bbf4a5771f8113ce5b88968c4dd3def2fbcd9354.tar.bz2
Merge topic 'tidy_inefficient_string'
18b0330b86 clang-tidy: Enable performance-inefficient-string-concatenation Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !3648
Diffstat (limited to 'Source/cmListCommand.cxx')
-rw-r--r--Source/cmListCommand.cxx51
1 files changed, 23 insertions, 28 deletions
diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx
index 1f748ca..868f564 100644
--- a/Source/cmListCommand.cxx
+++ b/Source/cmListCommand.cxx
@@ -1189,8 +1189,8 @@ bool cmListCommand::HandleSortCommand(std::vector<std::string> const& args)
const std::string option = args[argumentIndex++];
if (option == "COMPARE") {
if (sortCompare != cmStringSorter::Compare::UNINITIALIZED) {
- std::string error = messageHint + "option \"" + option +
- "\" has been specified multiple times.";
+ std::string error = cmStrCat(messageHint, "option \"", option,
+ "\" has been specified multiple times.");
this->SetError(error);
return false;
}
@@ -1201,23 +1201,22 @@ bool cmListCommand::HandleSortCommand(std::vector<std::string> const& args)
} else if (argument == "FILE_BASENAME") {
sortCompare = cmStringSorter::Compare::FILE_BASENAME;
} else {
- std::string error = messageHint + "value \"" + argument +
- "\" for option \"" + option + "\" is invalid.";
+ std::string error =
+ cmStrCat(messageHint, "value \"", argument, "\" for option \"",
+ option, "\" is invalid.");
this->SetError(error);
return false;
}
} else {
- std::string error =
- messageHint + "missing argument for option \"" + option + "\".";
- this->SetError(error);
+ this->SetError(cmStrCat(messageHint, "missing argument for option \"",
+ option, "\"."));
return false;
}
} else if (option == "CASE") {
if (sortCaseSensitivity !=
cmStringSorter::CaseSensitivity::UNINITIALIZED) {
- std::string error = messageHint + "option \"" + option +
- "\" has been specified multiple times.";
- this->SetError(error);
+ this->SetError(cmStrCat(messageHint, "option \"", option,
+ "\" has been specified multiple times."));
return false;
}
if (argumentIndex < args.size()) {
@@ -1227,23 +1226,21 @@ bool cmListCommand::HandleSortCommand(std::vector<std::string> const& args)
} else if (argument == "INSENSITIVE") {
sortCaseSensitivity = cmStringSorter::CaseSensitivity::INSENSITIVE;
} else {
- std::string error = messageHint + "value \"" + argument +
- "\" for option \"" + option + "\" is invalid.";
- this->SetError(error);
+ this->SetError(cmStrCat(messageHint, "value \"", argument,
+ "\" for option \"", option,
+ "\" is invalid."));
return false;
}
} else {
- std::string error =
- messageHint + "missing argument for option \"" + option + "\".";
- this->SetError(error);
+ this->SetError(cmStrCat(messageHint, "missing argument for option \"",
+ option, "\"."));
return false;
}
} else if (option == "ORDER") {
if (sortOrder != cmStringSorter::Order::UNINITIALIZED) {
- std::string error = messageHint + "option \"" + option +
- "\" has been specified multiple times.";
- this->SetError(error);
+ this->SetError(cmStrCat(messageHint, "option \"", option,
+ "\" has been specified multiple times."));
return false;
}
if (argumentIndex < args.size()) {
@@ -1253,21 +1250,19 @@ bool cmListCommand::HandleSortCommand(std::vector<std::string> const& args)
} else if (argument == "DESCENDING") {
sortOrder = cmStringSorter::Order::DESCENDING;
} else {
- std::string error = messageHint + "value \"" + argument +
- "\" for option \"" + option + "\" is invalid.";
- this->SetError(error);
+ this->SetError(cmStrCat(messageHint, "value \"", argument,
+ "\" for option \"", option,
+ "\" is invalid."));
return false;
}
} else {
- std::string error =
- messageHint + "missing argument for option \"" + option + "\".";
- this->SetError(error);
+ this->SetError(cmStrCat(messageHint, "missing argument for option \"",
+ option, "\"."));
return false;
}
} else {
- std::string error =
- messageHint + "option \"" + option + "\" is unknown.";
- this->SetError(error);
+ this->SetError(
+ cmStrCat(messageHint, "option \"", option, "\" is unknown."));
return false;
}
}