Open momo5502 opened 6 months ago
@llvm/issue-subscribers-clang-driver
Author: Maurice Heumann (momo5502)
@llvm/issue-subscribers-c-1
Author: Maurice Heumann (momo5502)
Seems like when compiling with MS cl, it enters a try block:
With clang-cl, it doesn't:
even though it splits the block at that position.
Seems like on IR level, the scope is being generated:
maybe it's just missing from the func info entry
setting the try state to 0 is necessary:
not sure why it's not done with clang
clang correctly emits it for the parent function (just like cl):
Building sample below with cl.exe (both x64 and x86) using
cl.exe /EHa a.cpp
yields the following expected output:Building it with clang-cl.exe for x86 using
clang-cl.exe -m32 /EHa a.cpp
yields the following output:As one can see, the destructor is not being called when unwinding. Note that compiling that sample using clang-cl for x64 works completely fine. This is only an issue with x86.
Another thing worth mentioning is that taking the code from
HandleDestructorCallWithException
and putting it directly withinCatchNativeExceptions
causes the x86 binary to crash, while x64 works fine.The sample: