mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
IRGen: Work around runtime bug demangling associated types of opaque types.
The Swift 5.1 runtime (and master, for the time being) do not successfully demangle this mangling, so for the time being, fall back to open-coded metadata access in this case. Workaround for rdar://problem/54084733.
This commit is contained in:
@@ -1905,6 +1905,19 @@ static bool shouldAccessByMangledName(IRGenModule &IGM, CanType type) {
|
||||
}
|
||||
}
|
||||
|
||||
// The Swift 5.1 runtime fails to demangle associated types of opaque types.
|
||||
auto hasNestedOpaqueArchetype = type.findIf([](CanType sub) -> bool {
|
||||
if (auto archetype = dyn_cast<NestedArchetypeType>(sub)) {
|
||||
if (isa<OpaqueTypeArchetypeType>(archetype->getRoot())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
if (hasNestedOpaqueArchetype)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
||||
// The visitor below can be used to fine-tune a heuristic to decide whether
|
||||
|
||||
Reference in New Issue
Block a user