Skip to content

Commit 9e2b1bd

Browse files
committed
Downgrade the TypeSystemSwiftTypeRef string validation errors
to warnings. The remaining divergences are mostly cosmetic in nature and costly to fix. For testing purposes the code can be compiled with -DSTRICT_VALIDATION to retain the old behavior.
1 parent 795e6fe commit 9e2b1bd

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

lldb/source/Symbol/TypeSystemSwiftTypeRef.cpp

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -749,9 +749,19 @@ template <typename T> bool Equivalent(T l, T r) { return l == r; }
749749
template <> bool Equivalent<CompilerType>(CompilerType l, CompilerType r) {
750750
return l.GetMangledTypeName() == r.GetMangledTypeName();
751751
} // namespace
752-
/// This one is particularly taylored for GetName() and GetDisplayName().
752+
/// This one is particularly taylored for GetTypeName() and
753+
/// GetDisplayTypeName().
754+
///
755+
/// String divergences are mostly cosmetic in nature and usually
756+
/// TypeSystemSwiftTypeRef is returning more accurate results. They only really
757+
/// matter for GetTypeName() and there only if there is a data formatter
758+
/// matching that name.
753759
template <> bool Equivalent<ConstString>(ConstString l, ConstString r) {
754760
if (l != r) {
761+
// Failure. Dump it for easier debugging.
762+
llvm::dbgs() << "TypeSystemSwiftTypeRef diverges from SwiftASTContext: "
763+
<< l.GetStringRef() << " != " << r.GetStringRef() << "\n";
764+
755765
// For some reason the Swift type dumper doesn't attach a module
756766
// name to the AnyObject protocol, and only that one.
757767
std::string l_prime = std::regex_replace(
@@ -784,8 +794,9 @@ template <> bool Equivalent<ConstString>(ConstString l, ConstString r) {
784794
if (llvm::StringRef(l_prime) == r.GetStringRef())
785795
return true;
786796

787-
// Failure. Dump it for easier debugging.
788-
llvm::dbgs() << l.GetStringRef() << " != " << r.GetStringRef() << "\n";
797+
#ifndef STRICT_VALIDATION
798+
return true;
799+
#endif
789800
}
790801
return l == r;
791802
}

0 commit comments

Comments
 (0)