diff options
Diffstat (limited to 'clang-tools-extra/clangd/Selection.cpp')
-rw-r--r-- | clang-tools-extra/clangd/Selection.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/clang-tools-extra/clangd/Selection.cpp b/clang-tools-extra/clangd/Selection.cpp index 77174936dfe..1877b1cf7b6 100644 --- a/clang-tools-extra/clangd/Selection.cpp +++ b/clang-tools-extra/clangd/Selection.cpp @@ -19,6 +19,7 @@ #include "clang/Lex/Lexer.h" #include "clang/Tooling/Syntax/Tokens.h" #include "llvm/ADT/STLExtras.h" +#include "llvm/Support/Casting.h" #include "llvm/Support/raw_ostream.h" #include <algorithm> #include <string> @@ -205,6 +206,11 @@ public: bool dataTraverseStmtPre(Stmt *X) { if (!X) return false; + // Implicit this in a MemberExpr is not filtered out by RecursiveASTVisitor. + // It would be nice if RAV handled this (!shouldTRaverseImplicitCode()). + if (auto *CTI = llvm::dyn_cast<CXXThisExpr>(X)) + if (CTI->isImplicit()) + return false; auto N = DynTypedNode::create(*X); if (canSafelySkipNode(N)) return false; |