Can IWYU use forward declarations in header, but full includes in cpp?

15 views
Skip to first unread message

Jo Huang

unread,
Jul 30, 2025, 3:03:09 AMJul 30
to include-what-you-use

Hello,


I hope this is the right place to ask.


I’m wondering if IWYU can support this kind of behavior:

  • In header files, I want to use forward declarations to keep includes minimal.

  • In cpp files, I prefer to use full includes to make things simple.


From what I see, IWYU applies the same rules to both .h and .cpp files.

Is it possible to configure them separately?


Thank you very much for your help!

Andrey Bolshakov

unread,
Aug 1, 2025, 11:31:26 AMAug 1
to include-wh...@googlegroups.com
I think the problem here is that IWYU suggests forward-declarations in .cpp-files which is almost definitely useless and thus annoying. Currently, it is not configurable, but patches are welcome!

Andrey Bolshakov a.k.a. Ali Khan


ср, 30 июл. 2025 г. в 10:03, Jo Huang <joap...@gmail.com>:
--
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 visit https://groups.google.com/d/msgid/include-what-you-use/16907115-fc7d-4857-9555-a1f21e2e1a26n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages