Commit 5d4e8997 authored by Haojian Wu's avatar Haojian Wu
Browse files

[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
parent 3593b5b3
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -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);
      }
+8 −0
Original line number Diff line number Diff line
@@ -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) {