[clang] [CIR] Support reference type of non-record ptr in InitCatchParam (PR #195722)
Andy Kaylor via cfe-commits
cfe-commits at lists.llvm.org
Fri May 15 17:12:36 PDT 2026
================
@@ -621,18 +622,35 @@ ItaniumEHLowering::resolveCatchCopyThunk(cir::ConstructCatchParamOp op) {
mlir::LogicalResult
ItaniumEHLowering::lowerConstructCatchParam(cir::ConstructCatchParamOp op,
mlir::Value exnPtr) {
+ mlir::Location loc = op.getLoc();
+ mlir::Value paramAddr = op.getParamAddr();
+ cir::PointerType paramAddrType =
+ mlir::cast<cir::PointerType>(paramAddr.getType());
+
+ if (op.getKind() == cir::InitCatchKind::Reference) {
+ assert(!MissingFeatures::winSizeOfUnwindException());
+ constexpr unsigned headerSize = 32;
+
+ builder.setInsertionPoint(op);
+ auto index = cir::ConstantOp::create(
+ builder, loc, cir::IntAttr::get(u32Type, headerSize));
+ auto exnObj =
+ cir::PtrStrideOp::create(builder, loc, exnPtr.getType(), exnPtr, index);
----------------
andykaylor wrote:
Is `exnPtr.getType` here guaranteed to be `void*` or `i8*`? Maybe add an assertion, because this PtrStrideOp will be incorrect otherwise.
https://github.com/llvm/llvm-project/pull/195722
More information about the cfe-commits
mailing list