diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2021-09-24 19:59:15 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2021-09-24 19:59:15 +0100 |
commit | dfd0dd6d9be9a22eecd332ffcc9f88e44dbbaef5 (patch) | |
tree | b22326266bc280046eedb7054b3cc30ce993d1ca | |
parent | Pass cppcheck (diff) | |
download | slicer-dfd0dd6d9be9a22eecd332ffcc9f88e44dbbaef5.tar.bz2 slicer-dfd0dd6d9be9a22eecd332ffcc9f88e44dbbaef5.tar.xz slicer-dfd0dd6d9be9a22eecd332ffcc9f88e44dbbaef5.zip |
Pass IWYU test for slicer and tool
-rw-r--r-- | Jamroot.jam | 1 | ||||
-rw-r--r-- | iwyu.json | 237 | ||||
-rw-r--r-- | slicer/slicer/hookMap.h | 6 | ||||
-rw-r--r-- | slicer/slicer/modelParts.h | 5 | ||||
-rw-r--r-- | slicer/slicer/modelPartsTypes.cpp | 21 | ||||
-rw-r--r-- | slicer/slicer/modelPartsTypes.h | 13 | ||||
-rw-r--r-- | slicer/slicer/serializer.h | 2 | ||||
-rw-r--r-- | slicer/slicer/slicer.cpp | 2 | ||||
-rw-r--r-- | slicer/slicer/slicer.h | 1 | ||||
-rw-r--r-- | slicer/tool/icemetadata.cpp | 4 | ||||
-rw-r--r-- | slicer/tool/icemetadata.h | 7 | ||||
-rw-r--r-- | slicer/tool/parser.cpp | 30 | ||||
-rw-r--r-- | slicer/tool/parser.h | 6 | ||||
-rw-r--r-- | slicer/tool/slicer.cpp | 22 |
14 files changed, 345 insertions, 12 deletions
diff --git a/Jamroot.jam b/Jamroot.jam index 63b7689..684df19 100644 --- a/Jamroot.jam +++ b/Jamroot.jam @@ -71,6 +71,7 @@ project <toolset>tidy:<define>__x86_64 <toolset>tidy:<librarydef>boost <toolset>tidy:<librarydef>std + <toolset>tidy:<mapping>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", + "<glibmm/ustring.h>", + "public" + ] + }, + { + "symbol": [ + "@u?int\\d\\+_t", + "private", + "<cstdint>", + "public" + ] + }, + { + "symbol": [ + "boost::posix_time::time_duration", + "private", + "<boost/date_time/posix_time/posix_time.hpp>", + "public" + ] + }, + { + "include": [ + "<bits/types/stack_t.h>", + "private", + "<ucontext.h>", + "public" + ] + }, + { + "include": [ + "@.field_types.h.", + "private", + "<mysql.h>", + "public" + ] + }, + { + "include": [ + "@.mysql_time.h.", + "private", + "<mysql.h>", + "public" + ] + }, + { + "symbol": [ + "free", + "private", + "<cstdlib>", + "public" + ] + }, + { + "include": [ + "<boost/cstdint.hpp>", + "private", + "<cstdint>", + "public" + ] + }, + { + "include": [ + "<ext/alloc_traits.h>", + "private", + "<memory>", + "public" + ] + }, + { + "include": [ + "<bits/struct_stat.h>", + "private", + "<sys/stat.h>", + "public" + ] + }, + { + "include": [ + "<bits/exception.h>", + "private", + "<stdexcept>", + "public" + ] + }, + { + "include": [ + "@<boost/test/(unit_test_suite|framework).hpp>", + "private", + "<boost/test/unit_test.hpp>", + "public" + ] + }, + { + "include": [ + "@<boost/test/(utils|tools|tree)/.*>", + "private", + "<boost/test/unit_test.hpp>", + "public" + ] + }, + { + "include": [ + "@<boost/format/(format_(class|implementation)|alt_sstream).hpp>", + "private", + "<boost/format.hpp>", + "public" + ] + }, + { + "include": [ + "@<boost/test/data/.*>", + "private", + "<boost/test/data/test_case.hpp>", + "public" + ] + }, + { + "include": [ + "@<boost/mpl/.*>", + "private", + "<boost/mpl/list.hpp>", + "public" + ] + }, + { + "include": [ + "@<boost/iostreams/detail/.*>", + "private", + "<boost/iostreams/stream.hpp>", + "public" + ] + }, + { + "include": [ + "@<boost/date_time/gregorian/.*>", + "private", + "<boost/date_time/gregorian_calendar.hpp>", + "public" + ] + }, + { + "include": [ + "@<boost/date_time/time_.*>", + "private", + "<boost/date_time/time.hpp>", + "public" + ] + }, + { + "include": [ + "@<boost/date_time/posix_time/posix_time_.*>", + "private", + "<boost/date_time/posix_time/posix_time.hpp>", + "public" + ] + }, + { + "include": [ + "@<boost/date_time/posix_time/(ptime|conversion|time_(formatt|pars)ers).hpp>", + "private", + "<boost/date_time/posix_time/posix_time.hpp>", + "public" + ] + }, + { + "include": [ + "@<boost/preprocessor/.*>", + "private", + "<boost/test/unit_test.hpp>", + "public" + ] + }, + { + "include": [ + "@<boost/lexical_cast/.*>", + "private", + "<boost/lexical_cast.hpp>", + "public" + ] + }, + { + "include": [ + "<boost/algorithm/string/detail/finder.hpp>", + "private", + "<boost/algorithm/string/finder.hpp>", + "public" + ] + }, + { + "include": [ + "@<boost/program_options/.*>", + "private", + "<boost/program_options.hpp>", + "public" + ] + }, + { + "include": [ + "@<boost/multi_index/detail/index.*>", + "private", + "<boost/multi_index/ordered_index.hpp>", + "public" + ] + }, + { + "include": [ + "@<boost/multi_index/detail/ord.*>", + "private", + "<boost/multi_index/ordered_index.hpp>", + "public" + ] + }, + { + "symbol": [ + "std::filesystem", + "private", + "<filesystem>", + "public" + ] + }, + { + "include": [ + "@<boost/multi_index/detail/bidir.*>", + "private", + "<boost/multi_index_container.hpp>", + "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 <array> +#include <cstddef> +#include <iterator> +#include <string> +#include <string_view> #include <visibility.h> namespace Slicer { void DLL_PUBLIC to_lower(std::string s); - template<typename T> class ModelPartForComplex; + template<typename T> class ModelPartForComplex; // IWYU pragma: keep template<typename T> class Hooks { public: using HookPtr = const typename ModelPartForComplex<T>::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 <Ice/Config.h> #include <functional> +#include <memory> #include <optional> -#include <stdexcept> -#include <vector> +#include <string> +#include <string_view> #include <visibility.h> 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 <boost/algorithm/string/case_conv.hpp> +#include <Ice/Config.h> +#include <Ice/Optional.h> #include <boost/algorithm/string/predicate.hpp> +#include <boost/multi_index/indexed_by.hpp> #include <boost/multi_index/member.hpp> #include <boost/multi_index/ordered_index.hpp> #include <boost/multi_index_container.hpp> +#include <cstdlib> #include <cxxabi.h> +#include <functional> +#include <map> +#include <memory> +#include <string> +#include <string_view> +#include <utility> +// IWYU pragma: no_forward_declare boost::multi_index::member +// IWYU pragma: no_include <boost/operators.hpp> + +namespace Ice { + class InputStream; + class OutputStream; +} namespace Slicer { using ClassRefMap = std::map<std::string, ClassRef, std::less<>>; 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 <Ice/ObjectF.h> #include <Ice/Optional.h> +#include <cstddef> +#include <functional> +#include <memory> +#include <optional> +#include <string> +#include <string_view> +#include <visibility.h> + +namespace Ice { + class InputStream; + class OutputStream; +} namespace Slicer { template<typename T> 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 <c++11Helpers.h> #include <factory.h> #include <filesystem> +#include <iosfwd> +#include <memory> #include <slicer/modelParts.h> #include <visibility.h> 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 <common.h> #include <compileTimeFormatter.h> +#include <utility> 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 <memory> #include <slicer/modelParts.h> #include <slicer/serializer.h> 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 <boost/algorithm/string/predicate.hpp> +#include "metadata.h" +#include <algorithm> +// IWYU pragma: no_include <list> 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 <Slice/Parser.h> #include <c++11Helpers.h> -#include <list> +#include <cstddef> #include <metadata.h> +#include <string> +#include <string_view> +#include <utility> +#include <vector> +#include <visibility.h> namespace Slicer { class DLL_PUBLIC IceMetaData : public MetaData<false, std::string> { 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 <IceUtil/Handle.h> #include <Slice/CPlusPlusUtil.h> #include <Slice/Parser.h> #include <Slice/Preprocessor.h> +#include <algorithm> #include <boost/algorithm/string/case_conv.hpp> -#include <boost/algorithm/string/predicate.hpp> +#include <boost/algorithm/string/classification.hpp> +#include <boost/algorithm/string/constants.hpp> #include <boost/algorithm/string/split.hpp> #include <boost/algorithm/string/trim.hpp> +#include <boost/format.hpp> +#include <cctype> #include <common.h> +#include <cstdio> +#include <cstdlib> +#include <filesystem> #include <fprintbf.h> +#include <iterator> +#include <list> +#include <memory> +#include <optional> +#include <ostream> #include <safeMapFind.h> +#include <set> +#include <string> +#include <string_view> +#include <utility> +#include <vector> +// IWYU pragma: no_include <boost/algorithm/string/detail/classification.hpp> +// IWYU pragma: no_include <boost/function/function_base.hpp> +// IWYU pragma: no_include <boost/iterator/iterator_facade.hpp> +// IWYU pragma: no_include <boost/iterator/iterator_traits.hpp> +// IWYU pragma: no_include <boost/range/begin.hpp> +// IWYU pragma: no_include <boost/range/end.hpp> +// IWYU pragma: no_include <boost/type_index/type_index_facade.hpp> 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 <Slice/Parser.h> +#include <cstdio> #include <filesystem> +#include <set> +#include <string> +#include <string_view> +#include <vector> #include <visibility.h> +// IWYU pragma: no_include <boost/iterator/transform_iterator.hpp> namespace Slicer { class SplitString : public std::vector<std::string> { 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 <boost/algorithm/string/split.hpp> +#include "parser.h" +#include <array> +#include <boost/algorithm/string/find_iterator.hpp> +#include <boost/algorithm/string/finder.hpp> #include <boost/program_options.hpp> #include <compileTimeFormatter.h> -#include <tool/parser.h> -#include <unistd.h> +#include <cstdlib> +#include <filesystem> +#include <iostream> +#include <string> +#include <string_view> +// IWYU pragma: no_include <utility> +// IWYU pragma: no_include <boost/algorithm/string/compare.hpp> +// IWYU pragma: no_include <boost/core/addressof.hpp> +// IWYU pragma: no_include <boost/detail/basic_pointerbuf.hpp> +// IWYU pragma: no_include <boost/function/function_base.hpp> +// IWYU pragma: no_include <boost/iterator/iterator_facade.hpp> +// IWYU pragma: no_include <boost/lexical_cast.hpp> +// IWYU pragma: no_include <boost/range/const_iterator.hpp> +// IWYU pragma: no_include <boost/range/iterator_range_core.hpp> +// IWYU pragma: no_include <boost/type_index/type_index_facade.hpp> namespace po = boost::program_options; using namespace AdHoc::literals; |