[PATCH] [Support] Add a Unicode conversion wrapper from UTF16 to UTF8

Reid Kleckner rnk at google.com
Tue Jul 16 08:07:27 PDT 2013


  You win yourself another round.  :)  I added a hasbom helper because the rsp file parser will need that.


================
Comment at: include/llvm/Support/ConvertUTF.h:227
@@ +226,3 @@
+/**
+ * Converts a stream of raw bytes assumed to be UTF16 into a UTF8 std::string.
+ */
----------------
Hans Wennborg wrote:
> It would be nice to say what the return value means.
Sure.

================
Comment at: lib/Support/ConvertUTFWrapper.cpp:78
@@ -74,1 +77,3 @@
 
+bool convertUTF16ToUTF8String(const char *SrcBytes, const char *SrcBytesEnd,
+                              std::string &Out) {
----------------
Hans Wennborg wrote:
> would ArrayRef<char> be appropriate here instead of pointers to the start and end?
I agree.  I also considered StringRef, but I don't like that it can be implicitly constructed form a C string with strlen, so ArrayRef it is.


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



More information about the llvm-commits mailing list