Index: libcxx/include/string =================================================================== --- libcxx/include/string +++ libcxx/include/string @@ -4537,6 +4537,7 @@ _LIBCPP_FUNC_VIS double stod (const string& __str, size_t* __idx = nullptr); _LIBCPP_FUNC_VIS long double stold(const string& __str, size_t* __idx = nullptr); +#if _LIBCPP_DEBUG_LEVEL != 2 || !defined(_LIBCPP_ALWAYS_INLINE) _LIBCPP_FUNC_VIS string to_string(int __val); _LIBCPP_FUNC_VIS string to_string(unsigned __val); _LIBCPP_FUNC_VIS string to_string(long __val); @@ -4546,6 +4547,55 @@ _LIBCPP_FUNC_VIS string to_string(float __val); _LIBCPP_FUNC_VIS string to_string(double __val); _LIBCPP_FUNC_VIS string to_string(long double __val); +#else +// HACK: These crash in debug mode and cannot be changed without changing ABI. +// Keep only the ones with the largest types and wrap the rest to fix the problem. +_LIBCPP_FUNC_VIS string to_string(long long __val); +_LIBCPP_FUNC_VIS string to_string(unsigned long long __val); +_LIBCPP_FUNC_VIS string to_string(long double __val); + +static _LIBCPP_ALWAYS_INLINE string to_string(int __val) +{ + string __s = to_string(static_cast(__val)); + std::__debug_db_insert_c(&__s); + return __s; +} + +static _LIBCPP_ALWAYS_INLINE string to_string(unsigned __val) +{ + string __s = to_string(static_cast(__val)); + std::__debug_db_insert_c(&__s); + return __s; +} + +static _LIBCPP_ALWAYS_INLINE string to_string(long __val) +{ + string __s = to_string(static_cast(__val)); + std::__debug_db_insert_c(&__s); + return __s; +} + +static _LIBCPP_ALWAYS_INLINE string to_string(unsigned long __val) +{ + string __s = to_string(static_cast(__val)); + std::__debug_db_insert_c(&__s); + return __s; +} + +static _LIBCPP_ALWAYS_INLINE string to_string(float __val) +{ + string __s = to_string(static_cast(__val)); + std::__debug_db_insert_c(&__s); + return __s; +} + +static _LIBCPP_ALWAYS_INLINE string to_string(double __val) +{ + string __s = to_string(static_cast(__val)); + std::__debug_db_insert_c(&__s); + return __s; +} +#endif #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS _LIBCPP_FUNC_VIS int stoi (const wstring& __str, size_t* __idx = nullptr, int __base = 10); @@ -4558,6 +4608,7 @@ _LIBCPP_FUNC_VIS double stod (const wstring& __str, size_t* __idx = nullptr); _LIBCPP_FUNC_VIS long double stold(const wstring& __str, size_t* __idx = nullptr); +#if _LIBCPP_DEBUG_LEVEL != 2 || !defined(_LIBCPP_ALWAYS_INLINE) _LIBCPP_FUNC_VIS wstring to_wstring(int __val); _LIBCPP_FUNC_VIS wstring to_wstring(unsigned __val); _LIBCPP_FUNC_VIS wstring to_wstring(long __val); @@ -4567,6 +4618,55 @@ _LIBCPP_FUNC_VIS wstring to_wstring(float __val); _LIBCPP_FUNC_VIS wstring to_wstring(double __val); _LIBCPP_FUNC_VIS wstring to_wstring(long double __val); +#else +// HACK: These crash in debug mode and cannot be changed without changing ABI. +// Keep only the ones with the largest types and wrap the rest to fix the problem. +_LIBCPP_FUNC_VIS wstring to_wstring(long long __val); +_LIBCPP_FUNC_VIS wstring to_wstring(unsigned long long __val); +_LIBCPP_FUNC_VIS wstring to_wstring(long double __val); + +static _LIBCPP_ALWAYS_INLINE wstring to_wstring(int __val) +{ + wstring __s = to_wstring(static_cast(__val)); + std::__debug_db_insert_c(&__s); + return __s; +} + +static _LIBCPP_ALWAYS_INLINE wstring to_wstring(unsigned __val) +{ + wstring __s = to_wstring(static_cast(__val)); + std::__debug_db_insert_c(&__s); + return __s; +} + +static _LIBCPP_ALWAYS_INLINE wstring to_wstring(long __val) +{ + wstring __s = to_wstring(static_cast(__val)); + std::__debug_db_insert_c(&__s); + return __s; +} + +static _LIBCPP_ALWAYS_INLINE wstring to_wstring(unsigned long __val) +{ + wstring __s = to_wstring(static_cast(__val)); + std::__debug_db_insert_c(&__s); + return __s; +} + +static _LIBCPP_ALWAYS_INLINE wstring to_wstring(float __val) +{ + wstring __s = to_wstring(static_cast(__val)); + std::__debug_db_insert_c(&__s); + return __s; +} + +static _LIBCPP_ALWAYS_INLINE wstring to_wstring(double __val) +{ + wstring __s = to_wstring(static_cast(__val)); + std::__debug_db_insert_c(&__s); + return __s; +} +#endif #endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS template