[clang] [CodeGen] Migrate away from PointerUnion::dyn_cast (NFC) (PR #122778)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Jan 13 12:00:00 PST 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: Kazu Hirata (kazutakahirata)
<details>
<summary>Changes</summary>
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.
---
Full diff: https://github.com/llvm/llvm-project/pull/122778.diff
1 Files Affected:
- (modified) clang/lib/CodeGen/CGCall.cpp (+1-1)
``````````diff
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(
``````````
</details>
https://github.com/llvm/llvm-project/pull/122778
More information about the cfe-commits
mailing list