Skip to content

Commit 7918dbd

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 (cherry picked from commit 5d4e899)
1 parent 2378a6e commit 7918dbd

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
@@ -373,6 +373,11 @@ struct TargetFinder {
373373
void VisitTagType(const TagType *TT) {
374374
Outer.add(TT->getAsTagDecl(), Flags);
375375
}
376+
377+
void VisitInjectedClassNameType(const InjectedClassNameType *ICNT) {
378+
Outer.add(ICNT->getDecl(), Flags);
379+
}
380+
376381
void VisitDecltypeType(const DecltypeType *DTT) {
377382
Outer.add(DTT->getUnderlyingType(), Flags | Rel::Underlying);
378383
}

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)