Find references inside blocks.
llvm-svn: 77540
diff --git a/clang/lib/Index/ASTLocation.cpp b/clang/lib/Index/ASTLocation.cpp
index d528c5a..f010a2bc 100644
--- a/clang/lib/Index/ASTLocation.cpp
+++ b/clang/lib/Index/ASTLocation.cpp
@@ -103,6 +103,18 @@
return isContainedInStatement(Node, MD->getBody()) ? D : 0;
}
+ if (BlockDecl *BD = dyn_cast<BlockDecl>(D)) {
+ for (DeclContext::decl_iterator
+ I = BD->decls_begin(), E = BD->decls_end(); I != E; ++I) {
+ Decl *Child = FindImmediateParent(*I, Node);
+ if (Child)
+ return Child;
+ }
+
+ assert(BD->getBody() && "BlockDecl without body ?");
+ return isContainedInStatement(Node, BD->getBody()) ? D : 0;
+ }
+
return 0;
}