]> granicus.if.org Git - llvm/commitdiff
Handle LLVM_USE_SANITIZER=Address;Undefined (and the other way around)
authorFilipe Cabecinhas <me@filcab.net>
Wed, 4 Feb 2015 22:33:31 +0000 (22:33 +0000)
committerFilipe Cabecinhas <me@filcab.net>
Wed, 4 Feb 2015 22:33:31 +0000 (22:33 +0000)
Summary:
Handle LLVM_USE_SANITIZER=Address;Undefined to enable ASan and UBSan
If UBSan is compatible with more of the other sanitizers, maybe we should
deal with this in a better way where we allow combining UBSan with any of
the other sanitizers.

Reviewers: samsonov

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D7024

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@228219 91177308-0d34-0410-b5e6-96231b3b80d8

cmake/modules/HandleLLVMOptions.cmake

index d38a4953abbcd9b88d81742de08836e25057e07d..de785d5bb591fd223f1390ab13d72d8c54aa9c2a 100644 (file)
@@ -404,6 +404,11 @@ if(LLVM_USE_SANITIZER)
     elseif (LLVM_USE_SANITIZER STREQUAL "Thread")
       append_common_sanitizer_flags()
       append("-fsanitize=thread" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
+    elseif (LLVM_USE_SANITIZER STREQUAL "Address;Undefined" OR
+            LLVM_USE_SANITIZER STREQUAL "Undefined;Address")
+      append_common_sanitizer_flags()
+      append("-fsanitize=address,undefined -fno-sanitize=vptr,function -fno-sanitize-recover"
+              CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
     else()
       message(WARNING "Unsupported value of LLVM_USE_SANITIZER: ${LLVM_USE_SANITIZER}")
     endif()