[PATCH] D126135: emitStringLiteralDef: Return earlier here. NFC.

NAKAMURA Takumi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 23 14:03:43 PDT 2022


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG40b9a2616e45: emitStringLiteralDef: Return earlier here. NFC. (authored by chapuni).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D126135/new/

https://reviews.llvm.org/D126135

Files:
  llvm/utils/TableGen/SequenceToOffsetTable.h


Index: llvm/utils/TableGen/SequenceToOffsetTable.h
===================================================================
--- llvm/utils/TableGen/SequenceToOffsetTable.h
+++ llvm/utils/TableGen/SequenceToOffsetTable.h
@@ -170,18 +170,18 @@
   /// `EmitLongStrLiterals` is false
   void emitStringLiteralDef(raw_ostream &OS, const llvm::Twine &Decl) const {
     assert(Entries && "Call layout() before emitStringLiteralDef()");
-    if (EmitLongStrLiterals) {
-      OS << "\n#ifdef __GNUC__\n"
-         << "#pragma GCC diagnostic push\n"
-         << "#pragma GCC diagnostic ignored \"-Woverlength-strings\"\n"
-         << "#endif\n"
-         << Decl << " = {\n";
-    } else {
+    if (!EmitLongStrLiterals) {
       OS << Decl << " = {\n";
       emit(OS, printChar, "0");
       OS << "\n};\n\n";
       return;
     }
+
+    OS << "\n#ifdef __GNUC__\n"
+       << "#pragma GCC diagnostic push\n"
+       << "#pragma GCC diagnostic ignored \"-Woverlength-strings\"\n"
+       << "#endif\n"
+       << Decl << " = {\n";
     for (auto I : Seqs) {
       OS << "  /* " << I.second << " */ \"";
       for (auto C : I.first) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D126135.431476.patch
Type: text/x-patch
Size: 1128 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220523/9cecae0d/attachment.bin>


More information about the llvm-commits mailing list