https://github.com/kazutakahirata created
https://github.com/llvm/llvm-project/pull/228991
Note that PointerUnion::dyn_cast has been soft deprecated in
PointerUnion.h:
// FIXME: Replace the uses of is(), get() and dyn_cast() with
// isa<T>, cast<T> and the llvm::dyn_cast<T>
Literal migration would result in dyn_cast_if_present (see the
definition of PointerUnion::dyn_cast), but this patch uses dyn_cast.
Note that Target here traces back to AnnotationWarningsMap, which is
populated only with nonnull pointers.
Assisted-by: Antigravity
>From 222b9f71af0cb1bed1562b9f5a8e16c9cf731056 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <[email protected]>
Date: Sun, 4 Oct 2026 10:48:37 -0700
Subject: [PATCH] [clang] Migrate away from PointerUnion::dyn_cast (NFC)
Note that PointerUnion::dyn_cast has been soft deprecated in
PointerUnion.h:
// FIXME: Replace the uses of is(), get() and dyn_cast() with
// isa<T>, cast<T> and the llvm::dyn_cast<T>
Literal migration would result in dyn_cast_if_present (see the
definition of PointerUnion::dyn_cast), but this patch uses dyn_cast.
Note that Target here traces back to AnnotationWarningsMap, which is
populated only with nonnull pointers.
Assisted-by: Antigravity
---
clang/lib/Sema/SemaLifetimeSafety.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/clang/lib/Sema/SemaLifetimeSafety.h
b/clang/lib/Sema/SemaLifetimeSafety.h
index 620032c27f955..847bebefd7291 100644
--- a/clang/lib/Sema/SemaLifetimeSafety.h
+++ b/clang/lib/Sema/SemaLifetimeSafety.h
@@ -343,11 +343,11 @@ class LifetimeSafetySemaHelperImpl : public
LifetimeSafetySemaHelper {
<< ParmToAnnotate->getSourceRange()
<< FixItHint::CreateInsertion(InsertionPoint, FixItText);
- if (const auto *EscapeExpr = Target.dyn_cast<const Expr *>())
+ if (const auto *EscapeExpr = dyn_cast<const Expr *>(Target))
S.Diag(EscapeExpr->getBeginLoc(),
diag::note_lifetime_safety_suggestion_returned_here)
<< EscapeExpr->getSourceRange();
- else if (const auto *EscapeField = Target.dyn_cast<const FieldDecl *>())
+ else if (const auto *EscapeField = dyn_cast<const FieldDecl *>(Target))
S.Diag(EscapeField->getLocation(),
diag::note_lifetime_safety_escapes_to_field_here)
<< EscapeField->getSourceRange();
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits