skia2/toolchain/linux_trampolines/IWYU_mapping.imp
Kevin Lubick 68d6ff9222 [includes] Reduce IWYU exports from SkTypes.h
SkTypes.h was found exporting <stddef.h> and <stdint.h>.
Thus if a Skia file includes SkTypes.h, it did not need
to include either of those files to use things like
size_t or uint8_t respectively. [1]

This also resulted in strange IWYU warnings like:
warning: size_t is defined in "include/core/SkTypes.h", which isn't directly #included.

Thus, this CL removes those additional exports, and as a result,
adds many more includes of <cstddef> and <cstdint>.

The second change this CL is to not use the default IWYU
mappings which are hard-coded into IWYU [2]. These defaults
are valid, but make suggestions for the C version of
headers and not the C++ ones (i.e. <stddef.h> over <cstddef>).

To make these recommendations align better with our preferred
style (the C++ ones), we use IWYU with --no_default_mappings
and then have to expand our existing mappings to better deal
with how IWYU would resolve some of these headers.

[1] https://codereview.chromium.org/1207893002/#msg49
[2] 4c0f396159/iwyu_include_picker.cc (L1221-L1234)

Change-Id: Iafebe190f8f3e86f252147b9f538c182bcc34af4
Bug: skia:13052
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/555516
Auto-Submit: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2022-07-06 14:52:55 +00:00

143 lines
8.2 KiB
Plaintext

