[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:03:40 PDT 2024
================
@@ -52,6 +52,33 @@ 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 << "\n"
+ << Indent << "#ifdef __GNUC__\n"
+ << Indent << "#pragma GCC diagnostic push\n"
+ << Indent << "#pragma GCC diagnostic ignored \"-Woverlength-strings\"\n"
+ << Indent << "#endif\n"
+ << Indent << Decl << " = {\n";
----------------
jurahul wrote:
How about: static class functions in StringToTableOffset (which is in llvm/TableGen/StringToOffsetTable.h) to emit the pragmas, make emit string just emit the data (and call it `EmitStringAsFragments` or something), and reuse the static functions in `SequenceToOffsetTable` (in a follow up)?
https://github.com/llvm/llvm-project/pull/105445
More information about the llvm-commits
mailing list