mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Merge remote-tracking branch 'origin/main' into next
This commit is contained in:
@@ -1026,8 +1026,8 @@ void Serializer::writeInputBlock(const SerializationOptions &options) {
|
||||
|
||||
SmallVector<ModuleDecl::ImportedModule, 8> allImports;
|
||||
M->getImportedModules(allImports,
|
||||
{ModuleDecl::ImportFilterKind::Public,
|
||||
ModuleDecl::ImportFilterKind::Private,
|
||||
{ModuleDecl::ImportFilterKind::Exported,
|
||||
ModuleDecl::ImportFilterKind::Default,
|
||||
ModuleDecl::ImportFilterKind::ImplementationOnly,
|
||||
ModuleDecl::ImportFilterKind::SPIAccessControl});
|
||||
ModuleDecl::removeDuplicateImports(allImports);
|
||||
@@ -1035,11 +1035,15 @@ void Serializer::writeInputBlock(const SerializationOptions &options) {
|
||||
// Collect the public and private imports as a subset so that we can
|
||||
// distinguish them.
|
||||
ImportSet publicImportSet =
|
||||
getImportsAsSet(M, ModuleDecl::ImportFilterKind::Public);
|
||||
getImportsAsSet(M, ModuleDecl::ImportFilterKind::Exported);
|
||||
ImportSet privateImportSet =
|
||||
getImportsAsSet(M, ModuleDecl::ImportFilterKind::Private);
|
||||
getImportsAsSet(M, ModuleDecl::ImportFilterKind::Default);
|
||||
ImportSet spiImportSet =
|
||||
getImportsAsSet(M, ModuleDecl::ImportFilterKind::SPIAccessControl);
|
||||
getImportsAsSet(M, {
|
||||
ModuleDecl::ImportFilterKind::Exported,
|
||||
ModuleDecl::ImportFilterKind::Default,
|
||||
ModuleDecl::ImportFilterKind::SPIAccessControl
|
||||
});
|
||||
|
||||
auto clangImporter =
|
||||
static_cast<ClangImporter *>(M->getASTContext().getClangModuleLoader());
|
||||
@@ -4136,7 +4140,10 @@ public:
|
||||
using namespace decls_block;
|
||||
|
||||
auto resultType = S.addTypeRef(fnTy->getResult());
|
||||
auto clangType = S.addClangTypeRef(fnTy->getClangTypeInfo().getType());
|
||||
auto clangType =
|
||||
S.getASTContext().LangOpts.UseClangFunctionTypes
|
||||
? S.addClangTypeRef(fnTy->getClangTypeInfo().getType())
|
||||
: ClangTypeID(0);
|
||||
|
||||
unsigned abbrCode = S.DeclTypeAbbrCodes[FunctionTypeLayout::Code];
|
||||
FunctionTypeLayout::emitRecord(S.Out, S.ScratchRecord, abbrCode,
|
||||
@@ -5209,9 +5216,11 @@ SerializerBase::SerializerBase(ArrayRef<unsigned char> signature,
|
||||
this->SF = DC.dyn_cast<SourceFile *>();
|
||||
}
|
||||
|
||||
void Serializer::writeToStream(raw_ostream &os, ModuleOrSourceFile DC,
|
||||
const SILModule *SILMod,
|
||||
const SerializationOptions &options) {
|
||||
void Serializer::writeToStream(
|
||||
raw_ostream &os, ModuleOrSourceFile DC,
|
||||
const SILModule *SILMod,
|
||||
const SerializationOptions &options,
|
||||
const fine_grained_dependencies::SourceFileDepGraph *DepGraph) {
|
||||
Serializer S{SWIFTMODULE_SIGNATURE, DC};
|
||||
|
||||
// FIXME: This is only really needed for debugging. We don't actually use it.
|
||||
@@ -5223,6 +5232,9 @@ void Serializer::writeToStream(raw_ostream &os, ModuleOrSourceFile DC,
|
||||
S.writeInputBlock(options);
|
||||
S.writeSIL(SILMod, options.SerializeAllSIL);
|
||||
S.writeAST(DC);
|
||||
if (options.ExperimentalCrossModuleIncrementalInfo) {
|
||||
S.writeIncrementalInfo(DepGraph);
|
||||
}
|
||||
}
|
||||
|
||||
S.writeToStream(os);
|
||||
@@ -5241,7 +5253,8 @@ void swift::serializeToBuffers(
|
||||
"Serialization, swiftmodule, to buffer");
|
||||
llvm::SmallString<1024> buf;
|
||||
llvm::raw_svector_ostream stream(buf);
|
||||
Serializer::writeToStream(stream, DC, M, options);
|
||||
Serializer::writeToStream(stream, DC, M, options,
|
||||
/*dependency info*/ nullptr);
|
||||
bool hadError = withOutputFile(getContext(DC).Diags,
|
||||
options.OutputPath,
|
||||
[&](raw_ostream &out) {
|
||||
@@ -5292,12 +5305,13 @@ void swift::serializeToBuffers(
|
||||
|
||||
void swift::serialize(ModuleOrSourceFile DC,
|
||||
const SerializationOptions &options,
|
||||
const SILModule *M) {
|
||||
const SILModule *M,
|
||||
const fine_grained_dependencies::SourceFileDepGraph *DG) {
|
||||
assert(!StringRef::withNullAsEmpty(options.OutputPath).empty());
|
||||
|
||||
if (StringRef(options.OutputPath) == "-") {
|
||||
// Special-case writing to stdout.
|
||||
Serializer::writeToStream(llvm::outs(), DC, M, options);
|
||||
Serializer::writeToStream(llvm::outs(), DC, M, options, DG);
|
||||
assert(StringRef::withNullAsEmpty(options.DocOutputPath).empty());
|
||||
return;
|
||||
}
|
||||
@@ -5307,7 +5321,7 @@ void swift::serialize(ModuleOrSourceFile DC,
|
||||
[&](raw_ostream &out) {
|
||||
FrontendStatsTracer tracer(getContext(DC).Stats,
|
||||
"Serialization, swiftmodule");
|
||||
Serializer::writeToStream(out, DC, M, options);
|
||||
Serializer::writeToStream(out, DC, M, options, DG);
|
||||
return false;
|
||||
});
|
||||
if (hadError)
|
||||
|
||||
Reference in New Issue
Block a user