<div dir="ltr">For anybody interested, I sent out:<div><a href="http://llvm-reviews.chandlerc.com/D2121">http://llvm-reviews.chandlerc.com/D2121</a><br></div><div><br></div><div>I decided to go for the "optional provided mapping" solution. Thx for all the feedback / questions / ideas. Feel free to chime in on the review thread...</div>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Nov 6, 2013 at 10:33 AM, Manuel Klimek <span dir="ltr"><<a href="mailto:klimek@google.com" target="_blank">klimek@google.com</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><div class="h5">On Wed, Nov 6, 2013 at 10:03 AM, Aaron Ballman <span dir="ltr"><<a href="mailto:aaron@aaronballman.com" target="_blank">aaron@aaronballman.com</a>></span> wrote:<br>
</div></div><div class="gmail_extra"><div class="gmail_quote"><div><div class="h5">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div>On Wed, Nov 6, 2013 at 12:59 PM, Manuel Klimek <<a href="mailto:klimek@google.com" target="_blank">klimek@google.com</a>> wrote:<br>


> On Wed, Nov 6, 2013 at 9:50 AM, Aaron Ballman <<a href="mailto:aaron@aaronballman.com" target="_blank">aaron@aaronballman.com</a>><br>
> wrote:<br>
>><br>
>> On Wed, Nov 6, 2013 at 12:34 PM, Manuel Klimek <<a href="mailto:klimek@google.com" target="_blank">klimek@google.com</a>> wrote:<br>
>> > Hi,<br>
>> ><br>
>> > as we've seen more use of the compilation database (for example through<br>
>> > the<br>
>> > YCM vim plugin), we noticed that for networked build systems and server<br>
>> > applications the information we currently expose in the interfaces<br>
>> > (path,<br>
>> > file-name, command line arguments) is not enough - we also need to be<br>
>> > able<br>
>> > to get all source code, which we then can put into clang's VFS to get a<br>
>> > fully build-system independent clang run over a translation unit.<br>
>> ><br>
>> > We think that getting the source information (perhaps optionally) as<br>
>> > part of<br>
>> > a getCompileCommands run is a good fit - a build system always must know<br>
>> > how<br>
>> > to provide the required sources, and as such it seems to be a natural<br>
>> > fit.<br>
>><br>
>> I think the premise is sound; it's information that's useful, and<br>
>> something the compilation database can definitely provide.<br>
>><br>
>> > I'd propose to change the CompilationDatabase interface<br>
>> > (tools/clang/include/clang/Tooling/CompilationDatabase.h) to that end,<br>
>> > and<br>
>> > see two possible solutions, which both have different pros and cons:<br>
>> > 1. Add a map from std::string (file-name) -> std::string (source<br>
>> > content) to<br>
>> > the CompileCommand class (in<br>
>> > tools/clang/include/clang/Tooling/CompilationDatabase.h); let specific<br>
>> > CompilationDatabases optionally fill in that information<br>
>> > 2. Do not modify CompileCommand - instead, add a<br>
>> > getCompileCommandsAndSources(StringRef FilePath) method that returns a<br>
>> > vector<pair<CompileCommand, map<string, string>>> which also includes<br>
>> > the<br>
>> > sources; I'm reluctant to split the call into two, as the compile<br>
>> > command<br>
>> > and the sources are tightly coupled (if a user syncs in the background,<br>
>> > both<br>
>> > tend to change at the same time)<br>
>><br>
>> Can we have a bit more information about these two options?  I think I<br>
>> may be a bit confused.  Option #1 sounds like it maps a file name to<br>
>> the file contents.  But I can't seem to make heads or tails of what<br>
>> the input and outputs are for Option #2.<br>
><br>
><br>
> Ah, both basically would additionally provide a map<string, string> that<br>
> maps from filenames to file contents, so a client can overlay those file<br>
> contents to get a fully hermetic "replay" of the compilation.<br>
><br>
> The difference is that option #1 would basically keep the old interface, and<br>
> optionally the compilation database could provide the file contents (if it<br>
> wants), while option #2 would introduce a new interface for clients to ask<br>
> for file contents explicitly if they need it.<br>
<br>
</div></div>Option #2 was accepting a file path input, but returning a vector of<br>
information -- was the file path the path to the database itself, or<br>
to a specific source file?<br></blockquote><div><br></div></div></div><div>The source file - we return a vector because we can have multiple ways to compile the same file (for example in host and target configuration in cross-compilations)</div>

<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<span><font color="#888888"><br>
~Aaron<br>
</font></span></blockquote></div><br></div></div>
</blockquote></div><br></div>