[PATCH] Header dependencies support for modularize

Manuel Klimek klimek at google.com
Thu Aug 22 01:17:09 PDT 2013


On Thu, Aug 22, 2013 at 12:57 AM, Sean Silva <silvas at purdue.edu> wrote:

>
>
>
> On Wed, Aug 21, 2013 at 8:48 AM, Thompson, John <
> John_Thompson at playstation.sony.com> wrote:
>
>>  Sean,****
>>
>> ** **
>>
>> (Sorry for the delay in getting back to you, I had a fire to put out
>> elsewhere.)****
>>
>> ** **
>>
>> >Is there no better way to do this? I think libOption should expose the
>> info you need.****
>>
>> ** **
>>
>> This would seem to have a prerequisite that ClangTooling have a OptTable
>> somewhere, but there doesn’t seem to be a connection.****
>>
>> ** **
>>
>> Now let’s suppose I get past that hurdle, either by creating one myself
>> and somehow coercing it to parse the arguments given to ArgumentsAdjuster,
>> how do I use libOption to walk the arguments and figure out which
>> command-line argument is the source file?
>>
>
> Maybe look at how the clang driver/frontend does it?
>

More specifically, CompilerInvocation::CreateFromArgs and ParseFrontendArgs.


> Ideally, tooling should have a mechanism to tell me what the source file
>> or files are for each command line in the compilation database.  I had a
>> much simpler version, but it required I modify ArgumentsAdjuster to be
>> given the source file, which the caller had handy, but I couldn’t get that
>> change through.
>>
>
> The JSON compilation databases have a "file" key which contains just the
> filename. Maybe that could help?
>

The problem is that that's not accessible at the point where the argument
adjuster is called (as that's decoupled).


>
> -- Sean Silva
>
>
>> ****
>>
>> ** **
>>
>> Could someone associated with tooling lend a hand and tell me how to get
>> the input file from the command lines in the compilation database?****
>>
>> ** **
>>
>> Otherwise, let’s live with the less-than-perfect solution so I can go on
>> to more important things.****
>>
>> ** **
>>
>> Thanks.****
>>
>> ** **
>>
>> -John****
>>
>> ** **
>>
>> ** **
>>
>> *From:* Sean Silva [mailto:silvas at purdue.edu]
>> *Sent:* Friday, August 16, 2013 10:59 PM
>> *To:* Thompson, John
>> *Cc:* cfe-commits at cs.uiuc.edu
>> *Subject:* Re: [PATCH] Header dependencies support for modularize****
>>
>> ** **
>>
>> +// The most common (but not all) options to modularize that take****
>>
>> +// an argument in the following slot.****
>>
>> +// Note: This needs to be kept in sync with new or removed Clang
>> arguments.****
>>
>> +// But hopefully modularize users won't need too many of these****
>>
>> +// kinds of arguments.****
>>
>> +const char *AddDependenciesAdjuster::OptionsWithArgument[] = {****
>>
>> ** **
>>
>> Is there no better way to do this? I think libOption should expose the
>> info you need.****
>>
>> ** **
>>
>> -- Sean Silva****
>>
>> ** **
>>
>> On Fri, Aug 16, 2013 at 8:42 AM, Thompson, John <
>> John_Thompson at playstation.sony.com> wrote:****
>>
>> A quick review anyone?****
>>
>>
>> Thanks.
>>
>> -John
>>
>> -----Original Message-----
>> From: cfe-commits-bounces at cs.uiuc.edu [mailto:
>> cfe-commits-bounces at cs.uiuc.edu] On Behalf Of John Thompson
>> Sent: Tuesday, August 13, 2013 11:11 AM
>> To: john.thompson.jtsoftware at gmail.com
>> Cc: cfe-commits at cs.uiuc.edu
>> Subject: [PATCH] Header dependencies support for modularize****
>>
>> In using modularize to check a large group of platform headers for
>> modules-readiness, I found that a few headers had dependencies, such that
>> they required other headers to be included first to avoid compile errors on
>> missing definitions.
>>
>> This patch adds support to modularize to allow specifying depended-on
>> headers in the header file list input to modularize, i.e.
>>
>> header.h: dependency1.h dependency2.h
>>
>>
>> http://llvm-reviews.chandlerc.com/D1383
>>
>> Files:
>>   test/modularize/NoProblemsDependencies.modularize
>>   test/modularize/Inputs/SomeOtherTypes.h
>>   test/modularize/Inputs/IsDependent.h
>>   modularize/Modularize.cpp****
>>
>> _______________________________________________
>> 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/20130822/45b4f461/attachment.html>


More information about the cfe-commits mailing list