Fix -Wloop-analysis warnings in llvm-subzero.
These match changes that have been previously landed in LLVM upstream.
Bug: chromium:1223264
Change-Id: Ifb104adc7d513b38ad13d96171b290ff204a7de1
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/55128
Kokoro-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Peter Kasting <pkasting@google.com>
Commit-Queue: Peter Kasting <pkasting@google.com>
diff --git a/third_party/llvm-subzero/lib/Support/CommandLine.cpp b/third_party/llvm-subzero/lib/Support/CommandLine.cpp
index ad5b733..3605c0f 100644
--- a/third_party/llvm-subzero/lib/Support/CommandLine.cpp
+++ b/third_party/llvm-subzero/lib/Support/CommandLine.cpp
@@ -137,7 +137,7 @@
// If we're adding this to all sub-commands, add it to the ones that have
// already been registered.
if (SC == &*AllSubCommands) {
- for (const auto &Sub : RegisteredSubCommands) {
+ for (auto *Sub : RegisteredSubCommands) {
if (SC == Sub)
continue;
addLiteralOption(Opt, Sub, Name);
@@ -188,7 +188,7 @@
// If we're adding this to all sub-commands, add it to the ones that have
// already been registered.
if (SC == &*AllSubCommands) {
- for (const auto &Sub : RegisteredSubCommands) {
+ for (auto *Sub : RegisteredSubCommands) {
if (SC == Sub)
continue;
addOption(O, Sub);
@@ -254,7 +254,7 @@
}
bool hasOptions() const {
- for (const auto &S : RegisteredSubCommands) {
+ for (const auto *S : RegisteredSubCommands) {
if (hasOptions(*S))
return true;
}
@@ -1738,7 +1738,7 @@
static void
sortSubCommands(const SmallPtrSetImpl<SubCommand *> &SubMap,
SmallVectorImpl<std::pair<const char *, SubCommand *>> &Subs) {
- for (const auto &S : SubMap) {
+ for (auto *S : SubMap) {
if (S->getName().empty())
continue;
Subs.push_back(std::make_pair(S->getName().data(), S));