[PATCH] clang-modernize: Add SubprocessCompilationDatabase

Manuel Klimek klimek at google.com
Fri Oct 11 19:07:33 PDT 2013


On Fri, Oct 11, 2013 at 6:54 PM, <revane at gmail.com> wrote:

> SingleCompilationDatabase is just a quick and safe way to pass compilation
> args from the parent process to the sub-process. The parent process asks
> its compilation database for args for a given file. If it's a json database
> you get exactly what's in the json file. If it's a fixed database you get a
> bogus "argv0" and the file name tacked on the end. If we were to rely on
> FixedCompilationDatabase to pass these args to the sub-process we need to
> strip out the filename and the argv0. The argv0 is straightforward since
> it's the first item in the vector of command line args. However, finding
> the filename is trickier. Where it's located depends on the database that
> provided the args. There's also the possibility the filename isn't in the
> args on its own or its after another arg like -c in which case we don't
> want to remove the filename. These problems are all soluble but it would
> end up duplicating what must happen in the clang driver or clang::tooling
> somewhere.
>
> We felt the easiest and safest option was to pass the args exactly as the
> comdb provides them. The new SingleCompilationDatabase takes these args
> directly and represents them identically as in the parent process.
>

I understood that from what you said before, but I feel like it doesn't
answer my questions.

Let me iterate on the second question first: why is subprocessing needed at
all?
Perhaps the answer will make it clearer to me what you're trying to do...

Cheers,
/Manuel


>
> Sent from my BlackBerry 10 smartphone.
>   *From: *Manuel Klimek
> *Sent: *Friday, October 11, 2013 12:06 PM
> *To: *reviews+D1877+public+656d0bc9c028c19a at llvm-reviews.chandlerc.com
> *Cc: *Guillaume Papin; cfe-commits at cs.uiuc.edu
> *Subject: *Re: [PATCH] clang-modernize: Add SubprocessCompilationDatabase
>
> On Thu, Oct 10, 2013 at 3:34 PM, Edwin Vane <edwin.vane at intel.com> wrote:
>
>>
>>   The problem is the FixedCompilationDatabase mangles the arguments you
>> pass. FixedCompilationDatabase as a result has some preconditions: the name
>> of the compiler should not be present nor should be the filename to operate
>> on. Check CompilationDatabase.h for a better description. As stated in the
>> patch summary we need a simpler compilation database that simply accepts a
>> full list of args and then provides those same args back upon request.
>>
>>   I'll fix the comment and add a test for -c -c
>>
>
> I still don't understand this explanation. Can you elaborate, why calling
> "tool -- <command line args>" doesn't work if you want to subprocess.
>
> (I also don't understand yet why you want to subprocess out, but that's a
> different topic - is it to run them in parallel?)
>
>
>>
>> http://llvm-reviews.chandlerc.com/D1877
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>>
>
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20131011/a799ee8f/attachment.html>


More information about the cfe-commits mailing list