Move 'convertUTF8Sequence' helper into the C++ section of the header file.
It's annotated as "inline", but ConvertUTF.c should still be able to compile
as C89.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173376 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/clang/Basic/ConvertUTF.h b/include/clang/Basic/ConvertUTF.h
index 38956ee..2d13d2c 100644
--- a/include/clang/Basic/ConvertUTF.h
+++ b/include/clang/Basic/ConvertUTF.h
@@ -161,16 +161,6 @@
unsigned getNumBytesForUTF8(UTF8 firstByte);
-static inline ConversionResult convertUTF8Sequence(const UTF8 **source,
- const UTF8 *sourceEnd,
- UTF32 *target,
- ConversionFlags flags) {
- unsigned size = getNumBytesForUTF8(**source);
- if (size > sourceEnd - *source)
- return sourceExhausted;
- return ConvertUTF8toUTF32(source, *source + size, &target, target + 1, flags);
-}
-
#ifdef __cplusplus
}
@@ -205,6 +195,32 @@
*/
bool ConvertCodePointToUTF8(unsigned Source, char *&ResultPtr);
+/**
+ * Convert the first UTF8 sequence in the given source buffer to a UTF32
+ * code point.
+ *
+ * \param [in,out] source A pointer to the source buffer. If the conversion
+ * succeeds, this pointer will be updated to point to the byte just past the
+ * end of the converted sequence.
+ * \param sourceEnd A pointer just past the end of the source buffer.
+ * \param [out] target The converted code
+ * \param flags Whether the conversion is strict or lenient.
+ *
+ * \returns conversionOK on success
+ *
+ * \sa ConvertUTF8toUTF32
+ */
+static inline ConversionResult convertUTF8Sequence(const UTF8 **source,
+ const UTF8 *sourceEnd,
+ UTF32 *target,
+ ConversionFlags flags) {
+ if (*source == sourceEnd)
+ return sourceExhausted;
+ unsigned size = getNumBytesForUTF8(**source);
+ if (size > sourceEnd - *source)
+ return sourceExhausted;
+ return ConvertUTF8toUTF32(source, *source + size, &target, target + 1, flags);
+}
}
#endif