llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clangd @llvm/pr-subscribers-clang-tools-extra Author: Younan Zhang (zyn0217) <details> <summary>Changes</summary> ConceptDecl doesn't have an associated template declaration, and it doesn't introduce a type either. Fixes https://github.com/llvm/llvm-project/issues/188914 --- Full diff: https://github.com/llvm/llvm-project/pull/191654.diff 2 Files Affected: - (modified) clang-tools-extra/clangd/XRefs.cpp (+1) - (modified) clang-tools-extra/clangd/unittests/XRefsTests.cpp (+7-2) ``````````diff diff --git a/clang-tools-extra/clangd/XRefs.cpp b/clang-tools-extra/clangd/XRefs.cpp index 4b685b7bf793e..2247586b78c84 100644 --- a/clang-tools-extra/clangd/XRefs.cpp +++ b/clang-tools-extra/clangd/XRefs.cpp @@ -2060,6 +2060,7 @@ static QualType typeForNode(const ASTContext &Ctx, const HeuristicResolver *H, QualType VisitTemplateDecl(const TemplateDecl *D) { return Visit(D->getTemplatedDecl()); } + QualType VisitConceptDecl(const ConceptDecl *C) { return QualType(); } } V(Ctx); return V.Visit(D); } diff --git a/clang-tools-extra/clangd/unittests/XRefsTests.cpp b/clang-tools-extra/clangd/unittests/XRefsTests.cpp index 8e97db7ab17c5..00ead63050c8d 100644 --- a/clang-tools-extra/clangd/unittests/XRefsTests.cpp +++ b/clang-tools-extra/clangd/unittests/XRefsTests.cpp @@ -2094,14 +2094,19 @@ TEST(FindType, All) { TEST(FindType, Definition) { Annotations A(R"cpp( class $decl[[X]]; - X *^x; + X *$x^x; class $def[[X]] {}; + + template <class T> + concept $Concept^True = true; )cpp"); auto TU = TestTU::withCode(A.code().str()); + TU.ExtraArgs.push_back("-std=c++20"); ParsedAST AST = TU.build(); - EXPECT_THAT(findType(AST, A.point(), nullptr), + EXPECT_THAT(findType(AST, A.point("x"), nullptr), ElementsAre(sym("X", A.range("decl"), A.range("def")))); + EXPECT_THAT(findType(AST, A.point("Concept"), nullptr), IsEmpty()); } TEST(FindType, Index) { `````````` </details> https://github.com/llvm/llvm-project/pull/191654 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
