================ @@ -740,6 +740,24 @@ bool hasDeclaredDeductionGuides(DeclarationName Name, DeclContext *DC) { return false; } +// Returns all source deduction guides associated with the declared +// deduction guides that have the specified deduction guide name. +llvm::DenseSet<const NamedDecl *> getSourceDeductionGuides(DeclarationName Name, + DeclContext *DC) { + assert(Name.getNameKind() == + DeclarationName::NameKind::CXXDeductionGuideName && + "name must be a deduction guide name"); + llvm::DenseSet<const NamedDecl *> Result; + for (auto *D : DC->lookup(Name)) { + if (const auto *FTD = dyn_cast<FunctionTemplateDecl>(D)) + D = FTD->getTemplatedDecl(); + + if (const auto *GD = dyn_cast<CXXDeductionGuideDecl>(D)) + Result.insert(GD->getSourceDeductionGuide()); ---------------- hokein wrote:
Added an assertion -- this cannot be nullptr in theory. The function is only called for the alias templates, if a deduction guide exists for a type alias, then it must be generated from a source deduction guide by definition. https://github.com/llvm/llvm-project/pull/125478 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits