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
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to