[cfe-dev] Unicode path handling on Windows

Nikola Smiljanic popizdeh at gmail.com
Wed Aug 31 12:29:45 PDT 2011


Exactly, the problem is that I also need a function that converts from
Multibyte to UTF8. I added it to PathV2.inc with other conversion functions
and then created a wrapper around it inside llvm::sys::path in order to call
it inside ExpandArgv in driver.cpp. I know that this is not the right place
for it, and it seems that I also need the one that converts from utf8 to
utf16. The question is whether I should raise them (they are windows only
functions) and if yes where do they belong?

On Wed, Aug 31, 2011 at 9:02 PM, Aaron Ballman <aaron at aaronballman.com>wrote:

> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20110831/c3811800/attachment.html>


More information about the cfe-dev mailing list