[llvm] [TableGen] Fix compile error in GCC-7.4.0 after 928f70d38e34 (PR #194692)

Krzysztof Parzyszek via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 28 10:50:24 PDT 2026


https://github.com/kparzysz created https://github.com/llvm/llvm-project/pull/194692

None

>From 25f5b360350e686ce96ee6bb40c094581cf8a2a1 Mon Sep 17 00:00:00 2001
From: Krzysztof Parzyszek <Krzysztof.Parzyszek at amd.com>
Date: Tue, 28 Apr 2026 12:48:53 -0500
Subject: [PATCH] [TableGen] Fix compile error in GCC-7.4.0 after 928f70d38e34

---
 llvm/utils/TableGen/Basic/DirectiveEmitter.cpp | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/llvm/utils/TableGen/Basic/DirectiveEmitter.cpp b/llvm/utils/TableGen/Basic/DirectiveEmitter.cpp
index ba6e10f7042cc..35df0ff18b6b5 100644
--- a/llvm/utils/TableGen/Basic/DirectiveEmitter.cpp
+++ b/llvm/utils/TableGen/Basic/DirectiveEmitter.cpp
@@ -848,8 +848,9 @@ static void generateGetDirectiveAssociation(const DirectiveLanguage &DirLang,
       OS << "    return Association::" << GetAssocName(F->second) << ";\n";
     }
   }
+  OS << "  default:\n";
+  OS << "    llvm_unreachable(\"Unexpected directive\");\n";
   OS << "  } // switch (Dir)\n";
-  OS << "  llvm_unreachable(\"Unexpected directive\");\n";
   OS << "}\n";
 }
 
@@ -866,8 +867,9 @@ static void generateGetDirectiveCategory(const DirectiveLanguage &DirLang,
     OS << "    return Category::" << D.getCategory()->getValueAsString("name")
        << ";\n";
   }
+  OS << "  default:\n";
+  OS << "    llvm_unreachable(\"Unexpected directive\");\n";
   OS << "  } // switch (Dir)\n";
-  OS << "  llvm_unreachable(\"Unexpected directive\");\n";
   OS << "}\n";
 }
 
@@ -891,8 +893,9 @@ static void generateGetDirectiveLanguages(const DirectiveLanguage &DirLang,
         " | ");
     OS << ";\n";
   }
+  OS << "  default:\n";
+  OS << "    llvm_unreachable(\"Unexpected directive\");\n";
   OS << "  } // switch(D)\n";
-  OS << "  llvm_unreachable(\"Unexpected directive\");\n";
   OS << "}\n";
 }
 



More information about the llvm-commits mailing list