mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Implement Swift serialization and deserialization of Clang types.
As part of this, we have to change the type export rules to prevent `@convention(c)` function types from being used in exported interfaces if they aren't serializable. This is a more conservative version of the original rule I had, which was to import such function-pointer types as opaque pointers. That rule would've completely prevented importing function-pointer types defined in bridging headers and so simply doesn't work, so we're left trying to catch the unsupportable cases retroactively. This has the unfortunate consequence that we can't necessarily serialize the internal state of the compiler, but that was already true due to normal type uses of aggregate types from bridging headers; if we can teach the compiler to reliably serialize such types, we should be able to use the same mechanisms for function types. This PR doesn't flip the switch to use Clang function types by default, so many of the clang-function-type-serialization FIXMEs are still in place.
This commit is contained in:
@@ -986,6 +986,10 @@ bool ModuleFile::readIndexBlock(llvm::BitstreamCursor &cursor) {
|
||||
assert(blobData.empty());
|
||||
allocateBuffer(Types, scratch);
|
||||
break;
|
||||
case index_block::CLANG_TYPE_OFFSETS:
|
||||
assert(blobData.empty());
|
||||
allocateBuffer(ClangTypes, scratch);
|
||||
break;
|
||||
case index_block::IDENTIFIER_OFFSETS:
|
||||
assert(blobData.empty());
|
||||
allocateBuffer(Identifiers, scratch);
|
||||
|
||||
Reference in New Issue
Block a user