.. ------------------------------------------------------------------- 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= Search $prefix/$triple-$file and $prefix$file for executables, libraries, includes, and data files used by the compiler. $prefix may or may not be a directory .. 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, -fno-ident Do not emit metadata containing compiler name and version .. option:: -Qunused-arguments Don't emit warning for unused driver arguments .. option:: -Qy, -fident 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\_ .. program:: clang1 .. option:: -Xarch\_device .. program:: clang Pass to the CUDA/HIP device compilation .. program:: clang2 .. option:: -Xarch\_host .. program:: clang Pass to the CUDA/HIP host compilation .. 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:: --analyzer-no-default-checks .. option:: --analyzer-output Static analyzer report output format (html\|plist\|plist-multi-file\|plist-html\|sarif\|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:: -client\_name .. option:: -compatibility\_version .. option:: --config Specifies configuration file .. option:: --constant-cfstrings .. 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-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 following 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:: -dsym-dir Directory to output dSYM's (if any) 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:: --emit-static-lib Enable linker job to emit a static library. .. option:: -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang Trivial automatic variable initialization to zero is only here for benchmarks, it'll eventually be removed, and I'm OK with that because I'm only using it to benchmark .. option:: -exported\_symbols\_list .. option:: -faligned-new= .. option:: -fcuda-flush-denormals-to-zero, -fno-cuda-flush-denormals-to-zero Flush denormal floating point values to zero in CUDA device mode. .. option:: -ffixed-r19 Reserve register r19 (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:: -fsanitize-system-ignorelist= Path to system ignorelist file for sanitizers .. option:: -fsystem-module Build this module as a system module. Only used with -emit-module .. option:: --gcc-toolchain=, -gcc-toolchain Search for GCC installation in the specified directory on targets which commonly use GCC. The directory usually contains 'lib{,32,64}/gcc{,-cross}/$triple' and 'include'. If specified, sysroot is skipped for GCC detection. Note: executables (e.g. ld) used by the compiler are not overridden by the selected GCC installation .. option:: -gcodeview Generate CodeView debug information .. option:: -gcodeview-ghash, -gno-codeview-ghash Emit type record hashes in a .debug$H section .. option:: -ginline-line-tables, -gno-inline-line-tables .. option:: --gpu-instrument-lib= Instrument device library for HIP, which is a LLVM bitcode containing \_\_cyg\_profile\_func\_enter and \_\_cyg\_profile\_func\_exit .. option:: --gpu-max-threads-per-block= Default max threads per block for kernel launch bounds for HIP .. option:: -headerpad\_max\_install\_names .. option:: -help, --help Display available options .. option:: --help-hidden Display help for hidden options .. option:: --hip-link Link clang-offload-bundler bundles for HIP .. option:: --hip-version= HIP version in the format of major.minor.patch .. option:: -ibuiltininc Enable builtin #include directories even when -nostdinc is used before or after -ibuiltininc. Using -nobuiltininc after the option disables it .. 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:: -interface-stub-version= .. option:: -keep\_private\_externs .. option:: -lazy\_framework .. program:: clang1 .. option:: -lazy\_library .. program:: clang .. option:: -mbig-endian, -EB .. option:: -mbranch-protection= Enforce targets of indirect branches and function returns .. option:: -mharden-sls= Select straight-line speculation hardening scope .. 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:: -nodefaultlibs .. option:: -nofixprebinding .. option:: -nogpuinc, -nocudainc .. option:: -nogpulib, -nocudalib Do not link device library for CUDA/HIP device compilation .. option:: -nolibc .. option:: -nomultidefs .. option:: -nopie, -no-pie .. option:: -noprebind .. option:: -noprofilelib .. option:: -noseglinkedit .. option:: -nostdinc, --no-standard-includes .. program:: clang1 .. option:: -nostdinc++ .. program:: clang Disable standard #include directories for the C++ standard library .. option:: -nostdlib++ .. 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:: --offload-arch=, --cuda-gpu-arch=, --no-offload-arch= CUDA offloading device architecture (e.g. sm\_35), or HIP offloading target ID in the form of a device architecture followed by target ID features delimited by a colon. Each target ID feature is a pre-defined string followed by a plus or minus sign (e.g. gfx908:xnack+:sram-ecc-). May be specified more than once. .. option:: -p, --profile .. option:: -pagezero\_size .. option:: -pg Enable mcount instrumentation .. 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-effective-triple, --print-effective-triple Print the effective target triple .. 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:: -print-target-triple, --print-target-triple Print the normalized target triple .. option:: -print-targets, --print-targets Print the registered targets .. option:: -private\_bundle .. option:: -pthread, -no-pthread Support POSIX threads in generated code .. option:: -pthreads .. 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-libgcc .. option:: -shared-libsan, -shared-libasan Dynamically link the sanitizer runtime .. option:: -single\_module .. option:: -static-libgcc .. option:: -static-libsan Statically link the sanitizer runtime .. option:: -static-libstdc++ .. option:: -static-openmp Use the static host OpenMP runtime while linking. .. 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:: -unwindlib=, --unwindlib= Unwind library to use .. 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-interface-stubs Generate Interface Stub Files. .. option:: -emit-llvm Use the LLVM representation for assembler and object files .. option:: -emit-merged-ifs Generate Interface Stub Files, emit merged text not binary. .. 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:: -fcomplete-member-pointers, -fno-complete-member-pointers Require member pointer base types to be complete if they would be significant under the Microsoft ABI .. option:: -fcrash-diagnostics-dir= .. 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-new-pass-manager, -fno-experimental-new-pass-manager Enables an experimental new pass manager in LLVM. .. option:: -fexperimental-strict-floating-point Enables experimental strict floating point in LLVM. .. option:: -ffine-grained-bitfield-accesses, -fno-fine-grained-bitfield-accesses Use separate accesses for consecutive bitfield runs with legal widths and alignments. .. option:: -fglobal-isel, -fexperimental-isel, -fno-global-isel Enables the global instruction selector .. 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-ignorelist Don't use ignorelist file for sanitizers .. option:: -fparse-all-comments .. option:: -frecord-command-line, -fno-record-command-line, -frecord-gcc-switches .. 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-custom-array-cookie, -fno-sanitize-address-poison-custom-array-cookie Enable poisoning array cookies when using custom 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-address-use-odr-indicator, -fno-sanitize-address-use-odr-indicator Enable ODR indicator globals to avoid false ODR violation reports in partially sanitized programs at the cost of an increase in binary size .. option:: -fsanitize-address-destructor= Set the kind of module destructors emitted by AddressSanitizer instrumentation. These destructors are emitted to unregister instrumented global variables when code is unloaded (e.g. via `dlclose()`). Valid options are: * ``global`` - Emit module destructors that are called via a platform specific array (see `llvm.global_dtors`). * ``none`` - Do not emit module destructors. .. option:: -fsanitize-ignorelist= Path to ignorelist file for sanitizers .. option:: -fsanitize-cfi-canonical-jump-tables, -fno-sanitize-cfi-canonical-jump-tables Make the jump table addresses canonical in the symbol table .. 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-allowlist= Restrict sanitizer coverage instrumentation exclusively to modules and functions that match the provided special case list, except the blocked ones .. option:: -fsanitize-coverage-ignorelist= Disable sanitizer coverage instrumentation for modules and functions that match the provided special case list, even the allowed ones .. option:: -fsanitize-coverage=,..., -fno-sanitize-coverage=,... Specify the type of coverage instrumentation for Sanitizers .. option:: -fsanitize-hwaddress-abi= Select the HWAddressSanitizer ABI to target (interceptor or platform, default interceptor). This option is currently unused. .. option:: -fsanitize-link-c++-runtime, -fno-sanitize-link-c++-runtime .. option:: -fsanitize-link-runtime, -fno-sanitize-link-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=,..., -fsanitize-recover (equivalent to -fsanitize-recover=all) 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=,..., -fsanitize-trap (equivalent to -fsanitize-trap=all), -fsanitize-undefined-trap-on-error (equivalent to -fsanitize-trap=undefined) 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=,..., -fno-sanitize=,... Turn on runtime checks for various forms of undefined or suspicious behavior. See user manual for available checks .. option:: -moutline, -mno-outline Enable function outlining (AArch64 only) .. option:: --param , --param= .. option:: -print-supported-cpus, --print-supported-cpus, -mcpu=?, -mtune=? Print supported cpu models for the given target (if target is not specified, it will print the supported cpus for the default target) .. 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 .. option:: -fmacro-prefix-map= remap file source paths in predefined preprocessor macros Include path management ----------------------- Flags controlling how ``#include``\s are resolved to files. .. option:: -I, --include-directory , --include-directory= Add directory to include search path. For C++ input, if there are multiple -I options, these directories are searched in the order they are given before the standard system directories are searched. If the same directory is in the SYSTEM include search paths, for example if also specified with -isystem, the -I option will be ignored .. 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=