Formatting of command line option help text

llvm-link and clang both have a -o option with similar meaning, but the help text describes it differently.

llvm-link describes it as:


and clang describes it as


with no ‘=’ between the option and the parameter.

When I try using the command line options library, it comes out the same way as llvm-link, with no apparent method of getting it to come out the other way. This might be just a minor cosmetic question, but I’ve a feeling it actually points to a significant gap in my understanding of the command line options library, because when I tried checking the clang source code for the answer, the only relevant reference I could find was in some configuration or DSL file whose syntax and function I’m not familiar with.

How exactly is clang getting that effect?

The LLVM toolchain, and many small LLVM based tools (like clang-format) use libSupport’s cl::ParseCommandLineOptions and related APIs for command line parsing. This results in the behavior you see with llvm-link.

Clang, lld, and some of the other higher level tools use a TableGen driven process implemented in libOption.

So, you get different help formats because the two APIs are completely independent.