[cfe-commits] r133761 - /cfe/trunk/lib/AST/DeclBase.cpp

John McCall rjmccall at apple.com
Thu Jun 23 14:18:32 PDT 2011


Author: rjmccall
Date: Thu Jun 23 16:18:31 2011
New Revision: 133761

URL: http://llvm.org/viewvc/llvm-project?rev=133761&view=rev
Log:
Apparently at some point in the past I forgot how 'continue'
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. :)


Modified:
    cfe/trunk/lib/AST/DeclBase.cpp

Modified: cfe/trunk/lib/AST/DeclBase.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclBase.cpp?rev=133761&r1=133760&r2=133761&view=diff
==============================================================================
--- cfe/trunk/lib/AST/DeclBase.cpp (original)
+++ cfe/trunk/lib/AST/DeclBase.cpp Thu Jun 23 16:18:31 2011
@@ -641,12 +641,8 @@
   // 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;





More information about the cfe-commits mailing list