Skip to content

Commit d7a3355

Browse files
committed
[Option] Add all new driver arguments (without implementations)
Various clients still use the old driver to convert a driver arguments to frontend arguments. This has to work when given new driver arguments, ie. not fail with an unknown argument error. Move all "extra options" from the new driver into `Options.td` and mark them as new driver only.
1 parent cd04e9e commit d7a3355

File tree

4 files changed

+141
-17
lines changed

4 files changed

+141
-17
lines changed

include/swift/AST/DiagnosticsDriver.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ WARNING(warn_drv_darwin_sdk_invalid_settings, none,
183183
())
184184

185185
WARNING(warning_unsupported_driver_option,none,
186-
"option '%0' is ony supported in swift-driver", (StringRef))
186+
"option '%0' is only supported in swift-driver", (StringRef))
187187

188188
WARNING(old_driver_deprecated,none,
189189
"legacy driver is now deprecated; consider avoiding specifying '%0'", (StringRef))

include/swift/Option/Options.td

Lines changed: 134 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -626,16 +626,6 @@ def experimental_cxx_stdlib :
626626
Flags<[HelpHidden]>,
627627
HelpText<"C++ standard library to use; forwarded to Clang's -stdlib flag">;
628628

629-
def experimental_emit_module_separately:
630-
Flag<["-"], "experimental-emit-module-separately">,
631-
Flags<[NoInteractiveOption, HelpHidden]>,
632-
HelpText<"Emit module files as a distinct job (new Driver only)">;
633-
634-
def no_emit_module_separately:
635-
Flag<["-"], "no-emit-module-separately">,
636-
Flags<[NoInteractiveOption, HelpHidden]>,
637-
HelpText<"Force using merge-module as the incremental build mode (new Driver only)">;
638-
639629
def experimental_hermetic_seal_at_link:
640630
Flag<["-"], "experimental-hermetic-seal-at-link">,
641631
Flags<[FrontendOption, HelpHidden]>,
@@ -1543,4 +1533,138 @@ def use_interface_for_module: Separate<["-", "--"], "use-interface-for-module">,
15431533
HelpText<"Prefer loading these modules via interface">,
15441534
MetaVarName<"<name>">;
15451535

