[clang] [clang] Replace PointerUnion::dyn_cast with llvm::dyn_cast (NFC) (PR #230381)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Oct 9 00:09:01 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
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 MaterializeTemporaryExpr::State is always initialized or
updated to a nonnull pointer. It is only set in:
- MaterializeTemporaryExpr::MaterializeTemporaryExpr
- MaterializeTemporaryExpr::setExtendingDecl
- ASTStmtReader::VisitMaterializeTemporaryExpr
Assisted-by: Antigravity
---
Full diff: https://github.com/llvm/llvm-project/pull/230381.diff
1 Files Affected:
- (modified) clang/include/clang/AST/ExprCXX.h (+2-2)
``````````diff
diff --git a/clang/include/clang/AST/ExprCXX.h b/clang/include/clang/AST/ExprCXX.h
index 512b4c60e52694..5187655386d9b7 100644
--- a/clang/include/clang/AST/ExprCXX.h
+++ b/clang/include/clang/AST/ExprCXX.h
@@ -5012,11 +5012,11 @@ class MaterializeTemporaryExpr : public Expr {
}
LifetimeExtendedTemporaryDecl *getLifetimeExtendedTemporaryDecl() {
- return State.dyn_cast<LifetimeExtendedTemporaryDecl *>();
+ return dyn_cast<LifetimeExtendedTemporaryDecl *>(State);
}
const LifetimeExtendedTemporaryDecl *
getLifetimeExtendedTemporaryDecl() const {
- return State.dyn_cast<LifetimeExtendedTemporaryDecl *>();
+ return dyn_cast<LifetimeExtendedTemporaryDecl *>(State);
}
/// Get the declaration which triggered the lifetime-extension of this
``````````
</details>
https://github.com/llvm/llvm-project/pull/230381
More information about the cfe-commits
mailing list