https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/124503
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 U.first to be nonnull. >From 3e3127aace0383117f0c02ebc60bb6de73e112af Mon Sep 17 00:00:00 2001 From: Kazu Hirata <k...@google.com> Date: Sat, 25 Jan 2025 12:23:27 -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 U.first to be nonnull. --- clang/lib/Sema/SemaDeclCXX.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp index 08065e3cad2bb3..c1a016ff91cb23 100644 --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/lib/Sema/SemaDeclCXX.cpp @@ -9235,7 +9235,7 @@ struct SpecialMemberVisitor { static SourceLocation getSubobjectLoc(Subobject Subobj) { // FIXME: For an indirect virtual base, the direct base leading to // the indirect virtual base would be a more useful choice. - if (auto *B = Subobj.dyn_cast<CXXBaseSpecifier*>()) + if (auto *B = dyn_cast<CXXBaseSpecifier *>(Subobj)) return B->getBaseTypeLoc(); else return cast<FieldDecl *>(Subobj)->getLocation(); @@ -17525,7 +17525,7 @@ DeclResult Sema::ActOnTemplatedFriendTag( unsigned FriendDeclDepth = TempParamLists.front()->getDepth(); for (UnexpandedParameterPack &U : Unexpanded) { if (getDepthAndIndex(U).first >= FriendDeclDepth) { - auto *ND = U.first.dyn_cast<NamedDecl *>(); + auto *ND = dyn_cast<NamedDecl *>(U.first); if (!ND) ND = cast<const TemplateTypeParmType *>(U.first)->getDecl(); Diag(U.second, diag::friend_template_decl_malformed_pack_expansion) _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits