Author: Timm Baeder
Date: 2026-07-03T11:02:01+02:00
New Revision: 4d46b7afdab1747618fdd0f1480ae59d8352eeea

URL: 
https://github.com/llvm/llvm-project/commit/4d46b7afdab1747618fdd0f1480ae59d8352eeea
DIFF: 
https://github.com/llvm/llvm-project/commit/4d46b7afdab1747618fdd0f1480ae59d8352eeea.diff

LOG: [clang][bytecode][NFC] Report error if HasGroup is set without types 
(#207334)

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

Added: 
    

Modified: 
    clang/utils/TableGen/ClangOpcodesEmitter.cpp

Removed: 
    


################################################################################
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