This is an archive of the discontinued LLVM Phabricator instance.

clang-cl: Map /EHs- to -fno-exceptions
ClosedPublic

Authored by rnk on Jun 26 2014, 3:25 PM.

Details

Summary

This isn't 100% compatible with MSVC, but it's close enough. MSVC's /EH
flag doesn't really control exceptions so much as how to clean up after
an exception is thrown. The upshot is that cl.exe /EHs- will compile
try, throw, and catch statements with a warning, but clang-cl will
reject such constructs with a hard error. We can't compile such EH
constructs anyway, but this may matter to consumers of the AST.

Diff Detail

Repository
rL LLVM

Event Timeline

rnk updated this revision to Diff 10906.Jun 26 2014, 3:25 PM
rnk retitled this revision from to clang-cl: Map /EHs- to -fno-exceptions.
rnk updated this object.
rnk added a reviewer: hans.
rnk added a subscriber: Unknown Object (MLST).
hans accepted this revision.Jun 27 2014, 9:06 AM
hans edited edge metadata.

lgtm with a few comments

lib/Driver/Tools.cpp
4409 ↗(On Diff #10906)

nit: "the whether".

Also, do you think we should break this into a helper function?

And I suppose we should forward the /EH flag to msvc when invoking the fallback.

This revision is now accepted and ready to land.Jun 27 2014, 9:06 AM
rnk added a comment.Jun 27 2014, 10:04 AM

thanks!

lib/Driver/Tools.cpp
4409 ↗(On Diff #10906)

nit: "the whether".

fixed

Also, do you think we should break this into a helper function?

Sure. I'll go back and split out /MD & co in a followup.

And I suppose we should forward the /EH flag to msvc when invoking the fallback.

Oh, right, added that.

rnk closed this revision.Jun 27 2014, 10:10 AM
rnk updated this revision to Diff 10937.

Closed by commit rL211909 (authored by @rnk).