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

@@ -1073,9 +1073,11 @@ void Serializer::writeInputBlock(const SerializationOptions &options) {
// FIXME: Having to deal with private imports as a superset of public imports
// is inefficient.
SmallVector<ModuleDecl::ImportedModule, 8> publicImports;
SmallVector<ModuleDecl::ImportedModule, 8> linkImports;
SmallVector<ModuleDecl::ImportedModule, 8> allImports;
for (auto file : M->getFiles()) {
file->getImportedModules(publicImports, ModuleDecl::ImportFilter::Public);
file->getImportedModules(linkImports, ModuleDecl::ImportFilter::ForLinking);
file->getImportedModules(allImports, ModuleDecl::ImportFilter::All);
}
@@ -1083,6 +1085,10 @@ void Serializer::writeInputBlock(const SerializationOptions &options) {
publicImportSet;
publicImportSet.insert(publicImports.begin(), publicImports.end());
llvm::SmallSet<ModuleDecl::ImportedModule, 8, ModuleDecl::OrderImportedModules>
linkImportSet;
linkImportSet.insert(linkImports.begin(), linkImports.end());
removeDuplicateImports(allImports);
auto clangImporter =
static_cast<ClangImporter *>(M->getASTContext().getClangModuleLoader());
@@ -1111,7 +1117,10 @@ void Serializer::writeInputBlock(const SerializationOptions &options) {
ImportPathBlob importPath;
flattenImportPath(import, importPath);
ImportedModule.emit(ScratchRecord, publicImportSet.count(import),
ImportedModule.emit(ScratchRecord,
publicImportSet.count(import),
(linkImportSet.count(import) &&
!publicImportSet.count(import)),
!import.first.empty(), importPath);
}