[PATCH] Add writeFileWithSystemEncoding to LibLLVMSupport
Rafael Ávila de Espíndola
rafael.espindola at gmail.com
Tue Aug 26 07:41:11 PDT 2014
================
Comment at: include/llvm/Support/Program.h:140
@@ +139,3 @@
+ struct EncodingStrategy {
+ EncodingMethod UnixEncoding;
+ EncodingMethod WindowsEncoding;
----------------
When is the UnixEncoding not UTF8?
If the problem was just the assert, I would suggest just writing the Unix version as
std::error_code llvm::sys::writeFileWithEncoding(const char *FileName,
StringRef Contents,
EncodingStrategy /*ignored*/) {
and documenting UTF8 is always used on Unix. You can even name enum WindowsEncodingMethod to make it explicit that is why we use on Windows.
================
Comment at: include/llvm/Support/Program.h:154
@@ +153,3 @@
+ std::error_code
+ writeFileWithEncoding(const char *FileName, StringRef Contents,
+ EncodingStrategy Encoding = {EM_UTF8, EM_UTF8});
----------------
FileName can be a StringRef now, no?
http://reviews.llvm.org/D4896
More information about the llvm-commits
mailing list