[llvm] 35e2172 - [TextAPI] Use const auto& in foreach loop to avoid pass-by-value static analyzer warnings. NFCI.
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Sun Feb 26 07:43:29 PST 2023
Author: Simon Pilgrim
Date: 2023-02-26T15:43:03Z
New Revision: 35e21725e24a597755005e71652d59b010f5b6f3
URL: https://github.com/llvm/llvm-project/commit/35e21725e24a597755005e71652d59b010f5b6f3
DIFF: https://github.com/llvm/llvm-project/commit/35e21725e24a597755005e71652d59b010f5b6f3.diff
LOG: [TextAPI] Use const auto& in foreach loop to avoid pass-by-value static analyzer warnings. NFCI.
Added:
Modified:
llvm/lib/TextAPI/TextStubV5.cpp
Removed:
################################################################################
diff --git a/llvm/lib/TextAPI/TextStubV5.cpp b/llvm/lib/TextAPI/TextStubV5.cpp
index 5b580828ac7e..a9355fabe220 100644
--- a/llvm/lib/TextAPI/TextStubV5.cpp
+++ b/llvm/lib/TextAPI/TextStubV5.cpp
@@ -223,7 +223,7 @@ Error collectFromArray(TBDKey Key, const Object *Obj,
return Error::success();
}
- for (Value Val : *Values) {
+ for (const Value &Val : *Values) {
auto ValStr = Val.getAsString();
if (!ValStr.has_value())
return make_error<JSONStubError>(getParseErrorMsg(Key));
@@ -256,7 +256,7 @@ Expected<TargetList> getTargets(const Object *Section) {
return make_error<JSONStubError>(getParseErrorMsg(TBDKey::Targets));
TargetList IFTargets;
- for (Value JSONTarget : *Targets) {
+ for (const Value &JSONTarget : *Targets) {
auto TargetStr = JSONTarget.getAsString();
if (!TargetStr.has_value())
return make_error<JSONStubError>(getParseErrorMsg(TBDKey::Target));
More information about the llvm-commits
mailing list