[clang] f09a6f6 - [Sema] Migrate away from PointerUnion::dyn_cast (NFC) (#124447)
via cfe-commits
cfe-commits at lists.llvm.org
Sun Jan 26 01:35:03 PST 2025
Author: Kazu Hirata
Date: 2025-01-26T01:34:59-08:00
New Revision: f09a6f632584c2b34f8f2d048a5420b040bb1005
URL: https://github.com/llvm/llvm-project/commit/f09a6f632584c2b34f8f2d048a5420b040bb1005
DIFF: https://github.com/llvm/llvm-project/commit/f09a6f632584c2b34f8f2d048a5420b040bb1005.diff
LOG: [Sema] Migrate away from PointerUnion::dyn_cast (NFC) (#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.
Added:
Modified:
clang/lib/Sema/SemaAPINotes.cpp
Removed:
################################################################################
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