https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/230009
PointerUnion::dyn_cast has been soft-deprecated in favor of llvm::dyn_cast and llvm::dyn_cast_if_present. This patch replaces the former with llvm::dyn_cast where the operand is guaranteed to be nonnull. Note that SpecialMemberVisitor::Subobject is always initialized to a nonnull pointer. Assisted-by: Antigravity >From 57b9a2d8bece391a632cc38637bb90cf058692f5 Mon Sep 17 00:00:00 2001 From: Kazu Hirata <[email protected]> Date: Wed, 7 Oct 2026 02:05:02 -0700 Subject: [PATCH] [clang] Replace PointerUnion::dyn_cast with llvm::dyn_cast (NFC) PointerUnion::dyn_cast has been soft-deprecated in favor of llvm::dyn_cast and llvm::dyn_cast_if_present. This patch replaces the former with llvm::dyn_cast where the operand is guaranteed to be nonnull. Note that SpecialMemberVisitor::Subobject is always initialized to a nonnull pointer. Assisted-by: Antigravity --- clang/lib/Sema/SemaDeclCXX.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp index 20c659c7520a4..f80fb2a3446b3 100644 --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/lib/Sema/SemaDeclCXX.cpp @@ -9668,7 +9668,7 @@ bool SpecialMemberDeletionInfo::isAccessible(Subobject Subobj, /// type of this special member. CanQualType objectTy; AccessSpecifier access = target->getAccess(); - if (CXXBaseSpecifier *base = Subobj.dyn_cast<CXXBaseSpecifier*>()) { + if (CXXBaseSpecifier *base = dyn_cast<CXXBaseSpecifier *>(Subobj)) { objectTy = S.Context.getCanonicalTagType(MD->getParent()); access = CXXRecordDecl::MergeAccess(base->getAccessSpecifier(), access); @@ -9687,7 +9687,7 @@ bool SpecialMemberDeletionInfo::shouldDeleteForSubobjectCall( Subobject Subobj, Sema::SpecialMemberOverloadResult SMOR, bool IsDtorCallInCtor) { CXXMethodDecl *Decl = SMOR.getMethod(); - FieldDecl *Field = Subobj.dyn_cast<FieldDecl*>(); + FieldDecl *Field = dyn_cast<FieldDecl *>(Subobj); enum { NotSet = -1, @@ -9766,7 +9766,7 @@ bool SpecialMemberDeletionInfo::shouldDeleteForSubobjectCall( /// direct or virtual base class or non-static data member of class type M. bool SpecialMemberDeletionInfo::shouldDeleteForClassSubobject( CXXRecordDecl *Class, Subobject Subobj, unsigned Quals) { - FieldDecl *Field = Subobj.dyn_cast<FieldDecl*>(); + FieldDecl *Field = dyn_cast<FieldDecl *>(Subobj); bool IsMutable = Field && Field->isMutable(); // C++11 [class.ctor]p5: @@ -14165,7 +14165,7 @@ bool SpecialMemberExceptionSpecInfo::visitField(FieldDecl *FD) { void SpecialMemberExceptionSpecInfo::visitClassSubobject(CXXRecordDecl *Class, Subobject Subobj, unsigned Quals) { - FieldDecl *Field = Subobj.dyn_cast<FieldDecl*>(); + FieldDecl *Field = dyn_cast<FieldDecl *>(Subobj); bool IsMutable = Field && Field->isMutable(); visitSubobjectCall(Subobj, lookupIn(Class, Quals, IsMutable)); } _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
