<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, Sep 21, 2016 at 11:29 AM, Tom Honermann via cfe-dev <span dir="ltr"><<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 9/20/2016 1:10 PM, Loïc Joly via cfe-dev wrote:<br>
> - Convert the files on the fly while Clang loads them. This looks<br>
> cleaner to me, even if it might be more performance intensive. From a<br>
> quick look at the code, it looks like a good place to do this would be<br>
> in VirtualFileSystem.cpp, with the classes File and RealFile.<br>
<br>
</span>Doing so can affect behavior if the source code uses characters outside<br>
the basic source character set.  Consider:<br>
<br>
$ cat t.c<br>
#include <string.h><br>
const char s[] = "À"; // where À is ISO-8859-1 0xC0.<br>
int main() {<br>
   return strlen(s);<br>
}<br>
<br>
$ clang t.c -o t; ./t; echo $?<br>
t.c:2:18: warning: illegal character encoding in string literal<br>
[-Winvalid-source-encoding]<br>
const char *s = "<C0>";<br>
                  ^~~~<br>
1 warning generated.<br>
1<br>
<br>
$ iconv -f iso8859-1 -t utf-8 t.c > t2.c<br>
<br>
$ clang t2.c -o t2; ./t2; echo $?<br>
2<br>
<br>
Whether that is a problem or not depends on the source code.<br>
<span class=""><br>
> Can you tell me if I'm on the right track?<br>
><br>
> Can you also tell me why doesn't Clang support -finput-charset? Is this<br>
> just a question of performances, or is there another issue I'm missing?<br>
<br>
</span>My guess is that noone has yet been motivated enough to do the work.<br></blockquote><div>There is interest in pursuing this (and some ideas have been discussed); however, as your code points out, support for<br></div><div>-finput-charset<br></div><div>and<br></div><div>-fexec-charset<br></div><div>is not a trivial endeavour.<br><br></div><div>-- HT <br></div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Tom.<br>
<div class="HOEnZb"><div class="h5"><br>
______________________________<wbr>_________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-dev</a><br>
</div></div></blockquote></div><br></div></div>