Add the BlockDecl to the DeclContext.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90808 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Index/ASTVisitor.h b/lib/Index/ASTVisitor.h
index 6cfa381..943c720 100644
--- a/lib/Index/ASTVisitor.h
+++ b/lib/Index/ASTVisitor.h
@@ -104,7 +104,7 @@
}
void VisitBlockExpr(BlockExpr *Node) {
- Visit(Node->getBlockDecl());
+ // The BlockDecl is also visited by 'VisitDeclContext()'. No need to visit it twice.
}
void VisitStmt(Stmt *Node) {
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index b3c5c9f..8332bf8 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -6499,6 +6499,7 @@
CurFunctionNeedsScopeChecking = false;
BSI->TheDecl = BlockDecl::Create(Context, CurContext, CaretLoc);
+ CurContext->addDecl(BSI->TheDecl);
PushDeclContext(BlockScope, BSI->TheDecl);
}