Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3244,12 +3244,22 @@ SwiftLanguageRuntimeImpl::GetTypeRef(CompilerType type,

// Demangle the mangled name.
swift::Demangle::Demangler dem;
ConstString mangled_name = type.GetMangledTypeName();
llvm::StringRef mangled_name = type.GetMangledTypeName().GetStringRef();
auto ts = type.GetTypeSystem().dyn_cast_or_null<TypeSystemSwift>();
if (!ts)
return nullptr;

// List of commonly used types known to have been been annotated with
// @_originallyDefinedIn to a different module.
static llvm::StringMap<llvm::StringRef> known_types_with_redefined_modules = {
{"$s14CoreFoundation7CGFloatVD", "$s12CoreGraphics7CGFloatVD"}};

auto it = known_types_with_redefined_modules.find(mangled_name);
if (it != known_types_with_redefined_modules.end())
mangled_name = it->second;

swift::Demangle::NodePointer node =
module_holder->GetCanonicalDemangleTree(dem, mangled_name.GetStringRef());
module_holder->GetCanonicalDemangleTree(dem, mangled_name);
if (!node)
return nullptr;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4148,8 +4148,6 @@ bool TypeSystemSwiftTypeRef::ShouldSkipValidation(opaque_compiler_type_t type) {
if (mangled_name == "$sSo6CGSizeVD")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does CGSize have the same problem?

return true;

if (mangled_name == "$s14CoreFoundation7CGFloatVD")
return true;
// We skip validation when dealing with a builtin type since builtins are
// considered type aliases by Swift, which we're deviating from since
// SwiftASTContext reconstructs Builtin types as TypeAliases pointing to the
Expand Down