ModuleLoader: emit a note when encountering a blocklisted module interface

This commit is contained in:
Xi Ge
2023-07-12 13:50:40 -07:00
parent 5ae73991d4
commit b697d40fb6
3 changed files with 15 additions and 4 deletions

View File

@@ -930,6 +930,9 @@ NOTE(modularization_issue_related_modules,none,
"the %select{declaration|type}0 %1 moved between related modules; "
"clang preprocessor macros may affect headers shared between these modules",
(bool, DeclName))
NOTE(interface_block_listed_broken,none,
"textual interface for %0 is blocklisted as broken; "
"interface verification errors are downgraded to warnings", (StringRef))
NOTE(modularization_issue_side_effect_extension_error,none,
"could not deserialize extension",

View File

@@ -189,10 +189,14 @@ bool ExplicitModuleInterfaceBuilder::collectDepsForSerialization(
static bool shouldDowngradeInterfaceVerificationError(const FrontendOptions &opts,
ASTContext &ctx) {
return opts.DowngradeInterfaceVerificationError ||
ctx.blockListConfig.hasBlockListAction(opts.ModuleName,
BlockListKeyKind::ModuleName,
BlockListAction::DowngradeInterfaceVerificationFailure);
if (ctx.blockListConfig.hasBlockListAction(opts.ModuleName,
BlockListKeyKind::ModuleName,
BlockListAction::DowngradeInterfaceVerificationFailure)) {
ctx.Diags.diagnose(SourceLoc(), diag::interface_block_listed_broken,
opts.ModuleName);
return true;
}
return opts.DowngradeInterfaceVerificationError;
}
std::error_code ExplicitModuleInterfaceBuilder::buildSwiftModuleFromInterface(

View File

@@ -18,4 +18,8 @@
// RUN: %target-swift-typecheck-module-from-interface(%t/Test.swiftinterface) -module-name Test -downgrade-typecheck-interface-error
// RUN: %target-swift-typecheck-module-from-interface(%t/Test.swiftinterface) -module-name Test -blocklist-file %t/blocklist.yml
// RUN: %target-swift-typecheck-module-from-interface(%t/Test.swiftinterface) -module-name Test -blocklist-file %t/blocklist.yml &> %t/notes.txt
// RUN: %FileCheck -check-prefix CHECK-NOTES --input-file %t/notes.txt %s
// CHECK-NOTES: note: textual interface for Test is blocklisted as broken; interface verification errors are downgraded to warnings
public func foo() {}