================
@@ -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);
----------------
AmrDeveloper wrote:

I will add an assert for that to be easy to catch if any mistakes happen

https://github.com/llvm/llvm-project/pull/195722
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to