From: Mark de Wever Date: Sun, 22 Dec 2019 17:58:32 +0000 (+0100) Subject: [TableGen] Fixes -Wrange-loop-analysis warnings X-Git-Tag: llvmorg-11-init~1549 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e8d448ec255c7034cd00d1e0d1469eb6b31682ae;p=platform%2Fupstream%2Fllvm.git [TableGen] Fixes -Wrange-loop-analysis warnings This avoids new warnings due to D68912 adds -Wrange-loop-analysis to -Wall. Differential Revision: https://reviews.llvm.org/D71807 --- diff --git a/llvm/utils/TableGen/AsmMatcherEmitter.cpp b/llvm/utils/TableGen/AsmMatcherEmitter.cpp index 1d39b30..ccf0959 100644 --- a/llvm/utils/TableGen/AsmMatcherEmitter.cpp +++ b/llvm/utils/TableGen/AsmMatcherEmitter.cpp @@ -3347,7 +3347,7 @@ void AsmMatcherEmitter::run(raw_ostream &OS) { return true; if (A.size() > B.size()) return false; - for (const auto &Pair : zip(A, B)) { + for (auto Pair : zip(A, B)) { if (std::get<0>(Pair)->getName() < std::get<1>(Pair)->getName()) return true; if (std::get<0>(Pair)->getName() > std::get<1>(Pair)->getName()) diff --git a/llvm/utils/TableGen/CodeEmitterGen.cpp b/llvm/utils/TableGen/CodeEmitterGen.cpp index 42f69cb..68cb8f1 100644 --- a/llvm/utils/TableGen/CodeEmitterGen.cpp +++ b/llvm/utils/TableGen/CodeEmitterGen.cpp @@ -563,7 +563,7 @@ void CodeEmitterGen::run(raw_ostream &o) { return true; if (A.size() > B.size()) return false; - for (const auto &Pair : zip(A, B)) { + for (auto Pair : zip(A, B)) { if (std::get<0>(Pair)->getName() < std::get<1>(Pair)->getName()) return true; if (std::get<0>(Pair)->getName() > std::get<1>(Pair)->getName()) diff --git a/llvm/utils/TableGen/CodeGenDAGPatterns.cpp b/llvm/utils/TableGen/CodeGenDAGPatterns.cpp index 332581a..d01de33 100644 --- a/llvm/utils/TableGen/CodeGenDAGPatterns.cpp +++ b/llvm/utils/TableGen/CodeGenDAGPatterns.cpp @@ -636,7 +636,7 @@ bool TypeInfer::EnforceVectorSubVectorTypeIs(TypeSetByHwMode &Vec, /// Return true if S has no element (vector type) that T is a sub-vector of, /// i.e. has the same element type as T and more elements. auto NoSubV = [&IsSubVec](const TypeSetByHwMode::SetType &S, MVT T) -> bool { - for (const auto &I : S) + for (auto I : S) if (IsSubVec(T, I)) return false; return true; @@ -645,7 +645,7 @@ bool TypeInfer::EnforceVectorSubVectorTypeIs(TypeSetByHwMode &Vec, /// Return true if S has no element (vector type) that T is a super-vector /// of, i.e. has the same element type as T and fewer elements. auto NoSupV = [&IsSubVec](const TypeSetByHwMode::SetType &S, MVT T) -> bool { - for (const auto &I : S) + for (auto I : S) if (IsSubVec(I, T)) return false; return true; diff --git a/llvm/utils/TableGen/GlobalISelEmitter.cpp b/llvm/utils/TableGen/GlobalISelEmitter.cpp index 895aa8a..07da34c 100644 --- a/llvm/utils/TableGen/GlobalISelEmitter.cpp +++ b/llvm/utils/TableGen/GlobalISelEmitter.cpp @@ -1181,7 +1181,7 @@ public: TypeIDValues.clear(); unsigned ID = 0; - for (const LLTCodeGen LLTy : KnownTypes) + for (const LLTCodeGen &LLTy : KnownTypes) TypeIDValues[LLTy] = ID++; } @@ -2153,7 +2153,7 @@ public: return false; } - for (const auto &Operand : zip(Operands, B.Operands)) { + for (auto Operand : zip(Operands, B.Operands)) { if (std::get<0>(Operand)->isHigherPriorityThan(*std::get<1>(Operand))) return true; if (std::get<1>(Operand)->isHigherPriorityThan(*std::get<0>(Operand))) @@ -3159,7 +3159,7 @@ bool RuleMatcher::isHigherPriorityThan(const RuleMatcher &B) const { if (Matchers.size() < B.Matchers.size()) return false; - for (const auto &Matcher : zip(Matchers, B.Matchers)) { + for (auto Matcher : zip(Matchers, B.Matchers)) { if (std::get<0>(Matcher)->isHigherPriorityThan(*std::get<1>(Matcher))) return true; if (std::get<1>(Matcher)->isHigherPriorityThan(*std::get<0>(Matcher))) @@ -5176,7 +5176,7 @@ void GlobalISelEmitter::run(raw_ostream &OS) { return true; if (A.size() > B.size()) return false; - for (const auto &Pair : zip(A, B)) { + for (auto Pair : zip(A, B)) { if (std::get<0>(Pair)->getName() < std::get<1>(Pair)->getName()) return true; if (std::get<0>(Pair)->getName() > std::get<1>(Pair)->getName()) diff --git a/llvm/utils/TableGen/OptParserEmitter.cpp b/llvm/utils/TableGen/OptParserEmitter.cpp index 5398bc8..c1978ac 100644 --- a/llvm/utils/TableGen/OptParserEmitter.cpp +++ b/llvm/utils/TableGen/OptParserEmitter.cpp @@ -241,9 +241,9 @@ void EmitOptParser(RecordKeeper &Records, raw_ostream &OS) { OS << "bool ValuesWereAdded;\n"; OS << R.getValueAsString("ValuesCode"); OS << "\n"; - for (const std::string &Pref : R.getValueAsListOfStrings("Prefixes")) { + for (std::string S : R.getValueAsListOfStrings("Prefixes")) { OS << "ValuesWereAdded = Opt.addValues("; - std::string S = (Pref + R.getValueAsString("Name")).str(); + S += R.getValueAsString("Name"); write_cstring(OS, S); OS << ", Values);\n"; OS << "(void)ValuesWereAdded;\n";