From: Ted Kremenek Date: Mon, 7 Dec 2009 22:01:30 +0000 (+0000) Subject: Add the BlockDecl to the DeclContext. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3cdff236e23e68fa19ed0b69f79ab7eb04593d28;p=clang 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 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); }