Skip to content

Commit 5d4e899

Browse files
committed
[clangd] Handle the missing injectedClassNameType in targetDecl.
Reviewers: sammccall Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D73102
1 parent 3593b5b commit 5d4e899

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

clang-tools-extra/clangd/FindTarget.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,11 @@ struct TargetFinder {
374374
void VisitTagType(const TagType *TT) {
375375
Outer.add(TT->getAsTagDecl(), Flags);
376376
}
377+
378+
void VisitInjectedClassNameType(const InjectedClassNameType *ICNT) {
379+
Outer.add(ICNT->getDecl(), Flags);
380+
}
381+
377382
void VisitDecltypeType(const DecltypeType *DTT) {
378383
Outer.add(DTT->getUnderlyingType(), Flags | Rel::Underlying);
379384
}

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,14 @@ TEST_F(TargetDeclTest, Types) {
286286
)cpp";
287287
// FIXME: We don't do a good job printing TemplateTypeParmDecls, apparently!
288288
EXPECT_DECLS("SizeOfPackExpr", "");
289+
290+
Code = R"cpp(
291+
template <typename T>
292+
class Foo {
293+
void f([[Foo]] x);
294+
};
295+
)cpp";
296+
EXPECT_DECLS("InjectedClassNameTypeLoc", "class Foo");
289297
}
290298

291299
TEST_F(TargetDeclTest, ClassTemplate) {

0 commit comments

Comments
 (0)