https://github.com/kazutakahirata created 
https://github.com/llvm/llvm-project/pull/230911

PointerUnion::dyn_cast has been soft-deprecated in favor of
llvm::dyn_cast and llvm::dyn_cast_if_present.  This patch replaces the
former with llvm::dyn_cast where the operand is guaranteed to be
nonnull.

Note that PlaceholderBase::ParamOrMethod is always initialized to a
nonnull pointer in LoanManager::getOrCreatePlaceholderBase and never
modified afterward.

Assisted-by: Antigravity


>From 291f6387aa10690886353fcffe040f58c36e0caa Mon Sep 17 00:00:00 2001
From: Kazu Hirata <[email protected]>
Date: Sat, 10 Oct 2026 01:20:55 -0700
Subject: [PATCH] [clang] Replace PointerUnion::dyn_cast with llvm::dyn_cast
 (NFC)

PointerUnion::dyn_cast has been soft-deprecated in favor of
llvm::dyn_cast and llvm::dyn_cast_if_present.  This patch replaces the
former with llvm::dyn_cast where the operand is guaranteed to be
nonnull.

Note that PlaceholderBase::ParamOrMethod is always initialized to a
nonnull pointer in LoanManager::getOrCreatePlaceholderBase and never
modified afterward.

Assisted-by: Antigravity
---
 clang/include/clang/Analysis/Analyses/LifetimeSafety/Loans.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/clang/include/clang/Analysis/Analyses/LifetimeSafety/Loans.h 
b/clang/include/clang/Analysis/Analyses/LifetimeSafety/Loans.h
index 00c931e4f9f66..5643f0fc87314 100644
--- a/clang/include/clang/Analysis/Analyses/LifetimeSafety/Loans.h
+++ b/clang/include/clang/Analysis/Analyses/LifetimeSafety/Loans.h
@@ -82,11 +82,11 @@ class PlaceholderBase : public llvm::FoldingSetNode {
   PlaceholderBase(const CXXMethodDecl *MD) : ParamOrMethod(MD) {}
 
   const ParmVarDecl *getParmVarDecl() const {
-    return ParamOrMethod.dyn_cast<const ParmVarDecl *>();
+    return dyn_cast<const ParmVarDecl *>(ParamOrMethod);
   }
 
   const CXXMethodDecl *getImplicitThisParent() const {
-    return ParamOrMethod.dyn_cast<const CXXMethodDecl *>();
+    return dyn_cast<const CXXMethodDecl *>(ParamOrMethod);
   }
 
   using KeyTy = llvm::PointerUnion<const ParmVarDecl *, const CXXMethodDecl *>;

_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to