[llvm] r329468 - Windows needs the current codepage instead of utf8 sometimes
Friedman, Eli via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 6 18:08:19 PDT 2018
On 4/6/2018 5:32 PM, Aaron Smith via llvm-commits wrote:
> Author: asmith
> Date: Fri Apr 6 17:32:59 2018
> New Revision: 329468
>
> - // Just use the caller's original path.
> - return UTF8ToUTF16(Path8Str, Path16);
> + // Path8Str now contains the full path or the original path
> + // If the conversion from UTF8 to UTF16 fails because of ERROR_NO_UNICODE_TRANSLATION,
> + // we also try using the current code page before giving up
> + auto ec = UTF8ToUTF16(Path8Str, Path16);
> + if (ec == mapWindowsError(ERROR_NO_UNICODE_TRANSLATION)) {
> + ec = CurCPToUTF16(Path8Str, Path16);
> + }
> + return ec;
This change is really dubious: we should not be charset sniffing in a
compiler. This will cause bugs where code appears to work sometimes,
but randomly breaks when we guess the encoding incorrectly.
-Eli
--
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
More information about the llvm-commits
mailing list