aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Index/ASTVisitor.h2
-rw-r--r--lib/Sema/SemaExpr.cpp1
2 files changed, 2 insertions, 1 deletions
diff --git a/lib/Index/ASTVisitor.h b/lib/Index/ASTVisitor.h
index 6cfa381608..943c720253 100644
--- a/lib/Index/ASTVisitor.h
+++ b/lib/Index/ASTVisitor.h
@@ -104,7 +104,7 @@ public:
}
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 b3c5c9fc20..8332bf8f7b 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -6499,6 +6499,7 @@ void Sema::ActOnBlockStart(SourceLocation CaretLoc, Scope *BlockScope) {
CurFunctionNeedsScopeChecking = false;
BSI->TheDecl = BlockDecl::Create(Context, CurContext, CaretLoc);
+ CurContext->addDecl(BSI->TheDecl);
PushDeclContext(BlockScope, BSI->TheDecl);
}