[PATCH] D23645: Fix LLVM_ENABLE_EH and LLVM_ENABLE_RTTI on MSVC

Johannes S. Mueller-Roemer via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 17 23:43:19 PDT 2016


jsroemer created this revision.
jsroemer added a subscriber: llvm-commits.
jsroemer set the repository for this revision to rL LLVM.

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.

Repository:
  rL LLVM

https://reviews.llvm.org/D23645

Files:
  cmake/modules/AddLLVM.cmake

Index: cmake/modules/AddLLVM.cmake
===================================================================
--- cmake/modules/AddLLVM.cmake
+++ cmake/modules/AddLLVM.cmake
@@ -15,6 +15,9 @@
       message(AUTHOR_WARNING "Exception handling requires RTTI. Enabling RTTI for ${name}")
       set(LLVM_REQUIRES_RTTI ON)
     endif()
+    if(MSVC)
+      list(APPEND LLVM_COMPILE_FLAGS "/EHsc")
+    endif()
   else()
     if(LLVM_COMPILER_IS_GCC_COMPATIBLE)
       list(APPEND LLVM_COMPILE_FLAGS "-fno-exceptions")
@@ -35,6 +38,8 @@
     elseif (MSVC)
       list(APPEND LLVM_COMPILE_FLAGS "/GR-")
     endif ()
+  elseif(MSVC)
+    list(APPEND LLVM_COMPILE_FLAGS "/GR")
   endif()
 
   # Assume that;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D23645.68483.patch
Type: text/x-patch
Size: 694 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160818/6d744d98/attachment.bin>


More information about the llvm-commits mailing list