]> granicus.if.org Git - clang/commitdiff
Add the BlockDecl to the DeclContext.
authorTed Kremenek <kremenek@apple.com>
Mon, 7 Dec 2009 22:01:30 +0000 (22:01 +0000)
committerTed Kremenek <kremenek@apple.com>
Mon, 7 Dec 2009 22:01:30 +0000 (22:01 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90808 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Index/ASTVisitor.h
lib/Sema/SemaExpr.cpp

index 6cfa381608a5a5d6de9f5d68ab0268be16887de1..943c72025312540d37a7971b45a0baa2c17826b8 100644 (file)
@@ -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) {
index b3c5c9fc20bc925113cab5dab430c8315680f224..8332bf8f7b13860f9155e92384cc9e9ed4e1b561 100644 (file)
@@ -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);
 }