mirror of
https://github.com/Kitware/CMake.git
synced 2026-05-06 22:30:07 -05:00
clang-tidy: fix performance-unnecessary-copy-initialization lints
This commit is contained in:
@@ -617,7 +617,7 @@ void cmCursesMainForm::FillCacheManagerFromUI()
|
||||
cmValue existingValue =
|
||||
this->CMakeInstance->GetState()->GetCacheEntryValue(cacheKey);
|
||||
if (existingValue) {
|
||||
std::string oldValue = *existingValue;
|
||||
std::string const& oldValue = *existingValue;
|
||||
std::string newValue = entry.Entry->GetValue();
|
||||
std::string fixedOldValue;
|
||||
std::string fixedNewValue;
|
||||
|
||||
@@ -303,7 +303,7 @@ void QCMakeCacheModel::setProperties(const QCMakePropertyList& props)
|
||||
|
||||
int num = props2.size();
|
||||
for (int i = 0; i < num; i++) {
|
||||
QCMakeProperty prop = props2[i];
|
||||
QCMakeProperty const& prop = props2[i];
|
||||
QList<QStandardItem*> items;
|
||||
items.append(new QStandardItem());
|
||||
items.append(new QStandardItem());
|
||||
@@ -325,7 +325,7 @@ void QCMakeCacheModel::setProperties(const QCMakePropertyList& props)
|
||||
|
||||
int num = props2.size();
|
||||
for (int i = 0; i < num; i++) {
|
||||
QCMakeProperty prop = props2[i];
|
||||
QCMakeProperty const& prop = props2[i];
|
||||
QList<QStandardItem*> items;
|
||||
items.append(new QStandardItem());
|
||||
items.append(new QStandardItem());
|
||||
|
||||
+2
-2
@@ -2804,7 +2804,7 @@ bool cmCTest::HandleTestActionArgument(const char* ctestExec, size_t& i,
|
||||
const std::vector<std::string>& args)
|
||||
{
|
||||
bool success = true;
|
||||
std::string arg = args[i];
|
||||
std::string const& arg = args[i];
|
||||
if (this->CheckArgument(arg, "-T"_s, "--test-action") &&
|
||||
(i < args.size() - 1)) {
|
||||
this->Impl->ProduceXML = true;
|
||||
@@ -2836,7 +2836,7 @@ bool cmCTest::HandleTestModelArgument(const char* ctestExec, size_t& i,
|
||||
const std::vector<std::string>& args)
|
||||
{
|
||||
bool success = true;
|
||||
std::string arg = args[i];
|
||||
std::string const& arg = args[i];
|
||||
if (this->CheckArgument(arg, "-M"_s, "--test-model") &&
|
||||
(i < args.size() - 1)) {
|
||||
i++;
|
||||
|
||||
@@ -478,7 +478,7 @@ bool cmDependsFortran::CopyModule(const std::vector<std::string>& args)
|
||||
// when the interface described in the module does not.
|
||||
|
||||
std::string mod = args[2];
|
||||
std::string stamp = args[3];
|
||||
std::string const& stamp = args[3];
|
||||
std::string compilerId;
|
||||
if (args.size() >= 5) {
|
||||
compilerId = args[4];
|
||||
|
||||
@@ -285,7 +285,7 @@ bool HandleStringsCommand(std::vector<std::string> const& args,
|
||||
}
|
||||
|
||||
// Get the variable in which to store the results.
|
||||
std::string outVar = args[2];
|
||||
std::string const& outVar = args[2];
|
||||
|
||||
// Parse the options.
|
||||
enum
|
||||
|
||||
@@ -413,7 +413,7 @@ static const struct TargetExistsNode : public cmGeneratorExpressionNode
|
||||
return std::string();
|
||||
}
|
||||
|
||||
std::string targetName = parameters.front();
|
||||
std::string const& targetName = parameters.front();
|
||||
if (targetName.empty() ||
|
||||
!cmGeneratorExpression::IsValidTargetName(targetName)) {
|
||||
reportError(context, content->GetOriginalExpression(),
|
||||
@@ -445,7 +445,7 @@ static const struct TargetNameIfExistsNode : public cmGeneratorExpressionNode
|
||||
return std::string();
|
||||
}
|
||||
|
||||
std::string targetName = parameters.front();
|
||||
std::string const& targetName = parameters.front();
|
||||
if (targetName.empty() ||
|
||||
!cmGeneratorExpression::IsValidTargetName(targetName)) {
|
||||
reportError(context, content->GetOriginalExpression(),
|
||||
@@ -1759,7 +1759,7 @@ static const struct TargetObjectsNode : public cmGeneratorExpressionNode
|
||||
const GeneratorExpressionContent* content,
|
||||
cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override
|
||||
{
|
||||
std::string tgtName = parameters.front();
|
||||
std::string const& tgtName = parameters.front();
|
||||
cmGeneratorTarget* gt = context->LG->FindGeneratorTargetToUse(tgtName);
|
||||
if (!gt) {
|
||||
std::ostringstream e;
|
||||
@@ -1847,7 +1847,7 @@ static const struct TargetRuntimeDllsNode : public cmGeneratorExpressionNode
|
||||
const GeneratorExpressionContent* content,
|
||||
cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override
|
||||
{
|
||||
std::string tgtName = parameters.front();
|
||||
std::string const& tgtName = parameters.front();
|
||||
cmGeneratorTarget* gt = context->LG->FindGeneratorTargetToUse(tgtName);
|
||||
if (!gt) {
|
||||
std::ostringstream e;
|
||||
@@ -2396,7 +2396,7 @@ protected:
|
||||
cmGeneratorExpressionDAGChecker* dagChecker) const
|
||||
{
|
||||
// Lookup the referenced target.
|
||||
std::string name = parameters.front();
|
||||
std::string const& name = parameters.front();
|
||||
|
||||
if (!cmGeneratorExpression::IsValidTargetName(name)) {
|
||||
::reportError(context, content->GetOriginalExpression(),
|
||||
|
||||
@@ -71,7 +71,7 @@ bool cmGetPropertyCommand(std::vector<std::string> const& args,
|
||||
}
|
||||
|
||||
// The cmake variable in which to store the result.
|
||||
const std::string variable = args[0];
|
||||
std::string const& variable = args[0];
|
||||
|
||||
std::string name;
|
||||
std::string propertyName;
|
||||
|
||||
@@ -1199,7 +1199,7 @@ bool HandleSortCommand(std::vector<std::string> const& args,
|
||||
const std::string messageHint = "sub-command SORT ";
|
||||
|
||||
while (argumentIndex < args.size()) {
|
||||
const std::string option = args[argumentIndex++];
|
||||
std::string const& option = args[argumentIndex++];
|
||||
if (option == "COMPARE") {
|
||||
if (sortCompare != cmStringSorter::Compare::UNINITIALIZED) {
|
||||
std::string error = cmStrCat(messageHint, "option \"", option,
|
||||
@@ -1208,7 +1208,7 @@ bool HandleSortCommand(std::vector<std::string> const& args,
|
||||
return false;
|
||||
}
|
||||
if (argumentIndex < args.size()) {
|
||||
const std::string argument = args[argumentIndex++];
|
||||
std::string const& argument = args[argumentIndex++];
|
||||
if (argument == "STRING") {
|
||||
sortCompare = cmStringSorter::Compare::STRING;
|
||||
} else if (argument == "FILE_BASENAME") {
|
||||
@@ -1235,7 +1235,7 @@ bool HandleSortCommand(std::vector<std::string> const& args,
|
||||
return false;
|
||||
}
|
||||
if (argumentIndex < args.size()) {
|
||||
const std::string argument = args[argumentIndex++];
|
||||
std::string const& argument = args[argumentIndex++];
|
||||
if (argument == "SENSITIVE") {
|
||||
sortCaseSensitivity = cmStringSorter::CaseSensitivity::SENSITIVE;
|
||||
} else if (argument == "INSENSITIVE") {
|
||||
@@ -1259,7 +1259,7 @@ bool HandleSortCommand(std::vector<std::string> const& args,
|
||||
return false;
|
||||
}
|
||||
if (argumentIndex < args.size()) {
|
||||
const std::string argument = args[argumentIndex++];
|
||||
std::string const& argument = args[argumentIndex++];
|
||||
if (argument == "ASCENDING") {
|
||||
sortOrder = cmStringSorter::Order::ASCENDING;
|
||||
} else if (argument == "DESCENDING") {
|
||||
|
||||
@@ -106,7 +106,7 @@ static bool ReadWithPrefix(std::vector<std::string> const& args,
|
||||
}
|
||||
|
||||
// Prepare the table of variables to read.
|
||||
std::string const prefix = args[2];
|
||||
std::string const& prefix = args[2];
|
||||
std::set<std::string> const variablesToRead(args.begin() + 3, args.end());
|
||||
|
||||
// Read the cache file.
|
||||
|
||||
@@ -57,10 +57,10 @@ bool HandleExprCommand(std::vector<std::string> const& args,
|
||||
|
||||
if (argumentIndex < args.size()) {
|
||||
const std::string messageHint = "sub-command EXPR ";
|
||||
const std::string option = args[argumentIndex++];
|
||||
std::string const& option = args[argumentIndex++];
|
||||
if (option == "OUTPUT_FORMAT") {
|
||||
if (argumentIndex < args.size()) {
|
||||
const std::string argument = args[argumentIndex++];
|
||||
std::string const& argument = args[argumentIndex++];
|
||||
if (argument == "DECIMAL") {
|
||||
outputFormat = NumericFormat::DECIMAL;
|
||||
} else if (argument == "HEXADECIMAL") {
|
||||
|
||||
Reference in New Issue
Block a user