Skip to content

Commit d402ea5

Browse files
Merge pull request #11823 from swiftlang/jepa-stable
[stable/21.x][lldb] Swift: Fix `swift::Type` casts for swiftlang/swift#85487
2 parents 5614413 + ab3a3d5 commit d402ea5

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
@@ -5405,7 +5405,7 @@ bool SwiftASTContext::IsTupleType(lldb::opaque_compiler_type_t type) {
54055405
VALID_OR_RETURN(false);
54065406

54075407
auto swift_type = GetSwiftType(type);
5408-
return llvm::isa<::swift::TupleType>(swift_type);
5408+
return swift_type->is<swift::TupleType>();
54095409
}
54105410

54115411
std::optional<TypeSystemSwift::NonTriviallyManagedReferenceKind>
@@ -6015,8 +6015,7 @@ SwiftASTContext::GetStaticSelfType(lldb::opaque_compiler_type_t type) {
60156015
VALID_OR_RETURN_CHECK_TYPE(type, CompilerType());
60166016

60176017
swift::Type swift_type = GetSwiftType(type);
6018-
if (auto *dyn_self =
6019-
llvm::dyn_cast_or_null<swift::DynamicSelfType>(swift_type))
6018+
if (auto *dyn_self = swift_type->getAs<swift::DynamicSelfType>())
60206019
return ToCompilerType({dyn_self->getSelfType().getPointer()});
60216020
return {weak_from_this(), type};
60226021
}

0 commit comments

Comments
 (0)