Skip to content

Commit 85a2d23

Browse files
committed
[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 eaf0c89)
1 parent 7918dbd commit 85a2d23

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

clang-tools-extra/clangd/FindTarget.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,10 @@ struct TargetFinder {
374374
Outer.add(TT->getAsTagDecl(), Flags);
375375
}
376376

377+
void VisitElaboratedType(const ElaboratedType *ET) {
378+
Outer.add(ET->desugar(), Flags);
379+
}
380+
377381
void VisitInjectedClassNameType(const InjectedClassNameType *ICNT) {
378382
Outer.add(ICNT->getDecl(), Flags);
379383
}

clang-tools-extra/clangd/unittests/FindTargetTests.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,13 @@ TEST_F(TargetDeclTest, Types) {
242242
)cpp";
243243
EXPECT_DECLS("TypedefTypeLoc", {"typedef S X", Rel::Alias},
244244
{"struct S", Rel::Underlying});
245+
Code = R"cpp(
246+
namespace ns { struct S{}; }
247+
typedef ns::S X;
248+
[[X]] x;
249+
)cpp";
250+
EXPECT_DECLS("TypedefTypeLoc", {"typedef ns::S X", Rel::Alias},
251+
{"struct S", Rel::Underlying});
245252

246253
// FIXME: Auto-completion in a template requires disabling delayed template
247254
// parsing.

0 commit comments

Comments
 (0)