[cfe-dev] Custom Tool Against Exception Code

Reid Kleckner via cfe-dev cfe-dev at lists.llvm.org
Tue Dec 1 17:47:57 PST 2015

Passing /EHsc should do it, just like you would enable them with cl.exe.
The default setting is /EHs-, which is off.

Our treatment of /EHsc is slightly different from MSVC. For MSVC, it really
controls whether C++ destructors are run on exception, and they emit a
warning whenever you use throw or catch without it. For Clang, it disables
everything, throw, catch, destructors, whatever.

We didn't feel it was worth supporting a mode where 'throw' and 'catch'
work, but destructors don't run. It might make sense to have a mode where
we downgrade the error to a warning and compile catch to nothing, though.

On Tue, Dec 1, 2015 at 3:59 PM, Daniel Dilts via cfe-dev <
cfe-dev at lists.llvm.org> wrote:

> I have a custom tool that I wrote that has a command-line like:
> Tool.exe file.cpp -- --driver-mode=cl -fms-compatibility-version=19
> -I(Some include directories) -D(Some macros)
> I have a line in the code I am running my tool against that throws an
> exception.  The tool gives an error "cannot use 'throw' with exceptions
> disables".
> As near as I can tell I am not disabling exceptions.  Is there something
> that I have to do to enable exceptions and RTTI?
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20151201/16c014b3/attachment.html>

More information about the cfe-dev mailing list