llvm-project/libcxx
Martin Storsjö 7db4f2c694 [libcxx] [Windows] Store the lconv struct returned from localeconv in locale_t
This fixes using non-default locales, which currently can crash when
e.g. formatting numbers.

Within the localeconv_l function, the per-thread locale is temporarily
changed with __libcpp_locale_guard, then localeconv() is called,
returning an lconv * struct pointer.

When localeconv_l returns, the __libcpp_locale_guard dtor restores
the per-thread locale back to the original. This invalidates the
contents of the earlier returned lconv struct, and all C strings
that are pointed to within it are also invalidated.

Thus, to have an actually working localeconv_l function, the
function needs to allocate some sort of storage for the returned
contents, that stays valid for as long as the caller needs to use
the returned struct.

Extend the libcxx/win32 specific locale_t class with storage for
a deep copy of a lconv struct, and change localeconv_l to take
a reference to the locale_t, to allow it to store the returned
lconv struct there.

This works fine for libcxx itself, but wouldn't necessarily be right
for a caller that uses libcxx's localeconv_l function.

This fixes around 11 of libcxx's currently failing tests on windows.

Differential Revision: https://reviews.llvm.org/D69505
2020-01-29 22:37:11 +02:00
..
benchmarks [libc++] Add additional benchmark functions to libcxx/benchmarks/string.bench 2020-01-07 16:31:40 -05:00
cmake [libcxx{,abi}] Don't link libpthread and libdl on Fuchsia 2019-12-06 11:15:15 -08:00
docs Bump the trunk major version to 11 2020-01-15 13:38:01 +01:00
fuzzing [libc++] Tolerate NaN returning random distributions for now 2019-12-12 17:11:13 -05:00
include [libcxx] [Windows] Store the lconv struct returned from localeconv in locale_t 2020-01-29 22:37:11 +02:00
lib [libc++] Add missing revision number in ABI changelog 2019-10-03 16:50:05 +00:00
src [libcxx] [Windows] Store the lconv struct returned from localeconv in locale_t 2020-01-29 22:37:11 +02:00
test [libcxx] Add a std::string_view pretty printer for libcxx. 2020-01-29 13:04:29 -05:00
utils [libcxx] Add a std::string_view pretty printer for libcxx. 2020-01-29 13:04:29 -05:00
www [libc++] [P0920] [P1661] Update status page. 2019-11-15 00:12:34 +01:00
.arcconfig [libcxx] Set up .arcconfig to point to new Diffusion CXX repository 2017-12-04 17:55:28 +00:00
.clang-format
.gitignore
CMakeLists.txt [libcxx] Link against android_support when needed 2020-01-28 14:36:24 -08:00
CREDITS.TXT [libcxx] Add Sergej Jaskiewicz to CREDITS.txt 2019-11-21 12:06:10 +03:00
LICENSE.TXT Fix typos throughout the license files that somehow I and my reviewers 2019-01-21 09:52:34 +00:00
NOTES.TXT Reland "Use custom command and target to install libc++ headers" 2018-06-12 03:10:02 +00:00
TODO.TXT
appveyor-reqs-install.cmd Attempt to upgrade compiler used by appveyor builds 2019-04-03 20:40:01 +00:00
appveyor.yml disable appveyor config for MSVC 2015 2019-04-03 20:36:51 +00:00