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. :)

llvm-svn: 133761
This commit is contained in:
John McCall 2011-06-23 21:18:31 +00:00
parent 08e17b506e
commit 63b45fef45
1 changed files with 2 additions and 6 deletions

View File

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