diff options
author | Ben Boeckel <ben.boeckel@kitware.com> | 2022-05-17 18:21:42 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2022-05-24 13:09:44 (GMT) |
commit | aa3649eb0488fe9ea82c330f2c0c606bbb9d32f4 (patch) | |
tree | 0709bde281596e328aa27adb41380bbd1cd046a9 | |
parent | 6ff03d463f40176389943100690cf1ca8593d739 (diff) | |
download | CMake-aa3649eb0488fe9ea82c330f2c0c606bbb9d32f4.zip CMake-aa3649eb0488fe9ea82c330f2c0c606bbb9d32f4.tar.gz CMake-aa3649eb0488fe9ea82c330f2c0c606bbb9d32f4.tar.bz2 |
clang-tidy: fix `performance-unnecessary-copy-initialization` lints
-rw-r--r-- | Source/CursesDialog/cmCursesMainForm.cxx | 2 | ||||
-rw-r--r-- | Source/QtDialog/QCMakeCacheView.cxx | 4 | ||||
-rw-r--r-- | Source/cmCTest.cxx | 4 | ||||
-rw-r--r-- | Source/cmDependsFortran.cxx | 2 | ||||
-rw-r--r-- | Source/cmFileCommand.cxx | 2 | ||||
-rw-r--r-- | Source/cmGeneratorExpressionNode.cxx | 10 | ||||
-rw-r--r-- | Source/cmGetPropertyCommand.cxx | 2 | ||||
-rw-r--r-- | Source/cmListCommand.cxx | 8 | ||||
-rw-r--r-- | Source/cmLoadCacheCommand.cxx | 2 | ||||
-rw-r--r-- | Source/cmMathCommand.cxx | 4 |
10 files changed, 20 insertions, 20 deletions
diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx index 5b1a433..5a8e40f 100644 --- a/Source/CursesDialog/cmCursesMainForm.cxx +++ b/Source/CursesDialog/cmCursesMainForm.cxx @@ -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; diff --git a/Source/QtDialog/QCMakeCacheView.cxx b/Source/QtDialog/QCMakeCacheView.cxx index 964d967..f79d6fc 100644 --- a/Source/QtDialog/QCMakeCacheView.cxx +++ b/Source/QtDialog/QCMakeCacheView.cxx @@ -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()); diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index d4c0e77..9638a72 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -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++; diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx index d5e54ae..ac93c90 100644 --- a/Source/cmDependsFortran.cxx +++ b/Source/cmDependsFortran.cxx @@ -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]; diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index e4728ac..71aa134 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -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 diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index 26ffd4b..beb623f 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -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(), diff --git a/Source/cmGetPropertyCommand.cxx b/Source/cmGetPropertyCommand.cxx index 4a25311..943ce1d 100644 --- a/Source/cmGetPropertyCommand.cxx +++ b/Source/cmGetPropertyCommand.cxx @@ -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; diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx index ebd089b..d412534 100644 --- a/Source/cmListCommand.cxx +++ b/Source/cmListCommand.cxx @@ -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") { diff --git a/Source/cmLoadCacheCommand.cxx b/Source/cmLoadCacheCommand.cxx index d49e711..9981c05 100644 --- a/Source/cmLoadCacheCommand.cxx +++ b/Source/cmLoadCacheCommand.cxx @@ -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. diff --git a/Source/cmMathCommand.cxx b/Source/cmMathCommand.cxx index df9ebcf..1c0ff13 100644 --- a/Source/cmMathCommand.cxx +++ b/Source/cmMathCommand.cxx @@ -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") { |