================ @@ -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; ---------------- zyn0217 wrote:
Do we need to fallback to something if HeuristicResolver isn't present? 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