[llvm] r224734 - Use iterators rather than indices to make this forwards-compatible with a change to the underlying container (to std::list)
David Blaikie
dblaikie at gmail.com
Mon Dec 22 13:26:39 PST 2014
Author: dblaikie
Date: Mon Dec 22 15:26:38 2014
New Revision: 224734
URL: http://llvm.org/viewvc/llvm-project?rev=224734&view=rev
Log:
Use iterators rather than indices to make this forwards-compatible with a change to the underlying container (to std::list)
Modified:
llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp
Modified: llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp?rev=224734&r1=224733&r2=224734&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp Mon Dec 22 15:26:38 2014
@@ -2606,10 +2606,11 @@ void AsmMatcherEmitter::run(raw_ostream
// Check for ambiguous matchables.
DEBUG_WITH_TYPE("ambiguous_instrs", {
unsigned NumAmbiguous = 0;
- for (unsigned i = 0, e = Info.Matchables.size(); i != e; ++i) {
- for (unsigned j = i + 1; j != e; ++j) {
- const MatchableInfo &A = *Info.Matchables[i];
- const MatchableInfo &B = *Info.Matchables[j];
+ for (auto I = Info.Matchables.begin(), E = Info.Matchables.end(); I != E;
+ ++I) {
+ for (auto J = std::next(I); J != E; ++J) {
+ const MatchableInfo &A = **I;
+ const MatchableInfo &B = **J;
if (A.couldMatchAmbiguouslyWith(B)) {
errs() << "warning: ambiguous matchables:\n";
More information about the llvm-commits
mailing list