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”.

Thanks!
—Tim

Hi Tim,

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

The list of recognized names is here: https://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Types.def?view=markup&pathrev=185562 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/Options.td , 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 Types.td 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 http://clang.llvm.org/docs/UsersManual.html – maybe you want to try and contribute documentation for -x? UsersManual.html is generated from docs/UsersManual.rst in the clang repo.

Nico

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!
:slight_smile:

Csaba

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

That's cheating!
:slight_smile:

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