Skip to content

Commit cc395e0

Browse files
committed
Get CFString.test to pass
(cherry picked from commit 9c36102)
1 parent fcee799 commit cc395e0

File tree

1 file changed

+24
-7
lines changed

1 file changed

+24
-7
lines changed

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

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3218,6 +3218,16 @@ bool TypeSystemSwiftTypeRef::DumpTypeValue(
32183218
ReconstructType(type), s, format, data, data_offset, data_byte_size,
32193219
bitfield_bit_size, bitfield_bit_offset, exe_scope, is_base_class);
32203220
}
3221+
case Node::Kind::TypeAlias:
3222+
case Node::Kind::BoundGenericTypeAlias: {
3223+
// This means we have an unresolved type alias that even
3224+
// SwiftASTContext couldn't resolve. This happens for ObjC
3225+
// typedefs such as CFString in the REPL. More investigation is
3226+
// needed.
3227+
return m_swift_ast_context->DumpTypeValue(
3228+
ReconstructType(type), s, format, data, data_offset, data_byte_size,
3229+
bitfield_bit_size, bitfield_bit_offset, exe_scope, is_base_class);
3230+
}
32213231
default:
32223232
assert(false && "Unhandled node kind");
32233233
LLDB_LOGF(GetLogIfAllCategoriesSet(LIBLLDB_LOG_TYPES),
@@ -3486,16 +3496,23 @@ TypeSystemSwiftTypeRef::GetGenericArgumentType(opaque_compiler_type_t type,
34863496
(ReconstructType(type), idx));
34873497
}
34883498
#ifndef NDEBUG
3489-
bool TypeSystemSwiftTypeRef::ShouldSkipValidation(opaque_compiler_type_t type) { \
3490-
// NSNotificationName is a typedef to a NSString in clang type, but it's a
3499+
bool TypeSystemSwiftTypeRef::ShouldSkipValidation(opaque_compiler_type_t type) {
3500+
auto mangled_name = GetMangledTypeName(type);
3501+
// NSNotificationName is a typedef to a NSString in clang type, but it's a
34913502
// struct in SwiftASTContext. Skip validation in this case.
3503+
if (mangled_name == "$sSo18NSNotificationNameaD")
3504+
return true;
3505+
34923506
// $s10Foundation12NotificationV4NameaD is a typealias to NSNotificationName,
34933507
// so we skip validation in that casse as well.
3494-
auto mangled_name = GetMangledTypeName(type);
3495-
if (mangled_name == "$sSo18NSNotificationNameaD" ||
3496-
mangled_name == "$s10Foundation12NotificationV4NameaD" ||
3497-
mangled_name == "$sSo9NSDecimalaD")
3498-
return true;
3508+
if (mangled_name == "$s10Foundation12NotificationV4NameaD")
3509+
return true;
3510+
if (mangled_name == "$sSo9NSDecimalaD")
3511+
return true;
3512+
// Reconstruct($sSo11CFStringRefaD) returns a non-typealias type, breaking
3513+
// isTypedef().
3514+
if (mangled_name == "$sSo11CFStringRefaD")
3515+
return true;
34993516

35003517
// We skip validation when dealing with a builtin type since builtins are
35013518
// considered type aliases by Swift, which we're deviating from since

0 commit comments

Comments
 (0)