[llvm-dev] clang-cl and exceptions

616 views
Skip to first unread message

Russell Wallace via llvm-dev

unread,
Sep 2, 2015, 6:25:07 AM9/2/15
to llvm-dev
Tried a small test just now to see how exception handling on Windows is getting on, and it seems to work except for one thing.

clang-cl /EHsc (the Microsoft compiler option to enable exceptions) doesn't do anything; they remain disabled. However, -Xclang -fcxx-exceptions succeeds. Is this a bug in the handling of compatibility options or am I missing something?

Reid Kleckner via llvm-dev

unread,
Sep 2, 2015, 1:28:38 PM9/2/15
to Russell Wallace, llvm-dev
This was intentional, since the old implementation was broken. VS projects set /EHsc by default, so users who weren't actively using EH were automatically getting EH anyway, which would crash the compiler. I can't reasonably ask everyone who wants to try clang to manually change their VS project settings, so I made clang-cl temporarily ignore /EHs.

We've started over with new LLVM IR constructs for representing Windows EH, and when that's done, we can make /EHs enable it. For now you have to pass all of the following to clang-cl to try the new implementation:
-Xclang -fexceptions -Xclang -fcxx-exceptions -Xclang -fnew-ms-eh

The current status is that we can catch some 32-bit exceptions, but will usually crash at runtime. The compiler will reject destructor cleanups very late during codegen.

Hope that helps.

For future reference, this is more of a cfe-dev kind of topic.

On Wed, Sep 2, 2015 at 3:25 AM, Russell Wallace via llvm-dev <llvm...@lists.llvm.org> wrote:
Tried a small test just now to see how exception handling on Windows is getting on, and it seems to work except for one thing.

clang-cl /EHsc (the Microsoft compiler option to enable exceptions) doesn't do anything; they remain disabled. However, -Xclang -fcxx-exceptions succeeds. Is this a bug in the handling of compatibility options or am I missing something?

_______________________________________________
LLVM Developers mailing list
llvm...@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev


Russell Wallace via llvm-dev

unread,
Sep 2, 2015, 1:42:21 PM9/2/15
to Reid Kleckner, llvm-dev
Ah, that makes sense, thanks!
Reply all
Reply to author
Forward
0 new messages