[clang] [clang] Replace PointerUnion::dyn_cast with llvm::dyn_cast (NFC) (PR #230911)
via cfe-commits
cfe-commits at lists.llvm.org
Sun Oct 11 00:37:59 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang-temporal-safety
@llvm/pr-subscribers-clang-analysis
Author: Kazu Hirata (kazutakahirata)
<details>
<summary>Changes</summary>
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
---
Full diff: https://github.com/llvm/llvm-project/pull/230911.diff
1 Files Affected:
- (modified) clang/include/clang/Analysis/Analyses/LifetimeSafety/Loans.h (+2-2)
``````````diff
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 *>;
``````````
</details>
https://github.com/llvm/llvm-project/pull/230911
More information about the cfe-commits
mailing list