Skip to content

Commit 5be8eee

Browse files
authored
iwyu.yml: use a distro which has the latest include-what-you-use / enabled Qt mappings / cleaned up includes (#4885)
1 parent 89a95dd commit 5be8eee

126 files changed

Lines changed: 548 additions & 186 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/iwyu.yml

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,39 @@ jobs:
1313
runs-on: ubuntu-22.04
1414

1515
container:
16-
image: "debian:unstable" # use latest debian image to get latest include-what-you-get
16+
image: "archlinux:latest"
1717

1818
steps:
1919
- uses: actions/checkout@v3
2020

2121
# TODO: the necessary packages are excessive - mostly because of Qt - use a pre-built image
22-
- name: Install missing software
22+
- name: Install missing software on debian/ubuntu
23+
if: false
2324
run: |
2425
apt-get update
2526
apt-get install -y cmake g++ make libpcre3-dev
2627
apt-get install -y qtbase5-dev qttools5-dev libqt5charts5-dev
2728
apt-get install -y wget iwyu
29+
ln -s ../x86_64-linux-gnu/qt5 /usr/include/qt
30+
31+
- name: Install missing software on archlinux
32+
run: |
33+
set -x
34+
pacman -Sy
35+
pacman -S cmake make gcc qt5-base qt5-tools qt5-charts pcre wget --noconfirm
36+
pacman-key --init
37+
pacman-key --recv-key FBA220DFC880C036 --keyserver keyserver.ubuntu.com
38+
pacman-key --lsign-key FBA220DFC880C036
39+
pacman -U 'https://cdn-mirror.chaotic.cx/chaotic-aur/chaotic-keyring.pkg.tar.zst' 'https://cdn-mirror.chaotic.cx/chaotic-aur/chaotic-mirrorlist.pkg.tar.zst' --noconfirm
40+
echo "[chaotic-aur]" >> /etc/pacman.conf
41+
echo "Include = /etc/pacman.d/chaotic-mirrorlist" >> /etc/pacman.conf
42+
pacman -Sy
43+
pacman -S include-what-you-use --noconfirm
44+
ln -s iwyu-tool /usr/sbin/iwyu_tool
2845
2946
- name: Prepare CMake
3047
run: |
31-
cmake -S . -B cmake.output -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DBUILD_TESTS=On -DBUILD_GUI=On -DWITH_QCHART=On -DENABLE_CHECK_INTERNAL=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=On -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCPPCHK_GLIBCXX_DEBUG=Off -DUSE_MATCHCOMPILER=Off
48+
cmake -S . -B cmake.output -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DWITH_QCHART=On -DENABLE_CHECK_INTERNAL=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=On -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCPPCHK_GLIBCXX_DEBUG=Off -DUSE_MATCHCOMPILER=Off
3249
3350
- name: Prepare CMake dependencies
3451
run: |
@@ -46,26 +63,27 @@ jobs:
4663
- name: Build Qt mappings
4764
run: |
4865
wget https://raw.githubusercontent.com/include-what-you-use/include-what-you-use/master/mapgen/iwyu-mapgen-qt.py
49-
python3 iwyu-mapgen-qt.py /usr/include/x86_64-linux-gnu/qt5/ > qt5.imp
66+
python3 iwyu-mapgen-qt.py /usr/include/qt/ > qt5.imp
5067
51-
# TODO: the mapping file causes a massive slowdown so we cannot use it at the moment.
52-
# add "-Xiwyu --mapping_file=qt5.imp" at the end of the whole command if we can use them.
5368
- name: iwyu_tool
5469
run: |
55-
# do not fail for now so the output is being saved
56-
iwyu_tool -p cmake.output -j $(nproc) -- -w > iwyu.log || true
70+
PWD=$(pwd)
71+
iwyu_tool -p cmake.output -j $(nproc) -- -w -Xiwyu --mapping_file=$PWD/qt5.imp > iwyu.log
5772
5873
- uses: actions/upload-artifact@v3
74+
if: success() || failure()
5975
with:
6076
name: Compilation Database
6177
path: ./cmake.output/compile_commands.json
6278

6379
- uses: actions/upload-artifact@v3
80+
if: success() || failure()
6481
with:
6582
name: Qt Mappings
6683
path: ./qt5.imp
6784

6885
- uses: actions/upload-artifact@v3
86+
if: success() || failure()
6987
with:
7088
name: Logs (include-what-you-use)
7189
path: ./*.log

Makefile

Lines changed: 97 additions & 97 deletions
Large diffs are not rendered by default.

cli/cppcheckexecutor.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
#include "library.h"
3030
#include "path.h"
3131
#include "pathmatch.h"
32-
#include "preprocessor.h"
3332
#include "settings.h"
3433
#include "suppressions.h"
3534
#include "utils.h"
@@ -42,7 +41,6 @@
4241
#endif
4342

4443
#include <algorithm>
45-
#include <atomic>
4644
#include <cstdio>
4745
#include <cstdlib> // EXIT_SUCCESS and EXIT_FAILURE
4846
#include <functional>

cli/executor.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,10 @@
2020

2121
#include "errorlogger.h"
2222
#include "settings.h"
23+
#include "suppressions.h"
2324

2425
#include <algorithm>
26+
#include <utility>
2527

2628
Executor::Executor(const std::map<std::string, std::size_t> &files, Settings &settings, ErrorLogger &errorLogger)
2729
: mFiles(files), mSettings(settings), mErrorLogger(errorLogger)

cli/threadexecutor.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,12 @@
1818

1919
#include "threadexecutor.h"
2020

21-
#include "color.h"
2221
#include "config.h"
2322
#include "cppcheck.h"
2423
#include "cppcheckexecutor.h"
2524
#include "errorlogger.h"
2625
#include "importproject.h"
2726
#include "settings.h"
28-
#include "suppressions.h"
2927

3028
#include <algorithm>
3129
#include <cstdlib>
@@ -39,6 +37,8 @@
3937
#include <utility>
4038
#include <vector>
4139

40+
enum class Color;
41+
4242
ThreadExecutor::ThreadExecutor(const std::map<std::string, std::size_t> &files, Settings &settings, ErrorLogger &errorLogger)
4343
: Executor(files, settings, errorLogger)
4444
{}

gui/aboutdialog.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020
#define ABOUT_DIALOG_H
2121

2222
#include <QDialog>
23+
#include <QObject>
2324
#include <QString>
2425

25-
class QObject;
2626
class QWidget;
2727
namespace Ui {
2828
class About;

gui/applicationdialog.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@
2424
#include "ui_applicationdialog.h"
2525

2626
#include <QDialogButtonBox>
27+
#include <QDir>
2728
#include <QFileDialog>
29+
#include <QLineEdit>
2830
#include <QMessageBox>
2931
#include <QPushButton>
3032

gui/applicationdialog.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020
#define APPLICATIONDIALOG_H
2121

2222
#include <QDialog>
23+
#include <QObject>
2324
#include <QString>
2425

25-
class QObject;
2626
class QWidget;
2727
class Application;
2828
namespace Ui {

gui/applicationlist.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include <QFileInfo>
2525
#include <QSettings>
2626
#include <QStringList>
27+
#include <QVariant>
2728

2829
ApplicationList::ApplicationList(QObject *parent) :
2930
QObject(parent),

gui/applicationlist.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@
2121

2222
#include "application.h"
2323

24+
#include <QList>
2425
#include <QObject>
26+
#include <QString>
2527

2628
/// @addtogroup GUI
2729
/// @{

0 commit comments

Comments
 (0)