[Bridging PCH] Add -emit-pch to Frontend; call emitBridgingPCH.

This commit is contained in:
Graydon Hoare
2016-11-29 16:31:21 -08:00
parent 01a7f46415
commit a95f5da86d
11 changed files with 44 additions and 0 deletions

View File

@@ -335,6 +335,15 @@ static bool performCompile(std::unique_ptr<CompilerInstance> &Instance,
FrontendOptions opts = Invocation.getFrontendOptions();
FrontendOptions::ActionType Action = opts.RequestedAction;
// We've been asked to precompile a bridging header; we want to
// avoid touching any other inputs and just parse, emit and exit.
if (Action == FrontendOptions::EmitPCH) {
auto clangImporter = static_cast<ClangImporter *>(
Instance->getASTContext().getClangModuleLoader());
return clangImporter->emitBridgingPCH(
Invocation.getInputFilenames()[0], opts.getSingleOutputFilename());
}
IRGenOptions &IRGenOpts = Invocation.getIRGenOptions();
bool inputIsLLVMIr = Invocation.getInputKind() == InputFileKind::IFK_LLVM_IR;