X-Git-Url: http://plrg.eecs.uci.edu/git/?p=oota-llvm.git;a=blobdiff_plain;f=cmake%2Fmodules%2FHandleLLVMOptions.cmake;h=2cec270e96ddb63a2fdc3eb20aad463c74e5307c;hp=4125feb579811225519be063d3e7b7afd5866a2f;hb=29150e45fbc6cabda57b2bce1c447a84b9c779f0;hpb=252d41691a2d9fc66173f917d538d0b2767b6440 diff --git a/cmake/modules/HandleLLVMOptions.cmake b/cmake/modules/HandleLLVMOptions.cmake index 4125feb5798..2cec270e96d 100644 --- a/cmake/modules/HandleLLVMOptions.cmake +++ b/cmake/modules/HandleLLVMOptions.cmake @@ -8,6 +8,8 @@ include(CheckCXXCompilerFlag) if( CMAKE_COMPILER_IS_GNUCXX ) set(LLVM_COMPILER_IS_GCC_COMPATIBLE ON) +elseif( MSVC ) + set(LLVM_COMPILER_IS_GCC_COMPATIBLE OFF) elseif( "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" ) set(LLVM_COMPILER_IS_GCC_COMPATIBLE ON) endif() @@ -151,10 +153,16 @@ endif() if( MSVC ) include(ChooseMSVCCRT) - if( MSVC11 ) + if( MSVC10 ) + # MSVC 10 will complain about headers in the STL not being exported, but + # will not complain in MSVC 11. + add_llvm_definitions( + -wd4275 # Suppress 'An exported class was derived from a class that was not exported.' + ) + elseif( MSVC11 ) add_llvm_definitions(-D_VARIADIC_MAX=10) endif() - + # Add definitions that make MSVC much less annoying. add_llvm_definitions( # For some reason MS wants to deprecate a bunch of standard functions... @@ -168,22 +176,16 @@ if( MSVC ) # Disabled warnings. -wd4146 # Suppress 'unary minus operator applied to unsigned type, result still unsigned' -wd4180 # Suppress 'qualifier applied to function type has no meaning; ignored' - -wd4181 # Suppress 'qualifier applied to reference type; ignored' - -wd4224 # Suppress 'nonstandard extension used : formal parameter 'identifier' was previously defined as a type' -wd4244 # Suppress ''argument' : conversion from 'type1' to 'type2', possible loss of data' -wd4267 # Suppress ''var' : conversion from 'size_t' to 'type', possible loss of data' - -wd4275 # Suppress 'An exported class was derived from a class that was not exported.' - -wd4291 # Suppress ''declaration' : no matching operator delete found; memory will not be freed if initialization throws an exception' -wd4345 # Suppress 'behavior change: an object of POD type constructed with an initializer of the form () will be default-initialized' -wd4351 # Suppress 'new behavior: elements of array 'array' will be default initialized' -wd4355 # Suppress ''this' : used in base member initializer list' -wd4503 # Suppress ''identifier' : decorated name length exceeded, name was truncated' - -wd4551 # Suppress 'function call missing argument list' -wd4624 # Suppress ''derived class' : destructor could not be generated because a base class destructor is inaccessible' - -wd4715 # Suppress ''function' : not all control paths return a value' - -wd4722 # Suppress ''function' : destructor never returns, potential memory leak' -wd4800 # Suppress ''type' : forcing value to bool 'true' or 'false' (performance warning)' - + -wd4291 # Suppress ''declaration' : no matching operator delete found; memory will not be freed if initialization throws an exception' + # Promoted warnings. -w14062 # Promote 'enumerator in switch of enum is not handled' to level 1 warning. @@ -240,6 +242,10 @@ macro(append_common_sanitizer_flags) NOT uppercase_CMAKE_BUILD_TYPE STREQUAL "RELWITHDEBINFO") add_flag_if_supported("-gline-tables-only") endif() + # Use -O1 even in debug mode, otherwise sanitizers slowdown is too large. + if (uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG") + add_flag_if_supported("-O1") + endif() endmacro() # Turn on sanitizers if necessary. @@ -262,6 +268,11 @@ if(LLVM_USE_SANITIZER) endif() endif() +# Turn on -gsplit-dwarf if requested +if(LLVM_USE_SPLIT_DWARF) + add_llvm_definitions("-gsplit-dwarf") +endif() + add_llvm_definitions( -D__STDC_CONSTANT_MACROS ) add_llvm_definitions( -D__STDC_FORMAT_MACROS ) add_llvm_definitions( -D__STDC_LIMIT_MACROS )