[PATCH] Add writeFileWithSystemEncoding to LibLLVMSupport

Rafael EspĂ­ndola rafael.espindola at gmail.com
Thu Aug 14 09:16:19 PDT 2014


On 13 August 2014 23:07, Rafael Auler <rafaelauler at gmail.com> wrote:
> Hi rafael,
>
> 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 patch also fixes a bug in the Unix version of argumentsFitWithinSystemLimits(). Both functions 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.

Do you have a complete list of programs that require the current
codepage to be used? If it is jut gcc, it seems better to switch clang
to using ld directly instead of calling gcc for linking. From the
perspective of this patch it would mean marking gcc as not supporting
response files.

Since the function may write UTF8, UTF16 and native codepage, what
about calling it just writeFileWithEncoding and pass an
UTF8/UTF16/CurrentCP enum value to it? The unix version can just
assert that it is always passed UTF8.

Cheers,
Rafael




More information about the llvm-commits mailing list