gbjie / include-what-you-use

Automatically exported from code.google.com/p/include-what-you-use
Other
0 stars 0 forks source link

Support for precompiled headers #167

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I would like some way to specify the precompiled header. From there, the 
following features would be useful:

- iwyu doesn't suggest that the pch include should be removed
- iwyu groups headers included by the pch immediately after the pch include
- option to ignore headers included by the pch

Original issue reported on code.google.com by bigwal...@gmail.com on 6 Jan 2015 at 8:02

GoogleCodeExporter commented 9 years ago
All this is already implemented; take a look at the --pch_in_code and 
--prefix_header_includes switches.

--pch_in_code says to assume the first #include line is a precompiled header 
(e.g. stdafx.h in the MSVC world).

--prefix_header_includes lets you choose what to do with includes and 
declarations that occur both in a PCH/prefix header and in the translation unit 
at large.

Let us know if this isn't working for you.

Original comment by kim.gras...@gmail.com on 6 Jan 2015 at 9:33

GoogleCodeExporter commented 9 years ago
Terrific, I didn't see that addition. Let me take a look.

Original comment by bigwal...@gmail.com on 6 Jan 2015 at 11:05

GoogleCodeExporter commented 9 years ago
It is working great, thanks! A couple questions: 

I would like to consume the output programatically. Is it possible to get the 
output in json or xml? If not, it's easy enough to parse as-is.

Related to this, I'd like to know which headers are from the prefix header. I 
think I can get this with some combination of add, edit, and remove modes and 
diffing the output, but it would be easier to have an option for it.

Original comment by bigwal...@gmail.com on 6 Jan 2015 at 11:26

GoogleCodeExporter commented 9 years ago
No, we don't have any alternative output formats. We've discussed this in the 
past (e.g. issue 107), but haven't had a chance to pursue it further.

We're trying to keep IWYU focused around just that -- include-what-you-use -- 
not a general-purpose include graph tool (though that might be nice, too!) 
Maybe it would be easier to build a separate tool to do this analysis. 
Everything that involves just the #includes (and not their relation to 
decls/uses) is vastly easier than what IWYU does. For inspiration, take a look 
at the iwyu_preprocessor (EnterFile, ExitFile, InclusionDirective), which I 
think does most of the work of collecting includes, header files and 
identifying the PCH/prefix header.

I'll close this issue as it appears to be working as intended, but feel free to 
bounce ideas on include-what-you-use@googlegroups.com.

Original comment by kim.gras...@gmail.com on 7 Jan 2015 at 6:25