Clang Docs

Apologies for the “noob” question, I’m still getting up to speed on clang…

Where is the best source of docs on clang, specifically options. I’m trying to use the “-x” option (select source language) and the online help and man page just says “-x language” without listing the acceptable values for “language”.


Hi Tim,

I don’t know if there’s any documentation for -x.

The list of recognized names is here: It’s a bit long to just include all of that in clang --help. (The way I discovered this was by looking for the “-x” text in include/clang/Driver/ , then looking for OPT_x in lib/Driver , which showed me that Driver.cpp calls types::lookupTypeForTypeSpecifier to do the string->type transition, and from there I could click me through clang’s oxygen to the file. clang users shouldn’t have to do this of course, but maybe you’re thinking about contributing, then this might be useful for you.)

clang’s user manual is at – maybe you want to try and contribute documentation for -x? UsersManual.html is generated from docs/UsersManual.rst in the clang repo.


For general options, your best bet is to look at the GCC docs. The clang program is meant to be GCC compatible, so those options naturally carry over. There should be pretty decent coverage of the clang-specific options in the user’s manual.

– Sean Silva

That's cheating!


> For general options, your best bet is to look at the GCC docs.

That's cheating!

It's not as strange as it seems if you consider that the frontend is
explicitly designed to be compatible with those options. It's a classic
Single Point of Truth pattern.

-- Sean Silva