[clang-tools-extra] eaf0c89 - [clangd] Add the missing elaborated types in FindTarget.
Haojian Wu via cfe-commits
cfe-commits at lists.llvm.org
Wed Feb 5 05:08:15 PST 2020
Author: Haojian Wu
Date: 2020-02-05T14:03:36+01:00
New Revision: eaf0c89ec5f866b6cef296c542c030bb2cf8481d
URL: https://github.com/llvm/llvm-project/commit/eaf0c89ec5f866b6cef296c542c030bb2cf8481d
DIFF: https://github.com/llvm/llvm-project/commit/eaf0c89ec5f866b6cef296c542c030bb2cf8481d.diff
LOG: [clangd] Add the missing elaborated types in FindTarget.
Reviewers: sammccall
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D74025
Added:
Modified:
clang-tools-extra/clangd/FindTarget.cpp
clang-tools-extra/clangd/unittests/FindTargetTests.cpp
Removed:
################################################################################
diff --git a/clang-tools-extra/clangd/FindTarget.cpp b/clang-tools-extra/clangd/FindTarget.cpp
index 13e4819bec9b..a9ac4b86d665 100644
--- a/clang-tools-extra/clangd/FindTarget.cpp
+++ b/clang-tools-extra/clangd/FindTarget.cpp
@@ -379,6 +379,10 @@ struct TargetFinder {
Outer.add(TT->getAsTagDecl(), Flags);
}
+ void VisitElaboratedType(const ElaboratedType *ET) {
+ Outer.add(ET->desugar(), Flags);
+ }
+
void VisitInjectedClassNameType(const InjectedClassNameType *ICNT) {
Outer.add(ICNT->getDecl(), Flags);
}
diff --git a/clang-tools-extra/clangd/unittests/FindTargetTests.cpp b/clang-tools-extra/clangd/unittests/FindTargetTests.cpp
index 22aeed6f5272..074a24d9edbf 100644
--- a/clang-tools-extra/clangd/unittests/FindTargetTests.cpp
+++ b/clang-tools-extra/clangd/unittests/FindTargetTests.cpp
@@ -241,6 +241,13 @@ TEST_F(TargetDeclTest, Types) {
)cpp";
EXPECT_DECLS("TypedefTypeLoc", {"typedef S X", Rel::Alias},
{"struct S", Rel::Underlying});
+ Code = R"cpp(
+ namespace ns { struct S{}; }
+ typedef ns::S X;
+ [[X]] x;
+ )cpp";
+ EXPECT_DECLS("TypedefTypeLoc", {"typedef ns::S X", Rel::Alias},
+ {"struct S", Rel::Underlying});
// FIXME: Auto-completion in a template requires disabling delayed template
// parsing.
More information about the cfe-commits
mailing list