From dfd0dd6d9be9a22eecd332ffcc9f88e44dbbaef5 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Fri, 24 Sep 2021 19:59:15 +0100 Subject: Pass IWYU test for slicer and tool --- Jamroot.jam | 1 + iwyu.json | 237 ++++++++++++++++++++++++++++++++++++++ slicer/slicer/hookMap.h | 6 +- slicer/slicer/modelParts.h | 5 +- slicer/slicer/modelPartsTypes.cpp | 21 +++- slicer/slicer/modelPartsTypes.h | 13 ++- slicer/slicer/serializer.h | 2 + slicer/slicer/slicer.cpp | 2 + slicer/slicer/slicer.h | 1 + slicer/tool/icemetadata.cpp | 4 +- slicer/tool/icemetadata.h | 7 +- slicer/tool/parser.cpp | 30 ++++- slicer/tool/parser.h | 6 + slicer/tool/slicer.cpp | 22 +++- 14 files changed, 345 insertions(+), 12 deletions(-) create mode 100644 iwyu.json diff --git a/Jamroot.jam b/Jamroot.jam index 63b7689..684df19 100644 --- a/Jamroot.jam +++ b/Jamroot.jam @@ -71,6 +71,7 @@ project tidy:__x86_64 tidy:boost tidy:std + tidy:iwyu.json ; build-project slicer ; diff --git a/iwyu.json b/iwyu.json new file mode 100644 index 0000000..81b7e04 --- /dev/null +++ b/iwyu.json @@ -0,0 +1,237 @@ +[ + { + "symbol": [ + "Glib::ustring", + "private", + "", + "public" + ] + }, + { + "symbol": [ + "@u?int\\d\\+_t", + "private", + "", + "public" + ] + }, + { + "symbol": [ + "boost::posix_time::time_duration", + "private", + "", + "public" + ] + }, + { + "include": [ + "", + "private", + "", + "public" + ] + }, + { + "include": [ + "@.field_types.h.", + "private", + "", + "public" + ] + }, + { + "include": [ + "@.mysql_time.h.", + "private", + "", + "public" + ] + }, + { + "symbol": [ + "free", + "private", + "", + "public" + ] + }, + { + "include": [ + "", + "private", + "", + "public" + ] + }, + { + "include": [ + "", + "private", + "", + "public" + ] + }, + { + "include": [ + "", + "private", + "", + "public" + ] + }, + { + "include": [ + "", + "private", + "", + "public" + ] + }, + { + "include": [ + "@", + "private", + "", + "public" + ] + }, + { + "include": [ + "@", + "private", + "", + "public" + ] + }, + { + "include": [ + "@", + "private", + "", + "public" + ] + }, + { + "include": [ + "@", + "private", + "", + "public" + ] + }, + { + "include": [ + "@", + "private", + "", + "public" + ] + }, + { + "include": [ + "@", + "private", + "", + "public" + ] + }, + { + "include": [ + "@", + "private", + "", + "public" + ] + }, + { + "include": [ + "@", + "private", + "", + "public" + ] + }, + { + "include": [ + "@", + "private", + "", + "public" + ] + }, + { + "include": [ + "@", + "private", + "", + "public" + ] + }, + { + "include": [ + "@", + "private", + "", + "public" + ] + }, + { + "include": [ + "@", + "private", + "", + "public" + ] + }, + { + "include": [ + "", + "private", + "", + "public" + ] + }, + { + "include": [ + "@", + "private", + "", + "public" + ] + }, + { + "include": [ + "@", + "private", + "", + "public" + ] + }, + { + "include": [ + "@", + "private", + "", + "public" + ] + }, + { + "symbol": [ + "std::filesystem", + "private", + "", + "public" + ] + }, + { + "include": [ + "@", + "private", + "", + "public" + ] + }, + { + "ref": "/usr/lib/llvm/12/share/include-what-you-use/boost-all-private.imp" + } +] diff --git a/slicer/slicer/hookMap.h b/slicer/slicer/hookMap.h index c1ea44a..bfced64 100644 --- a/slicer/slicer/hookMap.h +++ b/slicer/slicer/hookMap.h @@ -3,12 +3,16 @@ #include "modelParts.h" #include +#include +#include +#include +#include #include namespace Slicer { void DLL_PUBLIC to_lower(std::string s); - template class ModelPartForComplex; + template class ModelPartForComplex; // IWYU pragma: keep template class Hooks { public: using HookPtr = const typename ModelPartForComplex::HookBase *; diff --git a/slicer/slicer/modelParts.h b/slicer/slicer/modelParts.h index dd496ec..ac7aa4f 100644 --- a/slicer/slicer/modelParts.h +++ b/slicer/slicer/modelParts.h @@ -4,9 +4,10 @@ #include "metadata.h" #include #include +#include #include -#include -#include +#include +#include #include namespace Ice { diff --git a/slicer/slicer/modelPartsTypes.cpp b/slicer/slicer/modelPartsTypes.cpp index d859824..f69c96c 100644 --- a/slicer/slicer/modelPartsTypes.cpp +++ b/slicer/slicer/modelPartsTypes.cpp @@ -1,10 +1,29 @@ +#include "modelPartsTypes.h" +#include "common.h" +#include "modelParts.h" #include "modelPartsTypes.impl.h" -#include +#include +#include #include +#include #include #include #include +#include #include +#include +#include +#include +#include +#include +#include +// IWYU pragma: no_forward_declare boost::multi_index::member +// IWYU pragma: no_include + +namespace Ice { + class InputStream; + class OutputStream; +} namespace Slicer { using ClassRefMap = std::map>; diff --git a/slicer/slicer/modelPartsTypes.h b/slicer/slicer/modelPartsTypes.h index 9997144..9caac5f 100644 --- a/slicer/slicer/modelPartsTypes.h +++ b/slicer/slicer/modelPartsTypes.h @@ -2,8 +2,19 @@ #define SLICER_MODELPARTSTYPES_H #include "modelParts.h" -#include #include +#include +#include +#include +#include +#include +#include +#include + +namespace Ice { + class InputStream; + class OutputStream; +} namespace Slicer { template struct isLocal { diff --git a/slicer/slicer/serializer.h b/slicer/slicer/serializer.h index 75df79a..cb0a591 100644 --- a/slicer/slicer/serializer.h +++ b/slicer/slicer/serializer.h @@ -4,6 +4,8 @@ #include #include #include +#include +#include #include #include diff --git a/slicer/slicer/slicer.cpp b/slicer/slicer/slicer.cpp index 1d5118c..b36d6c6 100644 --- a/slicer/slicer/slicer.cpp +++ b/slicer/slicer/slicer.cpp @@ -1,6 +1,8 @@ #include "slicer.h" +#include "slicer/modelParts.h" #include #include +#include namespace Slicer { Slicer::ChildRef::ChildRef() : mpp(), mdr(emptyMetadata) { } diff --git a/slicer/slicer/slicer.h b/slicer/slicer/slicer.h index dcab8b3..4bf0681 100644 --- a/slicer/slicer/slicer.h +++ b/slicer/slicer/slicer.h @@ -1,6 +1,7 @@ #ifndef SLICER_H #define SLICER_H +#include #include #include diff --git a/slicer/tool/icemetadata.cpp b/slicer/tool/icemetadata.cpp index b575707..69709a1 100644 --- a/slicer/tool/icemetadata.cpp +++ b/slicer/tool/icemetadata.cpp @@ -1,5 +1,7 @@ #include "icemetadata.h" -#include +#include "metadata.h" +#include +// IWYU pragma: no_include namespace Slicer { IceMetaData::IceMetaData(Slice::StringList && a) diff --git a/slicer/tool/icemetadata.h b/slicer/tool/icemetadata.h index bd00686..ad396b5 100644 --- a/slicer/tool/icemetadata.h +++ b/slicer/tool/icemetadata.h @@ -3,8 +3,13 @@ #include #include -#include +#include #include +#include +#include +#include +#include +#include namespace Slicer { class DLL_PUBLIC IceMetaData : public MetaData { diff --git a/slicer/tool/parser.cpp b/slicer/tool/parser.cpp index aedeab8..d0bf601 100644 --- a/slicer/tool/parser.cpp +++ b/slicer/tool/parser.cpp @@ -1,14 +1,40 @@ #include "parser.h" +#include "icemetadata.h" +#include #include #include #include +#include #include -#include +#include +#include #include #include +#include +#include #include +#include +#include +#include #include +#include +#include +#include +#include +#include #include +#include +#include +#include +#include +#include +// IWYU pragma: no_include +// IWYU pragma: no_include +// IWYU pragma: no_include +// IWYU pragma: no_include +// IWYU pragma: no_include +// IWYU pragma: no_include +// IWYU pragma: no_include namespace fs = std::filesystem; @@ -737,7 +763,7 @@ namespace Slicer { } catch (...) { if (!cppPath.empty()) { - unlink(cppPath.c_str()); + std::filesystem::remove(cppPath); } throw; } diff --git a/slicer/tool/parser.h b/slicer/tool/parser.h index 4335d1d..a784d7a 100644 --- a/slicer/tool/parser.h +++ b/slicer/tool/parser.h @@ -3,8 +3,14 @@ #include "icemetadata.h" #include +#include #include +#include +#include +#include +#include #include +// IWYU pragma: no_include namespace Slicer { class SplitString : public std::vector { diff --git a/slicer/tool/slicer.cpp b/slicer/tool/slicer.cpp index a256bda..1a83519 100644 --- a/slicer/tool/slicer.cpp +++ b/slicer/tool/slicer.cpp @@ -1,8 +1,24 @@ -#include +#include "parser.h" +#include +#include +#include #include #include -#include -#include +#include +#include +#include +#include +#include +// IWYU pragma: no_include +// IWYU pragma: no_include +// IWYU pragma: no_include +// IWYU pragma: no_include +// IWYU pragma: no_include +// IWYU pragma: no_include +// IWYU pragma: no_include +// IWYU pragma: no_include +// IWYU pragma: no_include +// IWYU pragma: no_include namespace po = boost::program_options; using namespace AdHoc::literals; -- cgit v1.2.3