[cfe-dev] Unicode path handling on Windows

Aaron Ballman aaron at aaronballman.com
Wed Aug 31 12:02:11 PDT 2011


On Wed, Aug 31, 2011 at 1:17 PM, Eli Friedman <eli.friedman at gmail.com> wrote:
> On Wed, Aug 31, 2011 at 10:58 AM, Nikola Smiljanic <popizdeh at gmail.com> wrote:
>> _wopen expects wchar_t* and the only visible function for conversion to
>> utf16 is ConvertUTF8toUTF32 which converts to unsigned shorts.
>
> If you're in #ifdef WIN32 code, just use ConvertUTF8toUTF16 and
> reinterpret_cast from unsigned short* to wchar_t*.

I think the problem is that PathV2.inc is part of LLVM, and the
ConvertUTF8ToUTF16 function is in an anonymous namespace.  So the
question becomes: raise the function into an accessible namespace,
duplicate code, or find some other mechanism?

I don't think it makes sense to raise the function out of the
anonymous namespace unless it's also moved (it has nothing to do with
paths per se).  Perhaps it's worth it to move it to StringRef?

~Aaron




More information about the cfe-dev mailing list