Fix Wrange-loop-analysis warnings in swiftshader.
Bug: chromium:1039697
Change-Id: I5af47f44696a0eb1da7516ea57f3ae766651cae3
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/41548
Presubmit-Ready: Nico Weber <thakis@chromium.org>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
diff --git a/src/OpenGL/libGLESv2/Program.cpp b/src/OpenGL/libGLESv2/Program.cpp
index cc4c49c..eb1070e 100644
--- a/src/OpenGL/libGLESv2/Program.cpp
+++ b/src/OpenGL/libGLESv2/Program.cpp
@@ -1454,7 +1454,7 @@
}
bool found = false;
- for(const glsl::Varying varying : vertexShader->varyings)
+ for(const glsl::Varying& varying : vertexShader->varyings)
{
if(tfVaryingName == varying.name)
{
diff --git a/third_party/llvm-7.0/llvm/lib/CodeGen/InlineSpiller.cpp b/third_party/llvm-7.0/llvm/lib/CodeGen/InlineSpiller.cpp
index 007e928..d88df6a 100644
--- a/third_party/llvm-7.0/llvm/lib/CodeGen/InlineSpiller.cpp
+++ b/third_party/llvm-7.0/llvm/lib/CodeGen/InlineSpiller.cpp
@@ -1396,7 +1396,7 @@
}
// For spills in SpillsToKeep with LiveReg set (i.e., not original spill),
// save them to SpillsToIns.
- for (const auto Ent : SpillsToKeep) {
+ for (const auto& Ent : SpillsToKeep) {
if (Ent.second)
SpillsToIns[Ent.first->getBlock()] = Ent.second;
}
@@ -1470,7 +1470,7 @@
StackIntvl.getValNumInfo(0));
// Insert hoisted spills.
- for (auto const Insert : SpillsToIns) {
+ for (auto const& Insert : SpillsToIns) {
MachineBasicBlock *BB = Insert.first;
unsigned LiveReg = Insert.second;
MachineBasicBlock::iterator MI = IPA.getLastInsertPointIter(OrigLI, *BB);
diff --git a/third_party/llvm-7.0/llvm/lib/IR/Attributes.cpp b/third_party/llvm-7.0/llvm/lib/IR/Attributes.cpp
index d871874..8a9811e 100644
--- a/third_party/llvm-7.0/llvm/lib/IR/Attributes.cpp
+++ b/third_party/llvm-7.0/llvm/lib/IR/Attributes.cpp
@@ -929,7 +929,7 @@
MaxIndex = Attrs[Attrs.size() - 2].first;
SmallVector<AttributeSet, 4> AttrVec(attrIdxToArrayIdx(MaxIndex) + 1);
- for (const auto Pair : Attrs)
+ for (const auto& Pair : Attrs)
AttrVec[attrIdxToArrayIdx(Pair.first)] = Pair.second;
return getImpl(C, AttrVec);