bin/find-unneeded-includes                           |    7 +++++++
 sw/IwyuFilter_sw.yaml                                |    7 +++++++
 sw/source/writerfilter/dmapper/DomainMapper_Impl.hxx |    1 +
 sw/source/writerfilter/dmapper/GraphicImport.hxx     |    7 +++++++
 sw/source/writerfilter/dmapper/PropertyMap.hxx       |    2 ++
 sw/source/writerfilter/dmapper/ThemeColorHandler.hxx |    1 +
 vcl/IwyuFilter_vcl.yaml                              |    5 +++++
 7 files changed, 30 insertions(+)

New commits:
commit ccfebc2718c2feb8324a4d6abbd45935dcdcc597
Author:     Gabor Kelemen <[email protected]>
AuthorDate: Thu Oct 16 19:41:18 2025 +0200
Commit:     Miklos Vajna <[email protected]>
CommitDate: Thu Oct 30 10:07:22 2025 +0100

    bin/find-unneeded-includes: add assumeDirs support in yaml file
    
    There are cases when a modules certain header files need
    some other include search path than the single assumeFile provides
    
    This is visible when one runs in the --finderrors mode
    and the detailed IWYU run complains like:
    
    include/oox/export/drawingml.hxx:39:10: fatal error: 'oox/token/tokens.hxx' 
file not found
    
    Solve this by introducing assumeDirs in the yaml files, which provides
    a different assumeFile for headers in certain directories
    
    Demo on vcl/inc/qt[56] and sw/source/writerfilter;
    also with fixing the few identified non-self contained headers there
    
    Change-Id: Idf7cc38fe7d96d89dabcad9d5abd65283622ab96
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/192748
    Reviewed-by: Miklos Vajna <[email protected]>
    Tested-by: Jenkins

diff --git a/bin/find-unneeded-includes b/bin/find-unneeded-includes
index 3f9d3bfeccc5..2dafa002b4cc 100755
--- a/bin/find-unneeded-includes
+++ b/bin/find-unneeded-includes
@@ -539,6 +539,13 @@ def tidy(compileCommands, paths, dontstop, noexclude, 
checknamespaces, finderror
                 # code on Linux.
                 if "assumeFilename" in moduleRules.keys() and not 
path.endswith("cxx"):
                     assume = moduleRules["assumeFilename"]
+                    # Check for lower level assume file name
+                    if "customAssumeFilenames" in moduleRules:
+                        customAssumeRules = 
moduleRules["customAssumeFilenames"]
+                        for dirName in customAssumeRules.keys():
+                            if path.startswith(dirName):
+                                assume = customAssumeRules[dirName]
+
                 if assume:
                     assumeAbs = os.path.abspath(assume)
                     compileFile = assumeAbs
diff --git a/sw/IwyuFilter_sw.yaml b/sw/IwyuFilter_sw.yaml
index 0b0da76f296d..b6aef2298de8 100644
--- a/sw/IwyuFilter_sw.yaml
+++ b/sw/IwyuFilter_sw.yaml
@@ -1,5 +1,12 @@
 ---
 assumeFilename: sw/source/core/doc/docnew.cxx
+customAssumeFilenames:
+    # Need -I/.../sw/source/writerfilter/inc
+    sw/source/writerfilter: sw/source/writerfilter/dmapper/DomainMapper.cxx
+    # Need -I/.../workdir/UnpackedTarball/cppunit/include to work
+    sw/qa/inc: sw/qa/core/test_ToxMiscTest.cxx
+    # Needs -I/...workdir/CustomTarget/oox/generated
+    sw/source/filter/ww8: sw/source/filter/ww8/docxattributeoutput.cxx
 excludelist:
     sw/sdi/swslots.hrc:
     # Needed for sdi files to compile
diff --git a/sw/source/writerfilter/dmapper/DomainMapper_Impl.hxx 
b/sw/source/writerfilter/dmapper/DomainMapper_Impl.hxx
index b6d3df34e79a..79fcc0ba1937 100644
--- a/sw/source/writerfilter/dmapper/DomainMapper_Impl.hxx
+++ b/sw/source/writerfilter/dmapper/DomainMapper_Impl.hxx
@@ -56,6 +56,7 @@
 #include <unoidx.hxx>
 #include <unobookmark.hxx>
 #include <unofield.hxx>
+#include <unoframe.hxx>
 #include <map>
 
 class SwXTextDocument;
diff --git a/sw/source/writerfilter/dmapper/GraphicImport.hxx 
b/sw/source/writerfilter/dmapper/GraphicImport.hxx
index 6db245f1cbbf..0721988327cd 100644
--- a/sw/source/writerfilter/dmapper/GraphicImport.hxx
+++ b/sw/source/writerfilter/dmapper/GraphicImport.hxx
@@ -20,6 +20,7 @@
 
 #include <queue>
 #include <memory>
+#include <optional>
 
 #include "LoggedResources.hxx"
 #include "WrapPolygonHandler.hxx"
@@ -29,6 +30,12 @@
 #include <com/sun/star/graphic/XGraphic.hpp>
 #include <com/sun/star/drawing/ColorMode.hpp>
 #include <com/sun/star/text/GraphicCrop.hpp>
+#include <com/sun/star/text/WrapTextMode.hpp>
+
+#include <comphelper/sequenceashashmap.hxx>
+#include <rtl/ref.hxx>
+
+#include <unotxdoc.hxx>
 
 class SwXTextGraphicObject;
 namespace com::sun::star {
diff --git a/sw/source/writerfilter/dmapper/PropertyMap.hxx 
b/sw/source/writerfilter/dmapper/PropertyMap.hxx
index 3424c5143d58..ad066ecf5d6a 100644
--- a/sw/source/writerfilter/dmapper/PropertyMap.hxx
+++ b/sw/source/writerfilter/dmapper/PropertyMap.hxx
@@ -31,6 +31,8 @@
 #include <com/sun/star/drawing/XShape.hpp>
 #include "PropertyIds.hxx"
 #include <unofootnote.hxx>
+#include <unoxstyle.hxx>
+
 #include <memory>
 #include <optional>
 #include <map>
diff --git a/sw/source/writerfilter/dmapper/ThemeColorHandler.hxx 
b/sw/source/writerfilter/dmapper/ThemeColorHandler.hxx
index 49d7db20674f..da23f8a55d3a 100644
--- a/sw/source/writerfilter/dmapper/ThemeColorHandler.hxx
+++ b/sw/source/writerfilter/dmapper/ThemeColorHandler.hxx
@@ -17,6 +17,7 @@
 #include "PropertyIds.hxx"
 
 #include <oox/helper/grabbagstack.hxx>
+#include <ooxml/resourceids.hxx>
 #include <docmodel/uno/UnoComplexColor.hxx>
 
 #include <memory>
diff --git a/vcl/IwyuFilter_vcl.yaml b/vcl/IwyuFilter_vcl.yaml
index 7a9cbdd992b8..90bf28408d13 100644
--- a/vcl/IwyuFilter_vcl.yaml
+++ b/vcl/IwyuFilter_vcl.yaml
@@ -1,5 +1,10 @@
 ---
 assumeFilename: vcl/source/app/svapp.cxx
+customAssumeFilenames:
+    # Needs -isystem /usr/include/x86_64-linux-gnu/qt5
+    vcl/inc/qt5: vcl/qt5/QtInstance.cxx
+    # Needs -isystem /usr/include/x86_64-linux-gnu/qt6
+    vcl/inc/qt6: vcl/qt6/QtInstance.cxx
 excludelist:
     vcl/inc/unx/saldisp.hxx:
     # Don't replace with generated header

Reply via email to