Skip to content

Instantly share code, notes, and snippets.

@kb100824
Forked from enomoto/swiftc_help.txt
Created March 30, 2021 10:03
Show Gist options
  • Save kb100824/24da5dbedb5147ed496c93a3c7a58a31 to your computer and use it in GitHub Desktop.
Save kb100824/24da5dbedb5147ed496c93a3c7a58a31 to your computer and use it in GitHub Desktop.
$ swiftc -help
OVERVIEW: Swift compiler
USAGE: swiftc [options] <inputs>
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-scope-maps <expanded-or-list-of-line:column>
Parse and type-check input file(s) and dump the scope map(s)
-dump-type-refinement-contexts
Type-check input file(s) and dump type refinement contexts(s)
-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-ir Emit LLVM IR file(s)
-emit-library Emit a linked library
-emit-object Emit object file(s) (-c)
-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)
-index-file Produce index data for a source file
-parse Parse input file(s)
-print-ast Parse and type-check input file(s) and pretty print AST(s)
-typecheck Parse and type-check input file(s)
OPTIONS:
-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 Restrict code to those available for App Extensions
-assert-config <value> Specify the assert_configuration replacement. Possible values are Debug, Release, Unchecked, DisableReplacement.
-continue-building-after-errors
Continue building, even after errors are encountered
-debug-info-store-invocation
Emit the compiler invocation in the debug info.
-disable-migrator-fixits
Disable the Migrator phase which automatically applies fix-its
-driver-time-compilation
Prints the total time it took to execute all compilation tasks
-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
-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
-emit-dependencies Emit basic Make-compatible dependencies files
-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-path <path>
Emit an importable module to <path>
-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-public-type-metadata-accessors
Emit all type metadata accessors as public (deprecated: now does nothing)
-emit-tbd-path <path> Emit the TBD file to <path>
-emit-tbd Emit a TBD file
-enforce-exclusivity=<enforcement>
Enforce law of exclusivity
-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-underlying-module
Implicitly imports the Objective-C half of a module
-index-file-path <path> Produce index data for file <path>
-index-ignore-system-modules
Avoid indexing system modules
-index-store-path <path>
Store indexing data to <path>
-I <value> Add directory to the import search path
-j <n> Number of commands to execute in parallel
-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.
-module-cache-path <value>
Specifies the Clang module cache path
-module-link-name <value>
Library to link against when using this module
-module-name <value> Name of the module to build
-nostdimport 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>
-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
-profile-coverage-mapping
Generate coverage data for use with profiled execution counts
-profile-generate Generate instrumented code to collect execution counts
-profile-use=<profdata> Supply a profdata file to enable profile-guided optimization
-remove-runtime-asserts Remove runtime safety checks.
-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
-sanitize-coverage=<type>
Specify the type of coverage instrumentation for Sanitizers and additional options separated by commas
-sanitize=<check> Turn on runtime checks for erroneous behavior.
-save-optimization-record-path <value>
Specify the file name of any generated YAML optimization record
-save-optimization-record
Generate a YAML optimization record file
-save-temps Save intermediate compilation results
-sdk <sdk> Compile against <sdk>
-serialize-diagnostics Serialize diagnostics in a binary format
-static-executable Statically link the executable
-static-stdlib Statically link the Swift standard library
-suppress-warnings Suppress all warnings
-swift-version <vers> Interpret input according to a specific Swift language version number
-target-cpu <value> Generate code for a particular CPU variant
-target <value> Generate code for the given target
-tools-directory <directory>
Look for external executables (ld, clang, binutils) in <directory>
-use-ld=<value> Specifies the linker to be used
-verify-debug-info Verify the binary representation of debug output.
-version Print version information and exit
-v Show commands to run and use verbose output
-warn-swift3-objc-inference-complete
Warn 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-minimal
Warn about deprecated @objc inference in Swift 3 based on direct uses of the Objective-C entrypoint
-warnings-as-errors Treat warnings as errors
-whole-module-optimization
Optimize input files together instead of individually
-working-directory <path>
Resolve file paths relative to the specified directory
-Xcc <arg> Pass <arg> to the C/C++/Objective-C compiler
-Xlinker <value> Specifies an option which should be passed to the linker
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment