[clang] Add ParserConversionAction (PR #169803)

Sergei Barannikov via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 3 23:40:19 PDT 2026


================
@@ -33,16 +33,17 @@ FormatStringHandler::~FormatStringHandler() {}
 // scanf format strings.
 //===----------------------------------------------------------------------===//
 
-OptionalAmount
-clang::analyze_format_string::ParseAmount(const char *&Beg, const char *E) {
+OptionalAmount clang::analyze_format_string::ParseAmount(
+    const char *&Beg, const char *E,
+    const llvm::TextEncodingConverter &FormatStrConverter) {
   const char *I = Beg;
   UpdateOnReturn <const char*> UpdateBeg(Beg, I);
 
   unsigned accumulator = 0;
   bool hasDigits = false;
 
   for ( ; I != E; ++I) {
-    char c = *I;
+    char c = FormatStrConverter.convert(*I);
----------------
s-barannikov wrote:

> What about changing the name of the function to emphasize this nature of the function? That should help avoid someone comparing the result to zero.

Renaming the function and/or adding a comment would certainly be helpful.


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


More information about the cfe-commits mailing list