[llvm-branch-commits] [llvm-branch] r213764 - Merging r213663:
Dan Liew
dan at su-root.co.uk
Wed Jul 23 08:19:01 PDT 2014
Author: delcypher
Date: Wed Jul 23 10:19:01 2014
New Revision: 213764
URL: http://llvm.org/viewvc/llvm-project?rev=213764&view=rev
Log:
Merging r213663:
------------------------------------------------------------------------
r213663 | delcypher | 2014-07-22 16:41:18 +0100 (Tue, 22 Jul 2014) | 4 lines
Added LLVM_ENABLE_RTTI and LLVM_ENABLE_EH options that allow RTTI and EH
to globally be controlled. Individual targets (e.g. ExceptionDemo) can
still override this by using LLVM_REQUIRE_RTTI and LLVM_REQUIRE_EH if
they need to be compiled with RTTI or exception handling respectively.
------------------------------------------------------------------------
Modified:
llvm/branches/release_35/cmake/modules/AddLLVM.cmake
llvm/branches/release_35/cmake/modules/HandleLLVMOptions.cmake
llvm/branches/release_35/docs/CMake.rst
llvm/branches/release_35/examples/ExceptionDemo/CMakeLists.txt
Modified: llvm/branches/release_35/cmake/modules/AddLLVM.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_35/cmake/modules/AddLLVM.cmake?rev=213764&r1=213763&r2=213764&view=diff
==============================================================================
--- llvm/branches/release_35/cmake/modules/AddLLVM.cmake (original)
+++ llvm/branches/release_35/cmake/modules/AddLLVM.cmake Wed Jul 23 10:19:01 2014
@@ -8,8 +8,13 @@ function(llvm_update_compile_flags name)
set(update_src_props ON)
endif()
- if(LLVM_REQUIRES_EH)
- set(LLVM_REQUIRES_RTTI ON)
+ # LLVM_REQUIRES_EH is an internal flag that individual
+ # targets can use to force EH
+ if(LLVM_REQUIRES_EH OR LLVM_ENABLE_EH)
+ if(NOT (LLVM_REQUIRES_RTTI OR LLVM_ENABLE_RTTI))
+ message(AUTHOR_WARNING "Exception handling requires RTTI. Enabling RTTI for ${name}")
+ set(LLVM_REQUIRES_RTTI ON)
+ endif()
else()
if(LLVM_COMPILER_IS_GCC_COMPATIBLE)
list(APPEND LLVM_COMPILE_FLAGS "-fno-exceptions")
@@ -19,7 +24,9 @@ function(llvm_update_compile_flags name)
endif()
endif()
- if(NOT LLVM_REQUIRES_RTTI)
+ # LLVM_REQUIRES_RTTI is an internal flag that individual
+ # targets can use to force RTTI
+ if(NOT (LLVM_REQUIRES_RTTI OR LLVM_ENABLE_RTTI))
list(APPEND LLVM_COMPILE_DEFINITIONS GTEST_HAS_RTTI=0)
if (LLVM_COMPILER_IS_GCC_COMPATIBLE)
list(APPEND LLVM_COMPILE_FLAGS "-fno-rtti")
Modified: llvm/branches/release_35/cmake/modules/HandleLLVMOptions.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_35/cmake/modules/HandleLLVMOptions.cmake?rev=213764&r1=213763&r2=213764&view=diff
==============================================================================
--- llvm/branches/release_35/cmake/modules/HandleLLVMOptions.cmake (original)
+++ llvm/branches/release_35/cmake/modules/HandleLLVMOptions.cmake Wed Jul 23 10:19:01 2014
@@ -408,6 +408,13 @@ if(MSVC)
string(REGEX REPLACE "(^| ) */GR-? *( |$)" "\\1 \\2" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
endif()
+# Provide public options to globally control RTTI and EH
+option(LLVM_ENABLE_EH "Enable Exception handling" OFF)
+option(LLVM_ENABLE_RTTI "Enable run time type information" OFF)
+if(LLVM_ENABLE_EH AND NOT LLVM_ENABLE_RTTI)
+ message(FATAL_ERROR "Exception handling requires RTTI. You must set LLVM_ENABLE_RTTI to ON")
+endif()
+
# Plugin support
# FIXME: Make this configurable.
if(WIN32 OR CYGWIN)
Modified: llvm/branches/release_35/docs/CMake.rst
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_35/docs/CMake.rst?rev=213764&r1=213763&r2=213764&view=diff
==============================================================================
--- llvm/branches/release_35/docs/CMake.rst (original)
+++ llvm/branches/release_35/docs/CMake.rst Wed Jul 23 10:19:01 2014
@@ -218,10 +218,18 @@ LLVM-specific variables
Enables code assertions. Defaults to OFF if and only if ``CMAKE_BUILD_TYPE``
is *Release*.
+**LLVM_ENABLE_EH**:BOOL
+ Build LLVM with exception handling support. This is necessary if you wish to
+ link against LLVM libraries and make use of C++ exceptions in your own code
+ that need to propagate through LLVM code. Defaults to OFF.
+
**LLVM_ENABLE_PIC**:BOOL
Add the ``-fPIC`` flag for the compiler command-line, if the compiler supports
this flag. Some systems, like Windows, do not need this flag. Defaults to ON.
+**LLVM_ENABLE_RTTI**:BOOL
+ Build LLVM with run time type information. Defaults to OFF.
+
**LLVM_ENABLE_WARNINGS**:BOOL
Enable all compiler warnings. Defaults to ON.
Modified: llvm/branches/release_35/examples/ExceptionDemo/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_35/examples/ExceptionDemo/CMakeLists.txt?rev=213764&r1=213763&r2=213764&view=diff
==============================================================================
--- llvm/branches/release_35/examples/ExceptionDemo/CMakeLists.txt (original)
+++ llvm/branches/release_35/examples/ExceptionDemo/CMakeLists.txt Wed Jul 23 10:19:01 2014
@@ -6,7 +6,9 @@ set(LLVM_LINK_COMPONENTS
nativecodegen
)
+# Enable EH and RTTI for this demo
set(LLVM_REQUIRES_EH 1)
+set(LLVM_REQUIRES_RTTI 1)
add_llvm_example(ExceptionDemo
ExceptionDemo.cpp
More information about the llvm-branch-commits
mailing list