[clang] [CodeGen] Migrate away from PointerUnion::dyn_cast (NFC) (PR #123157)
Kazu Hirata via cfe-commits
cfe-commits at lists.llvm.org
Wed Jan 15 20:49:01 PST 2025
https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/123157
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
because we expect Data to be nonnull.
>From 1baa96e11d6f46f97f5385b5b907ef5b4726bba8 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Wed, 15 Jan 2025 09:03:11 -0800
Subject: [PATCH] [CodeGen] 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
because we expect Data to be nonnull.
---
clang/lib/CodeGen/ConstantInitBuilder.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/clang/lib/CodeGen/ConstantInitBuilder.cpp b/clang/lib/CodeGen/ConstantInitBuilder.cpp
index ddbf3ef743370b..ce1fe137c1919b 100644
--- a/clang/lib/CodeGen/ConstantInitBuilder.cpp
+++ b/clang/lib/CodeGen/ConstantInitBuilder.cpp
@@ -29,7 +29,7 @@ llvm::Type *ConstantInitFuture::getType() const {
void ConstantInitFuture::abandon() {
assert(Data && "abandoning null future");
- if (auto builder = Data.dyn_cast<ConstantInitBuilderBase*>()) {
+ if (auto *builder = dyn_cast<ConstantInitBuilderBase *>(Data)) {
builder->abandon(0);
}
Data = nullptr;
More information about the cfe-commits
mailing list