[libcxx-commits] [PATCH] D77466: libcxx 'LLVM_USE_SANITIZER=Address; Undefined'

Brian Gesiak via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Sat Apr 4 10:37:04 PDT 2020


modocache created this revision.
modocache added reviewers: jroelofs, EricWF, ldionne.
Herald added subscribers: dexonsmith, mgorny.
Herald added a project: libc++.
Herald added a reviewer: libc++.

Allow users to simultaneously enable address and undefined behavior
sanitizers, in the same manner that LLVM's 'HandleLLVMOptions.cmake'
allows.

Prior to this patch, `cmake -DLLVM_USE_SANITIZER="Address;Undefined"`
would succeed and the build would build most of the LLVM project with
`-fsanitize=address,undefined`, but a warning would be printed by
libcxx's CMake, and the build would use neither sanitizer. This
patch results in no warning being printed, and both sanitizers are used
in building libcxx.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D77466

Files:
  libcxx/CMakeLists.txt


Index: libcxx/CMakeLists.txt
===================================================================
--- libcxx/CMakeLists.txt
+++ libcxx/CMakeLists.txt
@@ -678,6 +678,9 @@
       endif()
     elseif (USE_SANITIZER STREQUAL "Undefined")
       append_flags(SANITIZER_FLAGS "-fsanitize=undefined -fno-sanitize=vptr,function -fno-sanitize-recover=all")
+    elseif (USE_SANITIZER STREQUAL "Address;Undefined" OR
+            USE_SANITIZER STREQUAL "Undefined;Address")
+      append_flags(SANITIZER_FLAGS "-fsanitize=address,undefined -fno-sanitize=vptr,function -fno-sanitize-recover=all")
     elseif (USE_SANITIZER STREQUAL "Thread")
       append_flags(SANITIZER_FLAGS -fsanitize=thread)
     else()


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D77466.255057.patch
Type: text/x-patch
Size: 698 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20200404/31276070/attachment.bin>


More information about the libcxx-commits mailing list