[llvm] r292256 - Enabled -fsanitize-address-use-after-scope for -DLLVM_USE_SANITIZER=Address

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


Vitaly Buka via llvm-commits <llvm-commits at lists.llvm.org> writes:
> Author: vitalybuka
> Date: Tue Jan 17 15:04:23 2017
> New Revision: 292256
>
> URL: http://llvm.org/viewvc/llvm-project?rev=292256&view=rev
> Log:
> Enabled -fsanitize-address-use-after-scope for -DLLVM_USE_SANITIZER=Address
>
> Subscribers: mgorny, llvm-commits
>
> Differential Revision: https://reviews.llvm.org/D28823
>
> 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=292256&r1=292255&r2=292256&view=diff
> ==============================================================================
>
> --- llvm/trunk/cmake/modules/HandleLLVMOptions.cmake (original)
> +++ llvm/trunk/cmake/modules/HandleLLVMOptions.cmake Tue Jan 17 15:04:23 2017
> @@ -588,6 +588,9 @@ if(LLVM_USE_SANITIZER)
>    else()
>      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)

This isn't right. -fsanitize-address-use-after-scope is a fairly new
flag, so this will fail to even be able to build anywhere where the host
clang isn't bleeding edge. Instead, we should be using
add_flag_if_supported here, which I've done for you in r292423.

> +  endif()
>    if (LLVM_USE_SANITIZE_COVERAGE)
>      append("-fsanitize-coverage=trace-pc-guard,indirect-calls,trace-cmp" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
>    endif()
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits


More information about the llvm-commits mailing list