[cfe-commits] r66741 - /cfe/trunk/lib/Sema/SemaExpr.cpp
Douglas Gregor
dgregor at apple.com
Wed Mar 11 16:54:15 PDT 2009
Author: dgregor
Date: Wed Mar 11 18:54:15 2009
New Revision: 66741
URL: http://llvm.org/viewvc/llvm-project?rev=66741&view=rev
Log:
Properly restore ActiveScope when we exit parsing of a block. This
should fix the largest problem in <rdar://problem/6669847>.
Modified:
cfe/trunk/lib/Sema/SemaExpr.cpp
Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=66741&r1=66740&r2=66741&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Wed Mar 11 18:54:15 2009
@@ -4591,11 +4591,18 @@
// Ensure that CurBlock is deleted.
llvm::OwningPtr<BlockSemaInfo> CC(CurBlock);
+ // Before popping CurBlock, set ActiveScope to this scope's function
+ // or block parent.
+ ActiveScope = CurBlock->TheScope->getParent();
+ while (ActiveScope &&
+ ((ActiveScope->getFlags() & (Scope::FnScope | Scope::BlockScope)) == 0))
+ ActiveScope = ActiveScope->getParent();
+
// Pop off CurBlock, handle nested blocks.
CurBlock = CurBlock->PrevBlockInfo;
// FIXME: Delete the ParmVarDecl objects as well???
-
+
}
/// ActOnBlockStmtExpr - This is called when the body of a block statement
@@ -4608,8 +4615,12 @@
PopDeclContext();
- // Before poping CurBlock, set ActiveScope to this scopes parent.
+ // Before popping CurBlock, set ActiveScope to this scope's function
+ // or block parent.
ActiveScope = CurBlock->TheScope->getParent();
+ while (ActiveScope &&
+ ((ActiveScope->getFlags() & (Scope::FnScope | Scope::BlockScope)) == 0))
+ ActiveScope = ActiveScope->getParent();
// Pop off CurBlock, handle nested blocks.
CurBlock = CurBlock->PrevBlockInfo;
More information about the cfe-commits
mailing list