https://github.com/tbaederr created 
https://github.com/llvm/llvm-project/pull/207334

Setting `HasGroup = 1` in tablegen without the types being non-empty causes 
problems later, so diagnose it.

>From 82492b8a8fad3711a144268dd8c34b72d6981414 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timm=20B=C3=A4der?= <[email protected]>
Date: Fri, 3 Jul 2026 09:15:39 +0200
Subject: [PATCH] [clang][bytecode][NFC] Report error if HasGroup is set
 without types

---
 clang/utils/TableGen/ClangOpcodesEmitter.cpp | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/clang/utils/TableGen/ClangOpcodesEmitter.cpp 
b/clang/utils/TableGen/ClangOpcodesEmitter.cpp
index 154969cf49b04..7fef309e127ef 100644
--- a/clang/utils/TableGen/ClangOpcodesEmitter.cpp
+++ b/clang/utils/TableGen/ClangOpcodesEmitter.cpp
@@ -320,6 +320,11 @@ void ClangOpcodesEmitter::EmitGroup(raw_ostream &OS, 
StringRef N,
   const auto *Types = R->getValueAsListInit("Types");
   const auto &Args = R->getValueAsListOfDefs("Args");
 
+  if (Types->empty()) {
+    PrintFatalError("HasGroup only makes sense for opcodes with types");
+    return;
+  }
+
   Twine EmitFuncName = "emit" + N;
 
   // Emit the prototype of the group emitter in the header.

_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to