[cfe-dev] Patch: reporting the full include graph for a C++ compilation unit
Lukács T. Berki
lberki at google.com
Tue May 10 07:57:43 PDT 2011
On second thought, I added line numbers to the output file, so that each
output line is now in the form of:
<including file> <line number> <included file>
Patch attached.
On Mon, May 9, 2011 at 6:24 PM, Lukács T. Berki <lberki at google.com> wrote:
>
>
> On Mon, May 9, 2011 at 4:39 PM, Douglas Gregor <dgregor at apple.com> wrote:
>
>>
>> On May 9, 2011, at 4:25 PM, Lukács T. Berki wrote:
>>
>> > Hello happy people,
>> >
>> > I created a small patch to Clang to allow the compiler to report the
>> full inclusion graph (i.e. a list of including file - included file) pairs.
>> Note that this is quite similar to the functionality of -H, with the
>> difference that this one reports also inclusions that are skipped because it
>> would have no effect due to include guards and that the output is written to
>> a file instead of stderr.
>> >
>> > The patch is in the attachment. What does it take to get this submitted
>> to Clang?
>>
>> Index: include/clang/Driver/CC1Options.td
>> ===================================================================
>> --- include/clang/Driver/CC1Options.td (revision 131087)
>> +++ include/clang/Driver/CC1Options.td (working copy)
>> @@ -200,6 +200,8 @@
>> HelpText<"Filename (or -) to write header include output to">;
>> def H : Flag<"-H">,
>> HelpText<"Show header includes and nesting depth">;
>> +def inclusion_graph_file : Separate<"-inclusion-graph-file">,
>> + HelpText<"Print the complete header inclusion graph to this file">;
>> def MQ : Separate<"-MQ">, HelpText<"Specify target to quote for
>> dependency">;
>> def MT : Separate<"-MT">, HelpText<"Specify target for dependency">;
>> def MP : Flag<"-MP">,
>>
>>
>> This is a -cc1-level option. Did you also mean to have it work through the
>> driver?
>>
> Yes! I admit I am quite unfamiliar with how Clang works, so I assumed that
> it was enough to do it only there. I threaded it through Driver, too.
>
>
>> If a path has spaces in it, you won't be able to tell where the first path
>> ends and the second path begins. You'll need to perform some escaping here.
>>
> Done. Note that there is small bug in DependencyFileCallback, whereupon
> backslashes in the file names are not escaped correctly (see
> DependencyFile:122). I guess this is to mimic GCC's behavior, though.
>
>
>>
>> Also, the FileManager doesn't necessarily use full paths. Did you want the
>> relative paths or full paths?
>>
> The same that are output by -dependency-file, so I copied the logic from
> there.
>
> New version of patch attached.
>
>
> Lukács
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20110510/9a6ce595/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: p3.patch
Type: application/octet-stream
Size: 8512 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20110510/9a6ce595/attachment.obj>
More information about the cfe-dev
mailing list