Skip to content

Commit a17593f

Browse files
committed
[Frontend] Always output swiftdeps when allowing errors
A module is always output when allowing errors, make sure to output its dependencies as well.
1 parent ab5a421 commit a17593f

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

lib/FrontendTool/FrontendTool.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -640,7 +640,10 @@ static void emitSwiftdepsForAllPrimaryInputsIfNeeded(
640640
//
641641
// FIXME: It seems more appropriate for the driver to notice the early-exit
642642
// and react by always enqueuing the jobs it dropped in the other waves.
643-
if (Instance.getDiags().hadAnyError())
643+
//
644+
// We will output a module if allowing errors, so ignore that case.
645+
if (Instance.getDiags().hadAnyError() &&
646+
!Invocation.getFrontendOptions().AllowModuleWithCompilerErrors)
644647
return;
645648

646649
for (auto *SF : Instance.getPrimarySourceFiles()) {

test/Frontend/allow-errors.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
// RUN: %empty-directory(%t)
22

33
// The module should be generated regardless of errors and diagnostic should still be output
4-
// RUN: %target-swift-frontend -verify -emit-module -o %t/errors.swiftmodule -experimental-allow-module-with-compiler-errors -D ERROR_MODULE %s
4+
// RUN: %target-swift-frontend -verify -emit-module -o %t/errors.swiftmodule -emit-reference-dependencies-path %t/errors.swiftdeps -emit-dependencies-path %t/errors.d -experimental-allow-module-with-compiler-errors -D ERROR_MODULE -primary-file %s
55
// RUN: llvm-bcanalyzer %t/errors.swiftmodule | %FileCheck -check-prefix=CHECK-BC %s
66
// CHECK-BC-NOT: UnknownCode
7+
// RUN: ls %t/errors.swiftdeps
8+
// RUN: ls %t/errors.d
9+
710
#if ERROR_MODULE
811
public struct ValidStructInvalidMember {
912
public var member: String

0 commit comments

Comments
 (0)