https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/123014
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 EnumUnderlying to be nonnull. >From 2b46a860ff31f7e09d5226348ba55fc1d02a4b84 Mon Sep 17 00:00:00 2001 From: Kazu Hirata <k...@google.com> Date: Tue, 14 Jan 2025 15:41:13 -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 EnumUnderlying to be nonnull. --- clang/lib/Sema/SemaDecl.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index 704cb82b291cc7..e0dd6039810cbc 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -17310,7 +17310,7 @@ Sema::ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK, SourceLocation KWLoc, return nullptr; if (EnumUnderlying) { EnumDecl *ED = cast<EnumDecl>(New); - if (TypeSourceInfo *TI = EnumUnderlying.dyn_cast<TypeSourceInfo *>()) + if (TypeSourceInfo *TI = dyn_cast<TypeSourceInfo *>(EnumUnderlying)) ED->setIntegerTypeSourceInfo(TI); else ED->setIntegerType(QualType(cast<const Type *>(EnumUnderlying), 0)); @@ -17943,7 +17943,7 @@ Sema::ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK, SourceLocation KWLoc, if (EnumUnderlying) { EnumDecl *ED = cast<EnumDecl>(New); - if (TypeSourceInfo *TI = EnumUnderlying.dyn_cast<TypeSourceInfo*>()) + if (TypeSourceInfo *TI = dyn_cast<TypeSourceInfo *>(EnumUnderlying)) ED->setIntegerTypeSourceInfo(TI); else ED->setIntegerType(QualType(cast<const Type *>(EnumUnderlying), 0)); _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits