[clang] [clang] Replace PointerUnion::dyn_cast with llvm::dyn_cast (NFC) (PR #232603)
Kazu Hirata via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 15 23:03:38 PDT 2026
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 <kazu at google.com>
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);
}
};
More information about the cfe-commits
mailing list