-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[clang][Index] Use HeuristicResolver in IndexTypeSourceInfo as well #128106
[clang][Index] Use HeuristicResolver in IndexTypeSourceInfo as well #128106
Conversation
10edf87
to
84fac9a
Compare
@llvm/pr-subscribers-clang Author: Nathan Ridge (HighCommander4) ChangesFull diff: https://github.com/llvm/llvm-project/pull/128106.diff 1 Files Affected:
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,
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, this is a nice improvement.
Nit: I think it'd be better to say NFC in the PR title.
Technically, this is a functional change since I considered constructing a test case to demonstrate, but given that |
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/163/builds/13886 Here is the relevant piece of the build log for the reference
|
No description provided.