Add flag to verify just-emitted module interfaces

The driver can now schedule jobs which typecheck just-emitted module interfaces to ensure that they can be consumed later. This can be enabled manually by passing `-verify-emitted-module-interface` to the driver.
This commit is contained in:
Brent Royal-Gordon
2020-08-07 17:43:28 -07:00
parent 3c69837102
commit 5f523fee66
8 changed files with 108 additions and 1 deletions

View File

@@ -2208,6 +2208,26 @@ void Driver::buildActions(SmallVectorImpl<const Action *> &TopLevelActions,
TopLevelActions.push_back(MergeModuleAction);
TopLevelActions.append(AllLinkerInputs.begin(), AllLinkerInputs.end());
}
bool verifyInterfacesByDefault = false;
if (MergeModuleAction
&& Args.hasFlag(options::OPT_verify_emitted_module_interface,
options::OPT_no_verify_emitted_module_interface,
verifyInterfacesByDefault)) {
if (Args.hasArgNoClaim(options::OPT_emit_module_interface,
options::OPT_emit_module_interface_path)) {
TopLevelActions.push_back(
C.createAction<VerifyModuleInterfaceJobAction>(MergeModuleAction,
file_types::TY_SwiftModuleInterfaceFile));
}
if (Args.hasArgNoClaim(options::OPT_emit_private_module_interface_path)) {
TopLevelActions.push_back(
C.createAction<VerifyModuleInterfaceJobAction>(MergeModuleAction,
file_types::TY_PrivateSwiftModuleInterfaceFile));
}
}
}
bool Driver::handleImmediateArgs(const ArgList &Args, const ToolChain &TC) {