[llvm-branch-commits] [clang-tools-extra] 85a2d23 - [clangd] Add the missing elaborated types in FindTarget.
Haojian Wu via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Wed Jun 10 01:45:20 PDT 2020
Author: Haojian Wu
Date: 2020-06-10T10:43:50+02:00
New Revision: 85a2d23d963a5bd537a447378c6fc19b6a8b224a
URL: https://github.com/llvm/llvm-project/commit/85a2d23d963a5bd537a447378c6fc19b6a8b224a
DIFF: https://github.com/llvm/llvm-project/commit/85a2d23d963a5bd537a447378c6fc19b6a8b224a.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
(cherry picked from commit eaf0c89ec5f866b6cef296c542c030bb2cf8481d)
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 5bdb1a63b87c..5912464b0ed0 100644
--- a/clang-tools-extra/clangd/FindTarget.cpp
+++ b/clang-tools-extra/clangd/FindTarget.cpp
@@ -374,6 +374,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 bbba007d242a..9c1020b7a189 100644
--- a/clang-tools-extra/clangd/unittests/FindTargetTests.cpp
+++ b/clang-tools-extra/clangd/unittests/FindTargetTests.cpp
@@ -242,6 +242,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 llvm-branch-commits
mailing list