Commit Graph

6 Commits

Author SHA1 Message Date
Saleem Abdulrasool
1dad536745 runtime: adjust template expression for C++17 changes
`std::result_of_t` has been deprecated and replaced with
`std::invoke_result_t`. Update to the newer spelling to avoid the C++17
deprecation warnings when building with a new STL.
2024-12-13 14:51:11 -08:00
Alastair Houghton
a13d67758c Make the UTF8-to-wide functions into SPI rather than internal.
They're useful functions to have; I don't think we want them to be API, but
having them as SPI is conceivably useful for other purposes, and avoids everyone
rolling their own copy.

rdar://103397975
2022-12-21 15:27:21 +00:00
Alastair Houghton
e73de539b8 Move _swift_win32_withDbgHelpLibrary into the new header.
It makes sense to move this function into the new Win32 header.

rdar://103397975
2022-12-21 11:44:37 +00:00
Alastair Houghton
fb1211e3fa Rename the functions as they're exported as C APIs.
`SWIFT_RUNTIME_STDLIB_INTERNAL` does `extern "C"`, so we can't put these
in a namespace and have to use a C-style prefix instead.

Also slightly rearrange the code in `CommandLine.cpp`.

rdar://103397975
2022-12-21 11:44:37 +00:00
Alastair Houghton
ca771c4d1d Change to returning nullptr rather than triggering a fatal error.
Instead of triggering a fatal error on failure, return `nullptr` and
let the caller decide what to do about it.  The CommandLine code should
trigger a fatal error, of course.

rdar://103397975
2022-12-21 11:44:37 +00:00
Alastair Houghton
a31b1c54fa Centralise code to map between UTF-8 and UTF-16 on Windows.
In various places we need to call the Windows API, and because Swift uses UTF-8
for its string representation, we can’t call the ANSI API functions (because the
code page used for the ANSI functions varies depending on the system locale
setting). Instead, we need to use the wide character APIs.

This means that we need to convert UTF-8 to wide character and vice-versa in
various places in the runtime.

rdar://103397975
2022-12-21 11:44:35 +00:00