[llvm-branch-commits] [clang] [clang-tools-extra] [llvm] Add format string handling (PR #196568)

Sergei Barannikov via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Sat Nov 14 22:04:39 PST 2026


================
@@ -134,6 +140,19 @@ class TextEncodingConverter {
       return std::string(Result);
     return EC;
   }
+
+  /// Returns true if this converter performs no conversion.
+  bool isNoop() const { return Converter->isNoop(); }
+
+  // This method is used in format string handling and is only intended
+  // to support basic charsets, not multibyte characters.
----------------
s-barannikov wrote:

`std::optional<char>` would do, I don't think we need the error code in places where this function is used (currently).
But there are so many uses, some inside `switch`es. An invaild return value (like the suggested 0x80) should work equally well with less code churn. 0x00 also works, but requires care as I tried to outline.

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


More information about the llvm-branch-commits mailing list