This is an archive of the discontinued LLVM Phabricator instance.

[CMake] Fix LLVM_ENABLE_EH and LLVM_ENABLE_RTTI on MSVC
ClosedPublic

Authored by jsroemer on Aug 17 2016, 11:43 PM.

Details

Summary

I just enabled LLVM_ENABLE_EH and LLVM_ENABLE_RTTI for all my platforms due to compatibility issues on Linux and noticed a massive number of warnings from xlocal that /EHsc should be enabled. I traced this down to HandleLLVMOptions unconditionally removing all EH and RTTI flags on MSVC (lines 609-616) and llvm_update_compile_flags not adding them back. In other words, as of right now, these options are broken on MSVC. The attached patch adds the flags back as required.

Diff Detail

Repository
rL LLVM

Event Timeline

jsroemer updated this revision to Diff 68483.Aug 17 2016, 11:43 PM
jsroemer retitled this revision from to Fix LLVM_ENABLE_EH and LLVM_ENABLE_RTTI on MSVC.
jsroemer updated this object.
jsroemer set the repository for this revision to rL LLVM.
jsroemer added a subscriber: llvm-commits.
jsroemer retitled this revision from Fix LLVM_ENABLE_EH and LLVM_ENABLE_RTTI on MSVC to [CMake] Fix LLVM_ENABLE_EH and LLVM_ENABLE_RTTI on MSVC.Aug 18 2016, 12:04 AM
rnk accepted this revision.Aug 18 2016, 8:53 AM
rnk edited edge metadata.

lgtm

It's unfortunate that we have to globally remove /EHsc and /GR in HandleLLVMOptions just to avoid warnings, but I don't think we can avoid it.

This revision is now accepted and ready to land.Aug 18 2016, 8:53 AM

Ok, great, can you or someone else land the patch? I don't have commit rights.

Personally, I think the issue is that we have an option like LLVM_ENABLE_EH at all instead of respecting what the user sets via CMAKE_${LANG}_FLAGS, but that's a different discussion.

This revision was automatically updated to reflect the committed changes.
rnk added a comment.Sep 1 2016, 7:59 AM

Thanks Andrey! I was sick/busy last week.