Add writeFileWithSystemEncoding to LibLLVMSuppor.
authorRafael Espindola <rafael.espindola@gmail.com>
Wed, 3 Sep 2014 20:02:00 +0000 (20:02 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Wed, 3 Sep 2014 20:02:00 +0000 (20:02 +0000)
commit52fa0d066a8fb81716713b85841b1aa031dbf8fc
treeff42b82b857c0f56b10889d16a7788d58b44751c
parent3693c29d1c6f500d50ff759d15538114f5b5dbe7
Add writeFileWithSystemEncoding to LibLLVMSuppor.

This patch adds to LLVMSupport the capability of writing files with
international characters encoded in the current system encoding. This
is relevant for Windows, where we can either use UTF16 or the current
code page (the legacy Windows international characters). On UNIX, the
file is always saved in UTF8.

This will be used in a patch for clang to thoroughly support response
files creation when calling other tools, addressing PR15171. On
Windows, to correctly support internationalization, we need the
ability to write response files both in UTF16 or the current code
page, depending on the tool we will call. GCC for mingw, for instance,
requires files to be encoded in the current code page. MSVC tools
requires files to be encoded in UTF16.

Patch by Rafael Auler!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217068 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Support/Program.h
lib/Support/Unix/Program.inc
lib/Support/Windows/Path.inc
lib/Support/Windows/Program.inc
lib/Support/Windows/WindowsSupport.h
unittests/Support/ProgramTest.cpp