[clang-tools-extra] 5d4e899 - [clangd] Handle the missing injectedClassNameType in targetDecl.
Haojian Wu via cfe-commits
cfe-commits at lists.llvm.org
Wed Jan 22 01:13:49 PST 2020
Author: Haojian Wu
Date: 2020-01-22T10:13:39+01:00
New Revision: 5d4e89975714875a86cb8e62b60d93eebefa4029
URL: https://github.com/llvm/llvm-project/commit/5d4e89975714875a86cb8e62b60d93eebefa4029
DIFF: https://github.com/llvm/llvm-project/commit/5d4e89975714875a86cb8e62b60d93eebefa4029.diff
LOG: [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
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 cbe83cc2cce4..bed32c394089 100644
--- a/clang-tools-extra/clangd/FindTarget.cpp
+++ b/clang-tools-extra/clangd/FindTarget.cpp
@@ -374,6 +374,11 @@ struct TargetFinder {
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);
}
diff --git a/clang-tools-extra/clangd/unittests/FindTargetTests.cpp b/clang-tools-extra/clangd/unittests/FindTargetTests.cpp
index 4c9fe120a8d6..c6ad75144f96 100644
--- a/clang-tools-extra/clangd/unittests/FindTargetTests.cpp
+++ b/clang-tools-extra/clangd/unittests/FindTargetTests.cpp
@@ -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) {
More information about the cfe-commits
mailing list