Skip to content

Commit

Permalink
Merge pull request llvm#4863 from hborla/5.7-lldb-existential-any-any…
Browse files Browse the repository at this point in the history
…object

[5.7][lldb] Look through existential types when handling typealiases in SwiftASTContext to correctly handle `AnyObject` existentials.
  • Loading branch information
hborla authored Jun 24, 2022
2 parents 44e155a + ccb4a75 commit 5dfda22
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions lldb/source/Plugins/TypeSystem/Swift/SwiftASTContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5247,6 +5247,13 @@ bool SwiftASTContext::IsTypedefType(opaque_compiler_type_t type) {
if (!type)
return false;
swift::Type swift_type(GetSwiftType(type));

swift::ExistentialType *existential_type =
swift::dyn_cast<swift::ExistentialType>(swift_type.getPointer());
if (existential_type) {
swift_type = existential_type->getConstraintType();
}

return swift::isa<swift::TypeAliasType>(swift_type.getPointer());
}

Expand Down Expand Up @@ -5881,6 +5888,13 @@ CompilerType SwiftASTContext::GetTypedefedType(opaque_compiler_type_t type) {
VALID_OR_RETURN_CHECK_TYPE(type, CompilerType());

swift::Type swift_type(GetSwiftType({this, type}));

swift::ExistentialType *existential_type =
swift::dyn_cast<swift::ExistentialType>(swift_type.getPointer());
if (existential_type) {
swift_type = existential_type->getConstraintType();
}

swift::TypeAliasType *name_alias_type =
swift::dyn_cast<swift::TypeAliasType>(swift_type.getPointer());
if (name_alias_type) {
Expand Down

0 comments on commit 5dfda22

Please sign in to comment.