Author: Kazu Hirata Date: 2026-09-28T10:57:32-07:00 New Revision: 111f1d4940427c04718fd038726da5d1860b94e3
URL: https://github.com/llvm/llvm-project/commit/111f1d4940427c04718fd038726da5d1860b94e3 DIFF: https://github.com/llvm/llvm-project/commit/111f1d4940427c04718fd038726da5d1860b94e3.diff LOG: [clang] Migrate away from PointerUnion::dyn_cast (NFC) (#226653) Note that PointerUnion::dyn_cast has been soft deprecated in PointerUnion.h: // FIXME: Replace the uses of is(), get() and dyn_cast() with // isa<T>, cast<T> and the llvm::dyn_cast<T> Literal migration would result in dyn_cast_if_present (see the definition of PointerUnion::dyn_cast), but this patch uses dyn_cast on UnsatisfiedConstraintRecord because it is always nonnull. Specifically, ConstraintSatisfaction::Details only receives nonnull pointers in the following places: - ASTNodeImporter::ImportConstraintSatisfaction - ConstraintSatisfactionChecker::consumeSFINAEFailure - ConstraintSatisfactionChecker::EvaluateSlow - ConstraintSatisfactionChecker::Evaluate - readConstraintSatisfaction Assisted-by: Antigravity Added: Modified: clang/include/clang/AST/ASTConcept.h clang/lib/Sema/SemaConcept.cpp Removed: ################################################################################ diff --git a/clang/include/clang/AST/ASTConcept.h b/clang/include/clang/AST/ASTConcept.h index 62fe2c0f653d5..839146f40445b 100644 --- a/clang/include/clang/AST/ASTConcept.h +++ b/clang/include/clang/AST/ASTConcept.h @@ -76,7 +76,7 @@ class ConstraintSatisfaction : public llvm::FoldingSetNode { bool HasSubstitutionFailure() { for (const auto &Detail : Details) - if (Detail.dyn_cast<const ConstraintSubstitutionDiagnostic *>()) + if (dyn_cast<const ConstraintSubstitutionDiagnostic *>(Detail)) return true; return false; } diff --git a/clang/lib/Sema/SemaConcept.cpp b/clang/lib/Sema/SemaConcept.cpp index 27c61586020ba..d31d86919588a 100644 --- a/clang/lib/Sema/SemaConcept.cpp +++ b/clang/lib/Sema/SemaConcept.cpp @@ -2009,9 +2009,7 @@ static void diagnoseWellFormedUnsatisfiedConstraintExpr(Sema &S, static void diagnoseUnsatisfiedConstraintExpr( Sema &S, const UnsatisfiedConstraintRecord &Record, SourceLocation Loc, bool First, concepts::NestedRequirement *Req) { - if (auto *Diag = - Record - .template dyn_cast<const ConstraintSubstitutionDiagnostic *>()) { + if (auto *Diag = dyn_cast<const ConstraintSubstitutionDiagnostic *>(Record)) { if (Req) S.Diag(Diag->first, diag::note_nested_requirement_substitution_error) << (int)First << Req->getInvalidConstraintEntity() << Diag->second; _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