1536+
// ONLY SUPPORTED IN NEW DRIVER
1537+
1538+
// These flags only exist here so that the old driver doesn't fail with unknown
1539+
// arguments when they're given. The option definitions (and ie. their flags)
1540+
// matter since they are synced to the new swift-driver. The options themselves
1541+
// are completely unimplemented in the old driver, however.
1542+
1543+
def driver_print_graphviz:
1544+
Flag<["-"], "driver-print-graphviz">,
1545+
Flags<[HelpHidden, DoesNotAffectIncrementalBuild, NewDriverOnlyOption]>,
1546+
HelpText<"Write the job graph as a graphviz file">;
1547+
1548+
def driver_explicit_module_build:
1549+
Flag<["-"], "explicit-module-build">,
1550+
Flags<[HelpHidden, NewDriverOnlyOption]>,
1551+
HelpText<"Prebuild module dependencies to make them explicit">;
1552+
1553+
def driver_experimental_explicit_module_build:
1554+
Flag<["-"], "experimental-explicit-module-build">,
1555+
Flags<[HelpHidden, NewDriverOnlyOption]>,
1556+
Alias<driver_explicit_module_build>,
1557+
HelpText<"Prebuild module dependencies to make them explicit">;
1558+
1559+
def driver_scan_dependencies_non_lib:
1560+
Flag<["-"], "nonlib-dependency-scanner">,
1561+
Flags<[HelpHidden, NewDriverOnlyOption]>,
1562+
HelpText<"Use calls to `swift-frontend -scan-dependencies` instead of "
1563+
"dedicated dependency scanning library">;
1564+
1565+
def driver_warn_unused_options:
1566+
Flag<["-"], "driver-warn-unused-options">,
1567+
Flags<[HelpHidden, NewDriverOnlyOption]>,
1568+
HelpText<"Emit warnings for any provided options which are unused by the "
1569+
"driver">;
1570+
1571+
def emit_module_separately:
1572+
Flag<["-"], "experimental-emit-module-separately">,
1573+
Flags<[HelpHidden, NewDriverOnlyOption]>,
1574+
HelpText<"Emit module files as a distinct job">;
1575+
1576+
def no_emit_module_separately:
1577+
Flag<["-"], "no-emit-module-separately">,
1578+
Flags<[HelpHidden, NewDriverOnlyOption]>,
1579+
HelpText<"Force using merge-module as the incremental build mode">;
1580+
1581+
def emit_module_separately_WMO:
1582+
Flag<["-"], "emit-module-separately-wmo">,
1583+
Flags<[HelpHidden, NewDriverOnlyOption]>,
1584+
HelpText<"Emit module files as a distinct job in wmo builds">;
1585+
1586+
def no_emit_module_separately_WMO:
1587+
Flag<["-"], "no-emit-module-separately-wmo">,
1588+
Flags<[HelpHidden, NewDriverOnlyOption]>,
1589+
HelpText<"Force emitting the swiftmodule in the same job in wmo builds">;
1590+
1591+
def emit_module_serialize_diagnostics_path:
1592+
Separate<["-"], "emit-module-serialize-diagnostics-path">,
1593+
Flags<[ArgumentIsPath, SupplementaryOutput, NewDriverOnlyOption]>,
1594+
HelpText<"Emit a serialized diagnostics file for the emit-module task to "
1595+
"<path>">,
1596+
MetaVarName<"<path>">;
1597+
1598+
def emit_module_dependencies_path:
1599+
Separate<["-"], "emit-module-dependencies-path">,
1600+
Flags<[ArgumentIsPath, SupplementaryOutput, NewDriverOnlyOption]>,
1601+
HelpText<"Emit a discovered dependencies file for the emit-module task to "
1602+
"<path>">,
1603+
MetaVarName<"<path>">;
1604+
1605+
def use_frontend_parseable_output:
1606+
Flag<["-"], "use-frontend-parseable-output">,
1607+
Flags<[HelpHidden, NewDriverOnlyOption]>,
1608+
HelpText<"Emit parseable-output from swift-frontend jobs instead of from "
1609+
"the driver">;
1610+
1611+
def print_explicit_dependency_graph:
1612+
Flag<["-"], "print-explicit-dependency-graph">,
1613+
Flags<[HelpHidden, NewDriverOnlyOption]>,
1614+
HelpText<"Print the result of module dependency scanning after external "
1615+
"module resolution to output">;
1616+
1617+
def print_preprocessed_explicit_dependency_graph:
1618+
Flag<["-"], "print-preprocessed-explicit-dependency-graph">,
1619+
Flags<[HelpHidden, NewDriverOnlyOption]>,
1620+
HelpText<"Print the result of module dependency scanning to output">;
1621+
1622+
def emit_digester_baseline:
1623+
Flag<["-"], "emit-digester-baseline">,
1624+
Flags<[NoInteractiveOption, SupplementaryOutput, NewDriverOnlyOption]>,
1625+
HelpText<"Emit a baseline file for the module using the API digester">;
1626+
1627+
def emit_digester_baseline_path:
1628+
Separate<["-"], "emit-digester-baseline-path">,
1629+
Flags<[NoInteractiveOption, ArgumentIsPath, SupplementaryOutput,
1630+
NewDriverOnlyOption]>,
1631+
HelpText<"Emit a baseline file for the module to <path> using the API "
1632+
"digester">,
1633+
MetaVarName<"<path>">;
1634+
1635+
def compare_to_baseline_path:
1636+
Separate<["-"], "compare-to-baseline-path">,
1637+
Flags<[NoInteractiveOption, ArgumentIsPath, NewDriverOnlyOption]>,
1638+
HelpText<"Compare the built module to the baseline at <path> and diagnose "
1639+
"breaking changes using the API digester">,
1640+
MetaVarName<"<path>">;
1641+
1642+
def serialize_breaking_changes_path:
1643+
Separate<["-"], "serialize-breaking-changes-path">,
1644+
Flags<[NoInteractiveOption, ArgumentIsPath, NewDriverOnlyOption]>,
1645+
HelpText<"Serialize breaking changes found by the API digester to <path>">,
1646+
MetaVarName<"<path>">;
1647+
1648+
def digester_breakage_allowlist_path:
1649+
Separate<["-"], "digester-breakage-allowlist-path">,
1650+
Flags<[NoInteractiveOption, ArgumentIsPath, NewDriverOnlyOption]>,
1651+
HelpText<"The path to a list of permitted breaking changes the API digester "
1652+
"should ignore">,
1653+
MetaVarName<"<path>">;
1654+
1655+
def digester_mode:
1656+
Separate<["-"], "digester-mode">,
1657+
Flags<[NoInteractiveOption, NewDriverOnlyOption]>,
1658+
HelpText<"Whether the API digester should run in API or ABI mode (defaults "
1659+
"to API checking)">,
1660+
MetaVarName<"<api|abi>">;
1661+
1662+
def nostartfiles:
1663+
Flag<["-"], "nostartfiles">,
1664+
Flags<[FrontendOption, DoesNotAffectIncrementalBuild, NoInteractiveOption,
1665+
HelpHidden, NewDriverOnlyOption]>,
1666+
HelpText<"Do not link in the Swift language startup routines">;
1667+
1668+
// END ONLY SUPPORTED IN NEW DRIVER
1669+
15461670
include "FrontendOptions.td"

