[clang] abadf9f - [clang] Replace PointerUnion::dyn_cast with llvm::dyn_cast (NFC) (#230381)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Oct 9 01:05:06 PDT 2026
Author: Kazu Hirata
Date: 2026-10-09T01:05:00-07:00
New Revision: abadf9fadce1bfbc81a6b4402a0f372f06b762a1
URL: https://github.com/llvm/llvm-project/commit/abadf9fadce1bfbc81a6b4402a0f372f06b762a1
DIFF: https://github.com/llvm/llvm-project/commit/abadf9fadce1bfbc81a6b4402a0f372f06b762a1.diff
LOG: [clang] Replace PointerUnion::dyn_cast with llvm::dyn_cast (NFC) (#230381)
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
Added:
Modified:
clang/include/clang/AST/ExprCXX.h
Removed:
################################################################################
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
More information about the cfe-commits
mailing list