added an include-what-you-use GitHub Action (#3759)

This commit is contained in:
Oliver Stöneberg 2022-02-01 17:19:19 +01:00 committed by GitHub
parent 0807924d32
commit 8f7770f512
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 83 additions and 17 deletions

63
.github/workflows/iwyu.yml vendored Normal file
View File

@ -0,0 +1,63 @@
# Syntax reference https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions
# Environment reference https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners
name: include-what-you-use
on: workflow_dispatch
jobs:
build:
runs-on: ubuntu-20.04
container:
image: "kalilinux/kali-rolling"
steps:
- uses: actions/checkout@v2
# TODO: the necessary packages are excessive - mostly because of Qt - use a pre-built image
- name: Install missing software
run: |
apt-get update
apt-get install -y cmake g++ make libz3-dev libpcre3-dev
apt-get install -y qtbase5-dev qttools5-dev libqt5charts5-dev
apt-get install -y wget iwyu
- name: Prepare CMake
run: |
mkdir cmake.output
cd cmake.output
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DUSE_Z3=On -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DBUILD_TESTS=On -DBUILD_GUI=On -DWITH_QCHART=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=On -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCPPCHK_GLIBCXX_DEBUG=Off -DUSE_MATCHCOMPILER=Off ..
cd ..
- name: Prepare CMake dependencies
run: |
# make sure the precompiled headers exist
#make -C cmake.output lib/CMakeFiles/lib_objs.dir/cmake_pch.hxx.cxx
#make -C cmake.output test/CMakeFiles/testrunner.dir/cmake_pch.hxx.cxx
# make sure the auto-generated GUI sources exist
make -C cmake.output autogen
# make sure the auto-generated GUI dependencies exist
make -C cmake.output gui-build-deps
- name: Build Qt mappings
run: |
wget https://raw.githubusercontent.com/include-what-you-use/include-what-you-use/master/mapgen/iwyu-mapgen-qt.py
python3 iwyu-mapgen-qt.py /usr/include/x86_64-linux-gnu/qt5/ > qt5.imp
# TODO: the mapping file causes a massive slowdown so we cannot use it at the moment.
# add "-Xiwyu --mapping_file=qt5.imp" at the end of the whole command if we can use them.
- name: iwyu_tool
run: |
# do not fail for now so the output is being saved
iwyu_tool -p cmake.output -j $(nproc) -- -w > iwyu.log || true
- uses: actions/upload-artifact@v2
with:
name: Qt Mappings
path: ./qt5.imp
- uses: actions/upload-artifact@v2
with:
name: Logs
path: ./*.log

View File

@ -62,8 +62,7 @@
# include <ucontext.h>
#endif
#ifdef __linux__
#include <sys/syscall.h>
#include <sys/types.h>
#include <syscall.h>
#endif
#endif

View File

@ -59,15 +59,15 @@
*/
#include "errortypes.h"
#include "cppcheckexecutor.h"
#ifdef NDEBUG
#include "errortypes.h"
#include <cstdlib>
#include <exception>
#include <string>
#ifdef NDEBUG
#include <iostream>
#include <string>
#endif
#ifdef _WIN32

View File

@ -38,6 +38,7 @@
#ifdef __SVR4 // Solaris
#include <sys/loadavg.h>
#endif
#ifdef THREADING_MODEL_FORK
#if defined(__linux__)
#include <sys/prctl.h>
@ -45,8 +46,10 @@
#include <sys/select.h>
#include <sys/wait.h>
#include <fcntl.h>
#include <csignal>
#include <unistd.h>
#endif
#ifdef THREADING_MODEL_WIN
#include <future>
#include <numeric>

View File

@ -27,12 +27,13 @@
#include <cstdlib>
#include <cstring>
#include <exception>
#include <fstream>
#include <fstream> // IWYU pragma: keep
#include <iostream>
#include <limits>
#include <sstream>
#include <sstream> // IWYU pragma: keep
#include <stack>
#include <stdexcept>
#include <type_traits>
#include <utility>
#ifdef SIMPLECPP_WINDOWS

View File

@ -25,7 +25,7 @@
#include <tinyxml2.h>
#include <cstring>
#include <map>
#include <sstream>
#include <sstream> // IWYU pragma: keep
AnalyzerInformation::~AnalyzerInformation()
{

View File

@ -40,7 +40,6 @@
#include <memory>
#include <ostream>
#include <set>
#include <type_traits>
#include <utility>
#include <numeric>

View File

@ -22,7 +22,7 @@
#include <unistd.h>
#endif
#include <cstddef>
#include <sstream>
#include <sstream> // IWYU pragma: keep
#ifdef _WIN32
std::ostream& operator<<(std::ostream& os, const Color& /*c*/)

View File

@ -24,6 +24,7 @@
#include "path.h"
#include "token.h"
#include "tokenlist.h"
#include "utils.h"
#include <algorithm>
#include <array>

View File

@ -29,7 +29,7 @@
#include <algorithm>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <fstream> // IWYU pragma: keep
#include <iostream>
#include <iterator>

View File

@ -27,6 +27,7 @@
#include <memory>
#include <string>
#include <tuple>
#include <type_traits>
const Scope* PathAnalysis::findOuterScope(const Scope * scope)
{

View File

@ -35,7 +35,6 @@
#include <list>
#include <memory>
#include <string>
#include <type_traits>
#include <utility>
#include <vector>

View File

@ -33,7 +33,6 @@
#include <map>
#include <memory>
#include <stack>
#include <type_traits>
#include <utility>
static Token *skipRequires(Token *tok)

View File

@ -16,17 +16,18 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "errortypes.h"
#include "options.h"
#include "preprocessor.h"
#include "testsuite.h"
#include <cstdlib>
#include <exception>
#include <string>
#ifdef NDEBUG
#include "errortypes.h" // for InternalError
#include <exception>
#include <iostream>
#include <string>
#endif
int main(int argc, char *argv[])