https://github.com/HighCommander4 created https://github.com/llvm/llvm-project/pull/128106
None >From 10edf87574f5473da01bd985cec4c7810f57c516 Mon Sep 17 00:00:00 2001 From: Nathan Ridge <zeratul...@hotmail.com> Date: Thu, 20 Feb 2025 20:44:52 -0500 Subject: [PATCH] [clang][Index] Use HeuristicResolver in IndexTypeSourceInfo as well --- clang/lib/Index/IndexTypeSourceInfo.cpp | 24 +++--------------------- 1 file changed, 3 insertions(+), 21 deletions(-) diff --git a/clang/lib/Index/IndexTypeSourceInfo.cpp b/clang/lib/Index/IndexTypeSourceInfo.cpp index b986ccde57452..d5d0a3c422871 100644 --- a/clang/lib/Index/IndexTypeSourceInfo.cpp +++ b/clang/lib/Index/IndexTypeSourceInfo.cpp @@ -11,6 +11,7 @@ #include "clang/AST/PrettyPrinter.h" #include "clang/AST/RecursiveASTVisitor.h" #include "clang/AST/TypeLoc.h" +#include "clang/Sema/HeuristicResolver.h" #include "llvm/ADT/ScopeExit.h" using namespace clang; @@ -207,27 +208,8 @@ class TypeIndexer : public RecursiveASTVisitor<TypeIndexer> { } bool VisitDependentNameTypeLoc(DependentNameTypeLoc TL) { - const DependentNameType *DNT = TL.getTypePtr(); - const NestedNameSpecifier *NNS = DNT->getQualifier(); - const Type *T = NNS->getAsType(); - if (!T) - return true; - const TemplateSpecializationType *TST = - T->getAs<TemplateSpecializationType>(); - if (!TST) - return true; - TemplateName TN = TST->getTemplateName(); - const ClassTemplateDecl *TD = - dyn_cast_or_null<ClassTemplateDecl>(TN.getAsTemplateDecl()); - if (!TD) - return true; - CXXRecordDecl *RD = TD->getTemplatedDecl(); - if (!RD->hasDefinition()) - return true; - RD = RD->getDefinition(); - DeclarationName Name(DNT->getIdentifier()); - std::vector<const NamedDecl *> Symbols = RD->lookupDependentName( - Name, [](const NamedDecl *ND) { return isa<TypeDecl>(ND); }); + std::vector<const NamedDecl *> Symbols = + IndexCtx.getResolver()->resolveDependentNameType(TL.getTypePtr()); if (Symbols.size() != 1) return true; return IndexCtx.handleReference(Symbols[0], TL.getNameLoc(), Parent, _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits