-
Richard Smith authored
Also accept -G= (and -msmall-data-threshold=) as an alias for -G on MIPS as well as Hexagon. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293254 91177308-0d34-0410-b5e6-96231b3b80d8
Richard Smith authoredAlso accept -G= (and -msmall-data-threshold=) as an alias for -G on MIPS as well as Hexagon. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293254 91177308-0d34-0410-b5e6-96231b3b80d8
Clang command line argument reference
Introduction
This page lists the command line arguments currently supported by the
GCC-compatible clang
and clang++
drivers.
Add <dir> to search path for binaries and object files used implicitly
Add directory to framework include search path
Treat source input files as Objective-C inputs
Treat source input files as Objective-C++ inputs
Don't emit warning for unused driver arguments
Pass the comma separated arguments in <arg> to the assembler
Pass <arg> to fatbinary invocation
Pass <arg> to the ptxas assembler
Run the static analyzer
Static analyzer report output format (html|plist|plist-multi-file|plist-html|text).
Emit ARC errors even if the migrator can fix them
Output path for the plist report
Compile CUDA code for both host and device (default). Has no effect on non-CUDA compilations.
Compile CUDA code for device only
CUDA GPU architecture (e.g. sm_35). May be specified more than once.
Compile CUDA code for host only. Has no effect on non-CUDA compilations.
Enable device-side debug info generation. Disables ptxas optimizations.
Filename to write DOT-formatted header dependencies to
Filename (or -) to write dependency output to
Emit Clang AST files for source inputs
Use approximate transcendental functions
Flush denormal floating point values to zero in CUDA device mode.
Specify comma-separated list of triples OpenMP offloading targets to be supported
Use the gcc toolchain at the given directory
Generate CodeView debug information
Display available options
Make the next included directory (-I or -F) an indexer header map
Run the migrator
Additional arguments to forward to LLVM's option processing
Directory to dump module dependencies to
Don't error out if the detected version of the CUDA install is too low for the requested CUDA gpu architecture.
Disable builtin #include directories
Disable standard #include directories for the C++ standard library
Write output to <file>
Make migration to 'atomic' properties
Enable migration to modern ObjC
Enable migration to property and method annotations
Enable migration to infer NS_DESIGNATED_INITIALIZER for initializer methods
Enable migration to infer instancetype for method result type
Enable migration to modern ObjC literals
Enable migration to NS_ENUM/NS_OPTIONS macros
Enable migration to modern ObjC property
Enable migration of setter/getter messages to property-dot syntax
Enable migration to add protocol conformance on classes
Enable migration to modern ObjC readonly property
Enable migration to modern ObjC readwrite property
Enable migration to modern ObjC subscripting
Enable migration to use NS_NONATOMIC_IOSONLY macro for setting property's 'atomic' attribute
Enable migration to annotate property with NS_RETURNS_INNER_POINTER
Only modify files with a filename contained in the provided directory path
Enable mcount instrumentation
Use pipes between commands, when possible
Print the full library path of <file>
Enable Objective-C Ivar layout bitmap print trace
Print the library path for the currently used compiler runtime library ("libgcc.a" or "libclang_rt.builtins.*.a")
Print the full program path of <name>
Print the paths used for finding libraries and programs
Support POSIX threads in generated code
Whether to build a relocatable precompiled header
Rewrite Legacy Objective-C source to C++
Compiler runtime library to use
Save llvm statistics.
Save intermediate compilation results.
Serialize compiler diagnostics to a file
C++ standard library to use
Generate code for the given target
Time individual commands
Enable some traditional CPP emulation
Show commands to run and use verbose output
Verify the binary representation of debug output
Suppress all warnings
Resolve file paths relative to the specified directory
Treat subsequent input files as having type <language>
Actions
The action to perform on the input.
Only run the preprocessor
Only run preprocess and compilation steps
Only run preprocess, compile, and assemble steps
Use the LLVM representation for assembler and object files
Provide information about a particular module file
Only precompile the input
Rewrite Objective-C source to C++
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.
Pass <arg> to the assembler
Pass <arg> to the clang compiler
Treat each comma separated argument in <arg> as a documentation comment block command
Allow __declspec as a keyword
Print fix-its in machine parseable form
Print source range spans in numeric form
Enables an experimental new pass manager in LLVM.
Inline suitable functions
Inline functions which are (explicitly or implicitly) marked inline
Don't use blacklist file for sanitizers
Level of field padding for AddressSanitizer
Enable use-after-scope detection in AddressSanitizer
Path to blacklist file for sanitizers
Enable control flow integrity (CFI) checks for cross-DSO calls.
Specify the type of coverage instrumentation for Sanitizers
Enable origins tracking in MemorySanitizer
Enable origins tracking in MemorySanitizer
Enable use-after-destroy detection in MemorySanitizer
Enable recovery for specified sanitizers
Enable sanitizer statistics gathering.
Enable atomic operations instrumentation in ThreadSanitizer (default)
Enable function entry/exit instrumentation in ThreadSanitizer (default)
Enable memory access instrumentation in ThreadSanitizer (default)
Enable trapping for specified sanitizers
Strip (or keep only, if negative) a given number of path components when emitting check metadata.
Turn on runtime checks for various forms of undefined or suspicious behavior. See user manual for available checks
Language standard to compile for
Preprocessor flags
Flags controlling the behavior of the Clang preprocessor.
Include comments in preprocessed output
Include comments from within macros in preprocessed output
Define <macro> to <value> (or 1 if <value> omitted)
Show header includes and nesting depth
Disable linemarker output in -E mode
Undefine macro <macro>
Pass the comma separated arguments in <arg> to the preprocessor
Pass <arg> to the preprocessor
Include path management
Flags controlling how #include
s are resolved to files.
Add directory to include search path
Restrict all prior -I flags to double-quoted inclusion and remove current directory from include path
CUDA installation path
Add directory to the C++ SYSTEM include search path
Use the last modification time of <file> as the build session timestamp
Time when the current build session started
Specify the module cache path
Disable validation of the diagnostic options when loading the module
Specify the interval (in seconds) after which a module file will be considered unused
Specify the interval (in seconds) between attempts to prune the module cache
Specify the module user build path
Don't verify input files for the modules if the module has been successfully validated or loaded during this build session
Validate the system headers that a module depends on when loading the module
Specify the prebuilt module path
Add directory to AFTER include search path
Add directory to SYSTEM framework search path
Include macros from file before parsing
Include file before parsing
Include precompiled header file
Set the -iwithprefix/-iwithprefixbefore prefix
Add directory to QUOTE include search path
Set the system root directory (usually /)
Add directory to SYSTEM include search path
Add directory to end of the SYSTEM include search path
Overlay the virtual filesystem described by file over the real file system
Set directory to SYSTEM include search path with prefix
Set directory to include search path with prefix
Add directory to SYSTEM include search path, absolute paths are relative to -isysroot
Path to ptxas (used for compiling CUDA code)
Treat all #include paths starting with <prefix> as including a system header.
Dependency file generation
Flags controlling generation of a dependency file for make
-like build
systems.
Like -MD, but also implies -E and writes to stdout by default
Write a depfile containing user and system headers
Write depfile output from -MMD, -MD, -MM, or -M to <file>
Add missing headers to depfile
Write a compilation database entry per input
Like -MMD, but also implies -E and writes to stdout by default
Write a depfile containing user headers
Create phony target for each dependency (other than main file)
Specify name of main file output to quote in depfile
Specify name of main file output in depfile
Use NMake/Jom format for the depfile
Dumping preprocessor state
Flags allowing the state of the preprocessor to be dumped in various ways.
Print macro definitions in -E mode in addition to normal output
Print include directives in -E mode in addition to normal output
Print macro definitions in -E mode instead of normal output
Diagnostic flags
Flags controlling which warnings, errors, and remarks Clang will generate. See the :doc:`full list of warning and remark flags <DiagnosticsReference>`.
Enable the specified remark
Report transformation analysis from optimization passes whose name matches the given POSIX regular expression
Report missed transformations by optimization passes whose name matches the given POSIX regular expression
Report transformations performed by optimization passes whose name matches the given POSIX regular expression
Enable the specified warning
Enable warnings for deprecated constructs and define __DEPRECATED
Target-independent compilation options
Enable C++17 aligned allocation functions
Enable AltiVec vector initializer syntax
Use ANSI escape codes for diagnostics
Use Apple's kernel extensions ABI
Enable Apple gcc-compatible #pragma pack handling
Restrict code to those available for App Extensions
Enable the 'blocks' language feature
Accept non-standard constructs supported by the Borland compiler
Load the clang builtins module map file.
Use colors in diagnostics
Enable support for the C++ Coroutines TS
Generate coverage mapping to enable code coverage analysis
Enable C++ exceptions
Place each data in its own section (ELF Only)
Emit extra debug info to make sample profile more accurate.
remap file source paths in debug info
Place debug types in their own section (ELF Only)
Parse templated function definitions at the end of the translation unit
Print absolute paths in diagnostics
Enable profile hotness information in diagnostic line
Display include stacks for diagnostic notes
Print option name with mappable diagnostics
Print a template comparison tree for differing templates
Allow '$' in identifiers
Embed LLVM bitcode (option: off, all, bitcode, marker)
Emit all declarations, even if unused
Use emutls functions to access thread_local variables
Enable support for exception handling
Allow aggressive, lossy floating-point optimizations
Form fused FP ops (e.g. FMAs): fast (everywhere) | on (according to FP_CONTRACT pragma, default) | off (never fuse)
Assert that the compilation takes place in a freestanding environment
Place each function in its own section (ELF Only)
Allow GNU-extension keywords regardless of language standard
Generate output compatible with the standard GNU Objective-C runtime
Use the gnu89 inline semantics
Implicitly search the file system for module map files.
Generate calls to instrument function entry and exit
Enable the integrated assembler
Enable LTO in 'full' mode
Controls the backend parallelism of -flto=thin (default of 0 means the number of threads will be derived from the number of CPUs detected)
Set LTO mode to either 'full' or 'thin'
Require math functions to indicate errors by setting errno
Specify the maximum alignment to enforce on pointers lacking an explicit alignment
Load this precompiled module file
Load this module map file
Specify the name of the module to build
Enable the 'modules' language feature
Require declaration of modules used within a module
Ignore the definition of the given macro when building and loading modules
Search even non-imported modules to resolve references
Like -fmodules-decluse but requires all headers to be in modules
Enable support for the C++ Modules TS
Enable full Microsoft Visual C++ compatibility
Dot-separated value representing the Microsoft compiler version number to report in _MSC_VER (0 = don't define it (default))
Accept some non-standard constructs supported by the Microsoft compiler
Microsoft compiler version number to report in _MSC_VER (0 = don't define it (default))
Specifies the largest alignment guaranteed by '::operator new(size_t)'
Disable implicit builtin knowledge of a specific function
Do not elide types when printing diagnostics
Do not treat C++ operator name keywords as synonyms for operators
Synthesize retain and release calls for Objective-C pointers
Use EH-safe code when synthesizing retains and releases in -fobjc-arc
Enable Objective-C exceptions
Specify the target Objective-C runtime kind and version
Enable ARC-style weak references in Objective-C
Specify the file name of any generated YAML optimization record
Specify the default maximum struct packing alignment
Recognize and construct Pascal-style string literals
Override the default ABI to return all structs on the stack
Load the named plugin (dynamic shared object)
Generate instrumented code to collect execution counts into default.profraw (overridden by LLVM_PROFILE_FILE env var)
Generate instrumented code to collect execution counts into <directory>/default.profraw (overridden by LLVM_PROFILE_FILE env var)
Generate instrumented code to collect execution counts into default.profraw file (overridden by '=' form of option or LLVM_PROFILE_FILE env var)
Generate instrumented code to collect execution counts into <file> (overridden by LLVM_PROFILE_FILE env var)
Use instrumentation data for profile-guided optimization
Enable sample-based profile guided optimizations
Use instrumentation data for profile-guided optimization. If pathname is a directory, it reads from <pathname>/default.profdata. Otherwise, it reads from file <pathname>.
Allow division operations to be reassociated
Override the default ABI to return small structs in registers
Enable C++17 relaxed template template argument matching
Turn on loop reroller
Generate a YAML optimization record file
Allocate to an enum type only as many bytes as it needs for the declared range of possible values
Force wchar_t to be a short unsigned int
Which overload candidates to show when overload resolution fails: best|all; defaults to all
Enable C++14 sized global deallocation functions
Use SjLj style exceptions
Enable the superword-level parallelism vectorization passes
Enable the BB vectorization passes
Place debug types in their own section (ELF Only)
Enable stack protectors for functions potentially vulnerable to stack smashing
Force the usage of stack protectors for all functions
Use a strong heuristic to apply stack protectors to functions
Emit full debug info for all types used by the program
Enable optimizations based on the strict definition of an enum's value range
Always treat control flow paths that fall off the end of a non-voidfunction as unreachable
Enable optimizations based on the strict rules for overwriting polymorphic C++ objects
Perform ThinLTO importing using provided function summary index
Issue call to specified function rather than a trap instruction
Trap on integer overflow
Specify the function to be called on overflow
Process trigraph sequences
Use unique names for text and data sections (ELF Only)
Turn on loop unroller
Use .init_array instead of .ctors
Use the given vector functions library
Enable the loop vectorization passes
Give inline C++ member functions default visibility by default
Give global types 'default' visibility and global functions and variables 'hidden' visibility by default
Set the default symbol visibility for all global declarations
Enables whole-program vtable optimization. Requires -flto
Treat signed integer overflow as two's complement
Store string literals as writable data
Sets the minimum function size to instrument with XRay
Generate XRay instrumentation sleds on function entry and exit
Enable System z vector language extension
OpenCL flags
OpenCL only. Allow denormals to be flushed to zero.
OpenCL only. Sets -cl-finite-math-only and -cl-unsafe-math-optimizations, and defines __FAST_RELAXED_MATH__.
OpenCL only. Allow floating-point optimizations that assume arguments and results are not NaNs or +-Inf.
OpenCL only. Specify that single precision floating-point divide and sqrt used in the program source are correctly rounded.
OpenCL only. Generate kernel argument metadata.
OpenCL only. Allow use of less precise MAD computations in the generated binary.
OpenCL only. Allow use of less precise no signed zeros computations in the generated binary.
OpenCL only. This option disables all optimizations. By default optimizations are enabled.
OpenCL only. Treat double precision floating-point constant as single precision constant.
OpenCL language standard to compile for.
OpenCL only. This option is added for compatibility with OpenCL 1.0.
OpenCL only. Allow unsafe floating-point optimizations. Also implies -cl-no-signed-zeros and -cl-mad-enable.
Target-dependent compilation options
Put objects of at most <size> bytes into small data section (MIPS / Hexagon)
Enable SVR4-style position-independent code (Mips only)
Align doubles to two words in structs (x86 only)
Link stack frames through backchain on System Z
Set EABI type, e.g. 4, 5 or gnu (default depends on triple)
Use 32-bit floating point registers (MIPS only)
Use 64-bit floating point registers (MIPS only)
Enable merging of globals
Use Intel MCU ABI
(integrated-as) Emit an object file which can be used with an incremental linker
Generate branches with extended addressability, usually via indirect jumps.
Set Mac OS X deployment target
Set the default structure layout to be compatible with the Microsoft compiler standard
Enable MSA ASE (MIPS only)
Omit frame pointer setup for leaf functions
Use copy relocations support for PIE builds
Enable hexagon-qdsp6 backward compatibility
(integrated-as) Relax all machine instructions
Make StdCall calling convention the default
Use software floating point
Set the stack alignment
Set the stack probe size
Force realign the stack at entry to every function
The thread model to use, e.g. posix, single (posix by default)
AARCH64
Reserve the x18 register (AArch64 only)
Workaround Cortex-A53 erratum 835769 (AArch64 only)
Generate code which only uses the general purpose registers (AArch64 only)
AMDGPU
ARM
Reserve the r9 register (ARM only)
Allow use of CRC instructions (ARM only)
Disallow generation of data access to code sections (ARM only)
Disallow use of movt/movw pairs (ARM only)
Disallow use of CRC instructions (ARM only)
Disallow generation of deprecated IT blocks for ARMv8. It is on by default for ARMv8 Thumb mode.
Allow memory accesses to be unaligned (AArch32/AArch64 only)
Hexagon
Enable Hexagon Vector eXtensions
Enable Hexagon Double Vector eXtensions
PowerPC
WebAssembly
X86
Optimization level
Flags controlling how much optimization should be performed.
Debug information generation
Flags controlling how much and what kind of debug information should be generated.
Kind and level of debug information
Generate source-level debug information
Generate source-level debug information with dwarf version 2
Generate source-level debug information with dwarf version 3
Generate source-level debug information with dwarf version 4
Generate source-level debug information with dwarf version 5
Debug level
Emit debug line number tables only
Generate debug info with external references to clang modules or precompiled headers
Debugger to tune debug information for
Debug information flags
Static analyzer flags
Flags controlling the behavior of the Clang Static Analyzer.
Pass <arg> to the static analyzer
Fortran compilation flags
Flags that will be passed onto the gfortran
compiler when Clang is given
a Fortran input.
Linker flags
Flags that are passed on to the linker
Add directory to library search path
Specify <script> as linker script
Set starting address of BSS to <addr>
Set starting address of BSS to <addr>
Set starting address of BSS to <addr>
Pass the comma separated arguments in <arg> to the linker
Pass <arg> to the linker
undef all system defines
Pass -z <arg> to the linker