Skip to content

Commit 9a8dda9

Browse files
Merge pull request #6886 from augusto2112/originally-def-cgfloat
[lldb] Add list of types known to use @_originallyDefinedIn
2 parents 98f8acf + 010321d commit 9a8dda9

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

lldb/source/Plugins/LanguageRuntime/Swift/SwiftLanguageRuntimeDynamicTypeResolution.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3259,12 +3259,22 @@ SwiftLanguageRuntimeImpl::GetTypeRef(CompilerType type,
32593259

32603260
// Demangle the mangled name.
32613261
swift::Demangle::Demangler dem;
3262-
ConstString mangled_name = type.GetMangledTypeName();
3262+
llvm::StringRef mangled_name = type.GetMangledTypeName().GetStringRef();
32633263
auto ts = type.GetTypeSystem().dyn_cast_or_null<TypeSystemSwift>();
32643264
if (!ts)
32653265
return nullptr;
3266+
3267+
// List of commonly used types known to have been been annotated with
3268+
// @_originallyDefinedIn to a different module.
3269+
static llvm::StringMap<llvm::StringRef> known_types_with_redefined_modules = {
3270+
{"$s14CoreFoundation7CGFloatVD", "$s12CoreGraphics7CGFloatVD"}};
3271+
3272+
auto it = known_types_with_redefined_modules.find(mangled_name);
3273+
if (it != known_types_with_redefined_modules.end())
3274+
mangled_name = it->second;
3275+
32663276
swift::Demangle::NodePointer node =
3267-
module_holder->GetCanonicalDemangleTree(dem, mangled_name.GetStringRef());
3277+
module_holder->GetCanonicalDemangleTree(dem, mangled_name);
32683278
if (!node)
32693279
return nullptr;
32703280

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4148,8 +4148,6 @@ bool TypeSystemSwiftTypeRef::ShouldSkipValidation(opaque_compiler_type_t type) {
41484148
if (mangled_name == "$sSo6CGSizeVD")
41494149
return true;
41504150

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

0 commit comments

Comments
 (0)