forked from OSchip/llvm-project
[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:
parent
68756a8c37
commit
65c58a902d
|
@ -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);
|
||||
};
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue