Use iterators rather than indices to make this forwards-compatible with a change to the underlying container (to std::list)

llvm-svn: 224734
This commit is contained in:
David Blaikie 2014-12-22 21:26:38 +00:00
parent ba4e00f04a
commit 9a6f2836db
1 changed files with 5 additions and 4 deletions

View File

@ -2606,10 +2606,11 @@ void AsmMatcherEmitter::run(raw_ostream &OS) {
// 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";