aboutsummaryrefslogtreecommitdiff
path: root/include/clang/Basic/ConvertUTF.h
diff options
context:
space:
mode:
authorNico Weber <nicolasweber@gmx.de>2012-07-03 02:24:52 +0000
committerNico Weber <nicolasweber@gmx.de>2012-07-03 02:24:52 +0000
commit941e47cef26fb6300a8d3e366f7c5694277e5849 (patch)
treee945a9199490fafc296ef2fcece986ab53a6b2bd /include/clang/Basic/ConvertUTF.h
parent7c81b43bef441960e921e0eb72d249369b7dd96c (diff)
Share ConvertUTF8toWide() between Lex and CodeGen.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159634 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Basic/ConvertUTF.h')
-rw-r--r--include/clang/Basic/ConvertUTF.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/include/clang/Basic/ConvertUTF.h b/include/clang/Basic/ConvertUTF.h
index 7fb5874027..53d451485d 100644
--- a/include/clang/Basic/ConvertUTF.h
+++ b/include/clang/Basic/ConvertUTF.h
@@ -159,6 +159,25 @@ Boolean isLegalUTF8String(const UTF8 *source, const UTF8 *sourceEnd);
#ifdef __cplusplus
}
+
+/*************************************************************************/
+/* Below are LLVM-specific wrappers of the functions above. */
+
+#include "llvm/ADT/StringRef.h"
+
+namespace clang {
+
+/**
+ * Convert an UTF8 StringRef to UTF8, UTF16, or UTF32 depending on
+ * WideCharWidth. The converted data is written to ResultPtr, which needs to
+ * point to at least WideCharWidth * (Source.Size() + 1) bytes. On success,
+ * ResultPtr will point one after the end of the copied string.
+ * \return true on success.
+ */
+bool ConvertUTF8toWide(unsigned WideCharWidth, llvm::StringRef Source,
+ char *&ResultPtr);
+
+}
#endif
#endif