..
-------------------------------------------------------------------
NOTE: This file is automatically generated by running clang-tblgen
-gen-opt-docs. Do not edit this file by hand!!
-------------------------------------------------------------------
=====================================
Clang command line argument reference
=====================================
.. contents::
:local:
Introduction
============
This page lists the command line arguments currently supported by the
GCC-compatible ``clang`` and ``clang++`` drivers.
.. program:: clang
.. option:: -B
, --prefix , --prefix=
Add to search path for binaries and object files used implicitly
.. option:: -F
Add directory to framework include search path
.. option:: -ObjC
Treat source input files as Objective-C inputs
.. program:: clang1
.. option:: -ObjC++
.. program:: clang
Treat source input files as Objective-C++ inputs
.. option:: -Qn
Do not emit metadata containing compiler name and version
.. option:: -Qunused-arguments
Don't emit warning for unused driver arguments
.. option:: -Qy
Emit metadata containing compiler name and version
.. option:: -Wa,,...
Pass the comma separated arguments in to the assembler
.. option:: -Wlarge-by-value-copy=
.. option:: -Xarch\_
.. option:: -Xcuda-fatbinary
Pass to fatbinary invocation
.. option:: -Xcuda-ptxas
Pass to the ptxas assembler
.. option:: -Xopenmp-target
Pass to the target offloading toolchain.
.. program:: clang1
.. option:: -Xopenmp-target=
.. program:: clang
Pass to the target offloading toolchain identified by .
.. option:: -Z
.. option:: -a, --profile-blocks
.. option:: -all\_load
.. option:: -allowable\_client
.. option:: --analyze
Run the static analyzer
.. option:: --analyze-auto
.. option:: --analyzer-no-default-checks
.. option:: --analyzer-output
Static analyzer report output format (html\|plist\|plist-multi-file\|plist-html\|text).
.. option:: -ansi, --ansi
.. option:: -arch
.. program:: clang1
.. option:: -arch\_errors\_fatal
.. program:: clang
.. program:: clang2
.. option:: -arch\_only
.. program:: clang
.. option:: -arcmt-migrate-emit-errors
Emit ARC errors even if the migrator can fix them
.. option:: -arcmt-migrate-report-output
Output path for the plist report
.. option:: --autocomplete=
.. option:: -bind\_at\_load
.. option:: -bundle
.. program:: clang1
.. option:: -bundle\_loader
.. program:: clang
.. option:: -cfguard
Emit tables required for Windows Control Flow Guard.
.. option:: -client\_name
.. option:: -compatibility\_version
.. option:: --config
Specifies configuration file
.. option:: --constant-cfstrings
.. option:: -coverage, --coverage
.. option:: --cuda-compile-host-device
Compile CUDA code for both host and device (default). Has no effect on non-CUDA compilations.
.. option:: --cuda-device-only
Compile CUDA code for device only
.. option:: --cuda-gpu-arch=, --no-cuda-gpu-arch=
CUDA GPU architecture (e.g. sm\_35). May be specified more than once.
.. option:: --cuda-host-only
Compile CUDA code for host only. Has no effect on non-CUDA compilations.
.. option:: --cuda-include-ptx=, --no-cuda-include-ptx=
Include PTX for the follwing GPU architecture (e.g. sm\_35) or 'all'. May be specified more than once.
.. option:: --cuda-noopt-device-debug, --no-cuda-noopt-device-debug
Enable device-side debug info generation. Disables ptxas optimizations.
.. option:: -current\_version
.. option:: -dead\_strip
.. option:: -dependency-dot
Filename to write DOT-formatted header dependencies to
.. option:: -dependency-file
Filename (or -) to write dependency output to
.. option:: -dumpmachine
.. option:: -dumpversion
.. option:: --dyld-prefix=, --dyld-prefix
.. option:: -dylib\_file
.. option:: -dylinker
.. program:: clang1
.. option:: -dylinker\_install\_name
.. program:: clang
.. option:: -dynamic
.. option:: -dynamiclib
.. option:: -emit-ast
Emit Clang AST files for source inputs
.. option:: -exported\_symbols\_list
.. option:: -faligned-new=
.. option:: -fcuda-approx-transcendentals, -fno-cuda-approx-transcendentals
Use approximate transcendental functions
.. option:: -fcuda-flush-denormals-to-zero, -fno-cuda-flush-denormals-to-zero
Flush denormal floating point values to zero in CUDA device mode.
.. option:: -fcuda-rdc, -fno-cuda-rdc
Generate relocatable device code, also known as separate compilation mode.
.. option:: -ffixed-r19
Reserve the r19 register (Hexagon only)
.. option:: -fheinous-gnu-extensions
.. option:: -flat\_namespace
.. option:: -fopenmp-targets=,...
Specify comma-separated list of triples OpenMP offloading targets to be supported
.. option:: -force\_cpusubtype\_ALL
.. program:: clang1
.. option:: -force\_flat\_namespace
.. program:: clang
.. program:: clang2
.. option:: -force\_load
.. program:: clang
.. option:: -framework
.. option:: -frtlib-add-rpath, -fno-rtlib-add-rpath
Add -rpath with architecture-specific resource directory to the linker flags
.. option:: --gcc-toolchain=, -gcc-toolchain
Use the gcc toolchain at the given directory
.. option:: -gcodeview
Generate CodeView debug information
.. option:: -headerpad\_max\_install\_names
.. option:: -help, --help
Display available options
.. option:: --help-hidden
Display help for hidden options
.. option:: -image\_base
.. option:: -index-header-map
Make the next included directory (-I or -F) an indexer header map
.. option:: -init
.. option:: -install\_name
.. option:: -keep\_private\_externs
.. option:: -lazy\_framework
.. program:: clang1
.. option:: -lazy\_library
.. program:: clang
.. option:: -mbig-endian, -EB
.. option:: --migrate
Run the migrator
.. option:: -mios-simulator-version-min=, -miphonesimulator-version-min=
.. option:: -mlinker-version=
.. option:: -mlittle-endian, -EL
.. option:: -mllvm
Additional arguments to forward to LLVM's option processing
.. option:: -module-dependency-dir
Directory to dump module dependencies to
.. option:: -mtvos-simulator-version-min=, -mappletvsimulator-version-min=
.. option:: -multi\_module
.. option:: -multiply\_defined
.. program:: clang1
.. option:: -multiply\_defined\_unused
.. program:: clang
.. option:: -mwatchos-simulator-version-min=, -mwatchsimulator-version-min=
.. option:: --no-cuda-version-check
Don't error out if the detected version of the CUDA install is too low for the requested CUDA gpu architecture.
.. option:: -no-integrated-cpp, --no-integrated-cpp
.. option:: -no\_dead\_strip\_inits\_and\_terms
.. option:: -nobuiltininc
Disable builtin #include directories
.. option:: -nocudainc
.. option:: -nocudalib
.. option:: -nodefaultlibs
.. option:: -nofixprebinding
.. option:: -nolibc
.. option:: -nomultidefs
.. option:: -nopie, -no-pie
.. option:: -noprebind
.. option:: -noseglinkedit
.. option:: -nostartfiles
.. option:: -nostdinc, --no-standard-includes
.. program:: clang1
.. option:: -nostdinc++
.. program:: clang
Disable standard #include directories for the C++ standard library
.. option:: -nostdlib, --no-standard-libraries
.. program:: clang1
.. option:: -nostdlib++
.. program:: clang
.. option:: -nostdlibinc
.. option:: -o, --output , --output=
Write output to
.. option:: -objcmt-atomic-property
Make migration to 'atomic' properties
.. option:: -objcmt-migrate-all
Enable migration to modern ObjC
.. option:: -objcmt-migrate-annotation
Enable migration to property and method annotations
.. option:: -objcmt-migrate-designated-init
Enable migration to infer NS\_DESIGNATED\_INITIALIZER for initializer methods
.. option:: -objcmt-migrate-instancetype
Enable migration to infer instancetype for method result type
.. option:: -objcmt-migrate-literals
Enable migration to modern ObjC literals
.. option:: -objcmt-migrate-ns-macros
Enable migration to NS\_ENUM/NS\_OPTIONS macros
.. option:: -objcmt-migrate-property
Enable migration to modern ObjC property
.. option:: -objcmt-migrate-property-dot-syntax
Enable migration of setter/getter messages to property-dot syntax
.. option:: -objcmt-migrate-protocol-conformance
Enable migration to add protocol conformance on classes
.. option:: -objcmt-migrate-readonly-property
Enable migration to modern ObjC readonly property
.. option:: -objcmt-migrate-readwrite-property
Enable migration to modern ObjC readwrite property
.. option:: -objcmt-migrate-subscripting
Enable migration to modern ObjC subscripting
.. option:: -objcmt-ns-nonatomic-iosonly
Enable migration to use NS\_NONATOMIC\_IOSONLY macro for setting property's 'atomic' attribute
.. option:: -objcmt-returns-innerpointer-property
Enable migration to annotate property with NS\_RETURNS\_INNER\_POINTER
.. option:: -objcmt-whitelist-dir-path=, -objcmt-white-list-dir-path=
Only modify files with a filename contained in the provided directory path
.. option:: -object
.. option:: -p, --profile
.. option:: -pagezero\_size
.. option:: -pg
Enable mcount instrumentation
.. option:: -pie
.. option:: -pipe, --pipe
Use pipes between commands, when possible
.. option:: -prebind
.. program:: clang1
.. option:: -prebind\_all\_twolevel\_modules
.. program:: clang
.. option:: -preload
.. option:: --print-diagnostic-categories
.. option:: -print-file-name=, --print-file-name=, --print-file-name
Print the full library path of
.. option:: -print-ivar-layout
Enable Objective-C Ivar layout bitmap print trace
.. option:: -print-libgcc-file-name, --print-libgcc-file-name
Print the library path for the currently used compiler runtime library ("libgcc.a" or "libclang\_rt.builtins.\*.a")
.. option:: -print-multi-directory, --print-multi-directory
.. option:: -print-multi-lib, --print-multi-lib
.. option:: -print-prog-name=, --print-prog-name=, --print-prog-name
Print the full program path of
.. option:: -print-resource-dir, --print-resource-dir
Print the resource directory pathname
.. option:: -print-search-dirs, --print-search-dirs
Print the paths used for finding libraries and programs
.. option:: -private\_bundle
.. option:: -pthread, -no-pthread
Support POSIX threads in generated code
.. option:: -pthreads
.. option:: -rdynamic
.. option:: -read\_only\_relocs
.. option:: -relocatable-pch, --relocatable-pch
Whether to build a relocatable precompiled header
.. option:: -remap
.. option:: -rewrite-legacy-objc
Rewrite Legacy Objective-C source to C++
.. option:: -rtlib=, --rtlib=, --rtlib
Compiler runtime library to use
.. option:: -save-stats=, --save-stats=, -save-stats (equivalent to -save-stats=cwd), --save-stats (equivalent to -save-stats=cwd)
Save llvm statistics.
.. option:: -save-temps=, --save-temps=, -save-temps (equivalent to -save-temps=cwd), --save-temps (equivalent to -save-temps=cwd)
Save intermediate compilation results.
.. option:: -sectalign
.. option:: -sectcreate
.. option:: -sectobjectsymbols
.. option:: -sectorder
.. option:: -seg1addr
.. option:: -seg\_addr\_table
.. program:: clang1
.. option:: -seg\_addr\_table\_filename
.. program:: clang
.. option:: -segaddr
.. option:: -segcreate
.. option:: -seglinkedit
.. option:: -segprot
.. option:: -segs\_read\_
.. program:: clang1
.. option:: -segs\_read\_only\_addr
.. program:: clang
.. program:: clang2
.. option:: -segs\_read\_write\_addr
.. program:: clang
.. option:: -serialize-diagnostics , --serialize-diagnostics
Serialize compiler diagnostics to a file
.. option:: -shared, --shared
.. option:: -shared-libgcc
.. option:: -shared-libsan, -shared-libasan
.. option:: -single\_module
.. option:: -specs=, --specs=
.. option:: -static, --static
.. option:: -static-libgcc
.. option:: -static-libsan
.. option:: -static-libstdc++
.. option:: -std-default=
.. option:: -stdlib=, --stdlib=, --stdlib
C++ standard library to use
.. option:: -sub\_library
.. program:: clang1
.. option:: -sub\_umbrella
.. program:: clang
.. option:: --sysroot=, --sysroot
.. option:: --target-help
.. option:: --target=, -target
Generate code for the given target
.. option:: -time
Time individual commands
.. option:: -traditional, --traditional
.. option:: -traditional-cpp, --traditional-cpp
Enable some traditional CPP emulation
.. option:: -twolevel\_namespace
.. program:: clang1
.. option:: -twolevel\_namespace\_hints
.. program:: clang
.. option:: -umbrella
.. option:: -unexported\_symbols\_list
.. option:: -v, --verbose
Show commands to run and use verbose output
.. option:: --verify-debug-info
Verify the binary representation of debug output
.. option:: --version
Print version information
.. option:: -w, --no-warnings
Suppress all warnings
.. option:: -weak-l
.. option:: -weak\_framework
.. program:: clang1
.. option:: -weak\_library
.. program:: clang
.. program:: clang2
.. option:: -weak\_reference\_mismatches
.. program:: clang
.. option:: -whatsloaded
.. option:: -whyload
.. option:: -working-directory, -working-directory=
Resolve file paths relative to the specified directory
.. option:: -x, --language , --language=
Treat subsequent input files as having type
.. option:: -y
Actions
=======
The action to perform on the input.
.. option:: -E, --preprocess
Only run the preprocessor
.. option:: -S, --assemble
Only run preprocess and compilation steps
.. option:: -c, --compile
Only run preprocess, compile, and assemble steps
.. option:: -emit-llvm
Use the LLVM representation for assembler and object files
.. option:: -fsyntax-only
.. option:: -module-file-info
Provide information about a particular module file
.. option:: --precompile
Only precompile the input
.. option:: -rewrite-objc
Rewrite Objective-C source to C++
.. option:: -verify-pch
Load and verify that a pre-compiled header file is not stale
Compilation flags
=================
Flags controlling the behavior of Clang during compilation. These flags have
no effect during actions that do not perform compilation.
.. option:: -Xassembler
Pass to the assembler
.. option:: -Xclang
Pass to the clang compiler
.. option:: -fclang-abi-compat=
Attempt to match the ABI of Clang
.. option:: -fcomment-block-commands=,...
Treat each comma separated argument in as a documentation comment block command
.. option:: -fdeclspec, -fno-declspec
Allow \_\_declspec as a keyword
.. option:: -fdepfile-entry=
.. option:: -fdiagnostics-fixit-info, -fno-diagnostics-fixit-info
.. option:: -fdiagnostics-format=
.. option:: -fdiagnostics-parseable-fixits
Print fix-its in machine parseable form
.. option:: -fdiagnostics-print-source-range-info
Print source range spans in numeric form
.. option:: -fdiagnostics-show-category=
.. option:: -fdiscard-value-names, -fno-discard-value-names
Discard value names in LLVM IR
.. option:: -fexperimental-isel, -fno-experimental-isel
Enables the experimental global instruction selector
.. option:: -fexperimental-new-pass-manager, -fno-experimental-new-pass-manager
Enables an experimental new pass manager in LLVM.
.. option:: -ffine-grained-bitfield-accesses, -fno-fine-grained-bitfield-accesses
Use separate accesses for bitfields with legal widths and alignments.
.. option:: -finline-functions, -fno-inline-functions
Inline suitable functions
.. option:: -finline-hint-functions
Inline functions which are (explicitly or implicitly) marked inline
.. option:: -fno-crash-diagnostics
Disable auto-generation of preprocessed source files and a script for reproduction during a clang crash
.. option:: -fno-sanitize-blacklist
Don't use blacklist file for sanitizers
.. option:: -fparse-all-comments
.. option:: -fsanitize-address-field-padding=
Level of field padding for AddressSanitizer
.. option:: -fsanitize-address-globals-dead-stripping
Enable linker dead stripping of globals in AddressSanitizer
.. option:: -fsanitize-address-poison-class-member-array-new-cookie, -fno-sanitize-address-poison-class-member-array-new-cookie
Enable poisoning array cookies when using class member operator new\[\] in AddressSanitizer
.. option:: -fsanitize-address-use-after-scope, -fno-sanitize-address-use-after-scope
Enable use-after-scope detection in AddressSanitizer
.. option:: -fsanitize-blacklist=
Path to blacklist file for sanitizers
.. option:: -fsanitize-cfi-cross-dso, -fno-sanitize-cfi-cross-dso
Enable control flow integrity (CFI) checks for cross-DSO calls.
.. option:: -fsanitize-cfi-icall-generalize-pointers
Generalize pointers in CFI indirect call type signature checks
.. option:: -fsanitize-coverage=,..., -fno-sanitize-coverage=,...
Specify the type of coverage instrumentation for Sanitizers
.. option:: -fsanitize-link-c++-runtime
.. option:: -fsanitize-memory-track-origins, -fno-sanitize-memory-track-origins
Enable origins tracking in MemorySanitizer
.. program:: clang1
.. option:: -fsanitize-memory-track-origins=
.. program:: clang
Enable origins tracking in MemorySanitizer
.. option:: -fsanitize-memory-use-after-dtor, -fno-sanitize-memory-use-after-dtor
Enable use-after-destroy detection in MemorySanitizer
.. option:: -fsanitize-minimal-runtime, -fno-sanitize-minimal-runtime
.. option:: -fsanitize-recover, -fno-sanitize-recover
.. program:: clang1
.. option:: -fsanitize-recover=,..., -fno-sanitize-recover=,...
.. program:: clang
Enable recovery for specified sanitizers
.. option:: -fsanitize-stats, -fno-sanitize-stats
Enable sanitizer statistics gathering.
.. option:: -fsanitize-thread-atomics, -fno-sanitize-thread-atomics
Enable atomic operations instrumentation in ThreadSanitizer (default)
.. option:: -fsanitize-thread-func-entry-exit, -fno-sanitize-thread-func-entry-exit
Enable function entry/exit instrumentation in ThreadSanitizer (default)
.. option:: -fsanitize-thread-memory-access, -fno-sanitize-thread-memory-access
Enable memory access instrumentation in ThreadSanitizer (default)
.. option:: -fsanitize-trap=,..., -fno-sanitize-trap=,...
Enable trapping for specified sanitizers
.. option:: -fsanitize-undefined-strip-path-components=
Strip (or keep only, if negative) a given number of path components when emitting check metadata.
.. option:: -fsanitize-undefined-trap-on-error, -fno-sanitize-undefined-trap-on-error
.. option:: -fsanitize=,..., -fno-sanitize=,...
Turn on runtime checks for various forms of undefined or suspicious behavior. See user manual for available checks
.. option:: --param , --param=
.. option:: -std=, --std=, --std
Language standard to compile for
Preprocessor flags
~~~~~~~~~~~~~~~~~~
Flags controlling the behavior of the Clang preprocessor.
.. option:: -C, --comments
Include comments in preprocessed output
.. option:: -CC, --comments-in-macros
Include comments from within macros in preprocessed output
.. option:: -D=, --define-macro , --define-macro=
Define to (or 1 if omitted)
.. option:: -H, --trace-includes
Show header includes and nesting depth
.. option:: -P, --no-line-commands
Disable linemarker output in -E mode
.. option:: -U, --undefine-macro , --undefine-macro=
Undefine macro
.. option:: -Wp,,...
Pass the comma separated arguments in to the preprocessor
.. option:: -Xpreprocessor
Pass to the preprocessor
Include path management
-----------------------
Flags controlling how ``#include``\s are resolved to files.
.. option:: -I, --include-directory , --include-directory=
Add directory to include search path
.. option:: -I-, --include-barrier
Restrict all prior -I flags to double-quoted inclusion and remove current directory from include path
.. option:: --cuda-path-ignore-env
Ignore environment variables to detect CUDA installation
.. option:: --cuda-path=
CUDA installation path
.. option:: -cxx-isystem
Add directory to the C++ SYSTEM include search path
.. option:: -fbuild-session-file=
Use the last modification time of as the build session timestamp
.. option:: -fbuild-session-timestamp=