aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2009-12-07 22:01:30 +0000
committerTed Kremenek <kremenek@apple.com>2009-12-07 22:01:30 +0000
commit3cdff236e23e68fa19ed0b69f79ab7eb04593d28 (patch)
tree7f6b49fa4fe268c874f4cc090dc1149151e0e780
parent48daf59c9f52856ca80074f1f5a30aa29c235726 (diff)
Add the BlockDecl to the DeclContext.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90808 91177308-0d34-0410-b5e6-96231b3b80d8
-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);
}