[Development] Use what you include mapping file

Scott Bloom scott at towel42.com
Mon Oct 13 23:13:28 CEST 2025



-----Original Message-----
From: Samuel Gaist <samuel.gaist at idiap.ch> 
Sent: Monday, October 13, 2025 12:07
To: Scott Bloom <scott at towel42.com>
Cc: List for announcements regarding Qt releases and development via Announce via Development <development at qt-project.org>
Subject: Re: [Development] Use what you include mapping file

On 13 Oct 2025, at 19:14, Scott Bloom <scott at towel42.com> wrote:
> 
> As part of a pre-checkin “semi-lint” strategy (along with proper formatting etc), I am investigating the usage of the tool include-what-you-use.
>  https://github.com/include-what-you-use/include-what-you-use
>  Essentially, it confirms that both every source (and header) file includes every header directly to reduce the possibility of a compile break if a dependent header changes what it includes.
>  It also reports when you include something that you don’t need, reducing compile time and dependencies.
>  It supports mapping files, for when a file is intentionally supposed to be included transitively.  For instance, including <iostream> vs <iosfwd> will not report issues.
>  The problem is with Qt, every include is transitive.  You include <QComboBox> not <qcombobox.h> for instance.
>  Creating this mapping file by hand, as you could imagine would be unlikely to be complete (or correct).
>  My question, does this mapping file already exist somewhere? If so where?
> If not, would this be something that would ever be considered? To be frank, I don’t want to bother with the enhancement request if it will just sit in the dustbin of issues of low priority.
>  Thanks.
> 
> Scott
> -- 
> Development mailing list
> Development at qt-project.org
> https://lists.qt-project.org/listinfo/development

Hi,

Taking a look at the tool (thanks for the pointer, looks interesting), I saw that they already have some Qt 5 mapping files provided.

There’s also a python script named iwyu-mapgen-qt.py under the mapgen folder that could do what you want and create the file you are after for Qt 6.

Best regards

Samuel
=================
Thanks,

Ill take a look, I cant believe I missed it.  

My thoughts though, if it were run as part of the build, and supplied as part of the prebuilt installers,  it would always be up to day for peoples development environment based on the Qt they are pointing to.

Scott


More information about the Development mailing list