Skip to content

Commit 9c36102

Browse files
committed
Get CFString.test to pass
1 parent cd97949 commit 9c36102

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
@@ -3219,6 +3219,16 @@ bool TypeSystemSwiftTypeRef::DumpTypeValue(
32193219
ReconstructType(type), s, format, data, data_offset, data_byte_size,
32203220
bitfield_bit_size, bitfield_bit_offset, exe_scope, is_base_class);
32213221
}
3222+
case Node::Kind::TypeAlias:
3223+
case Node::Kind::BoundGenericTypeAlias: {
3224+
// This means we have an unresolved type alias that even
3225+
// SwiftASTContext couldn't resolve. This happens for ObjC
3226+
// typedefs such as CFString in the REPL. More investigation is
3227+
// needed.
3228+
return m_swift_ast_context->DumpTypeValue(
3229+
ReconstructType(type), s, format, data, data_offset, data_byte_size,
3230+
bitfield_bit_size, bitfield_bit_offset, exe_scope, is_base_class);
3231+
}
32223232
default:
32233233
assert(false && "Unhandled node kind");
32243234
LLDB_LOGF(GetLogIfAllCategoriesSet(LIBLLDB_LOG_TYPES),
@@ -3487,16 +3497,23 @@ TypeSystemSwiftTypeRef::GetGenericArgumentType(opaque_compiler_type_t type,
34873497
(ReconstructType(type), idx));
34883498
}
34893499
#ifndef NDEBUG
3490-
bool TypeSystemSwiftTypeRef::ShouldSkipValidation(opaque_compiler_type_t type) { \
3491-
// NSNotificationName is a typedef to a NSString in clang type, but it's a
3500+
bool TypeSystemSwiftTypeRef::ShouldSkipValidation(opaque_compiler_type_t type) {
3501+
auto mangled_name = GetMangledTypeName(type);
3502+
// NSNotificationName is a typedef to a NSString in clang type, but it's a
34923503
// struct in SwiftASTContext. Skip validation in this case.
3504+
if (mangled_name == "$sSo18NSNotificationNameaD")
3505+
return true;
3506+
34933507
// $s10Foundation12NotificationV4NameaD is a typealias to NSNotificationName,
34943508
// so we skip validation in that casse as well.
3495-
auto mangled_name = GetMangledTypeName(type);
3496-
if (mangled_name == "$sSo18NSNotificationNameaD" ||
3497-
mangled_name == "$s10Foundation12NotificationV4NameaD" ||
3498-
mangled_name == "$sSo9NSDecimalaD")
3499-
return true;
3509+
if (mangled_name == "$s10Foundation12NotificationV4NameaD")
3510+
return true;
3511+
if (mangled_name == "$sSo9NSDecimalaD")
3512+
return true;
3513+
// Reconstruct($sSo11CFStringRefaD) returns a non-typealias type, breaking
3514+
// isTypedef().
3515+
if (mangled_name == "$sSo11CFStringRefaD")
3516+
return true;
35003517

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

0 commit comments

Comments
 (0)