<div dir="ltr">I don't know why, but phabricator didn't send the email here updating this thread. Anyway, I sent a new patch addressing your concerns. It is available at <a href="http://reviews.llvm.org/D4896">http://reviews.llvm.org/D4896</a>. <div>
<br></div><div>Description:<br><div><br></div><div> <span style="line-height:1.45em;color:rgb(0,0,0);font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;font-size:13px">Introduce "WindowsEncodingMethod" to stress that the file encoding is only relevant on Windows systems. Remove the old "EncodingStrategy", addressing Rafael's concerns.</span><div>
<span style="line-height:1.45em;color:rgb(0,0,0);font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;font-size:13px"><br></span></div></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">
On Tue, Aug 26, 2014 at 11:41 AM, Rafael Ávila de Espíndola <span dir="ltr"><<a href="mailto:rafael.espindola@gmail.com" target="_blank">rafael.espindola@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
================<br>
Comment at: include/llvm/Support/Program.h:140<br>
@@ +139,3 @@<br>
+  struct EncodingStrategy {<br>
+    EncodingMethod UnixEncoding;<br>
+    EncodingMethod WindowsEncoding;<br>
----------------<br>
When is the UnixEncoding not UTF8?<br>
<br>
If the problem was just the assert, I would suggest just writing the Unix version as<br>
<br>
        ​std::error_code llvm::sys::writeFileWithEncoding(const char *FileName,<br>
                ​                                                 StringRef Contents,<br>
                ​                                                     EncodingStrategy /*ignored*/) {<br>
<br>
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.<br>
<br>
================<br>
Comment at: include/llvm/Support/Program.h:154<br>
@@ +153,3 @@<br>
+  std::error_code<br>
+  writeFileWithEncoding(const char *FileName, StringRef Contents,<br>
+                        EncodingStrategy Encoding = {EM_UTF8, EM_UTF8});<br>
----------------<br>
FileName can be a StringRef now, no?<br>
<br>
<a href="http://reviews.llvm.org/D4896" target="_blank">http://reviews.llvm.org/D4896</a><br>
<br>
<br>
</blockquote></div><br></div>