diff --git a/include/swift/Basic/BlockListAction.def b/include/swift/Basic/BlockListAction.def index 724795c02a7ea..316de256e8b10 100644 --- a/include/swift/Basic/BlockListAction.def +++ b/include/swift/Basic/BlockListAction.def @@ -21,5 +21,6 @@ BLOCKLIST_ACTION(ShouldUseBinaryModule) BLOCKLIST_ACTION(ShouldUseTextualModule) +BLOCKLIST_ACTION(DowngradeInterfaceVerificationFailure) #undef BLOCKLIST_ACTION diff --git a/lib/Frontend/ModuleInterfaceBuilder.cpp b/lib/Frontend/ModuleInterfaceBuilder.cpp index 1d872b6b3b24d..83bb266f75f04 100644 --- a/lib/Frontend/ModuleInterfaceBuilder.cpp +++ b/lib/Frontend/ModuleInterfaceBuilder.cpp @@ -180,6 +180,14 @@ bool ExplicitModuleInterfaceBuilder::collectDepsForSerialization( return false; } +static bool shouldDowngradeInterfaceVerificationError(const FrontendOptions &opts, + ASTContext &ctx) { + return opts.DowngradeInterfaceVerificationError || + ctx.blockListConfig.hasBlockListAction(opts.ModuleName, + BlockListKeyKind::ModuleName, + BlockListAction::DowngradeInterfaceVerificationFailure); +} + std::error_code ExplicitModuleInterfaceBuilder::buildSwiftModuleFromInterface( StringRef InterfacePath, StringRef OutputPath, bool ShouldSerializeDeps, std::unique_ptr *ModuleBuffer, @@ -207,7 +215,8 @@ std::error_code ExplicitModuleInterfaceBuilder::buildSwiftModuleFromInterface( << " to " << OutputPath << "\n"); LLVM_DEBUG(llvm::dbgs() << "Performing sema\n"); - if (isTypeChecking && FEOpts.DowngradeInterfaceVerificationError) { + if (isTypeChecking && + shouldDowngradeInterfaceVerificationError(FEOpts, Instance.getASTContext())) { ErrorDowngradeConsumerRAII R(Instance.getDiags()); Instance.performSema(); return std::error_code(); diff --git a/test/ModuleInterface/blocklist_action.swift b/test/ModuleInterface/blocklist_action.swift new file mode 100644 index 0000000000000..5014dd774f1bc --- /dev/null +++ b/test/ModuleInterface/blocklist_action.swift @@ -0,0 +1,21 @@ +// REQUIRES: objc_interop +// RUN: %empty-directory(%t) +// RUN: %target-swift-frontend -emit-module -o %t/Test.swiftmodule -emit-module-interface-path %t/Test.swiftinterface -module-name Test %s +// RUN: %target-swift-typecheck-module-from-interface(%t/Test.swiftinterface) -module-name Test + +// RUN: echo "<<<<<>>>>>>>>" >> %t/Test.swiftinterface +// RUN: not %target-swift-typecheck-module-from-interface(%t/Test.swiftinterface) -module-name Test + +// RUN: echo "---" > %t/blocklist.yml +// RUN: echo "DowngradeInterfaceVerificationFailure:" >> %t/blocklist.yml +// RUN: echo " ModuleName:" >> %t/blocklist.yml +// RUN: echo " - FooBar" >> %t/blocklist.yml + +// RUN: not %target-swift-typecheck-module-from-interface(%t/Test.swiftinterface) -module-name Test -blocklist-file %t/blocklist.yml + +// RUN: echo " - Test" >> %t/blocklist.yml + +// 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 + +public func foo() {}