Add a “typecheck module interface” mode

This commit is contained in:
Brent Royal-Gordon
2020-07-23 18:05:31 -07:00
parent 9bbe6e7365
commit 9bc787ef5f
10 changed files with 62 additions and 8 deletions

View File

@@ -1259,7 +1259,7 @@ InterfaceSubContextDelegateImpl::InterfaceSubContextDelegateImpl(
inheritOptionsForBuildingInterface(searchPathOpts, langOpts);
// Configure front-end input.
auto &SubFEOpts = genericSubInvocation.getFrontendOptions();
SubFEOpts.RequestedAction = FrontendOptions::ActionType::EmitModuleOnly;
SubFEOpts.RequestedAction = LoaderOpts.requestedAction;
if (!moduleCachePath.empty()) {
genericSubInvocation.setClangModuleCachePath(moduleCachePath);
}
@@ -1442,7 +1442,10 @@ bool InterfaceSubContextDelegateImpl::runInSubCompilerInstance(StringRef moduleN
std::vector<std::string> outputFiles{"/<unused>"};
std::vector<SupplementaryOutputPaths> ModuleOutputPaths;
ModuleOutputPaths.emplace_back();
ModuleOutputPaths.back().ModuleOutputPath = outputPath.str();
if (subInvocation.getFrontendOptions().RequestedAction ==
FrontendOptions::ActionType::EmitModuleOnly) {
ModuleOutputPaths.back().ModuleOutputPath = outputPath.str();
}
assert(subInvocation.getFrontendOptions().InputsAndOutputs.isWholeModule());
subInvocation.getFrontendOptions().InputsAndOutputs
.setMainAndSupplementaryOutputs(outputFiles, ModuleOutputPaths);