[cfe-dev] tooling helper
Manuel Klimek
klimek at google.com
Mon Dec 10 06:01:22 PST 2012
On Sun, Dec 9, 2012 at 3:32 PM, Laszlo Nagy
<rizsotto.mailinglist at gmail.com>wrote:
> Hi,
>
> I need some help to clarify the JSON compilation database syntax... This
> document <http://clang.llvm.org/docs/JSONCompilationDatabase.html> gives
> an example with space separated definition. I tried to reproduce the
> desired output with cmake, but failed.
>
> add_definitions(-DQUOTED_DEF="With spaces and quotes.")
> add_definitions(-DESCAPED_DEF=With\ spaces\ and\ without\ quotes.)
>
> These extra lines causes this command on the terminal
>
> gcc -DQUOTED_DEF="\"With spaces and quotes.\"" -DESCAPED_DEF="With
> spaces and without quotes." -o ...
>
> And the compile_commands.json file has entry like this
>
> "command": "/usr/lib64/ccache/gcc -DQUOTED_DEF=\"\\\"With spaces and
> quotes.\\\"\" -DESCAPED_DEF=\"With spaces and without quotes.\" -o ..."
>
> (The cmake version is 2.8.9) My understanding is that cmake does produce
> valid JSON here. Only the document was wanted more elegant escaping by
> single quotes. (-DSOMEDEF='\"With spaces and quotes.\"') Is that correct?
>
Yes, the document is incorrect. Sorry for that, no idea what I smoked that
day...
Thx for reporting,
/Manuel
>
> Regards,
> Laszlo
>
>
> On Sat, Nov 17, 2012 at 10:06 PM, Laszlo Nagy <
> rizsotto.mailinglist at gmail.com> wrote:
>
>> Hi,
>>
>> wrote a small program which might help to use the tools, which are using
>> the tooling library. My understanding was that these tools need some
>> compilation database. And one format is the JSON compilation database,
>> which comes for free in a cmake project. Other projects could have
>> difficulties to generate such file. And that's where a tool could help.
>>
>> https://github.com/rizsotto/Bear
>>
>> It runs the build command and intercept the 'exec' calls, filters the
>> compiler invocations and generate the output file. (It is using LD_PRELOAD
>> from GNU Libc, so it is not really portable.)
>>
>> I know these kind of tools are out of scope here. But wanted to mention,
>> because it could simplify to solve some cases. At least it did to me. ;)
>>
>> Regards,
>> Laszlo
>>
>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20121210/e4ec8935/attachment.html>
More information about the cfe-dev
mailing list