[clang] [clang][bytecode][NFC] Report error if HasGroup is set without types (PR #207334)
Timm Baeder via cfe-commits
cfe-commits at lists.llvm.org
Fri Jul 3 00:17:31 PDT 2026
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?= <tbaeder at redhat.com>
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.
More information about the cfe-commits
mailing list