[clang] [CodeGen] Migrate away from PointerUnion::dyn_cast (NFC) (PR #122778)
Kazu Hirata via cfe-commits
cfe-commits at lists.llvm.org
Mon Jan 13 11:57:23 PST 2025
https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/122778
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 Prototype.P to be nonnull.
>From 7984eca5d3611fe69fe8d084c0111722a090312f Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Mon, 13 Jan 2025 11:51:41 -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 Prototype.P to be nonnull.
---
clang/lib/CodeGen/CGCall.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp
index 0fde4d8ee296bd..e0cf6ca69f0df2 100644
--- a/clang/lib/CodeGen/CGCall.cpp
+++ b/clang/lib/CodeGen/CGCall.cpp
@@ -4507,7 +4507,7 @@ void CodeGenFunction::EmitCallArgs(
// First, if a prototype was provided, use those argument types.
bool IsVariadic = false;
if (Prototype.P) {
- const auto *MD = Prototype.P.dyn_cast<const ObjCMethodDecl *>();
+ const auto *MD = dyn_cast<const ObjCMethodDecl *>(Prototype.P);
if (MD) {
IsVariadic = MD->isVariadic();
ExplicitCC = getCallingConventionForDecl(
More information about the cfe-commits
mailing list