Skip to content

Commit 95fec0a

Browse files
committed
[lldb] Swift: Fix swift::Type casts for swiftlang/swift#85487
(cherry picked from commit ab3a3d5)
1 parent 80066b9 commit 95fec0a

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

lldb/source/Plugins/ExpressionParser/Swift/SwiftExpressionParser.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -687,8 +687,8 @@ AddRequiredAliases(Block *block, lldb::StackFrameSP &stack_frame_sp,
687687
swift::Type first_arg_type = optional_type->getGenericArgs()[0];
688688

689689
// In Swift only class types can be weakly captured.
690-
if (!llvm::isa<swift::ClassType>(first_arg_type) &&
691-
!llvm::isa<swift::BoundGenericClassType>(first_arg_type))
690+
if (!first_arg_type->is<swift::ClassType>() &&
691+
!first_arg_type->is<swift::BoundGenericClassType>())
692692
return llvm::createStringError(
693693
"Unable to add the aliases the expression needs because "
694694
"weakly captured type is not a class type.");

lldb/source/Plugins/TypeSystem/Swift/SwiftASTContext.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5450,7 +5450,7 @@ bool SwiftASTContext::IsTupleType(lldb::opaque_compiler_type_t type) {
54505450
VALID_OR_RETURN(false);
54515451

54525452
auto swift_type = GetSwiftType(type);
5453-
return llvm::isa<::swift::TupleType>(swift_type);
5453+
return swift_type->is<swift::TupleType>();
54545454
}
54555455

54565456
std::optional<TypeSystemSwift::NonTriviallyManagedReferenceKind>
@@ -6060,8 +6060,7 @@ SwiftASTContext::GetStaticSelfType(lldb::opaque_compiler_type_t type) {
60606060
VALID_OR_RETURN_CHECK_TYPE(type, CompilerType());
60616061

60626062
swift::Type swift_type = GetSwiftType(type);
6063-
if (auto *dyn_self =
6064-
llvm::dyn_cast_or_null<swift::DynamicSelfType>(swift_type))
6063+
if (auto *dyn_self = swift_type->getAs<swift::DynamicSelfType>())
60656064
return ToCompilerType({dyn_self->getSelfType().getPointer()});
60666065
return {weak_from_this(), type};
60676066
}

0 commit comments

Comments
 (0)