[llvm] [NFC][TableGen] Emit more readable builtin string table. (PR #105445)
Rahul Joshi via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 22 06:55:49 PDT 2024
================
@@ -52,6 +53,35 @@ class StringToOffsetTable {
return II->second;
}
+ // Emit the string using string literal concatenation, for better readability
+ // and searchability.
+ void EmitStringLiteralDef(raw_ostream &OS, const Twine &Decl,
+ const Twine &Indent = " ") const {
+ OS << formatv(R"(
+{0}#ifdef __GNUC__
+{0}#pragma GCC diagnostic push
+{0}#pragma GCC diagnostic ignored "-Woverlength-strings"
+{0}#endif
+{0}{1} = {{
----------------
jurahul wrote:
Here's what the emitted table looks like:
```C++
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Woverlength-strings"
#endif
static constexpr char BuiltinNames[] =
"dmb\0"
"dsb\0"
"isb\0"
"MoveFromCoprocessor\0"
"MoveFromCoprocessor2\0"
"_dmb\0"
"_dsb\0"
"_isb\0"
"\0";
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
```
https://github.com/llvm/llvm-project/pull/105445
More information about the llvm-commits
mailing list