[clang] [CIR] Upstream Re-Throw with no return (PR #154994)
Andy Kaylor via cfe-commits
cfe-commits at lists.llvm.org
Fri Aug 22 12:34:54 PDT 2025
================
@@ -2646,6 +2646,24 @@ ParseResult cir::InlineAsmOp::parse(OpAsmParser &parser,
return mlir::success();
}
+//===----------------------------------------------------------------------===//
+// ThrowOp
+//===----------------------------------------------------------------------===//
+
+mlir::LogicalResult cir::ThrowOp::verify() {
+ // For the no-rethrow version, it must have at least the exception pointer.
+ if (rethrows())
+ return success();
+
+ if (getNumOperands() == 1) {
----------------
andykaylor wrote:
```suggestion
if (getNumOperands() != 0) {
```
I don't think this will ever be 1. In fact, maybe we should check for that. We need at least type info and an exception pointer if this isn't a rethrow.
When RTTI is implemented, it might be good to add a check to verify that `type_info` references valid type info, and perhaps also that `dtor`, if present, references a destructor.
https://github.com/llvm/llvm-project/pull/154994
More information about the cfe-commits
mailing list