Tooling command-line conventions

Hi all,

I'm looking into porting a pre-Tooling tool to Tooling to allow use of
compilation databases.

But our tool was built to be invoked from the build system, and
exposes the same command-line interface as Clang, with some additional
prefixed switches (e.g. tool -Xtool --toolswitch=value -I . foo.cpp).

It seems Tooling and LLVM's CommandLine library instead separates tool
switches and Clang switches with a double dash (e.g. tool
-toolswitch=value -- -I . foo.cpp)

Is there a clean way to combine Tooling's handling of compilation
databases with prefixed switches to get the benefits of both modes?

Do other people write tools based on Tooling to snap into Make-like
build systems?

- Kim

I've studied the Tooling code a bit more closely, and it seems
FixedCompilationDatabase is in charge of the "--" form.

That means, unless I'm mistaken, that I should be able to build my
command-line parser to handle the prefixed "-Xtool" and produce a
FixedCompilationDatabase. Would such an implementation be of general

So I won't be able to lean on CommonOptionsParser, but that's a
sacrifice I'm willing to make :slight_smile:

- Kim