https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/125457
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 typeDecl to be nonnull. Note that getObjCInterfaceType starts out dereferencing Decl. >From 605c32f531a4879de975350d47fc1015e7b45dbe Mon Sep 17 00:00:00 2001 From: Kazu Hirata <k...@google.com> Date: Sun, 2 Feb 2025 12:44:34 -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 typeDecl to be nonnull. Note that getObjCInterfaceType starts out dereferencing Decl. --- clang/lib/Sema/SemaDeclObjC.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clang/lib/Sema/SemaDeclObjC.cpp b/clang/lib/Sema/SemaDeclObjC.cpp index f97f17e8c96588..e665d0293dc84d 100644 --- a/clang/lib/Sema/SemaDeclObjC.cpp +++ b/clang/lib/Sema/SemaDeclObjC.cpp @@ -1584,7 +1584,7 @@ void SemaObjC::actOnObjCTypeArgsOrProtocolQualifiers( const char* prevSpec; // unused unsigned diagID; // unused QualType type; - if (auto *actualTypeDecl = typeDecl.dyn_cast<TypeDecl *>()) + if (auto *actualTypeDecl = dyn_cast<TypeDecl *>(typeDecl)) type = Context.getTypeDeclType(actualTypeDecl); else type = Context.getObjCInterfaceType(cast<ObjCInterfaceDecl *>(typeDecl)); _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits