[llvm] r292423 - cmake: Only sanitize use-after-scope if the host compiler supports it

Justin Bogner via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 18 11:01:58 PST 2017


Author: bogner
Date: Wed Jan 18 13:01:58 2017
New Revision: 292423

URL: http://llvm.org/viewvc/llvm-project?rev=292423&view=rev
Log:
cmake: Only sanitize use-after-scope if the host compiler supports it

In r292256, we started adding -fsanitize-use-after-scope when using
the address sanitizer, but that flag wasn't always available. This
fixes the config to only add the flag if the host compiler supports
it.

Modified:
    llvm/trunk/cmake/modules/HandleLLVMOptions.cmake

Modified: llvm/trunk/cmake/modules/HandleLLVMOptions.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/HandleLLVMOptions.cmake?rev=292423&r1=292422&r2=292423&view=diff
==============================================================================
--- llvm/trunk/cmake/modules/HandleLLVMOptions.cmake (original)
+++ llvm/trunk/cmake/modules/HandleLLVMOptions.cmake Wed Jan 18 13:01:58 2017
@@ -589,7 +589,8 @@ if(LLVM_USE_SANITIZER)
     message(FATAL_ERROR "LLVM_USE_SANITIZER is not supported on this platform.")
   endif()
   if (LLVM_USE_SANITIZER MATCHES "(Undefined;)?Address(;Undefined)?")
-    append("-fsanitize-address-use-after-scope" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
+    add_flag_if_supported("-fsanitize-address-use-after-scope"
+                          FSANITIZE_USE_AFTER_SCOPE_FLAG)
   endif()
   if (LLVM_USE_SANITIZE_COVERAGE)
     append("-fsanitize-coverage=trace-pc-guard,indirect-calls,trace-cmp" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)




More information about the llvm-commits mailing list