Serialization: Support '@_usableFromInline import'

Progress on <rdar://problem/39338239>; we still need to infer this
attribute though.
This commit is contained in:
Slava Pestov
2018-04-30 17:19:10 -07:00
parent cfa0ab3dbe
commit db440121b7
12 changed files with 97 additions and 14 deletions

View File

@@ -1140,10 +1140,12 @@ ModuleFile::ModuleFile(
unsigned kind = cursor.readRecord(next.ID, scratch, &blobData);
switch (kind) {
case input_block::IMPORTED_MODULE: {
bool exported, scoped;
bool exported, usableFromInline, scoped;
input_block::ImportedModuleLayout::readRecord(scratch,
exported, scoped);
Dependencies.push_back({blobData, exported, scoped});
exported,
usableFromInline,
scoped);
Dependencies.push_back({blobData, exported, usableFromInline, scoped});
break;
}
case input_block::LINK_LIBRARY: {
@@ -1600,8 +1602,8 @@ void ModuleFile::getImportedModules(
break;
case ModuleDecl::ImportFilter::ForLinking:
// FIXME
if (!dep.isExported())
// Only include @_exported and @usableFromInline imports.
if (!dep.isExported() && !dep.isUsableFromInline())
continue;
break;
@@ -1673,6 +1675,9 @@ void ModuleFile::getImportDecls(SmallVectorImpl<Decl *> &Results) {
if (Dep.isExported())
ID->getAttrs().add(
new (Ctx) ExportedAttr(/*IsImplicit=*/false));
if (Dep.isUsableFromInline())
ID->getAttrs().add(
new (Ctx) UsableFromInlineImportAttr(/*IsImplicit=*/true));
ImportDecls.push_back(ID);
}
Bits.ComputedImportDecls = true;