[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
This commit is contained in:
Haojian Wu 2020-01-21 15:28:06 +01:00
parent 3593b5b3e9
commit 5d4e899757
2 changed files with 13 additions and 0 deletions

View File

@ -374,6 +374,11 @@ public:
void VisitTagType(const TagType *TT) {
Outer.add(TT->getAsTagDecl(), Flags);
}
void VisitInjectedClassNameType(const InjectedClassNameType *ICNT) {
Outer.add(ICNT->getDecl(), Flags);
}
void VisitDecltypeType(const DecltypeType *DTT) {
Outer.add(DTT->getUnderlyingType(), Flags | Rel::Underlying);
}

View File

@ -286,6 +286,14 @@ TEST_F(TargetDeclTest, Types) {
)cpp";
// FIXME: We don't do a good job printing TemplateTypeParmDecls, apparently!
EXPECT_DECLS("SizeOfPackExpr", "");
Code = R"cpp(
template <typename T>
class Foo {
void f([[Foo]] x);
};
)cpp";
EXPECT_DECLS("InjectedClassNameTypeLoc", "class Foo");
}
TEST_F(TargetDeclTest, ClassTemplate) {