Skip to content

Commit 0a6fe05

Browse files
RKSimoncyndyishida
authored andcommitted
[TextAPI] Use const auto& in foreach loop to avoid pass-by-value static analyzer warnings. NFCI.
(cherry picked from commit 35e2172)
1 parent fde7d40 commit 0a6fe05

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

llvm/lib/TextAPI/TextStubV5.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ Error collectFromArray(TBDKey Key, const Object *Obj,
223223
return Error::success();
224224
}
225225

226-
for (Value Val : *Values) {
226+
for (const Value &Val : *Values) {
227227
auto ValStr = Val.getAsString();
228228
if (!ValStr.has_value())
229229
return make_error<JSONStubError>(getParseErrorMsg(Key));
@@ -256,7 +256,7 @@ Expected<TargetList> getTargets(const Object *Section) {
256256
return make_error<JSONStubError>(getParseErrorMsg(TBDKey::Targets));
257257

258258
TargetList IFTargets;
259-
for (Value JSONTarget : *Targets) {
259+
for (const Value &JSONTarget : *Targets) {
260260
auto TargetStr = JSONTarget.getAsString();
261261
if (!TargetStr.has_value())
262262
return make_error<JSONStubError>(getParseErrorMsg(TBDKey::Target));

0 commit comments

Comments
 (0)