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

Hubert Tong via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Sat Nov 7 21:03:54 PST 2026


================
@@ -17,11 +17,29 @@
 #include "clang/AST/ASTContext.h"
 #include "clang/AST/FormatString.h"
 #include "clang/AST/Type.h"
+#include "clang/Basic/TargetInfo.h"
+#include "llvm/Support/TextEncoding.h"
 
 namespace clang {
 
 class LangOptions;
 
+/// Creates a TextEncodingConverter for format string character comparisons.
+/// On z/OS format strings are IBM-1047 encoded, so each byte must be converted
----------------
hubert-reinterpretcast wrote:

z/OS format strings are locale-dependent as with other platforms. In particular, "\u{e29b}\n" in IBM-939 appears as the byte sequence corresponding to "\x0E%s\x0F\n" but, under the appropriate locale, merely prints as that sequence of bytes.

This PR is making changes in the expectations users can have with respect to the interpretation of format strings and requires a documentation update. In particular, it appears that interpretation is done without regard to the literal encoding.

Note that the documentation should also account for the treatment of format strings in `llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp`.

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


More information about the llvm-branch-commits mailing list