[clang] [clang][bytecode][NFC] Report error if HasGroup is set without types (PR #207334)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Jul 3 00:18:04 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: Timm Baeder (tbaederr)
<details>
<summary>Changes</summary>
Setting `HasGroup = 1` in tablegen without the types being non-empty causes problems later, so diagnose it.
---
Full diff: https://github.com/llvm/llvm-project/pull/207334.diff
1 Files Affected:
- (modified) clang/utils/TableGen/ClangOpcodesEmitter.cpp (+5)
``````````diff
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.
``````````
</details>
https://github.com/llvm/llvm-project/pull/207334
More information about the cfe-commits
mailing list