Author: Nathan Ridge Date: 2025-02-21T00:45:51-05:00 New Revision: fd5d1cbb75e4278d9074ff105efd3ab48f778b4b
URL: https://github.com/llvm/llvm-project/commit/fd5d1cbb75e4278d9074ff105efd3ab48f778b4b DIFF: https://github.com/llvm/llvm-project/commit/fd5d1cbb75e4278d9074ff105efd3ab48f778b4b.diff LOG: [clang][Index] Use HeuristicResolver in IndexTypeSourceInfo as well (#128106) Added: Modified: clang/lib/Index/IndexTypeSourceInfo.cpp Removed: ################################################################################ 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