mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
SIL: Don't serialize imported conformances nested in non-public types
Apparently you can use a swift_name attribute in Clang to import types as members of Swift types. If the Swift type is not public, we would still try to serialize the witness thunks, which tripped SIL verifier checks since the witnesses themselves were not serialized. Note that the fix here is to just delete the special case of an imported conformance; the regular "type is public and protocol is public" condition suffices here. Fixes <rdar://problem/48218483>.
This commit is contained in:
@@ -12,10 +12,11 @@
|
||||
//
|
||||
// This file defines the SILWitnessTable class, which is used to map a protocol
|
||||
// conformance for a type to its implementing SILFunctions. This information is
|
||||
// (FIXME will be) used by IRGen to create witness tables for protocol dispatch.
|
||||
// used by IRGen to create witness tables for protocol dispatch.
|
||||
//
|
||||
// It can also be used by generic specialization and existential
|
||||
// devirtualization passes to promote witness_method and protocol_method
|
||||
// instructions to static function_refs.
|
||||
// devirtualization passes to promote witness_method instructions to static
|
||||
// function_refs.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@@ -24,7 +25,6 @@
|
||||
#include "swift/AST/ASTMangler.h"
|
||||
#include "swift/AST/Module.h"
|
||||
#include "swift/AST/ProtocolConformance.h"
|
||||
#include "swift/ClangImporter/ClangModule.h"
|
||||
#include "swift/SIL/SILModule.h"
|
||||
#include "llvm/ADT/SmallString.h"
|
||||
|
||||
@@ -172,11 +172,6 @@ bool SILWitnessTable::conformanceIsSerialized(
|
||||
if (normalConformance && normalConformance->isResilient())
|
||||
return false;
|
||||
|
||||
// Serialize witness tables for conformances synthesized by
|
||||
// the ClangImporter.
|
||||
if (isa<ClangModuleUnit>(conformance->getDeclContext()->getModuleScopeContext()))
|
||||
return true;
|
||||
|
||||
if (conformance->getProtocol()->getEffectiveAccess() < AccessLevel::Public)
|
||||
return false;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user