[llvm] 51a3788 - [TableGen] Separate string when digit follows octal escape (#207807)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 6 22:18:25 PDT 2026
Author: Alexis Engelke
Date: 2026-07-07T07:18:21+02:00
New Revision: 51a378885ae5f48c2b1521700fd5732a5aae00aa
URL: https://github.com/llvm/llvm-project/commit/51a378885ae5f48c2b1521700fd5732a5aae00aa
DIFF: https://github.com/llvm/llvm-project/commit/51a378885ae5f48c2b1521700fd5732a5aae00aa.diff
LOG: [TableGen] Separate string when digit follows octal escape (#207807)
Silence MSVC warning C4125 by separating the string literals when an
octal escape sequence is followed by a decimal char.
Added:
Modified:
llvm/lib/TableGen/StringToOffsetTable.cpp
Removed:
################################################################################
diff --git a/llvm/lib/TableGen/StringToOffsetTable.cpp b/llvm/lib/TableGen/StringToOffsetTable.cpp
index 06d8240486245..546a11ac1287f 100644
--- a/llvm/lib/TableGen/StringToOffsetTable.cpp
+++ b/llvm/lib/TableGen/StringToOffsetTable.cpp
@@ -118,6 +118,12 @@ void StringToOffsetTable::EmitString(raw_ostream &O) const {
O << EscapedStr[++i];
O << EscapedStr[++i];
CharsPrinted += 3;
+ if (i + 1 < EscapedStr.size() && isDigit(EscapedStr[i + 1])) {
+ // If a digit follows after an octal literal, separate the string
+ // literals to silence MSVC warning C4125.
+ O << "\" \"";
+ CharsPrinted += 3;
+ }
} else {
O << EscapedStr[++i];
++CharsPrinted;
More information about the llvm-commits
mailing list