Skip to content

Commit 76d60fd

Browse files
authored
Merge pull request #65033 from nkcsgexi/block-action-downgrade
2 parents 5e90d32 + 63e2b2e commit 76d60fd

File tree

3 files changed

+32
-1
lines changed

3 files changed

+32
-1
lines changed

include/swift/Basic/BlockListAction.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,6 @@
2121

2222
BLOCKLIST_ACTION(ShouldUseBinaryModule)
2323
BLOCKLIST_ACTION(ShouldUseTextualModule)
24+
BLOCKLIST_ACTION(DowngradeInterfaceVerificationFailure)
2425

2526
#undef BLOCKLIST_ACTION

lib/Frontend/ModuleInterfaceBuilder.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,14 @@ bool ExplicitModuleInterfaceBuilder::collectDepsForSerialization(
180180
return false;
181181
}
182182

183+
static bool shouldDowngradeInterfaceVerificationError(const FrontendOptions &opts,
184+
ASTContext &ctx) {
185+
return opts.DowngradeInterfaceVerificationError ||
186+
ctx.blockListConfig.hasBlockListAction(opts.ModuleName,
187+
BlockListKeyKind::ModuleName,
188+
BlockListAction::DowngradeInterfaceVerificationFailure);
189+
}
190+
183191
std::error_code ExplicitModuleInterfaceBuilder::buildSwiftModuleFromInterface(
184192
StringRef InterfacePath, StringRef OutputPath, bool ShouldSerializeDeps,
185193
std::unique_ptr<llvm::MemoryBuffer> *ModuleBuffer,
@@ -207,7 +215,8 @@ std::error_code ExplicitModuleInterfaceBuilder::buildSwiftModuleFromInterface(
207215
<< " to " << OutputPath << "\n");
208216

209217
LLVM_DEBUG(llvm::dbgs() << "Performing sema\n");
210-
if (isTypeChecking && FEOpts.DowngradeInterfaceVerificationError) {
218+
if (isTypeChecking &&
219+
shouldDowngradeInterfaceVerificationError(FEOpts, Instance.getASTContext())) {
211220
ErrorDowngradeConsumerRAII R(Instance.getDiags());
212221
Instance.performSema();
213222
return std::error_code();
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// REQUIRES: objc_interop
2+
// RUN: %empty-directory(%t)
3+
// RUN: %target-swift-frontend -emit-module -o %t/Test.swiftmodule -emit-module-interface-path %t/Test.swiftinterface -module-name Test %s
4+
// RUN: %target-swift-typecheck-module-from-interface(%t/Test.swiftinterface) -module-name Test
5+
6+
// RUN: echo "<<<<<>>>>>>>>" >> %t/Test.swiftinterface
7+
// RUN: not %target-swift-typecheck-module-from-interface(%t/Test.swiftinterface) -module-name Test
8+
9+
// RUN: echo "---" > %t/blocklist.yml
10+
// RUN: echo "DowngradeInterfaceVerificationFailure:" >> %t/blocklist.yml
11+
// RUN: echo " ModuleName:" >> %t/blocklist.yml
12+
// RUN: echo " - FooBar" >> %t/blocklist.yml
13+
14+
// RUN: not %target-swift-typecheck-module-from-interface(%t/Test.swiftinterface) -module-name Test -blocklist-file %t/blocklist.yml
15+
16+
// RUN: echo " - Test" >> %t/blocklist.yml
17+
18+
// RUN: %target-swift-typecheck-module-from-interface(%t/Test.swiftinterface) -module-name Test -downgrade-typecheck-interface-error
19+
// RUN: %target-swift-typecheck-module-from-interface(%t/Test.swiftinterface) -module-name Test -blocklist-file %t/blocklist.yml
20+
21+
public func foo() {}

0 commit comments

Comments
 (0)