[cfe-dev] [RFC] Embedding compilation database info in object files.

Sean Silva silvas at purdue.edu
Fri Jul 19 21:54:40 PDT 2013


On Fri, Jul 19, 2013 at 9:44 PM, Sean Silva <silvas at purdue.edu> wrote:

> On Fri, Jul 19, 2013 at 6:36 PM, Joshua Cranmer 🐧 <Pidgeot18 at gmail.com>wrote:
>
>> On 7/17/2013 11:36 PM, Sean Silva wrote:
>>
>>> tl;dr: compiler embeds compilation db info in object files; you can then
>>> collect it afterwards with simple tools. Good idea?
>>>
>>> It seems like for a while now, we have been looking for a way that clang
>>> can assist users in creating JSON compilation databases, but solutions seem
>>> limited to specific build systems or platforms. I came up with a neat
>>> little hack that may be a viable way for clang to help create compilation
>>> databases "everywhere clang runs", with fairly good user experience.
>>>
>>> I believe the following user experience is achievable "everywhere clang
>>> runs":
>>> 1. Add some option to the compiler command line.
>>> 2. Rebuild.
>>> 3. Feed all of your built object files/executables to a small tool we
>>> ship and out comes a compilation database.
>>>
>>
>> Quite frankly, I don't see this as being a superior user-experience to
>> the following scenario:
>> 1. Add an option to the compiler command line to dump the database to a
>> file.
>> 2. Rebuild.
>> 3. You have your compilation database automatically!
>>
>> The primary difficulty of this approach from an implementation
>> perspective is locking the database for writing when compiling with make
>> -jN.
>
>
> That approach may simply not be achievable in the case where the
> compilations are happening on physically distinct machines that do not
> share an underlying filesystem. I consider 'achievable "everywhere clang
> runs"' to be an important property; it's easy to come up with many
> far-superior user experiences by restricting consideration to particular
> build environments.
>
>
And by all means I encourage people to purse better user experiences for
this! However, I think a baseline, reliable "always there" way to produce a
compilation database (with decent, but perhaps not perfect, user
experience) is useful to have.

-- Sean Silva
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130719/c0291dfd/attachment.html>


More information about the cfe-dev mailing list