]> granicus.if.org Git - clang/commitdiff
Apparently at some point in the past I forgot how 'continue'
authorJohn McCall <rjmccall@apple.com>
Thu, 23 Jun 2011 21:18:31 +0000 (21:18 +0000)
committerJohn McCall <rjmccall@apple.com>
Thu, 23 Jun 2011 21:18:31 +0000 (21:18 +0000)
works in a 'while(false)' loop.  Simplify this code;  it was
complicated only in anticipation of C++0x lambdas, and it can
become complicated again when those happen. :)

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

lib/AST/DeclBase.cpp

index 1766d39c1405f0ecace7b4548f366ea91e7b2989..b8d3ec60d3a16f908648f09c06fefe87fb8b9fbb 100644 (file)
@@ -641,12 +641,8 @@ DeclContext *Decl::getNonClosureContext() {
   // This is basically "while (DC->isClosure()) DC = DC->getParent();"
   // except that it's significantly more efficient to cast to a known
   // decl type and call getDeclContext() than to call getParent().
-  do {
-    if (isa<BlockDecl>(DC)) {
-      DC = cast<BlockDecl>(DC)->getDeclContext();
-      continue;
-    }
-  } while (false);
+  while (isa<BlockDecl>(DC))
+    DC = cast<BlockDecl>(DC)->getDeclContext();
 
   assert(!DC->isClosure());
   return DC;