emitStringLiteralDef: Return earlier here. NFC.
authorNAKAMURA Takumi <geek4civic@gmail.com>
Sat, 21 May 2022 23:56:30 +0000 (08:56 +0900)
committerNAKAMURA Takumi <geek4civic@gmail.com>
Mon, 23 May 2022 21:02:16 +0000 (06:02 +0900)
Differential Revision: https://reviews.llvm.org/D126135

llvm/utils/TableGen/SequenceToOffsetTable.h

index 41cdefd..a3d1e18 100644 (file)
@@ -170,18 +170,18 @@ public:
   /// `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) {