[llvm-branch-commits] [clang] [llvm] Enable fexec-charset option (PR #138895)

via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon May 12 00:42:43 PDT 2025


================
@@ -1842,23 +1859,52 @@ CharLiteralParser::CharLiteralParser(const char *begin, const char *end,
             HadError = true;
             PP.Diag(Loc, diag::err_character_too_large);
           }
+          if (!HadError && Converter) {
+            assert(Kind != tok::wide_char_constant &&
+                   "Wide character translation not supported");
+            char ByteChar = *tmp_out_start;
+            SmallString<1> ConvertedChar;
+            Converter->convert(StringRef(&ByteChar, 1), ConvertedChar);
+            assert(ConvertedChar.size() == 1 &&
+                   "Char size increased after translation");
+            *tmp_out_start = ConvertedChar[0];
----------------
cor3ntin wrote:

This should be handled with diagnostics. The conversion can also fail, and that should be handled.

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


More information about the llvm-branch-commits mailing list