[PATCH] D32927: [libc++] Implement exception_ptr on Windows

Eric Fiselier via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri May 5 17:49:10 PDT 2017


EricWF added inline comments.


================
Comment at: include/exception:192
+#endif
+    void* __ptr1_;
+    void* __ptr2_;
----------------
STL_MSFT wrote:
> BillyONeal wrote:
> > I hope you realize you are doing "evil" unsupported things :). (We won't go out of our way to break this, but if it does break we won't feel bad :P )
> More specifically, while this will work with MSVC 2015/2017's msvcp140.dll, we've changed exception_ptr's separately compiled component in the next major binary-incompatible version of our STL.
I'm well aware I'm being a bad boy, but I need to mimic the Microsoft ABI. Obviously I expect nothing less than breakage and pain.

>  separately compiled component in the next major binary-incompatible version of our STL.

I'll have to cross that bridge when I come to it. Hopefully I can still make libc++ work *somehow*.
Maybe the exception_ptr internals will live outside of the STL libraries next release too :-)




================
Comment at: test/std/language.support/support.exception/except.nested/rethrow_if_nested.pass.cpp:12
+
+// This test fails due to a stack overflow
 // XFAIL: LIBCXX-WINDOWS-FIXME
----------------
BillyONeal wrote:
> FWIW it does not pass for our implementation either.
> 
> Note that unlike the Itanium ABI, the stack is not popped back to the catch block when handling an exception (because SEH can act like a signal handler and say EXCEPTION_CONTINUE_EXECUTION).
Thanks for pointing that out! Otherwise I may have gone down a rabbit hole trying to figure it out.


================
Comment at: test/std/language.support/support.exception/propagation/current_exception.pass.cpp:10-11
 
-// exception_ptr has not been implemented on Windows
+// This test needs to be rewritten for the Windows exception_ptr semantics
+// which copy the exception each time the exception_ptr is copied.
 // XFAIL: LIBCXX-WINDOWS-FIXME
----------------
BillyONeal wrote:
> We don't copy the exception each time the exception_ptr is copied -- exception_ptr models shared_ptr. See: "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.10.25017\crt\src\stl\excptptr.cpp"
> 
> We do make a copy when making the initial exception_ptr.
Ah thanks for the clarification. So `std::current_exception()` always returns a different copy.


https://reviews.llvm.org/D32927





More information about the cfe-commits mailing list