<div dir="auto">We should really lift this logic into an LLVM cmake module, so we don't have to duplicate it everywhere.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat., Apr. 4, 2020, 4:29 p.m. Brian Gesiak via libcxx-commits, <<a href="mailto:libcxx-commits@lists.llvm.org">libcxx-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
Author: Brian Gesiak<br>
Date: 2020-04-04T16:28:41-04:00<br>
New Revision: 54176d1766f25bc03ddb1a8932a380f6543d5150<br>
<br>
URL: <a href="https://github.com/llvm/llvm-project/commit/54176d1766f25bc03ddb1a8932a380f6543d5150" rel="noreferrer noreferrer" target="_blank">https://github.com/llvm/llvm-project/commit/54176d1766f25bc03ddb1a8932a380f6543d5150</a><br>
DIFF: <a href="https://github.com/llvm/llvm-project/commit/54176d1766f25bc03ddb1a8932a380f6543d5150.diff" rel="noreferrer noreferrer" target="_blank">https://github.com/llvm/llvm-project/commit/54176d1766f25bc03ddb1a8932a380f6543d5150.diff</a><br>
<br>
LOG: libcxx 'LLVM_USE_SANITIZER=Address;Undefined'<br>
<br>
Summary:<br>
Allow users to simultaneously enable address and undefined behavior<br>
sanitizers, in the same manner that LLVM's 'HandleLLVMOptions.cmake'<br>
allows.<br>
<br>
Prior to this patch, `cmake -DLLVM_USE_SANITIZER="Address;Undefined"`<br>
would succeed and the build would build most of the LLVM project with<br>
`-fsanitize=address,undefined`, but a warning would be printed by<br>
libcxx's CMake, and the build would use neither sanitizer. This<br>
patch results in no warning being printed, and both sanitizers are used<br>
in building libcxx.<br>
<br>
Reviewers: jroelofs, EricWF, ldionne, #libc!<br>
<br>
Subscribers: mgorny, dexonsmith, llvm-commits, libcxx-commits<br>
<br>
Tags: #libc<br>
<br>
Differential Revision: <a href="https://reviews.llvm.org/D77466" rel="noreferrer noreferrer" target="_blank">https://reviews.llvm.org/D77466</a><br>
<br>
Added: <br>
<br>
<br>
Modified: <br>
    libcxx/CMakeLists.txt<br>
<br>
Removed: <br>
<br>
<br>
<br>
################################################################################<br>
diff  --git a/libcxx/CMakeLists.txt b/libcxx/CMakeLists.txt<br>
index a4297002644f..cab3f7b14036 100644<br>
--- a/libcxx/CMakeLists.txt<br>
+++ b/libcxx/CMakeLists.txt<br>
@@ -677,6 +677,9 @@ function(get_sanitizer_flags OUT_VAR  USE_SANITIZER)<br>
       endif()<br>
     elseif (USE_SANITIZER STREQUAL "Undefined")<br>
       append_flags(SANITIZER_FLAGS "-fsanitize=undefined -fno-sanitize=vptr,function -fno-sanitize-recover=all")<br>
+    elseif (USE_SANITIZER STREQUAL "Address;Undefined" OR<br>
+            USE_SANITIZER STREQUAL "Undefined;Address")<br>
+      append_flags(SANITIZER_FLAGS "-fsanitize=address,undefined -fno-sanitize=vptr,function -fno-sanitize-recover=all")<br>
     elseif (USE_SANITIZER STREQUAL "Thread")<br>
       append_flags(SANITIZER_FLAGS -fsanitize=thread)<br>
     else()<br>
<br>
<br>
<br>
_______________________________________________<br>
libcxx-commits mailing list<br>
<a href="mailto:libcxx-commits@lists.llvm.org" target="_blank" rel="noreferrer">libcxx-commits@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/libcxx-commits" rel="noreferrer noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/libcxx-commits</a><br>
</blockquote></div>