Add exception handling option to clang.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
This flag turns on CPU features (i.e. there's one for each new wasm feature proposal that has to be feature-detected), so I think this makes sense to be consistent with all the others. I could imagine enabling exceptions in the frontend but having some kind of emulation in the backend (like we do today for emscripten). More generally the semantics -fno-exceptions unfortunately doesn't exactly match the kind of behavior people typically want because it doesn't allow you to compile code that has try/catch/throw at all. In PNaCl and emscripten the default behavior is instead to compile that code but to lower it away and turn throw into abort. Also IIRC even with -fno-exceptions the code still has to allow exceptions to propagate which means you end up with invokes everywhere instead of calls, so you are still paying most of the costs of enabling EH. So that bit is a little bit complex and we'll probably want to think a bit more carefully about what options we want to have. But a machine flag for enabling the CPU feature makes sense to start.