mirror of
https://github.com/apple/swift.git
synced 2026-06-20 15:42:51 +02:00
[Serialization] Add precomputed layout table for hidden types
Add the module-format machinery that lets a Swift library record the physical layout of hidden types (currently limited to C types imported via internal bridging header). into binary modules, so downstream consumers can pull the layouts of these hidden types without loading the internal dependency. To test this, this change also added a frontend action to print hidden types' layouts from both the module under compilation and all the modules being imported.
This commit is contained in:
@@ -266,6 +266,11 @@ Status ModuleFile::associateWithFileContext(FileUnit *file, SourceLoc diagLoc,
|
||||
Status status = Status::Valid;
|
||||
|
||||
ModuleDecl *M = file->getParentModule();
|
||||
|
||||
// Propagate any deserialized hidden-type layouts onto the AST.
|
||||
for (auto &entry : Core->HiddenTypeLayouts)
|
||||
M->recordHiddenTypeLayout(entry.getKey(), entry.getValue());
|
||||
|
||||
// The real (on-disk) name of the module should be checked here as that's the
|
||||
// actually loaded module. In case module aliasing is used when building the main
|
||||
// module, e.g. -module-name MyModule -module-alias Foo=Bar, the loaded module
|
||||
|
||||
Reference in New Issue
Block a user