Author: Kazu Hirata Date: 2026-10-04T09:26:22Z New Revision: eddb17da45c0d2c23d71a1cef3e09821989988f2
URL: https://github.com/llvm/llvm-project/commit/eddb17da45c0d2c23d71a1cef3e09821989988f2 DIFF: https://github.com/llvm/llvm-project/commit/eddb17da45c0d2c23d71a1cef3e09821989988f2.diff LOG: [clang] Migrate away from PointerUnion::dyn_cast (NFC) (#228843) 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. Note that the if-then-else chain ends with: } else llvm_unreachable("Unhandled CausingFact type"); which guarantees that CausingFact is nonnull. Assisted-by: Antigravity Added: Modified: clang/lib/Analysis/LifetimeSafety/Checker.cpp Removed: ################################################################################ diff --git a/clang/lib/Analysis/LifetimeSafety/Checker.cpp b/clang/lib/Analysis/LifetimeSafety/Checker.cpp index c4cc872dcd568..29063398bfcd8 100644 --- a/clang/lib/Analysis/LifetimeSafety/Checker.cpp +++ b/clang/lib/Analysis/LifetimeSafety/Checker.cpp @@ -277,7 +277,7 @@ class LifetimeChecker { const Expr *MovedExpr = Warning.MovedExpr; SourceLocation ExpiryLoc = Warning.ExpiryLoc; - if (const auto *UF = CausingFact.dyn_cast<const UseFact *>()) { + if (const auto *UF = dyn_cast<const UseFact *>(CausingFact)) { llvm::SmallVector<const Expr *> ExprChain = getExprChain(LoanPropagation.buildOriginFlowChain(UF, LID, Cfg)); if (Warning.InvalidatedByExpr) { @@ -298,7 +298,7 @@ class LifetimeChecker { MovedExpr, ExpiryLoc, ExprChain); } else if (const auto *OEF = - CausingFact.dyn_cast<const OriginEscapesFact *>()) { + dyn_cast<const OriginEscapesFact *>(CausingFact)) { if (Warning.InvalidatedByExpr) { if (const auto *FieldEscape = dyn_cast<FieldEscapeFact>(OEF)) { // Invalidated object escapes to a field. _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
