We currently define the preferred names in multiple places. basic_string and basic_string_view also have a lot of aliases, which makes the declarations quite long. So let's only add the preferred names in forward-declaring headers to make the implementation more readable and have all the preferred names in one place.
Details
- Reviewers
 ldionne EricWF - Group Reviewers
 Restricted Project - Commits
 - rG627465cf9fa7: [libc++] Move preferred_name declarations into the forward declaring headers…
 
Diff Detail
- Repository
 - rG LLVM Github Monorepo
 
Event Timeline
| libcxx/include/__fwd/string.h | ||
|---|---|---|
| 58 | Second declaration here.  | |
| libcxx/include/regex | ||
| 6848 ↗ | (On Diff #471538) | This would have caused anybody including regex without wchar_t to fail to build, right? How did we not catch that before?  | 
| libcxx/include/string | ||
| 652 | Aren't we double defining this typedef?  | |
| 659 | What happened to _LIBCPP_TEMPLATE_VIS?  | |
| libcxx/include/string_view | ||
| 207 | Shouldn't this directly include the forward decl header?  | |
| libcxx/include/regex | ||
|---|---|---|
| 6848 ↗ | (On Diff #471538) | The problem here is that we don't have a true C library that does not provide wchar_t. So yes, this would have failed indeed and we would have caught it when building for a platform that truly doesn't provide wchar_t. This is a known hole in our CI coverage, but I think we'd need a custom C library in order to catch this (or an upstream platform that does not provide wchar_t, which is equivalent).  | 
Second declaration here.