Complete list of clang flags?

clang warning flags
gcc flags
clang optimization flags
clang pragma
pragma clang
clang weverything
clang unused variable
clang-cl

Where can I find a complete list of clang flags? There are some, like -include-pch, that don't appear to be even listed in the man page. :(

I know that GCC uses some of the same flags, but it doesn't include documentation for stuff like -Os which I believe is only available in clang. Is there a place where I can find a single, consolidated list of all the clang options ever?

I don't know if this is exactly what you want, maybe more options are described elsewhere but I think you are interested by the Clang frontend options, by default the options displayed seem to describe the "GCC-compatible driver".

clang -cc1 --help should give you what you want.

Clang Compiler User's Manual — Clang 12 documentation, See the diagnostics reference for a complete list of the warning flags that can be specified in this way. -Wno-foo �. Disable warning “foo”. -w� List of all 254 country flags of the world. This list also includes flags of dependent territories and not fully recognized countries. For sovereign states only, go to flags of UN members.

For Clang, they are listed in the diagnostics reference, which can be found on the documentation website here

Clang command line argument reference — Clang 12 documentation, Add -rpath with architecture-specific resource directory to the linker flags pointer base types to be complete if they would be significant under the Microsoft ABI. Flags controlling which warnings, errors, and remarks Clang will generate. See the full list of warning and remark flags.-R<remark>¶ Enable the specified remark-Rpass-analysis=<arg>¶ Report transformation analysis from optimization passes whose name matches the given POSIX regular expression-Rpass-missed=<arg>¶

I wonder no one mentioned this, there are many hidden options in LLVM.

clang --help-hidden
opt --help-hidden

Diagnostic flags in Clang — Clang 12 documentation, This page lists the diagnostic flags currently supported by Clang. comparisons before C11 need to be between two complete or two incomplete types; A is� By design, Clang generally matches the set of compiler flag options available in the GNU toolchain, but there are a few that are different. For embedded projects, it’s useful to cross-compile the source code with Clang to surface additional issues that GCC may have missed.

Clang Compiler User's Manual — Clang 3.3 documentation, For these cases, Clang provides a wide range of options to control the exact This is not a complete list; if you find an unsupported extension missing from this � Using .clang_complete file¶ This is a simple text file where each line defines a single flag. Don't forget, that you must specify the flags fully here. The paths that are not absolute will be expanded from the location of the .clang_complete file. The same wildcards as in settings can be used here too. Example .clang_complete file (click to

Diagnostic flags in Clang — Clang 8 documentation, Diagnostic flags in Clang. Introduction. Diagnostic flags. -W. -W#pragma-messages. -W#warnings. -WCFString-literal. -WCL4. -WIndependentClass-attribute. -WNSObject-attribute. -Wabi. -Wabsolute-value. -Wabstract-final-class. -Wabstract-vbase-init. -Waddress. -Waddress-of-packed-member. -Waddress-of-temporary. - As a C & Objective-C programmer, I'm a bit paranoid with the compiler warning flags. I usually try to find a complete list of warning flags for the compiler I use, and turn most of them on, unless I have a really good reason not to turn it on.

Clang command line argument reference — Clang 9 documentation, Add -rpath with architecture-specific resource directory to the linker flags pointer base types to be complete if they would be significant under the Microsoft ABI. Complete settings list¶ This is a complete guide over all settings. Here we look at every setting in detail, explain where they are used and what are their default values. common_flags¶ Specify common flags that are passed to clang for every compilation. These usually include common include paths that are needed for finding STL etc. Below are

Comments
  • See this answer by Chandler Carruth, clang developer.
  • Thanks, this is the best option I've seen so far.
  • is there a way to list all possible warnings for -W<warning>?
  • I don't think so. There is -Weverything if you want to activate all of them though. Since Clang tries to be compatible with GCC you can take a look at GCC's ones (gcc --help=warnings).
  • Some more info here programmers.stackexchange.com/a/124574 and here noxeos.com/2012/01/10/warning-flags-clang. Note that -Weverything that I mentioned earlier is not for everyday use but more for 'experimentation'.
  • You can see at the Clang - FAQ that clang -cc1 is the frontend. clang is the GCC-compatible driver. And recently, a new driver has appeared, clang-cl, which is a CL-compatible driver. I don't know how to explain clang -cc1 properly but the word that matters is frontend. You should get answers by looking for "compiler frontend", "clang frontend".