[clang] [Sema] Migrate away from PointerUnion::dyn_cast (NFC) (PR #124447)
Kazu Hirata via cfe-commits
cfe-commits at lists.llvm.org
Sat Jan 25 21:48:06 PST 2025
https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/124447
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 AnyFunc to be nonnull.
>From 000e59c4a98f6d9d801f278c873fc6d883b69d56 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Sat, 25 Jan 2025 12:20:59 -0800
Subject: [PATCH] [Sema] 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 AnyFunc to be nonnull.
---
clang/lib/Sema/SemaAPINotes.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/clang/lib/Sema/SemaAPINotes.cpp b/clang/lib/Sema/SemaAPINotes.cpp
index 4f79775bc5e913..b354bb7b06435f 100644
--- a/clang/lib/Sema/SemaAPINotes.cpp
+++ b/clang/lib/Sema/SemaAPINotes.cpp
@@ -478,7 +478,7 @@ static void ProcessAPINotes(Sema &S, FunctionOrMethod AnyFunc,
const api_notes::FunctionInfo &Info,
VersionedInfoMetadata Metadata) {
// Find the declaration itself.
- FunctionDecl *FD = AnyFunc.dyn_cast<FunctionDecl *>();
+ FunctionDecl *FD = dyn_cast<FunctionDecl *>(AnyFunc);
Decl *D = FD;
ObjCMethodDecl *MD = nullptr;
if (!D) {
More information about the cfe-commits
mailing list