Skip to content

Commit 45b5b4c

Browse files
authored
Merge pull request #67269 from apple/block-list-note
ModuleLoader: emit a note when encountering a blocklisted module interface
2 parents c3af373 + b697d40 commit 45b5b4c

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

include/swift/AST/DiagnosticsSema.def

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -930,6 +930,9 @@ NOTE(modularization_issue_related_modules,none,
930930
"the %select{declaration|type}0 %1 moved between related modules; "
931931
"clang preprocessor macros may affect headers shared between these modules",
932932
(bool, DeclName))
933+
NOTE(interface_block_listed_broken,none,
934+
"textual interface for %0 is blocklisted as broken; "
935+
"interface verification errors are downgraded to warnings", (StringRef))
933936

934937
NOTE(modularization_issue_side_effect_extension_error,none,
935938
"could not deserialize extension",

lib/Frontend/ModuleInterfaceBuilder.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -189,10 +189,14 @@ bool ExplicitModuleInterfaceBuilder::collectDepsForSerialization(
189189

190190
static bool shouldDowngradeInterfaceVerificationError(const FrontendOptions &opts,
191191
ASTContext &ctx) {
192-
return opts.DowngradeInterfaceVerificationError ||
193-
ctx.blockListConfig.hasBlockListAction(opts.ModuleName,
194-
BlockListKeyKind::ModuleName,
195-
BlockListAction::DowngradeInterfaceVerificationFailure);
192+
if (ctx.blockListConfig.hasBlockListAction(opts.ModuleName,
193+
BlockListKeyKind::ModuleName,
194+
BlockListAction::DowngradeInterfaceVerificationFailure)) {
195+
ctx.Diags.diagnose(SourceLoc(), diag::interface_block_listed_broken,
196+
opts.ModuleName);
197+
return true;
198+
}
199+
return opts.DowngradeInterfaceVerificationError;
196200
}
197201

198202
std::error_code ExplicitModuleInterfaceBuilder::buildSwiftModuleFromInterface(

test/ModuleInterface/blocklist_action.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,8 @@
1818
// RUN: %target-swift-typecheck-module-from-interface(%t/Test.swiftinterface) -module-name Test -downgrade-typecheck-interface-error
1919
// RUN: %target-swift-typecheck-module-from-interface(%t/Test.swiftinterface) -module-name Test -blocklist-file %t/blocklist.yml
2020

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

0 commit comments

Comments
 (0)