r217792 - Teach Clang how to use response files when calling other tools

Reid Kleckner rnk at google.com
Fri Sep 19 17:35:36 PDT 2014


On Fri, Sep 19, 2014 at 3:54 PM, Sean Silva <chisophugis at gmail.com> wrote:

>
>
> On Thu, Sep 18, 2014 at 4:32 PM, Reid Kleckner <rnk at google.com> wrote:
>
>> On Thu, Sep 18, 2014 at 4:20 PM, Rafael EspĂ­ndola <
>> rafael.espindola at gmail.com> wrote:
>>>
>>> Now, there are 300_000 options in the response file, but adding a
>>> counter to ] llvm::opt::Option::matches shows that it is called about
>>> 349_802_000 times :-)
>>>
>>> Is this a now issue? Is it worth fixing?
>>>
>>
>> It's sort of a known issue, but only by inspection. If you've ever looked
>> at the driver, there are all these calls to getLastArg(ID), AddAllArgs(ID1,
>> ID2) and things of that nature. They *all* iterate the whole argument list.
>>
>> We could probably make this much more efficient by mapping the arguments
>> into a table indexed by option ID and doing lookup on that. We would still
>> need to preserve order information, though.
>>
>> I think when Daniel Dunbar wrote all this, everyone agreed that command
>> line parsing would never be hot, so it was done expediently and without
>> consideration for efficiency. Previously strings were not allocated form a
>> pool, they were merely malloc'd and leaked. The leaks aren't really that
>> bad, considering that the command line has to live for roughly the driver's
>> whole life.
>>
>
> Unless clang is being used as a library...
>

That was how things used to work. My understanding is that these were leaks
that had to be fixed.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140919/bdfbc6ec/attachment.html>


More information about the cfe-commits mailing list