[llvm-branch-commits] [clang-tools-extra] 7918dbd - [clangd] Handle the missing injectedClassNameType in targetDecl.

Haojian Wu via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Jun 10 01:45:18 PDT 2020


Author: Haojian Wu
Date: 2020-06-10T10:40:34+02:00
New Revision: 7918dbda298871cd4f7f622c4d880e9251986ffd

URL: https://github.com/llvm/llvm-project/commit/7918dbda298871cd4f7f622c4d880e9251986ffd
DIFF: https://github.com/llvm/llvm-project/commit/7918dbda298871cd4f7f622c4d880e9251986ffd.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

(cherry picked from commit 5d4e89975714875a86cb8e62b60d93eebefa4029)

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 71bb9d3d5066..5bdb1a63b87c 100644
--- a/clang-tools-extra/clangd/FindTarget.cpp
+++ b/clang-tools-extra/clangd/FindTarget.cpp
@@ -373,6 +373,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 408ebe24e773..bbba007d242a 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 llvm-branch-commits mailing list