From ec8a7821e21051833d502e988a9c072750702b6f Mon Sep 17 00:00:00 2001 From: Anthony Latsis Date: Thu, 13 Nov 2025 22:04:19 +0000 Subject: [PATCH] [lldb] Swift: Fix `swift::Type` casts for https://github.com/swiftlang/swift/pull/85487 (cherry picked from commit ab3a3d5fd6ac3ca0f569a29773b5e71f8884770e) --- .../Plugins/ExpressionParser/Swift/SwiftExpressionParser.cpp | 4 ++-- lldb/source/Plugins/TypeSystem/Swift/SwiftASTContext.cpp | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/lldb/source/Plugins/ExpressionParser/Swift/SwiftExpressionParser.cpp b/lldb/source/Plugins/ExpressionParser/Swift/SwiftExpressionParser.cpp index 14ab65b45b0af..f78041d11abf2 100644 --- a/lldb/source/Plugins/ExpressionParser/Swift/SwiftExpressionParser.cpp +++ b/lldb/source/Plugins/ExpressionParser/Swift/SwiftExpressionParser.cpp @@ -687,8 +687,8 @@ AddRequiredAliases(Block *block, lldb::StackFrameSP &stack_frame_sp, swift::Type first_arg_type = optional_type->getGenericArgs()[0]; // In Swift only class types can be weakly captured. - if (!llvm::isa(first_arg_type) && - !llvm::isa(first_arg_type)) + if (!first_arg_type->is() && + !first_arg_type->is()) return llvm::createStringError( "Unable to add the aliases the expression needs because " "weakly captured type is not a class type."); diff --git a/lldb/source/Plugins/TypeSystem/Swift/SwiftASTContext.cpp b/lldb/source/Plugins/TypeSystem/Swift/SwiftASTContext.cpp index 6074b3032d4f1..fc9dbdeeeb8dc 100644 --- a/lldb/source/Plugins/TypeSystem/Swift/SwiftASTContext.cpp +++ b/lldb/source/Plugins/TypeSystem/Swift/SwiftASTContext.cpp @@ -5405,7 +5405,7 @@ bool SwiftASTContext::IsTupleType(lldb::opaque_compiler_type_t type) { VALID_OR_RETURN(false); auto swift_type = GetSwiftType(type); - return llvm::isa<::swift::TupleType>(swift_type); + return swift_type->is(); } std::optional @@ -6015,8 +6015,7 @@ SwiftASTContext::GetStaticSelfType(lldb::opaque_compiler_type_t type) { VALID_OR_RETURN_CHECK_TYPE(type, CompilerType()); swift::Type swift_type = GetSwiftType(type); - if (auto *dyn_self = - llvm::dyn_cast_or_null(swift_type)) + if (auto *dyn_self = swift_type->getAs()) return ToCompilerType({dyn_self->getSelfType().getPointer()}); return {weak_from_this(), type}; }