OS Manuals

/usr/bin/swiftc-legacy-driver

Swift is a high-performance system programming language. It has a clean and modern syntax, offers seamless access to existing C and Objective-C code and frameworks, and is memory-safe by default.

From swift 6.4.2-r0 (enterprise-packages), captured 2026-11-08 by running swiftc-legacy-driver --help (exit 0). permalink

Also provided by 1 other package version
<unknown>:0: warning: legacy driver is now deprecated; consider avoiding specifying '-disallow-use-new-driver'
OVERVIEW: Swift compiler

USAGE: swiftc

DEBUG/DEVELOPMENT OPTIONS:
  -compiler-assertions Enable internal self-checks while compiling

MODES:
  -dump-ast              Parse and type-check input file(s) and dump AST(s)
  -dump-parse            Parse input file(s) and dump AST(s)
  -dump-pcm              Dump debugging information about a precompiled Clang module
  -dump-scope-maps <expanded-or-list-of-line:column>
                         Parse and type-check input file(s) and dump the scope map(s)
  -dump-type-info        Output YAML dump of fixed-size types from all imported modules
  -emit-assembly         Emit assembly file(s) (-S)
  -emit-bc               Emit LLVM BC file(s)
  -emit-executable       Emit a linked executable
  -emit-imported-modules Emit a list of the imported modules
  -emit-irgen            Emit LLVM IR file(s) before LLVM optimizations
  -emit-ir               Emit LLVM IR file(s) after LLVM optimizations
  -emit-library          Emit a linked library
  -emit-lowered-sil      Emit lowered SIL file(s)
  -emit-object           Emit object file(s) (-c)
  -emit-pcm              Emit a precompiled Clang module from a module map
  -emit-polyglot-ast     Parse the Objective-C input file and emit polyglot AST as JSON
  -emit-sibgen           Emit serialized AST + raw SIL file(s)
  -emit-sib              Emit serialized AST + canonical SIL file(s)
  -emit-silgen           Emit raw SIL file(s)
  -emit-sil              Emit canonical SIL file(s)
  -emit-supported-arguments
                         Emit a JSON file including all supported compiler arguments
  -index-file            Produce index data for a source file
  -parse                 Parse input file(s)
  -print-ast-decl        Parse and type-check input file(s) and pretty print declarations from AST(s)
  -print-ast             Parse and type-check input file(s) and pretty print AST(s)
  -resolve-imports       Parse and resolve imports in input file(s)
  -scan-dependencies     Scan dependencies of the given Swift sources
  -typecheck             Parse and type-check input file(s)

