[cfe-dev] JSONCompilationDatabase additional keys

Manuel Klimek klimek at google.com
Wed Sep 11 05:14:02 PDT 2013


On Wed, Sep 11, 2013 at 12:41 PM, Nicholas Gill <mythagel at gmail.com> wrote:

> Hello cfe-dev,
>
> At present unknown keys in the compile_commands.json file will cause the
> JSONCompilationDatabase parser to reject the file.
>
> 1. Would a patch to relax this constraint be accepted?
> 2. Would other consumers of the compile_commands.json be negatively
> impacted by unknown keys?
>

Yes. This can be rather big, and being able to quickly parse it is
important for interactive use cases.


> The motivating example (somewhat contrived) involves a single TU built
> with a different environment in two different targets
>
> int main()
> {
>     TYPE i = -1;
>     return i < 0;
> }
>
> cc -DTYPE=int source.c -o bin1
> cc -DTYPE=uint16_t source.c -o bin2
>
> So for my use case I'd like to add a (purely optional) target name to the
> compilation database (generated via cmake) - in order to be able to provide
> more accurate diagnostics to the user.
>

I'd say that if we really want something more elaborate, we should try to
design it first instead of randomly allowing to add fields in ways that
might later break.

I'd be curious about other opinions though. (+Edwin, Daniel)


>
> Cheers,
>
> -nick
>
> _______________________________________________
> 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/20130911/7ee975c8/attachment.html>


More information about the cfe-dev mailing list