Windows needs the current codepage instead of utf8 sometimes
authorAaron Smith <aaron.smith@microsoft.com>
Sat, 7 Apr 2018 00:32:59 +0000 (00:32 +0000)
committerAaron Smith <aaron.smith@microsoft.com>
Sat, 7 Apr 2018 00:32:59 +0000 (00:32 +0000)
commit8a5ea618866ab00e1e4fd7d3083871cbd742046a
treefb3991533171c6754edaa161ccd55038733651f1
parent269c26ab9b5e3abb69a0199817468494d5c1b439
Windows needs the current codepage instead of utf8 sometimes

Llvm-mc (and tools that use Path.inc on Windows) assume that strings are utf-8
encoded, however, this is not always the case. On Windows the default codepage
is not utf-8, so most of the time the strings are not utf-8 encoded.

The lld test 'format-binary-non-ascii' uses llvm-mc with a file with non-ascii
characters in the name which is how this bug was found. The test fails when run
using Python 3 because it uses properly encoded unicode strings (Python 2 actually
ends up using a byte string which is not utf-8 encoded, so the test passes, but
that's separate issue).

Patch by Stella Stamenova!

llvm-svn: 329468
llvm/lib/Support/Windows/Path.inc
llvm/lib/Support/Windows/WindowsSupport.h