std::codecvt conversions internally use uint32_t in codecvt specializations for wchar_t, which breaks conversion logic if the '-fshort-wchar' was used during compilation.
This patch modifies std::codecvt_utf8 to use the same logic for short wchar_t as the one for WIN32 where wchar_t is 2 bytes long.
std::codecvt_utf16 and std::codecvt_utf8_utf16 changed to work with both WIN32 and fshort-wchar.
It also improves code reuse by generalizing utf16_to_utf8 and utf8_to_utf16 functions, and fixes the libcxx tests dependent on std::codecvt, which use 4-byte test data or expect UCS-4 encoding.
UPDATE
The libc++ tests not working with short wchar now have their short wchar counterparts. The short_wchar feature added to the libc++ tests. Lit decides which version of a test to run depending on availability of short_wchar.
You're changing a function named utf8_to_utf16 to take parameters of type uint32_t *?
Eww. I object.