Skip to content

Commit

Permalink
Merge pull request #206 from eseiler/misc/iwyu
Browse files Browse the repository at this point in the history
[MISC] Update IWYU mappings
  • Loading branch information
eseiler authored Jun 6, 2024
2 parents ccd5a82 + 2be9d85 commit 8984db3
Show file tree
Hide file tree
Showing 6 changed files with 82 additions and 44 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci_iwyu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
- name: Configure Test
run: |
mkdir build && cd build
cmake ../hibf/test/iwyu -DCMAKE_BUILD_TYPE=Release
cmake ../hibf/test/iwyu -DCMAKE_BUILD_TYPE=Debug
- name: Run Test
working-directory: build
Expand Down
1 change: 1 addition & 0 deletions test/iwyu/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ list (APPEND CMAKE_CXX_INCLUDE_WHAT_YOU_USE "-Xiwyu;--keep=**hibf/platform.hpp")
list (APPEND CMAKE_CXX_INCLUDE_WHAT_YOU_USE "-Xiwyu;--keep=**hibf/version.hpp")
list (APPEND CMAKE_CXX_INCLUDE_WHAT_YOU_USE "-Xiwyu;--no_default_mappings")
list (APPEND CMAKE_CXX_INCLUDE_WHAT_YOU_USE "-Xiwyu;--mapping_file=${CMAKE_CURRENT_LIST_DIR}/mappings/iwyu.imp")
list (APPEND CMAKE_CXX_INCLUDE_WHAT_YOU_USE "--stdlib=libc++")

option (INSTALL_HIBF "" OFF)
add_subdirectory (../unit/ unit)
Expand Down
63 changes: 43 additions & 20 deletions test/iwyu/mappings/gcc.stl.headers.imp
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,32 @@
# Note: make sure to sync this setting with iwyu_include_picker.cc

