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 <vmiklos@collabora.com>
Tested-by: Jenkins
This commit is contained in:
Gabor Kelemen
2025-10-30 10:07:22 +01:00
committed by Miklos Vajna
parent 92e2869fc6
commit ccfebc2718
7 changed files with 30 additions and 0 deletions
+7
View File
@@ -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
+7
View File
@@ -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
@@ -56,6 +56,7 @@
#include <unoidx.hxx>
#include <unobookmark.hxx>
#include <unofield.hxx>
#include <unoframe.hxx>
#include <map>
class SwXTextDocument;
@@ -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 {
@@ -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>
@@ -17,6 +17,7 @@
#include "PropertyIds.hxx"
#include <oox/helper/grabbagstack.hxx>
#include <ooxml/resourceids.hxx>
#include <docmodel/uno/UnoComplexColor.hxx>
#include <memory>
+5
View File
@@ -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