================
@@ -90,3 +89,35 @@ int bar()
     }
   }
 }
+
+// CHECK-LABEL: @"?foo1@@YAXXZ"()
+// CHECK-NOT: invoke void @llvm.seh.scope.begin()
+// CHECK:     invoke void @llvm.seh.try.begin()
+// CHECK:     invoke.cont:
+// CHECK:     invoke void @llvm.seh.scope.begin()
+// CHECK:     invoke noundef ptr @"??0A@@QEAA@XZ"
+// CHECK:     invoke void @llvm.seh.scope.end()
+// CHECK:     invoke void @llvm.seh.scope.begin()
+// CHECK:     invoke void @"??1A@@QEAA@XZ"
+// CHECK:     invoke void @llvm.seh.scope.end()
+// CHECK-NOT: invoke void @llvm.seh.try.end()
+// CHECK:     br label %delete.end
+// CHECK:     invoke void @llvm.seh.try.end()
+// CHECK:     call void @"?fin$0@0@foo1@@"(i8 noundef 0
+// CHECK:     cleanupret
+// CHECK:     call void @"?fin$0@0@foo1@@"(i8 noundef 1
+// CHECK-NOT: @llvm.seh.scope.end
+// CHECK:     cleanupret
+struct A {
+       A();
+       ~A();
+};
+
+void foo1() {
+       __try {
----------------
efriedma-quic wrote:

Looking at the IR here, it looks like what happens is that you emit what is, in 
essence, a nested __finally block to call delete.  Structurally, it's the same 
IR we'd emit for C++ exception-handling, so the result is well-formed. But I'd 
guess there's a reason MSVC refuses to do this?

https://developercommunity.visualstudio.com/t/c2712-generated-even-when-seh-does-not-traverse-sc/1692745
 has some related discussion.

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

Reply via email to