[libc-commits] [libc] [libc] Add UTF-16 support in CharacterConverter [1/6] (PR #230434)

Michael Jones via libc-commits libc-commits at lists.llvm.org
Tue Oct 13 15:58:46 PDT 2026


================
@@ -112,13 +161,31 @@ LIBC_INLINE int CharacterConverter::push(char8_t utf8_byte) {
     state->bytes_stored++;
     return 0;
   }
+  // Pushing when partially popping is a misuse in the library
+  if (isPartiallyPopping()) {
+    clear();
+    return -1;
+  }
----------------
michaelrj-google wrote:

this could be a `LIBC_ASSERT` but having this check in the fast path is likely to cause performance issues.

https://github.com/llvm/llvm-project/pull/230434


More information about the libc-commits mailing list