mirror of
https://github.com/intel/llvm.git
synced 2026-01-26 21:53:12 +08:00
Properly restore ActiveScope when we exit parsing of a block. This
should fix the largest problem in <rdar://problem/6669847>. llvm-svn: 66741
This commit is contained in:
@@ -4591,11 +4591,18 @@ void Sema::ActOnBlockError(SourceLocation CaretLoc, Scope *CurScope) {
|
||||
// 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 @@ Sema::ExprResult Sema::ActOnBlockStmtExpr(SourceLocation CaretLoc, StmtTy *body,
|
||||
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user