Skip to content
Snippets Groups Projects
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
ClangCommandLineReference.rst 56.72 KiB

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