Don't assume a random access iterator, instead just use CFG::iterator.
Thanks Ted.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93413 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index 40c3e75..75fe7fd 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -1344,9 +1344,9 @@
// Mark all live things first.
MarkLive(&cfg->getEntry(), live);
- for (unsigned i = 0; i < cfg->getNumBlockIDs(); ++i) {
- if (!live[i]) {
- CFGBlock &b = *(cfg->begin()[i]);
+ for (CFG::iterator I = cfg->begin(), E = cfg->end(); I != E; ++I) {
+ CFGBlock &b = **I;
+ if (!live[b.getBlockID()]) {
if (!b.empty())
Diag(b[0].getStmt()->getLocStart(), diag::warn_unreachable);
// Avoid excessive errors by marking everything reachable from here