[Lldb-commits] [PATCH] Disable exception handling for LLDB.

Zachary Turner zturner at google.com
Tue May 27 14:41:31 PDT 2014


Disables exception handling in LLDB, using appropriate compiler
flags depending on the platform.  This is consistent with the build
of LLVM, should improve performance, and also removes a substantial number
of warnings from the Windows build.

http://reviews.llvm.org/D3929

Files:
  CMakeLists.txt

Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -153,6 +153,7 @@
     -wd4068 # Suppress 'warning C4068: unknown pragma'
     -wd4150 # Suppress 'warning C4150: deletion of pointer to incomplete type'
     -wd4521 # Suppress 'warning C4521: 'type' : multiple copy constructors specified'
+    -wd4530 # Suppress 'warning C4530: C++ exception handler used, but unwind semantics are not enabled.'
   )
 endif() 
 
@@ -290,21 +291,28 @@
   ${DEBUG_SYMBOLS_LIBRARY})
 endif()
 
+if(LLDB_REQUIRES_EH)
+  set(LLDB_REQUIRES_RTTI ON)
+else()
+  if(LLVM_COMPILER_IS_GCC_COMPATIBLE)
+    set(LLDB_COMPILE_FLAGS "${LLDB_COMPILE_FLAGS} -fno-exceptions")
+  elseif(MSVC)
+    add_definitions( -D_HAS_EXCEPTIONS=0 )
+    set(LLDB_COMPILE_FLAGS "${LLDB_COMPILE_FLAGS} /EHs-c-")
+  endif()
+endif()
+
 # Disable RTTI by default
 if(NOT LLDB_REQUIRES_RTTI)
-  if (NOT MSVC)
-    if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU" OR
-        "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
-      #gnu && clang compilers
-      set(LLDB_COMPILE_FLAGS "-fno-rtti")
-    endif() #GNU or CLANG
-  else()
-    #MSVC
-    set(LLDB_COMPILE_FLAGS "/GR-")
-  endif() #NOT MSVC
-  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${LLDB_COMPILE_FLAGS}")
+  if (LLVM_COMPILER_IS_GCC_COMPATIBLE)
+    set(LLDB_COMPILE_FLAGS "${LLDB_COMPILE_FLAGS} -fno-rtti")
+  elseif(MSVC)
+    set(LLDB_COMPILE_FLAGS "${LLDB_COMPILE_FLAGS} /GR-")
+  endif()
 endif()
 
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${LLDB_COMPILE_FLAGS}")
+
 #add_subdirectory(include)
 add_subdirectory(docs)
 if (NOT CMAKE_SYSTEM_NAME MATCHES "Windows")
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D3929.9848.patch
Type: text/x-patch
Size: 1656 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20140527/34a4c3e9/attachment.bin>


More information about the lldb-commits mailing list