How to handle shared implementation header?

2 views
Skip to first unread message

zhang kai

unread,
Jul 24, 2022, 11:51:40 PMJul 24
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.

Thanks.

Kim Gräsman

unread,
Jul 25, 2022, 1:27:37 PMJul 25
to include-wh...@googlegroups.com
Hello,

You should be able to specify multiple mappings for a single header, see for example: https://github.com/include-what-you-use/include-what-you-use/blob/master/iwyu_include_picker.cc#L924.
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 include-what-you...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/include-what-you-use/60d29d92-6d1b-41e0-a9db-010705da4e36n%40googlegroups.com.

zhang kai

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