mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Add frontend mode -build-module-from-parseable-interface
Makes it easier to test the caching behavior, and may also be useful for "prebuilding" swiftinterfaces in the future, or having the Driver kick off a bunch of separate builds as proper tasks.
This commit is contained in:
@@ -559,6 +559,17 @@ static bool precompileBridgingHeader(CompilerInvocation &Invocation,
|
||||
.InputsAndOutputs.getSingleOutputFilename());
|
||||
}
|
||||
|
||||
static bool buildModuleFromParseableInterface(CompilerInvocation &Invocation,
|
||||
CompilerInstance &Instance) {
|
||||
const auto &InputsAndOutputs =
|
||||
Invocation.getFrontendOptions().InputsAndOutputs;
|
||||
assert(InputsAndOutputs.hasSingleInput());
|
||||
StringRef InputPath = InputsAndOutputs.getFilenameOfFirstInput();
|
||||
return ParseableInterfaceModuleLoader::buildSwiftModuleFromSwiftInterface(
|
||||
Instance.getASTContext(), Invocation.getClangModuleCachePath(),
|
||||
Invocation.getModuleName(), InputPath, Invocation.getOutputFilename());
|
||||
}
|
||||
|
||||
static bool compileLLVMIR(CompilerInvocation &Invocation,
|
||||
CompilerInstance &Instance,
|
||||
UnifiedStatsReporter *Stats) {
|
||||
@@ -923,6 +934,9 @@ static bool performCompile(CompilerInstance &Instance,
|
||||
if (Action == FrontendOptions::ActionType::EmitPCH)
|
||||
return precompileBridgingHeader(Invocation, Instance);
|
||||
|
||||
if (Action == FrontendOptions::ActionType::BuildModuleFromParseableInterface)
|
||||
return buildModuleFromParseableInterface(Invocation, Instance);
|
||||
|
||||
if (Invocation.getInputKind() == InputFileKind::LLVM)
|
||||
return compileLLVMIR(Invocation, Instance, Stats);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user