[llvm][ubsan] Inclusive language: replace use of blacklist HandleLLVMOptions.cmake...
authorZarko Todorovski <zarko@ca.ibm.com>
Thu, 25 Nov 2021 13:18:08 +0000 (08:18 -0500)
committerZarko Todorovski <zarko@ca.ibm.com>
Thu, 25 Nov 2021 15:23:14 +0000 (10:23 -0500)
Retry at https://reviews.llvm.org/D113689, this time with using the old option name
to support older versions of clang.

Reviewed By: bjope

Differential Revision: https://reviews.llvm.org/D114033

llvm/cmake/modules/HandleLLVMOptions.cmake
llvm/utils/sanitizers/ubsan_blacklist.txt [deleted file]
llvm/utils/sanitizers/ubsan_ignorelist.txt [new file with mode: 0644]

index 54eebb8d6b454cf77270a4103e5e921f089442d6..0280e1746ab044b9e62c99bcb41ac556554fc934 100644 (file)
@@ -870,9 +870,11 @@ if(LLVM_USE_SANITIZER)
     append("-fsanitize=fuzzer-no-link" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
   endif()
   if (LLVM_USE_SANITIZER MATCHES ".*Undefined.*")
-    set(BLACKLIST_FILE "${CMAKE_SOURCE_DIR}/utils/sanitizers/ubsan_blacklist.txt")
-    if (EXISTS "${BLACKLIST_FILE}")
-      append("-fsanitize-blacklist=${BLACKLIST_FILE}"
+    set(IGNORELIST_FILE "${CMAKE_SOURCE_DIR}/utils/sanitizers/ubsan_ignorelist.txt")
+    if (EXISTS "${IGNORELIST_FILE}")
+      # Use this option name version since -fsanitize-ignorelist is only
+      # accepted with clang 13.0 or newer.
+      append("-fsanitize-blacklist=${IGNORELIST_FILE}"
              CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
     endif()
   endif()
diff --git a/llvm/utils/sanitizers/ubsan_blacklist.txt b/llvm/utils/sanitizers/ubsan_blacklist.txt
deleted file mode 100644 (file)
index 144ab1f..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-# This blacklist should be applied when LLVM is built
-# with -fsanitize=undefined instrumentation. It exists
-# because libstdc++ has some undefined behavior issues
-# in some of the headers, in particular, stl_tree.h.
-
-# upcast of address with insufficient space for an object of type std::_Rb_tree_node<...>
-src:*bits/stl_tree.h
-
-# libstdc++ 4.8 creates a null reference when calling
-# data() on an empty vector: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59829
-src:*bits/stl_iterator.h
-src:*bits/stl_vector.h
-
-# libstdc++ 8.0.1 casts an under-aligned pointer to type type_info:
-# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85930
-src:*bits/shared_ptr_base.h
diff --git a/llvm/utils/sanitizers/ubsan_ignorelist.txt b/llvm/utils/sanitizers/ubsan_ignorelist.txt
new file mode 100644 (file)
index 0000000..144ab1f
--- /dev/null
@@ -0,0 +1,16 @@
+# This blacklist should be applied when LLVM is built
+# with -fsanitize=undefined instrumentation. It exists
+# because libstdc++ has some undefined behavior issues
+# in some of the headers, in particular, stl_tree.h.
+
+# upcast of address with insufficient space for an object of type std::_Rb_tree_node<...>
+src:*bits/stl_tree.h
+
+# libstdc++ 4.8 creates a null reference when calling
+# data() on an empty vector: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59829
+src:*bits/stl_iterator.h
+src:*bits/stl_vector.h
+
+# libstdc++ 8.0.1 casts an under-aligned pointer to type type_info:
+# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85930
+src:*bits/shared_ptr_base.h