test/Driver/Dependencies/one-way-merge-module-fine.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@
44
// RUN: cp -r %S/Inputs/one-way-fine/* %t
55
// RUN: touch -t 201401240005 %t/*
66

7-
// RUN: cd %t && %swiftc_driver -driver-use-frontend-path "%{python.unquoted};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -emit-module-path %t/master.swiftmodule -module-name main -j1 -v -no-emit-module-separately 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s
7+
// RUN: cd %t && %swiftc_driver -driver-use-frontend-path "%{python.unquoted};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -emit-module-path %t/master.swiftmodule -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s
88

99
// CHECK-FIRST-NOT: warning
10-
// CHECK-FIRST: Handled main.swift
11-
// CHECK-FIRST: Handled other.swift
12-
// CHECK-FIRST: Produced master.swiftmodule
10+
// CHECK-FIRST-DAG: Handled main.swift
11+
// CHECK-FIRST-DAG: Handled other.swift
12+
// CHECK-FIRST-DAG: Produced master.swiftmodule
1313

1414
// swift-driver checks existence of all outputs
1515
// RUN: touch -t 201401240006 %t/{main,other,master}.swift{module,doc,sourceinfo}
1616

17-
// RUN: cd %t && %swiftc_driver -driver-use-frontend-path "%{python.unquoted};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -emit-module-path %t/master.swiftmodule -module-name main -j1 -v -no-emit-module-separately 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s
17+
// RUN: cd %t && %swiftc_driver -driver-use-frontend-path "%{python.unquoted};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -emit-module-path %t/master.swiftmodule -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s
1818

1919
// CHECK-SECOND-NOT: warning
2020
// CHECK-SECOND-NOT: Handled
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
// RUN: %swiftc_driver -emit-module -user-module-version 999.999 %s -### 2>&1 | %FileCheck %s
22

3-
// CHECK: warning: option '-user-module-version' is ony supported in swift-driver
3+
// CHECK: warning: option '-user-module-version' is only supported in swift-driver

0 commit comments

Comments
 (0)