How to handle shared implementation header?

Skip to first unread message

zhang kai

Jul 24, 2022, 11:51:40 PM7/24/22
to include-what-you-use
Hi, I'm new to include-what-you-use. It's a wonderful tool! One little problem I encounter is that iwyu sometimes suggest adding a shared implementation header. Since it is shared between multiple public headers, I can't simply map it to one of the public headers.

For example, in libcxx, there is a header file <__tree> shared between <map> and <set>. Is there a way I can tell iwyu do not include <__tree> if <map> or <set> already included? Also I can't change the libcxx code.


Kim Gräsman

Jul 25, 2022, 1:27:37 PM7/25/22

You should be able to specify multiple mappings for a single header, see for example:
I think they're suggested in the order specified, and should be satisfied with either public header already being available.

There are several confusing issues and weaknesses here, so be careful :-)

- Kim

You received this message because you are subscribed to the Google Groups "include-what-you-use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web visit

zhang kai

Jul 25, 2022, 1:48:13 PM7/25/22
to include-what-you-use
Thanks! It works.
Reply all
Reply to author
0 new messages