[
{ include: ["<__algorithm/all_of.h>", "private", "<algorithm>", "public"] },
{ include: ["<__algorithm/any_of.h>", "private", "<algorithm>", "public"] },
{ include: ["<__algorithm/copy.h>", "private", "<algorithm>", "public"] },
{ include: ["<__algorithm/copy_n.h>", "private", "<algorithm>", "public"] },
{ include: ["<__algorithm/equal_range.h>", "private", "<algorithm>", "public"] },
{ include: ["<__algorithm/lower_bound.h>", "private", "<algorithm>", "public"] },
{ include: ["<__algorithm/max.h>", "private", "<algorithm>", "public"] },
{ include: ["<__algorithm/min.h>", "private", "<algorithm>", "public"] },
{ include: ["<__algorithm/remove_if.h>", "private", "<algorithm>", "public"] },
{ include: ["<__algorithm/sort.h>", "private", "<algorithm>", "public"] },
{ include: ["<__algorithm/stable_sort.h>", "private", "<algorithm>", "public"] },
{ include: ["<__algorithm/upper_bound.h>", "private", "<algorithm>", "public"] },
{ symbol: ["INT32_MAX", "public", "<climits>", "public"]},
{ symbol: ["abs", "public", "<cmath>", "public"]},
# The first of these is the preferred include, but the others are acceptable.
{ symbol: ["size_t", "public", "<cstddef>", "public"]},
{ symbol: ["size_t", "public", "<cstdio>", "public"]},
{ symbol: ["size_t", "public", "<cstdlib>", "public"]},
{ symbol: ["size_t", "public", "<cstring>", "public"]},
{ symbol: ["size_t", "public", "<ctime>", "public"]},
{ symbol: ["size_t", "public", "<cuchar>", "public"]},
{ symbol: ["size_t", "public", "<cwchar>", "public"]},
{ symbol: ["int8_t", "public", "<cstdint>", "public"]},
{ symbol: ["int16_t", "public", "<cstdint>", "public"]},
{ symbol: ["int32_t", "public", "<cstdint>", "public"]},
{ symbol: ["int64_t", "public", "<cstdint>", "public"]},
{ symbol: ["uint8_t", "public", "<cstdint>", "public"]},
{ symbol: ["uint16_t", "public", "<cstdint>", "public"]},
{ symbol: ["uint32_t", "public", "<cstdint>", "public"]},
{ symbol: ["uint64_t", "public", "<cstdint>", "public"]},
{ include: ["<__functional/function.h>", "private", "<functional>", "public"] },
{ include: ["<__iterator/access.h>", "private", "<iterator>", "public"] },
{ include: ["<__iterator/distance.h>", "private", "<iterator>", "public"] },
# The first of these is the preferred include, but the others are acceptable.
{ include: ["<__iterator/size.h>", "private", "<array>", "public"] },
{ include: ["<__iterator/size.h>", "private", "<deque>", "public"] },
{ include: ["<__iterator/size.h>", "private", "<forward_list>", "public"] },
{ include: ["<__iterator/size.h>", "private", "<iterator>", "public"] },
{ include: ["<__iterator/size.h>", "private", "<list>", "public"] },
{ include: ["<__iterator/size.h>", "private", "<map>", "public"] },
{ include: ["<__iterator/size.h>", "private", "<regex>", "public"] },
{ include: ["<__iterator/size.h>", "private", "<set>", "public"] },
{ include: ["<__iterator/size.h>", "private", "<string>", "public"] },
{ include: ["<__iterator/size.h>", "private", "<string_view>", "public"] },
{ include: ["<__iterator/size.h>", "private", "<unordered_map>", "public"] },
{ include: ["<__iterator/size.h>", "private", "<unordered_set>", "public"] },
{ include: ["<__iterator/size.h>", "private", "<vector>", "public"] },
{ include: ["<__locale>", "private", "<locale>", "public"] },
{ include: ["<__memory/shared_ptr.h>", "private", "<memory>", "public"] },
{ include: ["<__memory/unique_ptr.h>", "private", "<memory>", "public"] },
{ include: ["<__tree>", "private", "<set>", "public"] },
{ symbol: ["std::istringstream", "public", "<sstream>", "public"] },
{ symbol: ["std::ostringstream", "public", "<sstream>", "public"] },
{ symbol: ["std::stringstream", "public", "<sstream>", "public"] },
{ symbol: ["std::stringbuf", "public", "<sstream>", "public"] },
{ symbol: ["std::basic_istringstream", "public", "<sstream>", "public"] },
{ symbol: ["std::basic_ostringstream", "public", "<sstream>", "public"] },
{ symbol: ["std::basic_stringstream", "public", "<sstream>", "public"] },
{ symbol: ["std::basic_stringbuf", "public", "<sstream>", "public"] },
{ symbol: ["va_list", "public", "<stdarg.h>", "public"] },
{ symbol: ["std::string", "public", "<string>", "public"] },
{ include: ["<__hash_table>", "private", "<unordered_map>", "public"] },
{ include: ["<__utility/forward.h>", "private", "<utility>", "public"] },
{ include: ["<__utility/move.h>", "private", "<utility>", "public"] },
{ include: ["<__utility/swap.h>", "private", "<utility>", "public"] },
{ include: ["<__utility/pair.h>", "private", "<utility>", "public"] },
{ symbol: ["std::__bit_reference", "public", "<vector>", "public"] },
# Without these, IWYU won't accept the C++ wrappers and throws
# a mysterious "cyclical import" error.
# https://github.com/include-what-you-use/include-what-you-use/blob/4c0f39615982c57a9cb313c971c6f45fca1cc1fe/iwyu_include_picker.cc#L573
{ include: ["<assert.h>", "public", "<cassert>", "public"] },
{ include: ["<complex.h>", "public", "<ccomplex>", "public"] },
{ include: ["<ctype.h>", "public", "<cctype>", "public"] },
{ include: ["<errno.h>", "public", "<cerrno>", "public"] },
{ include: ["<fenv.h>", "public", "<cfenv>", "public"] },
{ include: ["<float.h>", "public", "<cfloat>", "public"] },
{ include: ["<inttypes.h>", "public", "<cinttypes>", "public"] },
{ include: ["<iso646.h>", "public", "<ciso646>", "public"] },
{ include: ["<limits.h>", "public", "<climits>", "public"] },
{ include: ["<locale.h>", "public", "<clocale>", "public"] },
{ include: ["<math.h>", "public", "<cmath>", "public"] },
{ include: ["<setjmp.h>", "public", "<csetjmp>", "public"] },
{ include: ["<signal.h>", "public", "<csignal>", "public"] },
{ include: ["<stdalign.h>", "public", "<cstdalign>", "public"] },
{ include: ["<stdarg.h>", "public", "<cstdarg>", "public"] },
{ include: ["<stdbool.h>", "public", "<cstdbool>", "public"] },
{ include: ["<stddef.h>", "public", "<cstddef>", "public"] },
{ include: ["<stdint.h>", "public", "<cstdint>", "public"] },
{ include: ["<stdio.h>", "public", "<cstdio>", "public"] },
{ include: ["<stdlib.h>", "public", "<cstdlib>", "public"] },
{ include: ["<string.h>", "public", "<string>", "public"] },
{ include: ["<string.h>", "public", "<cstring>", "public"] },
{ include: ["<tgmath.h>", "public", "<ctgmath>", "public"] },
{ include: ["<time.h>", "public", "<ctime>", "public"] },
{ include: ["<uchar.h>", "public", "<cuchar>", "public"] },
{ include: ["<wchar.h>", "public", "<cwchar>", "public"] },
{ include: ["<wctype.h>", "public", "<cwctype>", "public"] },
# From https://github.com/include-what-you-use/include-what-you-use/blob/4c0f39615982c57a9cb313c971c6f45fca1cc1fe/iwyu_include_picker.cc#L327
{ symbol: ["std::allocator", "private", "<memory>", "public"] },
{ symbol: ["std::allocator", "private", "<string>", "public"] },
{ symbol: ["std::allocator", "private", "<vector>", "public"] },
{ symbol: ["std::allocator", "private", "<map>", "public"] },
{ symbol: ["std::allocator", "private", "<set>", "public"] },
{ symbol: ["std::char_traits", "private", "<string>", "public"] },
{ symbol: ["std::char_traits", "private", "<ostream>", "public"] },
{ symbol: ["std::char_traits", "private", "<istream>", "public"] },
# We are pretty forgiving with iostream headers. If we specify
# any of them, that is generally sufficient.
# https://github.com/include-what-you-use/include-what-you-use/blob/4c0f39615982c57a9cb313c971c6f45fca1cc1fe/iwyu_include_picker.cc#L995
{include: ["<ios>", "public", "<istream>", "public"] },
{include: ["<ios>", "public", "<ostream>", "public"] },
{include: ["<iosfwd>", "public", "<ios>", "public"] },
{include: ["<iosfwd>", "public", "<streambuf>", "public"] },
{include: ["<istream>", "public", "<fstream>", "public"] },
{include: ["<istream>", "public", "<iostream>", "public"] },
{include: ["<istream>", "public", "<sstream>", "public"] },
{include: ["<ostream>", "public", "<fstream>", "public"] },
{include: ["<ostream>", "public", "<iostream>", "public"] },
{include: ["<ostream>", "public", "<istream>", "public"] },
{include: ["<ostream>", "public", "<sstream>", "public"] },
{include: ["<streambuf>", "public", "<ios>", "public"] },
]