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

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 Origin::Ptr is always initialized to a nonnull pointer in
OriginManager::createNode and never modified afterward.

Assisted-by: Antigravity


>From d5c0e710199e1b1cc10cec4e4a7067c2e3f890b0 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <[email protected]>
Date: Sun, 20 Sep 2026 15:29:53 -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 Origin::Ptr is always initialized to a nonnull pointer in
OriginManager::createNode and never modified afterward.

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

diff --git a/clang/include/clang/Analysis/Analyses/LifetimeSafety/Origins.h 
b/clang/include/clang/Analysis/Analyses/LifetimeSafety/Origins.h
index 4dc05cdd0c56ae..1755eca536097b 100644
--- a/clang/include/clang/Analysis/Analyses/LifetimeSafety/Origins.h
+++ b/clang/include/clang/Analysis/Analyses/LifetimeSafety/Origins.h
@@ -69,10 +69,10 @@ struct Origin {
       : ID(ID), Ptr(E), Ty(QT), NamesDeclStorage(NamesDeclStorage) {}
 
   const clang::ValueDecl *getDecl() const {
-    return Ptr.dyn_cast<const clang::ValueDecl *>();
+    return dyn_cast<const clang::ValueDecl *>(Ptr);
   }
   const clang::Expr *getExpr() const {
-    return Ptr.dyn_cast<const clang::Expr *>();
+    return dyn_cast<const clang::Expr *>(Ptr);
   }
 };
 

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

Reply via email to