[cfe-dev] clang tool rejects compilation arguments from compilation database (incorrectly?)

Péter Ésik peter.esik at gmail.com
Fri Oct 24 04:06:54 PDT 2014


Hello

I would like to introduce clang tooling to a fairly large code base with a
custom build system. The first step i wanted to take is to manually create
a compilation database file for one translation unit, and do some testing
on that.

First, i added -### to the compilation flags, so i could get the actual
compiler invocation. I took the ouput, and put it into a
compile_command.json file. At this point, everything should have worked
just fine, but it did not. My clang tool for testing is really simple, all
it does is, it tries to run a clang::SyntaxOnlyAction on the given inputs.

If i try to run my tool on the TU that's in my compilation database, i get
errors. Here's my compilation database: http://pastebin.com/6gsRHBEN and
here is my output the tool gives me: http://pastebin.com/4AXfdF0r I also
tried without the inner-quotes (http://pastebin.com/sWwyvbp8), the result's
the same.

What really bugs me is that if i open a terminal, switch to the
'directory', and copy-paste the content of the 'command' part (without
JSON-escaping of course), clang compiles the file (and generates the object
file) without any errors. Also, don't know if relevant, but the project is
built using an older xcode toolchain (based on clang 3.2), and i built my
tool based on clang 3.5. Why does my tool reject totally valid arguments,
what do i do wrong?

Thanks,
Peter
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20141024/8c189a14/attachment.html>


More information about the cfe-dev mailing list