-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[Frontend] Set up output file .swiftmodule.summary #33324
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1899,6 +1899,17 @@ static bool serializeSIB(SILModule *SM, const PrimarySpecificPaths &PSPs, | |
return Context.hadError(); | ||
} | ||
|
||
static bool serializeModuleSummary(SILModule *SM, | ||
const PrimarySpecificPaths &PSPs, | ||
const ASTContext &Context) { | ||
auto summaryOutputPath = PSPs.SupplementaryOutputs.ModuleSummaryOutputPath; | ||
return withOutputFile(Context.Diags, summaryOutputPath, | ||
[&](llvm::raw_ostream &out) { | ||
out << "Some stuff"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just quickly checking: if the tools that are meant to consume these files read There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, swiftmodulesummary will be serialized into LLVM bitcode stream, so if deserializer reads this text, it will fail due to signature checking. |
||
return false; | ||
}); | ||
} | ||
|
||
static GeneratedModule | ||
generateIR(const IRGenOptions &IRGenOpts, const TBDGenOptions &TBDOpts, | ||
std::unique_ptr<SILModule> SM, | ||
|
@@ -2123,6 +2134,12 @@ static bool performCompileStepsPostSILGen(CompilerInstance &Instance, | |
if (observer) | ||
observer->performedSILProcessing(*SM); | ||
|
||
if (PSPs.haveModuleSummaryOutputPath()) { | ||
if (serializeModuleSummary(SM.get(), PSPs, Context)) { | ||
return true; | ||
} | ||
} | ||
|
||
if (Action == FrontendOptions::ActionType::EmitSIB) | ||
return serializeSIB(SM.get(), PSPs, Context, MSF); | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// RUN: %empty-directory(%t) | ||
// RUN: echo 'print("Hello, World!")' >%t/main.swift | ||
// RUN: cd %t | ||
|
||
// RUN: %target-swiftc_driver -emit-sib -emit-module-summary -emit-module-summary-path %t/main.swiftmodulesummary %t/main.swift | ||
// RUN: test -f %t/main.swiftmodulesummary |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// RUN: %empty-directory(%t) | ||
// RUN: echo 'print("Hello, World!")' >%t/main.swift | ||
// RUN: cd %t | ||
|
||
// RUN: %target-swift-frontend -emit-sib -emit-module-summary-path %t/main.swiftmodulesummary %t/main.swift | ||
// RUN: test -f %t/main.swiftmodulesummary | ||
|
||
// RUN: echo '"%/t/main.swift": { swiftmodulesummary: "%/t/foo.swiftmodulesummary" }' > %/t/filemap.yaml | ||
// RUN: %target-swift-frontend -emit-sib -supplementary-output-file-map %/t/filemap.yaml %/t/main.swift | ||
// RUN: test -f %t/foo.swiftmodulesummary |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: I would put these new entries either above
emit_module_interface
or belowemit_private_module_interface_path
to avoid splitting the module interface options from each other.