Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 45557ee

Browse files
committedOct 5, 2018
[Driver] Disallow emitting swiftinterfaces with bridging headers
There's no place to put the bridging header in a swiftinterface, and they don't make sense with the intended use case of distribution. Just disallow it up front. rdar://problem/44113493
1 parent c38fcc1 commit 45557ee

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed
 

‎include/swift/AST/DiagnosticsDriver.def

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@ ERROR(error_unknown_target,none,
8484

8585
ERROR(error_framework_bridging_header,none,
8686
"using bridging headers with framework targets is unsupported", ())
87+
ERROR(error_bridging_header_parseable_interface,none,
88+
"using bridging headers with parseable module interfaces is unsupported",
89+
())
8790

8891
ERROR(error_i_mode,none,
8992
"the flag '-i' is no longer required and has been removed; "

‎lib/Driver/Driver.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,15 @@ ArrayRef<const char *> Driver::getArgsWithoutProgramNameAndDriverMode(
121121

122122
static void validateBridgingHeaderArgs(DiagnosticEngine &diags,
123123
const ArgList &args) {
124-
if (args.hasArgNoClaim(options::OPT_import_underlying_module) &&
125-
args.hasArgNoClaim(options::OPT_import_objc_header)) {
124+
if (!args.hasArgNoClaim(options::OPT_import_objc_header))
125+
return;
126+
127+
if (args.hasArgNoClaim(options::OPT_import_underlying_module))
126128
diags.diagnose({}, diag::error_framework_bridging_header);
129+
130+
if (args.hasArgNoClaim(options::OPT_emit_parseable_module_interface,
131+
options::OPT_emit_parseable_module_interface_path)) {
132+
diags.diagnose({}, diag::error_bridging_header_parseable_interface);
127133
}
128134
}
129135

‎test/Driver/options.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@
2525
// RUN: not %swiftc_driver -import-objc-header fake.h -import-underlying-module -c %s 2>&1 | %FileCheck -check-prefix=FRAMEWORK_BRIDGING_HEADER %s
2626
// FRAMEWORK_BRIDGING_HEADER: error: using bridging headers with framework targets is unsupported
2727

28+
// RUN: not %swiftc_driver -import-objc-header fake.h -emit-parseable-module-interface %s 2>&1 | %FileCheck -check-prefix=BRIDGING_HEADER_SWIFTINTERFACE %s
29+
// RUN: not %swiftc_driver -import-objc-header fake.h -emit-parseable-module-interface-path fake.swiftinterface %s 2>&1 | %FileCheck -check-prefix=BRIDGING_HEADER_SWIFTINTERFACE %s
30+
// BRIDGING_HEADER_SWIFTINTERFACE: error: using bridging headers with parseable module interfaces is unsupported
31+
2832
// RUN: %swift_driver -### | %FileCheck -check-prefix=DEFAULT_REPL %s
2933
// DEFAULT_REPL: -repl
3034
// RUN: not %swiftc_driver 2>&1 | %FileCheck -check-prefix=DEFAULT_EXEC_ERR %s

0 commit comments

Comments
 (0)
Please sign in to comment.