<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Jul 19, 2013 at 9:44 PM, Sean Silva <span dir="ltr"><<a href="mailto:silvas@purdue.edu" target="_blank">silvas@purdue.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="im">On Fri, Jul 19, 2013 at 6:36 PM, Joshua Cranmer 🐧 <span dir="ltr"><<a href="mailto:Pidgeot18@gmail.com" target="_blank">Pidgeot18@gmail.com</a>></span> wrote:<br>
</div><div class="gmail_extra"><div class="gmail_quote"><div class="im">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div>On 7/17/2013 11:36 PM, Sean Silva wrote:<br>

<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
tl;dr: compiler embeds compilation db info in object files; you can then collect it afterwards with simple tools. Good idea?<br>
<br>
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.<br>


<br>
I believe the following user experience is achievable "everywhere clang runs":<br>
1. Add some option to the compiler command line.<br>
2. Rebuild.<br>
3. Feed all of your built object files/executables to a small tool we ship and out comes a compilation database.<br>
</blockquote>
<br></div>
Quite frankly, I don't see this as being a superior user-experience to the following scenario:<br>
1. Add an option to the compiler command line to dump the database to a file.<br>
2. Rebuild.<br>
3. You have your compilation database automatically!<br>
<br>
The primary difficulty of this approach from an implementation perspective is locking the database for writing when compiling with make -jN.</blockquote><div><br></div></div>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.</div>

<div class="gmail_quote"><br></div></div></div></blockquote><div><br></div><div>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.</div>
<div><br></div><div>-- Sean Silva</div></div></div></div>