================
@@ -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:
Please document it that the result of this function must not be compared
against the null character.
The caller doesn't know if this function returned the null character because of
an error or because of the null character input. If the caller needs to know
whether a character is null, it should check for that *before* calling this
function (like you do everywhere in this patch).
As a safe alternative (I think), we could return any non-null character outside
the basic character set (e.g., '\x80') in the error case. The callers only
compare the result against characters in the basic character set.
This might sound more reliable, but it is still an implicit contract, and I
don't know what else we can do without complicating the code or hurting the
performance further.
https://github.com/llvm/llvm-project/pull/196568
_______________________________________________
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits