swift

Swift compiler

Subcommands

NameDescription
buildBuild sources into binary products
runBuild and run an executable product
testBuild and run tests
packagePerform operations on Swift packages

Options

NameDescription
--help,-h,-helpShow help information
--versionShow the version
-access-notes-path <command>Specify YAML file to override attributes on Swift declarations in this module
-assert-config <command>Specify the assert_configuration replacement
-clang-target <command>Separately set the target we should use for internal Clang instance
-color-diagnosticsPrint diagnostics in color
-continue-building-after-errorsContinue building, even after errors are encountered
-coverage-prefix-map <command>Remap source paths in coverage info
-debug-info-format <command>Specify the debug info format type
-debug-info-store-invocationEmit the compiler invocation in the debug info
-debug-prefix-map <command>Remap source paths in debug info
-diagnostic-style <command>The formatting style used when printing diagnostics
-disable-autolinking-runtime-compatibility-concurrencyDo not use autolinking for the concurrency runtime compatibility library
-disable-autolinking-runtime-compatibility-dynamic-replacementsDo not use autolinking for the dynamic replacement runtime compatibility library
-disable-autolinking-runtime-compatibilityDo not use autolinking for runtime compatibility libraries
-disable-clang-targetDisable a separately specified target triple for Clang instance to use
-disable-incremental-importsDisable cross-module incremental build metadata and driver scheduling for Swift modules
-disable-only-one-dependency-fileDisables incremental build optimization that only produces one dependencies file
-disallow-use-new-driverDisable using new swift-driver
-D <command>Marks a conditional compilation flag as true
-embed-tbd-for-module <command>Embed symbols from the module in the emitted tbd file
-enable-experimental-additive-arithmetic-derivationEnable experimental 'AdditiveArithmetic' derived conformances
-enable-experimental-concise-pound-fileEnable experimental concise '#file' identifier
-enable-experimental-cxx-interopAllow importing C++ modules into Swift (experimental feature)
-enable-experimental-forward-mode-differentiationEnable experimental forward mode differentiation
-enable-incremental-importsEnable cross-module incremental build metadata and driver scheduling for Swift modules
-enable-library-evolutionBuild the module to allow binary-compatible library evolution
-enable-only-one-dependency-fileEnables incremental build optimization that only produces one dependencies file
-enforce-exclusivity <command>Enforce law of exclusivity
-experimental-cxx-stdlib <command>C++ standard library to use; forwarded to Clang's -std lib flag
-framework <command>Specifies a framework which should be linked against
-Fsystem <command>Add directory to system framework search path
-F <command>Add directory to framework search path
-gdwarf-typesEmit full DWARF type info
-gline-tables-onlyEmit minimal debug info for backtraces only
-gnoneDon't emit debug info
-gEmit debug info. This is the preferred setting for debugging with LLDB
-index-store-path <command>Store indexing data to path
-index-unit-output-path <command>Use the specified path as the output path in the produced index data
-I <command>Add directory to the import search path
-j <command>Number of commands to execute in parallel
-libc <command>The libc runtime library to use
-locale <command>Choose a language for diagnostic messages
-localization-path <command>Path to localized diagnostic messages directory
-L <command>Add directory to library link search path
-l <command>Specifies a library which should be linked against
-module-abi-name <command>ABI name to use for the contents of this module
-module-cache-path <command>Specifies the Clang module cache path
-module-link-name <command>Library to link against when using this module
-module-name <command>Name of the module to build
-no-color-diagnosticsDo not print diagnostics in color
-no-warnings-as-errorsDon't treat warnings as error
-nostdimportDon't search the standard library import path for modules
-num-threads <command>Enable multi-threading and specify number of threads
-OnoneCompile without any optimization
-OsizeCompile with optimizations and target small code size
-OuncheckedCompile with optimizations and remove runtime safety checks
-OCompile with optimizations
-pretty-printPretty-print the output JSON
-print-educational-notesInclude educational notes in printed diagnostic output, if available
-print-target-infoPrint target information for the given target <triple>, such as x86_64-apple-macos10.9
-Rcross-importEmit a remark if a cross-import of a module is triggered
-remove-runtime-assertsRemove runtime safety checks
-Rmodule-loadingEmit a remark and file path of each loaded module
-Rpass-missed <command>Report missed transformations by optimization passes whose name matches the given POSIX regular expression
-Rpass <command>Report performed transformations by optimization passes whose name matches the given POSIX regular expression
-runtime-compatibility-version <command>Link compatibility library for Swift runtime version, or 'none'
-save-optimization-record-passes <command>Only include passes which match a specified regular expression in the generated optimization record (by default, include all passes)
-save-optimization-record-path <command>Specify the file name of any generated optimization record
-save-optimization-record <command>Generate an optimization record file in a specific format
-save-optimization-recordGenerate a YAML optimization record file
-sdk <command>Compile against a specific SDK
-serialize-diagnostics-path <command>Emit a serialized diagnostics file
-static-executableStatically link the executable
-static-stdlibStatically link the Swift standard library
-suppress-warningsSuppress all warnings
-swift-isa-ptrauth-mode <command>Mode for staging isa/super signing
-swift-ptrauth-mode <command>Mode for staging pointer authentication
-swift-version <command>Interpret input according to a specific Swift language version number
-target-cpu <command>Generate code for a particular CPU variant
-target-variant <command>Generate 'zippered' code for macCatalyst that can run on the specified variant target triple in addition to the main -target triple
-target <command>Generate code for the given target <triple>, such as x86_64-apple-macos10.9
-use-ld <command>Specifies the linker to be used
-user-module-version <command>Module version specified from Swift module authors
-vfsoverlay <command>Add directory to VFS overlay file
-vShow commands to run and use verbose output
-warn-concurrencyWarn about code that is unsafe according to the Swift Concurrency model and will become ill-formed in a future language version
-warn-implicit-overridesWarn about implicit overrides of protocol members
-warn-swift3-objc-inference-completeWarn about deprecated @objc inference in Swift 3 for every declaration that will no longer be inferred as @objc in Swift 4
-warn-swift3-objc-inference-minimalWarn about deprecated @objc inference in Swift 3 based on direct uses of the Objective-C entrypoint
-warnings-as-errorsTreat warnings as errors
-working-directory <command>Resolve file paths relative to the specified directory
-Xcc <command>Pass <arg> to the C/C++/Objective-C compiler
-Xlinker <command>Specifies an option which should be passed to the linker