Skip to content

Commit cca8345

Browse files
Merge pull request #3650 from adrian-prantl/relax-chil
Relax validation for GetChildCompilerTypeAtIndex
2 parents 8527595 + 43fd5ac commit cca8345

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1510,8 +1510,18 @@ StripPrivateIDs(swift::Demangle::Demangler &dem,
15101510
/// Compare two swift types from different type systems by comparing their
15111511
/// (canonicalized) mangled name.
15121512
template <> bool Equivalent<CompilerType>(CompilerType l, CompilerType r) {
1513+
#ifdef STRICT_VALIDATION
15131514
if (!l || !r)
15141515
return !l && !r;
1516+
#else
1517+
// We allow the typeref typesystem to return a type where
1518+
// SwiftASTContext fails.
1519+
if (!l)
1520+
return !r;
1521+
if (!r)
1522+
return true;
1523+
#endif
1524+
15151525
// See comments in SwiftASTContext::ReconstructType(). For
15161526
// SILFunctionTypes the mapping isn't bijective.
15171527
auto *ast_ctx = llvm::cast<SwiftASTContext>(r.GetTypeSystem());
@@ -2727,6 +2737,9 @@ CompilerType TypeSystemSwiftTypeRef::GetChildCompilerTypeAtIndex(
27272737
if (!ModuleList::GetGlobalModuleListProperties()
27282738
.GetSwiftValidateTypeSystem())
27292739
return;
2740+
// Ignore if SwiftASTContext got no result.
2741+
if (ast_child_name.empty())
2742+
return;
27302743
llvm::StringRef suffix(ast_child_name);
27312744
if (suffix.consume_front("__ObjC."))
27322745
ast_child_name = suffix.str();

0 commit comments

Comments
 (0)