clang tool rejects compilation arguments from compilation database (incorrectly?)

2014-10-24 18:36 GMT+02:00 Manuel Klimek <klimek@google.com>:

To get a compilation database from a project:
https://github.com/rizsotto/Bear
might help.

I did try bear some time back, but it did not work. Or to be more accurate, it worked “some”. For some files, the compilation failed with an error i can’t recall right now, and for the cpp files that did compile correctly, the result compile_command.json was corrupt (by the looks of it, it was a race condition, overlapping lines, weird NULL characters at the end of the file).

The tooling infrastructure expects your compilation database to
contain flags for the main gcc-style frontend, not the -cc1 subprocess
invocation. So -### won’t help you here.

Not really relevant for me, but is this because for a clang tool to work properly, the gcc interface is always sufficient? (include paths, etc.)

I believe we have some flag that prints the full clang command line
during the compile, but I’ve forgotten what it is.

That would be extremely useful for me, does anyone remember it? :slight_smile:

Peter, if you could reproduce the bear problem and could file a bug report
on github then i would try to fix it.