https://github.com/kazutakahirata created 
https://github.com/llvm/llvm-project/pull/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


>From 818254e00c240243bb6588f5c9da9d71e4b89f78 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <[email protected]>
Date: Thu, 8 Oct 2026 13:16:42 -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 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
---
 clang/include/clang/AST/ExprCXX.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

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

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

Reply via email to