Skip to content

Commit 262e2b3

Browse files
committed
Eat -experimental-emit-module-separately
SourceKit invokes the legacy driver. Providing this flag in the IDE means the command lines SourceKit forms to run semantic requests in the editor are all invalid. Teach the legacy driver to eat this flag. rdar://80811565
1 parent d52dca5 commit 262e2b3

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

include/swift/Option/Options.td

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -598,6 +598,10 @@ def experimental_cxx_stdlib :
598598
Separate<["-"], "experimental-cxx-stdlib">,
599599
HelpText<"C++ standard library to use; forwarded to Clang's -stdlib flag">;
600600

601+
def experimental_emit_module_separately:
602+
Flag<["-"], "experimental-emit-module-separately">,
603+
Flags<[FrontendOption, NoInteractiveOption, HelpHidden]>,
604+
HelpText<"Schedule a swift module emission job instead of a merge-modules job (new Driver only)">;
601605

602606
// Diagnostic control options
603607
def suppress_warnings : Flag<["-"], "suppress-warnings">,
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// RUN: %empty-directory(%t)
2+
// RUN: touch %t/file1.swift %t/file2.swift %t/file3.swift
3+
// RUN: echo 'public func main() {}' >%t/main.swift
4+
//
5+
// RUN: %target-swiftc_driver -driver-skip-execution -c -emit-module -module-name main -driver-print-jobs %s -experimental-emit-module-separately %t/file1.swift %t/file2.swift %t/file3.swift %t/main.swift 2>^1 | %FileCheck -check-prefix NORMAL %s
6+
// RUN: %target-swiftc_driver -driver-skip-execution -c -emit-module -module-name main -driver-print-jobs -incremental %s -experimental-emit-module-separately %t/file1.swift %t/file2.swift %t/file3.swift %t/main.swift 2>^1 | %FileCheck -check-prefix INCREMENTAL %s
7+
8+
// Just test that we eat this argument. Only the new driver knows what to do
9+
// here. The legacy driver will just fall back to a merge-modules job as usual.
10+
// NORMAL: swift
11+
// NORMAL-NOT: -experimental-emit-module-separately
12+
13+
// INCREMENTAL: swift
14+
// INCREMENTAL: -merge-modules
15+
// INCREMENTAL-NOT: -experimental-emit-module-separately

0 commit comments

Comments
 (0)