]> granicus.if.org Git - clang/commitdiff
Don't assume a random access iterator, instead just use CFG::iterator.
authorMike Stump <mrs@apple.com>
Thu, 14 Jan 2010 02:45:29 +0000 (02:45 +0000)
committerMike Stump <mrs@apple.com>
Thu, 14 Jan 2010 02:45:29 +0000 (02:45 +0000)
Thanks Ted.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93413 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaDecl.cpp

index 40c3e754ad98bb7eee0fe94106881a0f05ac78d8..75fe7fd00fcf10afe2459ca21142f563b782dabf 100644 (file)
@@ -1344,9 +1344,9 @@ void Sema::CheckUnreachable(AnalysisContext &AC) {
   // 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