# Headers explicitly annotated with `@headername`
# ( cd /usr/include/c++/10 && grep -r headername | perl -nle 'm/^([^:]+).*@headername\{([^,]*)\}/ && print qq@ { include: ["<$1>", private, "<$2>", public ] },@' | sort -u )
# ( cd /usr/include/c++/14 && grep -r headername | perl -nle 'm/^([^:]+).*@headername\{([^,]*)\}/ && print qq@ { include: ["<$1>", private, "<$2>", public ] },@' | sort -u )
{ include: ["<backward/auto_ptr.h>", private, "<memory>", public ] },
{ include: ["<backward/backward_warning.h>", private, "<iosfwd>", public ] },
{ include: ["<backward/binders.h>", private, "<functional>", public ] },
{ include: ["<bits/algorithmfwd.h>", private, "<algorithm>", public ] },
{ include: ["<bits/align.h>", private, "<memory>", public ] },
{ include: ["<bits/alloc_traits.h>", private, "<memory>", public ] },
{ include: ["<bits/allocated_ptr.h>", private, "<memory>", public ] },
{ include: ["<bits/allocator.h>", private, "<memory>", public ] },
{ include: ["<bits/alloc_traits.h>", private, "<memory>", public ] },
{ include: ["<bits/atomic_base.h>", private, "<atomic>", public ] },
{ include: ["<bits/atomic_lockfree_defines.h>", private, "<atomic>", public ] },
{ include: ["<bits/atomic_timed_wait.h>", private, "<atomic>", public ] },
{ include: ["<bits/atomic_wait.h>", private, "<atomic>", public ] },
{ include: ["<bits/basic_ios.h>", private, "<ios>", public ] },
{ include: ["<bits/basic_ios.tcc>", private, "<ios>", public ] },
{ include: ["<bits/basic_string.h>", private, "<string>", public ] },
{ include: ["<bits/basic_string.tcc>", private, "<string>", public ] },
{ include: ["<bits/boost_concept_check.h>", private, "<iterator>", public ] },
{ include: ["<bits/c++0x_warning.h>", private, "<iosfwd>", public ] },
{ include: ["<bits/charconv.h>", private, "<charconv>", public ] },
{ include: ["<bits/char_traits.h>", private, "<string>", public ] },
{ include: ["<bits/charconv.h>", private, "<charconv>", public ] },
{ include: ["<bits/chrono.h>", private, "<chrono>", public ] },
{ include: ["<bits/chrono_io.h>", private, "<chrono>", public ] },
{ include: ["<bits/codecvt.h>", private, "<locale>", public ] },
{ include: ["<bits/concept_check.h>", private, "<iterator>", public ] },
{ include: ["<bits/cow_string.h>", private, "<string>", public ] },
{ include: ["<bits/cpp_type_traits.h>", private, "<ext/type_traits>", public ] },
{ include: ["<bits/cxxabi_forced.h>", private, "<cxxabi.h>", public ] },
{ include: ["<bits/deque.tcc>", private, "<deque>", public ] },
Expand All @@ -41,11 +47,10 @@
{ include: ["<bits/fstream.tcc>", private, "<fstream>", public ] },
{ include: ["<bits/functexcept.h>", private, "<exception>", public ] },
{ include: ["<bits/functional_hash.h>", private, "<functional>", public ] },
{ include: ["<bits/gslice_array.h>", private, "<valarray>", public ] },
{ include: ["<bits/gslice.h>", private, "<valarray>", public ] },
{ include: ["<bits/gslice_array.h>", private, "<valarray>", public ] },
{ include: ["<bits/hash_bytes.h>", private, "<functional>", public ] },
{ include: ["<bits/indirect_array.h>", private, "<valarray>", public ] },
{ include: ["<bits/int_limits.h>", private, "<limits>", public ] },
{ include: ["<bits/invoke.h>", private, "<functional>", public ] },
{ include: ["<bits/ios_base.h>", private, "<ios>", public ] },
{ include: ["<bits/istream.tcc>", private, "<istream>", public ] },
Expand All @@ -55,16 +60,22 @@
{ include: ["<bits/locale_classes.tcc>", private, "<locale>", public ] },
{ include: ["<bits/locale_conv.h>", private, "<locale>", public ] },
{ include: ["<bits/locale_facets.h>", private, "<locale>", public ] },
{ include: ["<bits/locale_facets.tcc>", private, "<locale>", public ] },
{ include: ["<bits/locale_facets_nonio.h>", private, "<locale>", public ] },
{ include: ["<bits/locale_facets_nonio.tcc>", private, "<locale>", public ] },
{ include: ["<bits/locale_facets.tcc>", private, "<locale>", public ] },
{ include: ["<bits/localefwd.h>", private, "<locale>", public ] },
{ include: ["<bits/mask_array.h>", private, "<valarray>", public ] },
{ include: ["<bits/max_size_type.h>", private, "<iterator>", public ] },
{ include: ["<bits/memory_resource.h>", private, "<memory_resource>", public ] },
{ include: ["<bits/memoryfwd.h>", private, "<memory>", public ] },
{ include: ["<bits/mofunc_impl.h>", private, "<functional>", public ] },
{ include: ["<bits/move.h>", private, "<utility>", public ] },
{ include: ["<bits/move_only_function.h>", private, "<functional>", public ] },
{ include: ["<bits/nested_exception.h>", private, "<exception>", public ] },
{ include: ["<bits/ostream_insert.h>", private, "<ostream>", public ] },
{ include: ["<bits/new_allocator.h>", private, "<memory>", public ] },
{ include: ["<bits/ostream.tcc>", private, "<ostream>", public ] },
{ include: ["<bits/ostream_insert.h>", private, "<ostream>", public ] },
{ include: ["<bits/out_ptr.h>", private, "<memory>", public ] },
{ include: ["<bits/parse_numbers.h>", private, "<chrono>", public ] },
{ include: ["<bits/postypes.h>", private, "<iosfwd>", public ] },
{ include: ["<bits/predefined_ops.h>", private, "<algorithm>", public ] },
Expand All @@ -73,11 +84,15 @@
{ include: ["<bits/random.h>", private, "<random>", public ] },
{ include: ["<bits/random.tcc>", private, "<random>", public ] },
{ include: ["<bits/range_access.h>", private, "<iterator>", public ] },
{ include: ["<bits/range_cmp.h>", private, "<functional>", public ] },
{ include: ["<bits/ranges_algobase.h>", private, "<algorithm>", public ] },
{ include: ["<bits/ranges_algo.h>", private, "<algorithm>", public ] },
{ include: ["<bits/ranges_algobase.h>", private, "<algorithm>", public ] },
{ include: ["<bits/ranges_base.h>", private, "<ranges>", public ] },
{ include: ["<bits/ranges_cmp.h>", private, "<functional>", public ] },
{ include: ["<bits/ranges_uninitialized.h>", private, "<memory>", public ] },
{ include: ["<bits/ranges_util.h>", private, "<ranges>", public ] },
{ include: ["<bits/refwrap.h>", private, "<functional>", public ] },
{ include: ["<bits/regex.h>", private, "<regex>", public ] },
{ include: ["<bits/regex.tcc>", private, "<regex>", public ] },
{ include: ["<bits/regex_automaton.h>", private, "<regex>", public ] },
{ include: ["<bits/regex_automaton.tcc>", private, "<regex>", public ] },
{ include: ["<bits/regex_compiler.h>", private, "<regex>", public ] },
Expand All @@ -86,28 +101,30 @@
{ include: ["<bits/regex_error.h>", private, "<regex>", public ] },
{ include: ["<bits/regex_executor.h>", private, "<regex>", public ] },
{ include: ["<bits/regex_executor.tcc>", private, "<regex>", public ] },
{ include: ["<bits/regex.h>", private, "<regex>", public ] },
{ include: ["<bits/regex_scanner.h>", private, "<regex>", public ] },
{ include: ["<bits/regex_scanner.tcc>", private, "<regex>", public ] },
{ include: ["<bits/regex.tcc>", private, "<regex>", public ] },
{ include: ["<bits/requires_hosted.h>", private, "<version>", public ] },
{ include: ["<bits/sat_arith.h>", private, "<numeric>", public ] },
{ include: ["<bits/semaphore_base.h>", private, "<semaphore>", public ] },
{ include: ["<bits/shared_ptr.h>", private, "<memory>", public ] },
{ include: ["<bits/shared_ptr_atomic.h>", private, "<memory>", public ] },
{ include: ["<bits/shared_ptr_base.h>", private, "<memory>", public ] },
{ include: ["<bits/shared_ptr.h>", private, "<memory>", public ] },
{ include: ["<bits/slice_array.h>", private, "<valarray>", public ] },
{ include: ["<bits/specfun.h>", private, "<cmath>", public ] },
{ include: ["<bits/sstream.tcc>", private, "<sstream>", public ] },
{ include: ["<bits/std_function.h>", private, "<functional>", public ] },
{ include: ["<bits/std_mutex.h>", private, "<mutex>", public ] },
{ include: ["<bits/stl_algobase.h>", private, "<algorithm>", public ] },
{ include: ["<bits/std_thread.h>", private, "<thread>", public ] },
{ include: ["<bits/stl_algo.h>", private, "<algorithm>", public ] },
{ include: ["<bits/stl_algobase.h>", private, "<algorithm>", public ] },
{ include: ["<bits/stl_bvector.h>", private, "<vector>", public ] },
{ include: ["<bits/stl_construct.h>", private, "<memory>", public ] },
{ include: ["<bits/stl_deque.h>", private, "<deque>", public ] },
{ include: ["<bits/stl_function.h>", private, "<functional>", public ] },
{ include: ["<bits/stl_heap.h>", private, "<queue>", public ] },
{ include: ["<bits/stl_iterator.h>", private, "<iterator>", public ] },
{ include: ["<bits/stl_iterator_base_funcs.h>", private, "<iterator>", public ] },
{ include: ["<bits/stl_iterator_base_types.h>", private, "<iterator>", public ] },
{ include: ["<bits/stl_iterator.h>", private, "<iterator>", public ] },
{ include: ["<bits/stl_list.h>", private, "<list>", public ] },
{ include: ["<bits/stl_map.h>", private, "<map>", public ] },
{ include: ["<bits/stl_multimap.h>", private, "<map>", public ] },
Expand All @@ -122,22 +139,29 @@
{ include: ["<bits/stl_tempbuf.h>", private, "<memory>", public ] },
{ include: ["<bits/stl_uninitialized.h>", private, "<memory>", public ] },
{ include: ["<bits/stl_vector.h>", private, "<vector>", public ] },
{ include: ["<bits/streambuf_iterator.h>", private, "<iterator>", public ] },
{ include: ["<bits/streambuf.tcc>", private, "<streambuf>", public ] },
{ include: ["<bits/stream_iterator.h>", private, "<iterator>", public ] },
{ include: ["<bits/stringfwd.h>", private, "<string>", public ] },
{ include: ["<bits/streambuf.tcc>", private, "<streambuf>", public ] },
{ include: ["<bits/streambuf_iterator.h>", private, "<iterator>", public ] },
{ include: ["<bits/string_view.tcc>", private, "<string_view>", public ] },
{ include: ["<bits/stringfwd.h>", private, "<string>", public ] },
{ include: ["<bits/text_encoding-data.h>", private, "<text_encoding>", public ] },
{ include: ["<bits/this_thread_sleep.h>", private, "<thread>", public ] },
{ include: ["<bits/unicode-data.h>", private, "<format>", public ] },
{ include: ["<bits/unicode.h>", private, "<format>", public ] },
{ include: ["<bits/uniform_int_dist.h>", private, "<random>", public ] },
{ include: ["<bits/unique_lock.h>", private, "<mutex>", public ] },
{ include: ["<bits/unique_ptr.h>", private, "<memory>", public ] },
{ include: ["<bits/unordered_map.h>", private, "<unordered_map>", public ] },
{ include: ["<bits/unordered_set.h>", private, "<unordered_set>", public ] },
{ include: ["<bits/uses_allocator.h>", private, "<memory>", public ] },
{ include: ["<bits/uses_allocator_args.h>", private, "<memory>", public ] },
{ include: ["<bits/utility.h>", private, "<utility>", public ] },
{ include: ["<bits/valarray_after.h>", private, "<valarray>", public ] },
{ include: ["<bits/valarray_array.h>", private, "<valarray>", public ] },
{ include: ["<bits/valarray_array.tcc>", private, "<valarray>", public ] },
{ include: ["<bits/valarray_before.h>", private, "<valarray>", public ] },
{ include: ["<bits/vector.tcc>", private, "<vector>", public ] },
{ include: ["<bits/version.h>", private, "<version>", public ] },
{ include: ["<decimal/decimal.h>", private, "<decimal>", public ] },
{ include: ["<experimental/bits/fs_dir.h>", private, "<experimental/filesystem>", public ] },
{ include: ["<experimental/bits/fs_fwd.h>", private, "<experimental/filesystem>", public ] },
Expand All @@ -151,8 +175,8 @@
{ include: ["<ext/rc_string_base.h>", private, "<ext/vstring.h>", public ] },
{ include: ["<ext/ropeimpl.h>", private, "<ext/rope>", public ] },
{ include: ["<ext/sso_string_base.h>", private, "<ext/vstring.h>", public ] },
{ include: ["<ext/vstring_fwd.h>", private, "<ext/vstring.h>", public ] },
{ include: ["<ext/vstring.tcc>", private, "<ext/vstring.h>", public ] },
{ include: ["<ext/vstring_fwd.h>", private, "<ext/vstring.h>", public ] },
{ include: ["<ext/vstring_util.h>", private, "<ext/vstring.h>", public ] },
{ include: ["<tr1/bessel_function.tcc>", private, "<tr1/cmath>", public ] },
{ include: ["<tr1/beta_function.tcc>", private, "<tr1/cmath>", public ] },
Expand All @@ -173,10 +197,9 @@
{ include: ["<tr1/unordered_map.h>", private, "<tr1/unordered_map>", public ] },
{ include: ["<tr1/unordered_set.h>", private, "<tr1/unordered_set>", public ] },
{ include: ["<tr2/dynamic_bitset.tcc>", private, "<tr2/dynamic_bitset>", public ] },
# ( cd /usr/include/x86_64-linux-gnu/c++/10 && grep -r headername | perl -nle 'm/^([^:]+).*@headername\{([^,]*)\}/ && print qq@ { include: ["<$1>", private, "<$2>", public ] },@' | sort -u )
# ( cd /usr/include/x86_64-linux-gnu/c++/14 && grep -r headername | perl -nle 'm/^([^:]+).*@headername\{([^,]*)\}/ && print qq@ { include: ["<$1>", private, "<$2>", public ] },@' | sort -u )
{ include: ["<bits/basic_file.h>", private, "<ios>", public ] },
{ include: ["<bits/c++allocator.h>", private, "<memory>", public ] },
{ include: ["<bits/c++config.h>", private, "<iosfwd>", public ] },
{ include: ["<bits/c++config.h>", private, "<version>", public ] },
{ include: ["<bits/c++io.h>", private, "<ios>", public ] },
{ include: ["<bits/c++locale.h>", private, "<locale>", public ] },
Expand Down
3 changes: 1 addition & 2 deletions test/iwyu/mappings/iwyu.imp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,5 @@
{ symbol: [ "std::filesystem", private, "<filesystem>", public ] },
# Manual
{ symbol: [ "_LIBCPP_VERSION", private, "<hibf/platform.hpp>", public ] },
{ symbol: [ "__sanitizer_annotate_contiguous_container", private, "<vector>", public ] },
{ symbol: [ "_LIBCPP_HAS_NO_ASAN", private, "<vector>", public ] },
{ symbol: [ "_LIBCPP_HAS_NO_ASAN", private, "<hibf/platform.hpp>", public ] },
]
44 changes: 25 additions & 19 deletions test/iwyu/mappings/libcxx.imp
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,21 @@
# cd __fwd ; find -type f | sort | sed -e "s#./\(.*\)\(.h\)# { include: [\"@<__fwd/\1\2>\", private, \"<\1>\", public ] },#"
[
# from llvm-XX/include/c++/v1/libcxx.imp
{ include: [ "<__hash_table>", "private", "<unordered_map>", "public" ] },
{ include: [ "<__hash_table>", "private", "<unordered_set>", "public" ] },
{ include: [ "<__locale>", "private", "<locale>", "public" ] },
{ include: [ "<__node_handle>", "private", "<map>", "public" ] },
{ include: [ "<__node_handle>", "private", "<set>", "public" ] },
{ include: [ "<__node_handle>", "private", "<unordered_map>", "public" ] },
{ include: [ "<__node_handle>", "private", "<unordered_set>", "public" ] },
{ include: [ "<__split_buffer>", "private", "<deque>", "public" ] },
{ include: [ "<__split_buffer>", "private", "<vector>", "public" ] },
{ include: [ "<__threading_support>", "private", "<atomic>", "public" ] },
{ include: [ "<__threading_support>", "private", "<mutex>", "public" ] },
{ include: [ "<__threading_support>", "private", "<semaphore>", "public" ] },
{ include: [ "<__threading_support>", "private", "<thread>", "public" ] },
{ include: [ "<__tree>", "private", "<map>", "public" ] },
{ include: [ "<__tree>", "private", "<set>", "public" ] },
{ include: ["<__hash_table>", private, "<unordered_map>", public ] },
{ include: ["<__hash_table>", private, "<unordered_set>", public ] },
{ include: ["<__locale>", private, "<locale>", public ] },
{ include: ["<__node_handle>", private, "<map>", public ] },
{ include: ["<__node_handle>", private, "<set>", public ] },
{ include: ["<__node_handle>", private, "<unordered_map>", public ] },
{ include: ["<__node_handle>", private, "<unordered_set>", public ] },
{ include: ["<__split_buffer>", private, "<deque>", public ] },
{ include: ["<__split_buffer>", private, "<vector>", public ] },
{ include: ["<__threading_support>", private, "<atomic>", public ] },
{ include: ["<__threading_support>", private, "<mutex>", public ] },
{ include: ["<__threading_support>", private, "<semaphore>", public ] },
{ include: ["<__threading_support>", private, "<thread>", public ] },
{ include: ["<__tree>", private, "<map>", public ] },
{ include: ["<__tree>", private, "<set>", public ] },
# cd llvm-project/libcxx/include ;
# find -type d -name "__*" -and -not -name "__debug_utils*" -and -not -name "__fwd*" -and -not -name "__pstl*" -and -not -name "__support*" | sort | sed -e "s#./__\(.*\)# { include: [\"@<__\1/.*>\", private, \"<\1>\", public ] },#"
{ include: ["@<__algorithm/.*>", private, "<algorithm>", public ] },
Expand All @@ -41,7 +41,8 @@
{ include: ["@<__functional/.*>", private, "<functional>", public ] },
{ include: ["@<__ios/.*>", private, "<ios>", public ] },
{ include: ["@<__iterator/.*>", private, "<iterator>", public ] },
{ include: ["@<__locale_dir/.*>", private, "<locale_dir>", public ] },
{ include: ["@<__locale_dir/.*>", private, "<locale>", public ] },
{ include: ["@<__math/.*>", private, "<cmath>", public ] },
{ include: ["@<__mdspan/.*>", private, "<mdspan>", public ] },
{ include: ["@<__memory/.*>", private, "<memory>", public ] },
{ include: ["@<__memory_resource/.*>", private, "<memory_resource>", public ] },
Expand All @@ -61,15 +62,20 @@
# find -type f | sort | sed -e "s#./\(.*\)\(.h\)# { include: [\"@<__fwd/\1\2>\", private, \"<\1>\", public ] },#"
# Manual adjustment
{ include: ["@<__fwd/array.h>", private, "<array>", public ] },
{ include: ["@<__fwd/fstream.h>", private, "<iosfwd>", public ] },
#{ include: ["@<__fwd/get.h>", private, "<get>", public ] },
{ include: ["<__fwd/bit_reference.h>", private, "<bitset>", public ] },
{ include: ["<__fwd/bit_reference.h>", private, "<vector>", public ] },
{ include: ["@<__fwd/fstream.h>", private, "<fstream>", public ] },
{ include: ["@<__fwd/get.h>", private, "<array>", public ] },
{ include: ["@<__fwd/get.h>", private, "<pair>", public ] },
{ include: ["@<__fwd/get.h>", private, "<ranges>", public ] },
{ include: ["@<__fwd/get.h>", private, "<tuple>", public ] },
{ include: ["@<__fwd/hash.h>", private, "<functional>", public ] },
{ include: ["@<__fwd/ios.h>", private, "<iosfwd>", public ] },
{ include: ["@<__fwd/istream.h>", private, "<iosfwd>", public ] },
{ include: ["@<__fwd/mdspan.h>", private, "<mdspan>", public ] },
{ include: ["@<__fwd/memory_resource.h>", private, "<memory_resource>", public ] },
{ include: ["@<__fwd/ostream.h>", private, "<iosfwd>", public ] },
{ include: ["@<__fwd/pair.h>", private, "<pair>", public ] },
{ include: ["@<__fwd/pair.h>", private, "<utility>", public ] },
{ include: ["@<__fwd/span.h>", private, "<span>", public ] },
{ include: ["@<__fwd/sstream.h>", private, "<iosfwd>", public ] },
{ include: ["@<__fwd/streambuf.h>", private, "<iosfwd>", public ] },
Expand Down
Loading

0 comments on commit 8984db3

Please sign in to comment.