Skip to content

Commit 56c1e23

Browse files
author
David Ronnqvist
committed
[SR-2409] Rephrase diagnostic to consider Objective-C interop
When Objective-C interop is enabled, modules will continue to be referred to as “Objective-C modules”. But when interop is disabled, they will be referred to as “C modules”. Updated the existing test for the current behavior that doesn’t expect to fail on linux and doesn’t require objc_interop, so that it checks to different diagnostics on the two systems.
1 parent 6293546 commit 56c1e23

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

include/swift/AST/DiagnosticsClangImporter.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ NOTE(note_from_clang,none,
4444
"%0", (StringRef))
4545

4646
ERROR(clang_cannot_build_module,Fatal,
47-
"could not build Objective-C module '%0'", (StringRef))
47+
"could not build %select{C|Objective-C}0 module '%1'", (bool, StringRef))
4848

4949
ERROR(bridging_header_missing,Fatal,
5050
"bridging header '%0' does not exist", (StringRef))

lib/ClangImporter/ClangDiagnosticConsumer.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ void ClangDiagnosticConsumer::HandleDiagnostic(
173173
clangDiag.getLocation());
174174

175175
ctx.Diags.diagnose(loc, diag::clang_cannot_build_module,
176+
ctx.LangOpts.EnableObjCInterop,
176177
CurrentImport->getName());
177178
return;
178179
}

test/ClangImporter/non-modular-include.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
// RUN: rm -rf %t && mkdir -p %t
2-
// RUN: not %target-swift-frontend -typecheck %s -I %S/Inputs/non-modular -F %S/Inputs/non-modular 2>&1 | %FileCheck %s
2+
// RUN: not %target-swift-frontend -typecheck %s -I %S/Inputs/non-modular -F %S/Inputs/non-modular 2>&1 | %FileCheck --check-prefix=CHECK --check-prefix=CHECK-%target-os %s
33

44
// CHECK: {{.+}}/non-modular/Foo.framework/Headers/Foo.h:1:9: error: include of non-modular header inside framework module 'Foo'
5-
// CHECK: error: could not build Objective-C module 'Foo'
5+
// CHECK-macosx: error: could not build Objective-C module 'Foo'
6+
// CHECK-linux: error: could not build C module 'Foo'
67
// CHECK-NOT: error
78

89
import Foo

0 commit comments

Comments
 (0)