[clangd] Ignore implicit conversion-operator nodes in find refs.

Reviewers: ilya-biryukov

Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D66478

llvm-svn: 369514
This commit is contained in:
Haojian Wu 2019-08-21 10:54:19 +00:00
parent 68756a8c37
commit 65c58a902d
2 changed files with 17 additions and 0 deletions

View File

@ -187,6 +187,11 @@ public:
// experssion is impossible to write down.
if (const auto *CtorExpr = dyn_cast<CXXConstructExpr>(E))
return CtorExpr->getParenOrBraceRange().isInvalid();
// Ignore implicit conversion-operator AST node.
if (const auto *ME = dyn_cast<MemberExpr>(E)) {
if (isa<CXXConversionDecl>(ME->getMemberDecl()))
return ME->getMemberLoc().isInvalid();
}
return isa<ImplicitCastExpr>(E);
};

View File

@ -2069,6 +2069,18 @@ TEST(FindReferences, ExplicitSymbols) {
using ::[[fo^o]];
}
)cpp",
R"cpp(
struct X {
operator bool();
};
int test() {
X [[a]];
[[a]].operator bool();
if ([[a^]]) {} // ignore implicit conversion-operator AST node
}
)cpp",
};
for (const char *Test : Tests) {
Annotations T(Test);