From 3cdff236e23e68fa19ed0b69f79ab7eb04593d28 Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Mon, 7 Dec 2009 22:01:30 +0000 Subject: [PATCH] Add the BlockDecl to the DeclContext. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90808 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Index/ASTVisitor.h | 2 +- lib/Sema/SemaExpr.cpp | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) 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); } -- 2.50.1