================ @@ -168,51 +169,33 @@ class BodyIndexer : public RecursiveASTVisitor<BodyIndexer> { Parent, ParentDC, Roles, Relations, E); } - bool indexDependentReference( - const Expr *E, const Type *T, const DeclarationNameInfo &NameInfo, - llvm::function_ref<bool(const NamedDecl *ND)> Filter) { - 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(); - std::vector<const NamedDecl *> Symbols = - RD->lookupDependentName(NameInfo.getName(), Filter); + bool indexDependentReference(const Expr *E, SourceLocation Loc, + std::vector<const NamedDecl *> TargetSymbols) { // FIXME: Improve overload handling. - if (Symbols.size() != 1) + if (TargetSymbols.size() != 1) return true; - SourceLocation Loc = NameInfo.getLoc(); if (Loc.isInvalid()) Loc = E->getBeginLoc(); SmallVector<SymbolRelation, 4> Relations; SymbolRoleSet Roles = getRolesForRef(E, Relations); - return IndexCtx.handleReference(Symbols[0], Loc, Parent, ParentDC, Roles, - Relations, E); + return IndexCtx.handleReference(TargetSymbols[0], Loc, Parent, ParentDC, + Roles, Relations, E); } bool VisitCXXDependentScopeMemberExpr(CXXDependentScopeMemberExpr *E) { - const DeclarationNameInfo &Info = E->getMemberNameInfo(); - return indexDependentReference( - E, E->getBaseType().getTypePtrOrNull(), Info, - [](const NamedDecl *D) { return D->isCXXInstanceMember(); }); + auto *Resolver = IndexCtx.getResolver(); + if (!Resolver) + return true; ---------------- HighCommander4 wrote:
I don't think so; the only situation in which there is no `Resolver` is if `IndexingContext::Ctx` (the `ASTContext`) is not set, and I think it should always be set (e.g. `handleDeclOccurrence` [assumes it](https://searchfox.org/llvm/rev/dab9156923133b4ce3c40efcae4f80b0d720e72f/clang/lib/Index/IndexingContext.cpp#367)). Maybe `getResolver()` should assume it as well and return a reference rather than a pointer? https://github.com/llvm/llvm-project/pull/125153 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits