Open GoogleCodeExporter opened 9 years ago
Have you seen https://code.google.com/p/include-what-you-use/wiki/IWYUMappings?
The mapping files were intended to solve exactly this problem.
Original comment by kim.gras...@gmail.com
on 9 Feb 2014 at 1:01
Actually after raising the issue I indeed noticed the mapping file and played
with it, but I could not really achieve what I wanted.
Not sure if the mapping file has preference above internal mappings
Also I could not find how to define a mapping for export (also not in the wiki)
This seems to be closest, but I could not get it to work:
{ include: ["<bits/unique_ptr.h>", "private", "<memory>", "public"] }
Also in this example I was not sure how to deal with header files that used " "
instead of < >
Original comment by fransmeu...@gmail.com
on 10 Feb 2014 at 2:46
The mapping files are applied on top of the internal mappings (unless you also
specify -Xiwyu --no_default_mappings, in which case the internal mappings are
pruned.)
Unfortunately there is no external syntax for export. Sometimes it can be
achieved with a mapping, but not always (e.g. selective export). Maybe we
should look into a syntax for describing exports as well.
In mapping files, escape quotes with \, so something like:
{ include: ["\"foo.h\"", "private", "\"bar.h\"", "public"] }
Please post back with more concrete details and maybe we can figure something
out.
Original comment by kim.gras...@gmail.com
on 10 Feb 2014 at 7:27
Ah, ok, thanks for the suggestion wrt the \"
Actually ideally (at least in a C world) one probably does not want to treat
quotes and angled brackets much differently.
I for me, I prefer angled brackets where possible. It is a little bit faster as
the compiler does not need to search in the current dir.
The concrete issue I am facing is:
We have code that needs to work on windows as well as linux, and at some point
it was decided to create a file platform.h as a facade to hide some os specific
includes. So basically platform.h has an #ifdef/#else/#endif with some
#includes in it.
I could add pragma's to the file, but I would prefer not to touch the file and
instead specify it in a mapping file (also as we have a few of those facade
files for different purposes).
Original comment by fransmeu...@gmail.com
on 12 Feb 2014 at 8:07
Yes, I'm also a little suspicious wrt angled vs quoted includes, I don't really
understand why they've been given such significance in IWYU.
Would it work if you added a mapping file to map all detail haeders to
platform.h?
Original comment by kim.gras...@gmail.com
on 12 Feb 2014 at 8:15
I think that would indeed help.
(not sure if the project review will accept annotations in the project facade
files).
For now I created a small script that adds begin-exports and end-exports around
the facade files locally.
Original comment by fransmeu...@gmail.com
on 12 Feb 2014 at 8:23
Original issue reported on code.google.com by
fransmeu...@gmail.com
on 9 Feb 2014 at 12:41Attachments: