[PATCH] Add getenv() wrapper that works on multibyte environment variable.

Rui Ueyama ruiu at google.com
Mon Sep 9 15:28:27 PDT 2013



================
Comment at: include/llvm/Support/ConvertUTF.h:240
@@ +239,3 @@
+ */
+bool convertUTF8ToUTF16String(ArrayRef<char> SrcBytes, std::string &Out);
+
----------------
Reid Kleckner wrote:
> Reid Kleckner wrote:
> > I don't think we should use std::strings of UTF16 across any function call boundary.  What can we do instead?  I guess wchar_t is a different size on different platforms, so std::wstring is right out.  Does std::basic_string<UTF16> work?
> Do you think this helper is generally useful?  Can we get away with calling MultiByteToWideChar(CP_UTF8, ...) instead, since we only need this functionality in Windows code?
That's a good point. This helper may not be useful for platforms other than Windows. We have a wrapper function for MultiByteToWideChar in lib/Support/Windows/Path.inc (UTF8ToUTF16()). I'd move this function to a separate file, say lib/Support/Windows/Wchar.inc, and use it both from Path.inc and from this file.


http://llvm-reviews.chandlerc.com/D1612



More information about the llvm-commits mailing list