llvm-project/libcxx
Christopher Di Bella ab46648082 [libcxx] adds an include-what-you-use (IWYU) mapping file
This makes it possible for programmers to run IWYU and get more accurate
standard library inclusions. Prior to this commit, the following program
would be transformed thusly:

```cpp
// Before
 #include <algorithm>
 #include <vector>

void f() {
  auto v = std::vector{0, 1};
  std::find(std::ranges::begin(v), std::ranges::end(v), 0);
}
```

```cpp
// After
 #include <__algorithm/find.h>
 #include <__ranges/access.h>
 #include <vector>
...
```

There are two ways to fix this issue: to use [comment pragmas](https://github.com/include-what-you-use/include-what-you-use/blob/master/docs/IWYUPragmas.md)
on every private include, or to write a canonical [mapping file](https://github.com/include-what-you-use/include-what-you-use/blob/master/docs/IWYUMappings.md)
that provides the tool with a manual on how libc++ is laid out. Due to
the complexity of libc++, this commit opts for the latter, to maximise
correctness and minimise developer burden.

To mimimise developer updates to the file, it makes use of wildcards
that match everything within listed subdirectories. A script has also
been added to ensure that the mapping is always fresh in CI, and makes
the process a single step.

Finally, documentation has been added to inform users that IWYU is
supported, and what they need to do in order to leverage the mapping
file.

Closes #56937.

Differential Revision: https://reviews.llvm.org/D138189
2022-11-22 01:09:49 +00:00
..
benchmarks [libc++] Extend check for non-ASCII characters to src/, test/ and benchmarks/ 2022-08-23 18:36:38 -04:00
cmake [libc++] Introduce a setting to remove fstream from the library 2022-11-20 10:51:32 -05:00
docs [libcxx] adds an include-what-you-use (IWYU) mapping file 2022-11-22 01:09:49 +00:00
include [libcxx] adds an include-what-you-use (IWYU) mapping file 2022-11-22 01:09:49 +00:00
lib [libc++][PMR] Move the pmr::memory_resource destructor into the dylib 2022-11-01 00:37:04 +01:00
src [libc++] Introduce a setting to remove fstream from the library 2022-11-20 10:51:32 -05:00
test [libcxx] adds an include-what-you-use (IWYU) mapping file 2022-11-22 01:09:49 +00:00
utils [libcxx] adds an include-what-you-use (IWYU) mapping file 2022-11-22 01:09:49 +00:00
.clang-format [libc++][NFC] Rename the constexpr macros 2022-08-19 15:35:02 +02:00
.clang-tidy [libc++] Make the naming of private member variables consistent and enforce it through readability-identifier-naming 2022-09-02 21:36:36 +02:00
.gitignore
CMakeLists.txt [libc++] Introduce a setting to remove fstream from the library 2022-11-20 10:51:32 -05:00
CREDITS.TXT Microsoft's floating-point to_chars powered by Ryu and Ryu Printf 2021-12-12 16:34:50 +01:00
LICENSE.TXT
TODO.TXT [libc++] Disallow volatile types in std::allocator 2021-09-22 11:47:38 -04:00
appveyor-reqs-install.cmd
appveyor.yml [libc++] Re-apply "Always build c++experimental.a"" 2022-07-19 10:44:19 -04:00