summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clangd/FindTarget.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang-tools-extra/clangd/FindTarget.cpp')
-rw-r--r--clang-tools-extra/clangd/FindTarget.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/clang-tools-extra/clangd/FindTarget.cpp b/clang-tools-extra/clangd/FindTarget.cpp
index 7dc7fd906be..1ab80b72a90 100644
--- a/clang-tools-extra/clangd/FindTarget.cpp
+++ b/clang-tools-extra/clangd/FindTarget.cpp
@@ -448,8 +448,15 @@ llvm::SmallVector<ReferenceLoc, 2> refInDecl(const Decl *D) {
// FIXME: decide on how to surface destructors when we need them.
if (llvm::isa<CXXDestructorDecl>(ND))
return;
- Refs.push_back(ReferenceLoc{
- getQualifierLoc(*ND), ND->getLocation(), /*IsDecl=*/true, {ND}});
+ // Filter anonymous decls, name location will point outside the name token
+ // and the clients are not prepared to handle that.
+ if (ND->getDeclName().isIdentifier() &&
+ !ND->getDeclName().getAsIdentifierInfo())
+ return;
+ Refs.push_back(ReferenceLoc{getQualifierLoc(*ND),
+ ND->getLocation(),
+ /*IsDecl=*/true,
+ {ND}});
}
};
OpenPOWER on IntegriCloud