Skip to content

Commit 85c78e8

Browse files
authored
Merge pull request #2998 from augusto2112/tss-typeref-typeaslias-skip-special
[lldb] Skip validation on TypeSystemSwiftTypeRef::IsTypedefedType and GetTypedefedType when dealing with special types which diverge from SwiftASTContext.
2 parents b223d53 + c3ac368 commit 85c78e8

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3168,6 +3168,15 @@ bool TypeSystemSwiftTypeRef::IsTypedefType(opaque_compiler_type_t type) {
31683168
NodePointer node = GetDemangledType(dem, AsMangledName(type));
31693169
if (node && node->getKind() == Node::Kind::BuiltinTypeName)
31703170
return impl();
3171+
3172+
// This is a discrepancy with `SwiftASTContext`. `impl` correctly
3173+
// returns true, but `VALIDATE_AND_RETURN` will assert. This hardcoded
3174+
// handling of `__C.NSNotificationName` and `__C.NSDecimal` can be removed
3175+
// when the `VALIDATE_AND_RETURN` is removed.
3176+
auto mangled_name = GetMangledTypeName(type);
3177+
if (mangled_name == "$sSo18NSNotificationNameaD" ||
3178+
mangled_name == "$sSo9NSDecimalaD")
3179+
return impl();
31713180
#endif
31723181
VALIDATE_AND_RETURN(impl, IsTypedefType, type, (ReconstructType(type)),
31733182
(ReconstructType(type)));
@@ -3200,6 +3209,15 @@ TypeSystemSwiftTypeRef::GetTypedefedType(opaque_compiler_type_t type) {
32003209
NodePointer node = GetDemangledType(dem, AsMangledName(type));
32013210
if (node && node->getKind() == Node::Kind::BuiltinTypeName)
32023211
return impl();
3212+
3213+
// This is a discrepancy with `SwiftASTContext`. `impl` correctly
3214+
// returns true, but `VALIDATE_AND_RETURN` will assert. This hardcoded
3215+
// handling of `__C.NSNotificationName` and `__C.NSDecimal` can be removed
3216+
// when the `VALIDATE_AND_RETURN` is removed.
3217+
auto mangled_name = GetMangledTypeName(type);
3218+
if (mangled_name == "$sSo18NSNotificationNameaD" ||
3219+
mangled_name == "$sSo9NSDecimalaD")
3220+
return impl();
32033221
#endif
32043222
VALIDATE_AND_RETURN(impl, GetTypedefedType, type, (ReconstructType(type)),
32053223
(ReconstructType(type)));

0 commit comments

Comments
 (0)