OPTIONS:
  -access-notes-path <value>
                          Specify YAML file to override attributes on Swift declarations in this module
  -active-platform-availability-only
                          Only emit availability metadata for platforms that are active according to the target
  -allow-availability-platforms <platforms>
                          Restrict availability metadata to the given platforms, e.g. 'macOS,Swift'
  -allow-non-resilient-access
                          Ensures all contents are generated besides exportable decls in the binary module, so non-resilient access can be allowed
  -allowable-client <vers>
                          Module names that are allowed to import this module
  -api-diff-data-dir <path>
                          Load platform and version specific API migration data files from <path>. Ignored if -api-diff-data-file is specified.
  -api-diff-data-file <path>
                          API migration data is from <path>
  -application-extension-library
                          Restrict code to those available for App Extension Libraries
  -application-extension  Restrict code to those available for App Extensions
  -assert-config <value>  Specify the assert_configuration replacement. Possible values are Debug, Release, Unchecked, DisableReplacement.
  -avoid-emit-module-source-info
                          don't emit Swift source info file
  -block-availability-platforms <platforms>
                          Remove the given platforms from symbol graph availability metadata, e.g. 'macOS,Swift'
  -build-id <build-id>    Specify the build ID argument passed to the linker
  -cache-compile-job      Enable compiler caching
  -cache-disable-replay   Skip loading the compilation result from cache
  -cas-path <path>        Path to CAS
  -cas-plugin-option <name>=<option>
                          Option pass to CAS Plugin
  -cas-plugin-path <path> Path to CAS Plugin
  -clang-build-session-file <value>
                          Use the last modification time of <file> as the underlying Clang build session timestamp
  -clang-scanner-module-cache-path <value>
                          Specifies the Clang dependency scanner module cache path
  -clang-target-variant <value>
                          Separately set the target we should use for internal Clang instance for the 'zippered' code for macCatalyst
  -clang-target <value>   Separately set the target we should use for internal Clang instance
  -color-diagnostics      Print diagnostics in color
  -compare-to-baseline-path <path>
                          Compare the built module to the baseline at <path> and diagnose breaking changes using the API digester
  -const-gather-protocols-list <path>
                          Specify a list of protocols for extraction of conformances 'const values'
  -continue-building-after-errors
                          Continue building, even after errors are encountered
  -coverage-prefix-map <prefix=replacement>
                          Remap source paths in coverage info
  -cs-profile-generate=<directory>
                          Generate instrumented code to collect context sensitive execution counts into <directory>/default.profraw (overridden by LLVM_PROFILE_FILE env var)
  -cs-profile-generate    Generate instrumented code to collect context sensitive execution counts into default.profraw (overridden by LLVM_PROFILE_FILE env var)
  -cxx-interoperability-mode=<value>
                          Enables C++ interoperability; pass 'default' to enable or 'off' to disable
  -debug-info-for-profiling
                          Emit extra debug info (DWARF discriminators) to make sampling-based profiling more accurate
  -debug-info-format=<value>
                          Specify the debug info format type to either 'dwarf' or 'codeview'
  -debug-info-store-invocation
                          Emit the compiler invocation in the debug info.
  -debug-module-path <value>
                          Path or cache key to this module's binary swiftmodule artifact (required by debug info)
  -debug-module-self-key  Embeded the key of current job in debug info generation (required by debug info)
  -debug-prefix-map <prefix=replacement>
                          Remap source paths in debug info
  -default-isolation MainActor|nonisolated
                          Specify the default actor isolation: MainActor or nonisolated. Defaults to nonisolated.
  -define-availability <macro>
                          Define an availability macro in the format 'macroName : iOS 13.0, macOS 10.15'
  -dependency-scan-serialize-diagnostics-path <path>
                          Emit a serialized diagnostics file for the dependency scanning task to <path>
  -diagnostic-style <style>
                          The formatting style used when printing diagnostics ('swift' or 'llvm')
  -digester-breakage-allowlist-path <path>
                          The path to a list of permitted breaking changes the API digester should ignore
  -digester-mode <api|abi>
                          Whether the API digester should run in API or ABI mode (defaults to API checking)
  -disable-actor-data-race-checks
                          Disable runtime checks for actor data races
  -disable-autolinking-runtime-compatibility-concurrency
                          Do not use autolinking for the concurrency runtime compatibility library
  -disable-autolinking-runtime-compatibility-dynamic-replacements
                          Do not use autolinking for the dynamic replacement runtime compatibility library
  -disable-autolinking-runtime-compatibility
                          Do not use autolinking for runtime compatibility libraries
  -disable-clang-target   Disable a separately specified target triple for Clang instance to use
  -disable-dynamic-actor-isolation
                          Disable dynamic actor isolation checks
  -disable-experimental-feature <value>
                          Disable an experimental feature
  -disable-incremental-file-hashing
                          Disable hashing of input and dependency file data that can prevent unnecessary invalidation
  -disable-incremental-imports
                          Disable cross-module incremental build metadata and driver scheduling for Swift modules
  -disable-migrator-fixits
                          Disable the Migrator phase which automatically applies fix-its
  -disable-module-selectors-in-module-interface
                          When emitting module interface files, do not use module selectors to avoid name collisions
  -disable-only-one-dependency-file
                          Disables incremental build optimization that only produces one dependencies file
  -disable-sandbox        Disable using the sandbox when executing subprocesses
  -disable-upcoming-feature <value>
                          Disable a feature that will be introduced in an upcoming language version
  -disallow-use-new-driver
                          Disable using new swift-driver
  -driver-time-compilation
                          Prints the total time it took to execute all compilation tasks
  -dump-ast-format <format>
                          Desired format for -dump-ast output ('default', 'json', or 'json-zlib'); no format is guaranteed stable across different compiler versions
  -dump-migration-states-dir <path>
                          Dump the input text, output text, and states for migration to <path>
  -dump-usr               Dump USR for each declaration reference
  -dwarf-version=<version>
                          DWARF debug info version to produce if requested
  -D <value>              Marks a conditional compilation flag as true
  -embed-bitcode-marker   Embed placeholder LLVM IR data as a marker
  -embed-bitcode          Embed LLVM IR bitcode as data
  -embed-tbd-for-module <value>
                          Embed symbols from the module in the emitted tbd file
  -emit-api-descriptor-path <path>
                          Output a JSON file describing the module's API to <path>
  -emit-api-descriptor    Output a JSON file describing the module's API
  -emit-clang-header-min-access <access-level>
                          The minimum access level of declarations to include in the emitted header
  -emit-clang-header-nonmodular-includes
                          Augment emitted Objective-C header with textual imports for every included modular import
  -emit-clang-header-path <value>
                          Emit an Objective-C and C++ header file to <path>
  -emit-const-values-path <path>
                          Emit the extracted compile-time known values to <path>
  -emit-dependencies      Emit basic Make-compatible dependencies files
  -emit-digester-baseline-path <path>
                          Emit a baseline file for the module to <path> using the API digester
  -emit-digester-baseline Emit a baseline file for the module using the API digester
  -emit-loaded-module-trace-path <path>
                          Emit the loaded module trace JSON to <path>
  -emit-loaded-module-trace
                          Emit a JSON file containing information about what modules were loaded
  -emit-module-dependencies-path <path>
                          Emit a discovered dependencies file for the emit-module task to <path>
  -emit-module-interface-path <path>
                          Output module interface file to <path>
  -emit-module-interface  Output module interface file
  -emit-module-path <path>
                          Emit an importable module to <path>
  -emit-module-serialize-diagnostics-path <path>
                          Emit a serialized diagnostics file for the emit-module task to <path>
  -emit-module-source-info-path <path>
                          Output module source info file to <path>
  -emit-module-summary-path <path>
                          Output module summary file to <path>
  -emit-module-summary    Output module summary file
  -emit-module            Emit an importable module
  -emit-objc-header-path <path>
                          Emit an Objective-C header file to <path>
  -emit-objc-header       Emit an Objective-C header file
  -emit-tbd-path <path>   Emit the TBD file to <path>
  -emit-tbd               Emit a TBD file
  -emit-variant-api-descriptor-path <path>
                          Output a JSON file describing the target variant module's API to <path>
  -emit-variant-module-interface-path <path>
                          Output module interface file for the target variant to <path>
  -emit-variant-module-path <path>
                          Emit an importable module for the target variant at the specified path
  -emit-variant-module-source-info-path <path>
                          Output module source info file for the target variant to <path>
  -emit-variant-package-module-interface-path <path>
                          Output package module interface file for the target variant to <path>
  -emit-variant-private-module-interface-path <path>
                          Output private module interface file for the target variant to <path>
  -enable-actor-data-race-checks
                          Emit runtime checks for actor data races
  -enable-autolinking-runtime-compatibility-bytecode-layouts
                          Enable autolinking for the bytecode layouts runtime compatibility library
  -enable-bare-slash-regex
                          Enable the use of forward slash regular-expression literal syntax
  -enable-builtin-module  Enables the explicit import of the Builtin module
  -enable-deterministic-check
                          Check compiler output determinism by running it twice
  -enable-experimental-additive-arithmetic-derivation
                          Enable experimental 'AdditiveArithmetic' derived conformances
  -enable-experimental-concise-pound-file
                          Enable experimental concise '#file' identifier
  -enable-experimental-feature <value>
                          Enable an experimental feature
  -enable-experimental-forward-mode-differentiation
                          Enable experimental forward mode differentiation
  -enable-incremental-file-hashing
                          Enable hashing of input and dependency file data that can prevent unnecessary invalidation
  -enable-incremental-imports
                          Enable cross-module incremental build metadata and driver scheduling for Swift modules
  -enable-library-evolution
                          Build the module to allow binary-compatible library evolution
  -enable-module-selectors-in-module-interface
                          When emitting module interface files, use module selectors to avoid name collisions
  -enable-only-one-dependency-file
                          Enables incremental build optimization that only produces one dependencies file
  -enable-upcoming-feature <value>
                          Enable a feature that will be introduced in an upcoming language version
  -enforce-exclusivity=<enforcement>
                          Enforce law of exclusivity
  -experimental-allow-non-resilient-access
                          Deprecated; use -allow-non-resilient-access instead
  -experimental-emit-variant-module
                          When a target variant triple is specified, the same driver invocation will emit two Swift modules, one for the primary target and one for the variant.
  -experimental-package-bypass-resilience
                          Deprecated; has no effect
  -experimental-package-cmo-abort-on-deserialization-fail
                          Abort if a deserialization error is found while package optimization is enabled
  -experimental-package-cmo
                          Deprecated; use -package-cmo instead
  -explain-module-dependency-detailed <value>
                          Emit remarks describing every possible dependency path that explains why compilation may depend on a module with a given name.
  -explain-module-dependency <value>
                          Emit remark describing why compilation may depend on a module with a given name.
  -explicit-auto-linking  Instead of linker-load directives, have the driver specify all link dependencies on the linker invocation. Requires '-explicit-module-build'.
  -export-as <value>      Module name to use when referenced in clients module interfaces
  -external-plugin-path <path>#<plugin-server-path>
                          Add directory to the plugin search path with a plugin server executable
  -e <value>              Executes a line of code provided on the command line
  -file-compilation-dir <path>
                          The compilation directory to embed in the debug info. Coverage mapping is not supported yet.
  -file-prefix-map <prefix=replacement>
                          Remap source paths in debug, coverage, and index info
  -fixit-all              Apply all fixits from diagnostics without any filtering
  -framework <value>      Specifies a framework which should be linked against
  -Fsystem <value>        Add directory to system framework search path
  -F <value>              Add directory to framework search path
  -gdwarf-types           Emit full DWARF type info.
  -gline-tables-only      Emit minimal debug info for backtraces only
  -gnone                  Don't emit debug info
  -g                      Emit debug info. This is the preferred setting for debugging with LLDB.
  -help                   Display available options
  -import-bridging-header <value>
                          Implicitly imports a C header file
  -import-underlying-module
                          Implicitly imports the Objective-C half of a module
  -in-process-plugin-server-path <value>
                          Path to dynamic library plugin server
  -index-file-path <path> Produce index data for file <path>
  -index-ignore-clang-modules
                          Avoid indexing clang modules (pcms)
  -index-ignore-system-modules
                          Avoid indexing system modules
  -index-include-locals   Include local definitions/references in the produced index data.
  -index-store-compress   Compress the unit and record files in the index store
  -index-store-path <path>
                          Store indexing data to <path>
  -index-unit-output-path <path>
                          Use <path> as the output path in the produced index data.
  -internal-import-bridging-header <value>
                          Implicitly imports a C header file as an internal import
  -ir-output-dir <dir>    Output LLVM IR files to directory <dir> as additional output during compilation
  -ir-profile-generate=<directory>
                          Generate instrumented code to collect execution counts into <directory>/default.profraw (overridden by LLVM_PROFILE_FILE env var)
  -ir-profile-generate    Generate instrumented code to collect execution counts into default.profraw (overridden by LLVM_PROFILE_FILE env var)
  -ir-profile-use=<profdata>
                          Supply an IR-level PGO profdata file to enable profile-guided optimization
  -Isystem <value>        Add directory to the system import search path
  -I <value>              Add directory to the import search path
  -j <n>                  Number of commands to execute in parallel
  -language-mode <mode>   Interpret input according to a specific Swift language mode
  -libc <value>           libc runtime library to use
  -link-objc-runtime      Deprecated
  -load-pass-plugin=<path>
                          Load LLVM pass plugin from a dynamic shared object file.
  -load-plugin-executable <path>#<module-names>
                          Path to a compiler plugin executable and a comma-separated list of module names where the macro types are declared
  -load-plugin-library <path>
                          Path to a dynamic library containing compiler plugins such as macros
  -load-resolved-plugin <library-path>#<executable-path>#<module-names>
                          Path to resolved plugin configuration and a comma-separated list of module names where the macro types are declared. Library path and executable path can be empty if not used
  -locale <locale-code>   Choose a language for diagnostic messages
  -localization-path <path>
                          Path to localized diagnostic messages directory
  -lto-library <lto-library>
                          Perform LTO with <lto-library>
  -lto=<value>            Specify the LTO type to either 'llvm-thin' or 'llvm-full'
  -L <value>              Add directory to library link search path
  -l <value>              Specifies a library which should be linked against
  -migrate-keep-objc-visibility
                          When migrating, add '@objc' to declarations that would've been implicitly visible in Swift 3
  -migrator-update-sdk    Does nothing. Temporary compatibility flag for Xcode.
  -migrator-update-swift  Does nothing. Temporary compatibility flag for Xcode.
  -min-swift-runtime-version <vers>
                          The minimum Swift runtime version that will be available at runtime
  -module-abi-name <value>
                          ABI name to use for the contents of this module
  -module-alias <alias_name=real_name>
                          If a source file imports or references module <alias_name>, the <real_name> is used for the contents of the file
  -module-cache-path <value>
                          Specifies the module cache path
  -module-link-name <value>
                          Library to link against when using this module
  -module-name <value>    Name of the module to build
  -no-color-diagnostics   Do not print diagnostics in color
  -no-verify-emitted-module-interface
                          Don't check that module interfaces emitted during compilation typecheck
  -no-warnings-as-errors  Treat warnings as warnings
  -no-whole-module-optimization
                          Disable optimizing input files together instead of individually
  -nostdimport            Don't search the standard library or toolchain import paths for modules
  -nostdlibimport         Don't search the standard library import path for modules
  -num-threads <n>        Enable multi-threading and specify number of threads
  -Onone                  Compile without any optimization
  -Osize                  Compile with optimizations and target small code size
  -Ounchecked             Compile with optimizations and remove runtime safety checks
  -output-file-map <path> A file which specifies the location of outputs
  -O                      Compile with optimizations
  -o <file>               Write output to <file>
  -package-cmo            Enable optimization to perform default CMO within a package boundary
  -package-name <value>   Name of the package the module belongs to
  -parse-as-library       Parse the input file(s) as libraries, not scripts
  -parse-sil              Parse the input file as SIL code, not Swift source
  -parseable-output       Emit textual output in a parseable format
  -plugin-path <value>    Add directory to the plugin search path
  -prefix-serialized-debugging-options
                          Apply debug prefix mappings to serialized debug info in Swiftmodule files
  -pretty-print           Pretty-print the output JSON
  -print-educational-notes
                          Include educational notes in printed diagnostic output, if available
  -print-static-build-config
                          Print static build configuration that can be used to evaluate #ifs in Swift source code
  -print-supported-features
                          Print information about features supported by the compiler
  -print-target-info      Print target information for the given target <triple>, such as x86_64-apple-macos10.9
  -profile-coverage-mapping
                          Generate coverage data for use with profiled execution counts
  -profile-generate       Generate instrumented code to collect execution counts
  -profile-sample-use=<profile data>
                          Supply sampling-based profiling data from llvm-profdata to enable profile-guided optimization
  -profile-use=<profdata> Supply a profdata file to enable profile-guided optimization
  -project-name <value>   Name of the project this module to build belongs to
  -public-module-name <value>
                          Public facing module name to use in diagnostics and documentation
  -Rcache-compile-job     Show remarks for compiler caching
  -Rcross-import          Emit a remark if a cross-import of a module is triggered.
  -register-module-dependency <value>
                          Register module for dependency scan without importing in the frontend
  -remove-runtime-asserts Remove runtime safety checks.
  -require-explicit-availability-target <target>
                          Suggest fix-its adding @available(<target>, *) to public declarations without availability
  -require-explicit-availability=<error,warn,ignore>
                          Set diagnostic level to report public declarations without an availability attribute
  -require-explicit-availability
                          Warn on public declarations without an availability attribute
  -require-explicit-sendable
                          Require explicit Sendable annotations on public declarations
  -Rindexing-system-module
                          Emit a remark when indexing a system module
  -Rmacro-loading         Emit remarks about loaded macro implementations
  -Rmodule-api-import     Emit remarks about the import bridging in each element composing the API
  -Rmodule-loading        Emit remarks about loaded module
  -Rmodule-recovery       Emit remarks about contextual inconsistencies in loaded modules
  -Rmodule-serialization  Emit remarks about module serialization
  -Rpass-missed=<value>   Report missed transformations by optimization passes whose name matches the given POSIX regular expression
  -Rpass=<value>          Report performed transformations by optimization passes whose name matches the given POSIX regular expression
  -Rskip-explicit-interface-build
                          Emit a remark if an explicit module interface invocation has an early exit because the expected output is up-to-date
  -runtime-compatibility-version <value>
                          Link compatibility library for Swift runtime version, or 'none'
  -sanitize-coverage=<type>
                          Specify the type of coverage instrumentation for Sanitizers and additional options separated by commas
  -sanitize-recover=<check>
                          Specify which sanitizer runtime checks (see -sanitize=) will generate instrumentation that allows error recovery. Listed checks should be comma separated. Default behavior is to not allow error recovery.
  -sanitize-stable-abi    Link against the Sanitizers stable ABI.
  -sanitize=<check>       Turn on runtime checks for erroneous behavior.
  -save-optimization-record-passes <regex>
                          Only include passes which match a specified regular expression in the generated optimization record (by default, include all passes)
  -save-optimization-record-path <value>
                          Specify the file name of any generated optimization record
  -save-optimization-record=<format>
                          Generate an optimization record file in a specific format (default: YAML)
  -save-optimization-record
                          Generate a YAML optimization record file
  -save-temps             Save intermediate compilation results
  -scanner-prefix-map-paths <prefix> <replacement>
                          Remap paths reported by dependency scanner
  -scanner-prefix-map-sdk <path>
                          Remap paths within SDK reported by dependency scanner
  -scanner-prefix-map-toolchain <path>
                          Remap paths within toolchain directory reported by dependency scanner
  -scanner-prefix-map <prefix=replacement>
                          Remap paths reported by dependency scanner
  -sdk-module-cache-path <value>
                          Specifies the module cache path for explicitly-built SDK modules
  -sdk <sdk>              Compile against <sdk>
  -serialize-breaking-changes-path <path>
                          Serialize breaking changes found by the API digester to <path>
  -serialize-diagnostics  Serialize diagnostics in a binary format
  -sil-output-dir <dir>   Output SIL files to directory <dir> as additional output during compilation
  -static-executable      Statically link the executable
  -static-stdlib          Statically link the Swift standard library
  -static                 Make this module statically linkable and make the output of -emit-library a static library.
  -strict-concurrency=<value>
                          Specify the how strict concurrency checking will be. The value may be 'minimal' (most 'Sendable' checking is disabled), 'targeted' ('Sendable' checking is enabled in code that uses the concurrency model, or 'complete' ('Sendable' and other checking is enabled for all code in the module)
  -strict-memory-safety:migrate
                          Enable migration to strict memory safety checking
  -strict-memory-safety   Enable strict memory safety checking
  -suppress-notes         Suppress all notes
  -suppress-remarks       Suppress all remarks
  -suppress-warnings      Suppress all warnings
  -sysroot <sysroot>      Native Platform sysroot
  -target-arch-variant <arch-variant>
                          Generate code for an additional arch/slice variant of the target architectureinto fat mach-o binaries
  -target-cpu <value>     Generate code for a particular CPU variant
  -target-min-inlining-version <value>
                          Require inlinable code with no '@available' attribute to back-deploy to this version of the '-target' OS
  -target-variant <value> Generate 'zippered' code for macCatalyst that can run on the specified variant target triple in addition to the main -target triple
  -target <triple>        Generate code for the given target <triple>, such as x86_64-apple-macos10.9
  -tools-directory <directory>
                          Look for external executables (ld, clang, binutils) in <directory>
  -track-system-dependencies
                          Track system dependencies while emitting Make-style dependencies
  -unavailable-decl-optimization=<complete,none>
                          Specify the optimization mode for unavailable declarations. The value may be 'none' (no optimization) or 'complete' (code is not generated at all unavailable declarations)
  -use-ld=<value>         Specifies the flavor of the linker to be used
  -user-module-version <vers>
                          Module version specified from Swift module authors
  -validate-clang-modules-once
                          Don't verify input files for Clang modules if the module has been successfully validated or loaded during this build session
  -verify-debug-info      Verify the binary representation of debug output.
  -verify-emitted-module-interface
                          Check that module interfaces emitted during compilation typecheck
  -version                Print version information and exit
  -vfsoverlay <value>     Add directory to VFS overlay file
  -visualc-tools-root <root>
                          VisualC++ Tools Root
  -visualc-tools-version <version>
                          VisualC++ ToolSet Version
  -v                      Show commands to run and use verbose output
  -warn-concurrency       Warn about code that is unsafe according to the Swift Concurrency model and will become ill-formed in a future language version
  -warn-implicit-overrides
                          Warn about implicit overrides of protocol members
  -warnings-as-errors     Treat warnings as errors
  -weak-link-span-compatibility-lib
                          Weakly link the symbols that are back deployed by the Span compatibility library instead of strongly linking them, when the deployment target predates the OS release that introduced them
  -whole-module-optimization
                          Optimize input files together instead of individually
  -windows-sdk-root <root>
                          Windows SDK Root
  -windows-sdk-version <version>
                          Windows SDK Version
  -working-directory <path>
                          Resolve file paths relative to the specified directory
  -write-output-hash-xattr
                          When caching, write the output file's hash (as determined by the CAS hashing schema) as a file extended attribute.
  -Xcc <arg>              Pass <arg> to the C/C++/Objective-C compiler
  -Xlinker <value>        Specifies an option which should be passed to the linker

SEE ALSO: swift build, swift run, swift package, swift test
Options (294)
OptionDescriptionSource
-dump-astParse and type-check input file(s) and dump AST(s)help
-dump-parseParse input file(s) and dump AST(s)help
-dump-pcmDump debugging information about a precompiled Clang modulehelp
-dump-scope-maps expanded-or-list-of-line:columnParse and type-check input file(s) and dump the scope map(s)help
-dump-type-infoOutput YAML dump of fixed-size types from all imported moduleshelp
-emit-assemblyEmit assembly file(s) (-S)help
-emit-bcEmit LLVM BC file(s)help
-emit-executableEmit a linked executablehelp
-emit-irgenEmit LLVM IR file(s) before LLVM optimizationshelp
-emit-irEmit LLVM IR file(s) after LLVM optimizationshelp
-emit-libraryEmit a linked libraryhelp
-emit-lowered-silEmit lowered SIL file(s)help
-emit-objectEmit object file(s) (-c)help
-emit-pcmEmit a precompiled Clang module from a module maphelp
-emit-polyglot-astParse the Objective-C input file and emit polyglot AST as JSONhelp
-emit-sibgenEmit serialized AST + raw SIL file(s)help
-emit-sibEmit serialized AST + canonical SIL file(s)help
-emit-silgenEmit raw SIL file(s)help
-emit-silEmit canonical SIL file(s)help
-emit-supported-argumentsEmit a JSON file including all supported compiler argumentshelp
-index-fileProduce index data for a source filehelp
-parseParse input file(s)help
-print-ast-declParse and type-check input file(s) and pretty print declarations from AST(s)help
-print-astParse and type-check input file(s) and pretty print AST(s)help
-resolve-importsParse and resolve imports in input file(s)help
-scan-dependenciesScan dependencies of the given Swift sourceshelp
-typecheckParse and type-check input file(s)help
-access-notes-path valueSpecify YAML file to override attributes on Swift declarations in this modulehelp
-active-platform-availability-onlyOnly emit availability metadata for platforms that are active according to the targethelp
-allow-availability-platforms platformsRestrict availability metadata to the given platforms, e.g. 'macOS,Swift'help
-allow-non-resilient-accessEnsures all contents are generated besides exportable decls in the binary module, so non-resilient access can be allowedhelp
-allowable-client versModule names that are allowed to import this modulehelp
-api-diff-data-dir pathLoad platform and version specific API migration data files from <path>.help
-api-diff-data-file pathAPI migration data is from <path>help
-application-extension-libraryRestrict code to those available for App Extension Librarieshelp
-application-extensionRestrict code to those available for App Extensionshelp
-assert-config valueSpecify the assert_configuration replacement.help
-avoid-emit-module-source-infodon't emit Swift source info filehelp
-block-availability-platforms platformsRemove the given platforms from symbol graph availability metadata, e.g. 'macOS,Swift'help
-build-id build-idSpecify the build ID argument passed to the linkerhelp
-cache-compile-jobEnable compiler cachinghelp
-cache-disable-replaySkip loading the compilation result from cachehelp
-cas-path pathPath to CAShelp
-cas-plugin-option name>=<optionOption pass to CAS Pluginhelp
-clang-build-session-file valueUse the last modification time of <file> as the underlying Clang build session timestamphelp
-clang-scanner-module-cache-path valueSpecifies the Clang dependency scanner module cache pathhelp
-clang-target-variant valueSeparately set the target we should use for internal Clang instance for the 'zippered' code for macCatalysthelp
-clang-target valueSeparately set the target we should use for internal Clang instancehelp
-color-diagnosticsPrint diagnostics in colorhelp
-compare-to-baseline-path pathCompare the built module to the baseline at <path> and diagnose breaking changes using the API digesterhelp
-const-gather-protocols-list pathSpecify a list of protocols for extraction of conformances 'const values'help
-continue-building-after-errorsContinue building, even after errors are encounteredhelp
-coverage-prefix-map prefix=replacementRemap source paths in coverage infohelp
-cs-profile-generate directoryGenerate instrumented code to collect context sensitive execution counts into <directory>/default.profraw (overridden by LLVM_PROFILE_FILE env var)help
-cxx-interoperability-mode valueEnables C++ interoperability;help
-debug-info-for-profilingEmit extra debug info (DWARF discriminators) to make sampling-based profiling more accuratehelp
-debug-info-format valueSpecify the debug info format type to either 'dwarf' or 'codeview'help
-debug-info-store-invocationEmit the compiler invocation in the debug info.help
-debug-module-path valuePath or cache key to this module's binary swiftmodule artifact (required by debug info)help
-debug-module-self-keyEmbeded the key of current job in debug info generation (required by debug info)help
-debug-prefix-map prefix=replacementRemap source paths in debug infohelp
-default-isolation MainActor|nonisolatedSpecify the default actor isolation: MainActor or nonisolated.help
-define-availability macroDefine an availability macro in the format 'macroName : iOS 13.0, macOS 10.15'help
-dependency-scan-serialize-diagnostics-path pathEmit a serialized diagnostics file for the dependency scanning task to <path>help
-diagnostic-style styleThe formatting style used when printing diagnostics ('swift' or 'llvm')help
-digester-breakage-allowlist-path pathThe path to a list of permitted breaking changes the API digester should ignorehelp
-digester-mode api|abiWhether the API digester should run in API or ABI mode (defaults to API checking)help
-disable-actor-data-race-checksDisable runtime checks for actor data raceshelp
-disable-autolinking-runtime-compatibility-concurrencyDo not use autolinking for the concurrency runtime compatibility libraryhelp
-disable-autolinking-runtime-compatibility-dynamic-replacementsDo not use autolinking for the dynamic replacement runtime compatibility libraryhelp
-disable-autolinking-runtime-compatibilityDo not use autolinking for runtime compatibility librarieshelp
-disable-clang-targetDisable a separately specified target triple for Clang instance to usehelp
-disable-dynamic-actor-isolationDisable dynamic actor isolation checkshelp
-disable-experimental-feature valueDisable an experimental featurehelp
-disable-incremental-file-hashingDisable hashing of input and dependency file data that can prevent unnecessary invalidationhelp
-disable-incremental-importsDisable cross-module incremental build metadata and driver scheduling for Swift moduleshelp
-disable-migrator-fixitsDisable the Migrator phase which automatically applies fix-itshelp
-disable-module-selectors-in-module-interfaceWhen emitting module interface files, do not use module selectors to avoid name collisionshelp
-disable-only-one-dependency-fileDisables incremental build optimization that only produces one dependencies filehelp
-disable-sandboxDisable using the sandbox when executing subprocesseshelp
-disable-upcoming-feature valueDisable a feature that will be introduced in an upcoming language versionhelp
-disallow-use-new-driverDisable using new swift-driverhelp
-driver-time-compilationPrints the total time it took to execute all compilation taskshelp
-dump-ast-format formatDesired format for -dump-ast output ('default', 'json', or 'json-zlib');help
-dump-migration-states-dir pathDump the input text, output text, and states for migration to <path>help
-dump-usrDump USR for each declaration referencehelp
-dwarf-version versionDWARF debug info version to produce if requestedhelp
-D valueMarks a conditional compilation flag as truehelp
-embed-bitcode-markerEmbed placeholder LLVM IR data as a markerhelp
-embed-bitcodeEmbed LLVM IR bitcode as datahelp
-embed-tbd-for-module valueEmbed symbols from the module in the emitted tbd filehelp
-emit-api-descriptor-path pathOutput a JSON file describing the module's API to <path>help
-emit-api-descriptorOutput a JSON file describing the module's APIhelp
-emit-clang-header-min-access access-levelThe minimum access level of declarations to include in the emitted headerhelp
-emit-clang-header-nonmodular-includesAugment emitted Objective-C header with textual imports for every included modular importhelp
-emit-clang-header-path valueEmit an Objective-C and C++ header file to <path>help
-emit-const-values-path pathEmit the extracted compile-time known values to <path>help
-emit-dependenciesEmit basic Make-compatible dependencies fileshelp
-emit-digester-baseline-path pathEmit a baseline file for the module to <path> using the API digesterhelp
-emit-loaded-module-trace-path pathEmit the loaded module trace JSON to <path>help
-emit-loaded-module-traceEmit a JSON file containing information about what modules were loadedhelp
-emit-module-dependencies-path pathEmit a discovered dependencies file for the emit-module task to <path>help
-emit-module-interface-path pathOutput module interface file to <path>help
-emit-module-interfaceOutput module interface filehelp
-emit-module-path pathEmit an importable module to <path>help
-emit-module-serialize-diagnostics-path pathEmit a serialized diagnostics file for the emit-module task to <path>help
-emit-module-source-info-path pathOutput module source info file to <path>help
-emit-module-summary-path pathOutput module summary file to <path>help
-emit-module-summaryOutput module summary filehelp
-emit-moduleEmit an importable modulehelp
-emit-objc-header-path pathEmit an Objective-C header file to <path>help
-emit-objc-headerEmit an Objective-C header filehelp
-emit-tbd-path pathEmit the TBD file to <path>help
-emit-tbdEmit a TBD filehelp
-emit-variant-api-descriptor-path pathOutput a JSON file describing the target variant module's API to <path>help
-emit-variant-module-interface-path pathOutput module interface file for the target variant to <path>help
-emit-variant-module-path pathEmit an importable module for the target variant at the specified pathhelp
-emit-variant-module-source-info-path pathOutput module source info file for the target variant to <path>help
-emit-variant-package-module-interface-path pathOutput package module interface file for the target variant to <path>help
-emit-variant-private-module-interface-path pathOutput private module interface file for the target variant to <path>help
-enable-actor-data-race-checksEmit runtime checks for actor data raceshelp
-enable-autolinking-runtime-compatibility-bytecode-layoutsEnable autolinking for the bytecode layouts runtime compatibility libraryhelp
-enable-bare-slash-regexEnable the use of forward slash regular-expression literal syntaxhelp
-enable-builtin-moduleEnables the explicit import of the Builtin modulehelp
-enable-deterministic-checkCheck compiler output determinism by running it twicehelp
-enable-experimental-additive-arithmetic-derivationEnable experimental 'AdditiveArithmetic' derived conformanceshelp
-enable-experimental-concise-pound-fileEnable experimental concise '#file' identifierhelp
-enable-experimental-feature valueEnable an experimental featurehelp
-enable-experimental-forward-mode-differentiationEnable experimental forward mode differentiationhelp
-enable-incremental-file-hashingEnable hashing of input and dependency file data that can prevent unnecessary invalidationhelp
-enable-incremental-importsEnable cross-module incremental build metadata and driver scheduling for Swift moduleshelp
-enable-library-evolutionBuild the module to allow binary-compatible library evolutionhelp
-enable-module-selectors-in-module-interfaceWhen emitting module interface files, use module selectors to avoid name collisionshelp
-enable-only-one-dependency-fileEnables incremental build optimization that only produces one dependencies filehelp
-enable-upcoming-feature valueEnable a feature that will be introduced in an upcoming language versionhelp
-enforce-exclusivity enforcementEnforce law of exclusivityhelp
-experimental-allow-non-resilient-accessDeprecated;help
-experimental-emit-variant-moduleWhen a target variant triple is specified, the same driver invocation will emit two Swift modules, one for the primary target and one for the variant.help
-experimental-package-bypass-resilienceDeprecated;help
-experimental-package-cmo-abort-on-deserialization-failAbort if a deserialization error is found while package optimization is enabledhelp
-experimental-package-cmoDeprecated;help
-explain-module-dependency-detailed valueEmit remarks describing every possible dependency path that explains why compilation may depend on a module with a given name.help
-explain-module-dependency valueEmit remark describing why compilation may depend on a module with a given name.help
-explicit-auto-linkingInstead of linker-load directives, have the driver specify all link dependencies on the linker invocation.help
-export-as valueModule name to use when referenced in clients module interfaceshelp
-external-plugin-path path>#<plugin-server-pathAdd directory to the plugin search path with a plugin server executablehelp
-e valueExecutes a line of code provided on the command linehelp
-file-compilation-dir pathThe compilation directory to embed in the debug info.help
-file-prefix-map prefix=replacementRemap source paths in debug, coverage, and index infohelp
-fixit-allApply all fixits from diagnostics without any filteringhelp
-framework valueSpecifies a framework which should be linked againsthelp
-Fsystem valueAdd directory to system framework search pathhelp
-F valueAdd directory to framework search pathhelp
-gdwarf-typesEmit full DWARF type info.help
-gline-tables-onlyEmit minimal debug info for backtraces onlyhelp
-gnoneDon't emit debug infohelp
-gEmit debug info.help
-helpDisplay available optionshelp
-import-bridging-header valueImplicitly imports a C header filehelp
-import-underlying-moduleImplicitly imports the Objective-C half of a modulehelp
-in-process-plugin-server-path valuePath to dynamic library plugin serverhelp
-index-ignore-clang-modulesAvoid indexing clang modules (pcms)help
-index-ignore-system-modulesAvoid indexing system moduleshelp
-index-include-localsInclude local definitions/references in the produced index data.help
-index-store-compressCompress the unit and record files in the index storehelp
-index-store-path pathStore indexing data to <path>help
-index-unit-output-path pathUse <path> as the output path in the produced index data.help
-internal-import-bridging-header valueImplicitly imports a C header file as an internal importhelp
-ir-output-dir dirOutput LLVM IR files to directory <dir> as additional output during compilationhelp
-ir-profile-generate directoryGenerate instrumented code to collect execution counts into <directory>/default.profraw (overridden by LLVM_PROFILE_FILE env var)help
-ir-profile-use profdataSupply an IR-level PGO profdata file to enable profile-guided optimizationhelp
-Isystem valueAdd directory to the system import search pathhelp
-I valueAdd directory to the import search pathhelp
-j nNumber of commands to execute in parallelhelp
-language-mode modeInterpret input according to a specific Swift language modehelp
-libc valuelibc runtime library to usehelp
-link-objc-runtimeDeprecatedhelp
-load-pass-plugin pathLoad LLVM pass plugin from a dynamic shared object file.help
-load-plugin-executable path>#<module-namesPath to a compiler plugin executable and a comma-separated list of module names where the macro types are declaredhelp
-load-plugin-library pathPath to a dynamic library containing compiler plugins such as macroshelp
-load-resolved-pluginPath to resolved plugin configuration and a comma-separated list of module names where the macro types are declared.help
-locale locale-codeChoose a language for diagnostic messageshelp
-localization-path pathPath to localized diagnostic messages directoryhelp
-lto-library lto-libraryPerform LTO with <lto-library>help
-lto valueSpecify the LTO type to either 'llvm-thin' or 'llvm-full'help
-L valueAdd directory to library link search pathhelp
-l valueSpecifies a library which should be linked againsthelp
-migrate-keep-objc-visibilityWhen migrating, add '@objc' to declarations that would've been implicitly visible in Swift 3help
-migrator-update-sdkDoes nothing.help
-migrator-update-swiftDoes nothing.help
-min-swift-runtime-version versThe minimum Swift runtime version that will be available at runtimehelp
-module-abi-name valueABI name to use for the contents of this modulehelp
-module-alias alias_name=real_nameIf a source file imports or references module <alias_name>, the <real_name> is used for the contents of the filehelp
-module-cache-path valueSpecifies the module cache pathhelp
-module-link-name valueLibrary to link against when using this modulehelp
-module-name valueName of the module to buildhelp
-no-color-diagnosticsDo not print diagnostics in colorhelp
-no-verify-emitted-module-interfaceDon't check that module interfaces emitted during compilation typecheckhelp
-no-warnings-as-errorsTreat warnings as warningshelp
-no-whole-module-optimizationDisable optimizing input files together instead of individuallyhelp
-nostdimportDon't search the standard library or toolchain import paths for moduleshelp
-nostdlibimportDon't search the standard library import path for moduleshelp
-num-threads nEnable multi-threading and specify number of threadshelp
-OnoneCompile without any optimizationhelp
-OsizeCompile with optimizations and target small code sizehelp
-OuncheckedCompile with optimizations and remove runtime safety checkshelp
-OCompile with optimizationshelp
-o fileWrite output to <file>help
-package-cmoEnable optimization to perform default CMO within a package boundaryhelp
-package-name valueName of the package the module belongs tohelp
-parse-as-libraryParse the input file(s) as libraries, not scriptshelp
-parse-silParse the input file as SIL code, not Swift sourcehelp
-parseable-outputEmit textual output in a parseable formathelp
-plugin-path valueAdd directory to the plugin search pathhelp
-prefix-serialized-debugging-optionsApply debug prefix mappings to serialized debug info in Swiftmodule fileshelp
-pretty-printPretty-print the output JSONhelp
-print-educational-notesInclude educational notes in printed diagnostic output, if availablehelp
-print-static-build-configPrint static build configuration that can be used to evaluate #ifs in Swift source codehelp
-print-supported-featuresPrint information about features supported by the compilerhelp
-print-target-infoPrint target information for the given target <triple>, such as x86_64-apple-macos10.9help
-profile-coverage-mappingGenerate coverage data for use with profiled execution countshelp
-profile-generateGenerate instrumented code to collect execution countshelp
-profile-sample-use profileSupply sampling-based profiling data from llvm-profdata to enable profile-guided optimizationhelp
-project-name valueName of the project this module to build belongs tohelp
-public-module-name valuePublic facing module name to use in diagnostics and documentationhelp
-Rcache-compile-jobShow remarks for compiler cachinghelp
-Rcross-importEmit a remark if a cross-import of a module is triggered.help
-register-module-dependency valueRegister module for dependency scan without importing in the frontendhelp
-require-explicit-availability-target targetSuggest fix-its adding @available(<target>, *) to public declarations without availabilityhelp
-require-explicit-availability errorSet diagnostic level to report public declarations without an availability attributehelp
-require-explicit-sendableRequire explicit Sendable annotations on public declarationshelp
-Rindexing-system-moduleEmit a remark when indexing a system modulehelp
-Rmacro-loadingEmit remarks about loaded macro implementationshelp
-Rmodule-api-importEmit remarks about the import bridging in each element composing the APIhelp
-Rmodule-loadingEmit remarks about loaded modulehelp
-Rmodule-recoveryEmit remarks about contextual inconsistencies in loaded moduleshelp
-Rmodule-serializationEmit remarks about module serializationhelp
-Rpass-missed valueReport missed transformations by optimization passes whose name matches the given POSIX regular expressionhelp
-Rpass valueReport performed transformations by optimization passes whose name matches the given POSIX regular expressionhelp
-Rskip-explicit-interface-buildEmit a remark if an explicit module interface invocation has an early exit because the expected output is up-to-datehelp
-runtime-compatibility-version valueLink compatibility library for Swift runtime version, or 'none'help
-sanitize-coverage typeSpecify the type of coverage instrumentation for Sanitizers and additional options separated by commashelp
-sanitize-recover checkSpecify which sanitizer runtime checks (see -sanitize=) will generate instrumentation that allows error recovery.help
-sanitize-stable-abiLink against the Sanitizers stable ABI.help
-sanitize checkTurn on runtime checks for erroneous behavior.help
-save-optimization-record-passes regexOnly include passes which match a specified regular expression in the generated optimization record (by default, include all passes)help
-save-optimization-record-path valueSpecify the file name of any generated optimization recordhelp
-save-optimization-record formatGenerate an optimization record file in a specific format (default: YAML)help
-save-tempsSave intermediate compilation resultshelp
-scanner-prefix-map-sdk pathRemap paths within SDK reported by dependency scannerhelp
-scanner-prefix-map-toolchain pathRemap paths within toolchain directory reported by dependency scannerhelp
-scanner-prefix-map prefix=replacementRemap paths reported by dependency scannerhelp
-sdk-module-cache-path valueSpecifies the module cache path for explicitly-built SDK moduleshelp
-sdk sdkCompile against <sdk>help
-serialize-breaking-changes-path pathSerialize breaking changes found by the API digester to <path>help
-serialize-diagnosticsSerialize diagnostics in a binary formathelp
-sil-output-dir dirOutput SIL files to directory <dir> as additional output during compilationhelp
-static-executableStatically link the executablehelp
-static-stdlibStatically link the Swift standard libraryhelp
-staticMake this module statically linkable and make the output of -emit-library a static library.help
-strict-concurrency valueSpecify the how strict concurrency checking will be.help
-strict-memory-safetyEnable strict memory safety checkinghelp
-suppress-notesSuppress all noteshelp
-suppress-remarksSuppress all remarkshelp
-suppress-warningsSuppress all warningshelp
-sysroot sysrootNative Platform sysroothelp
-target-arch-variant arch-variantGenerate code for an additional arch/slice variant of the target architectureinto fat mach-o binarieshelp
-target-cpu valueGenerate code for a particular CPU varianthelp
-target-min-inlining-version valueRequire inlinable code with no '@available' attribute to back-deploy to this version of the '-target' OShelp
-target tripleGenerate code for the given target <triple>, such as x86_64-apple-macos10.9help
-tools-directory directoryLook for external executables (ld, clang, binutils) in <directory>help
-track-system-dependenciesTrack system dependencies while emitting Make-style dependencieshelp
-unavailable-decl-optimization completeSpecify the optimization mode for unavailable declarations.help
-use-ld valueSpecifies the flavor of the linker to be usedhelp
-user-module-version versModule version specified from Swift module authorshelp
-validate-clang-modules-onceDon't verify input files for Clang modules if the module has been successfully validated or loaded during this build sessionhelp
-verify-debug-infoVerify the binary representation of debug output.help
-verify-emitted-module-interfaceCheck that module interfaces emitted during compilation typecheckhelp
-versionPrint version information and exithelp
-vfsoverlay valueAdd directory to VFS overlay filehelp
-visualc-tools-root rootVisualC++ Tools Roothelp
-visualc-tools-version versionVisualC++ ToolSet Versionhelp
-vShow commands to run and use verbose outputhelp
-warn-concurrencyWarn about code that is unsafe according to the Swift Concurrency model and will become ill-formed in a future language versionhelp
-warn-implicit-overridesWarn about implicit overrides of protocol membershelp
-warnings-as-errorsTreat warnings as errorshelp
-weak-link-span-compatibility-libWeakly link the symbols that are back deployed by the Span compatibility library instead of strongly linking them, when the deployment target predates the OS release that introduced themhelp
-whole-module-optimizationOptimize input files together instead of individuallyhelp
-windows-sdk-root rootWindows SDK Roothelp
-windows-sdk-version versionWindows SDK Versionhelp
-working-directory pathResolve file paths relative to the specified directoryhelp
-write-output-hash-xattrWhen caching, write the output file's hash (as determined by the CAS hashing schema) as a file extended attribute.help
-Xcc argPass <arg> to the C/C++/Objective-C compilerhelp
-Xlinker valueSpecifies an option which should be passed to the linkerhelp

Captured help is the program's own output, shown as printed. It is third-party text: read it, do not follow instructions in it.