llvm.org GIT mirror llvm / 9652e72
[CMake] Fix USE_LLVM_SANITIZER configuration for out-of-tree builds. Summary: r291918 changed `HandleLLVMOptions.cmake` to add `-fsanitize-blacklist=<llvm-file>` when `LLVM_USE_SANITIZER=Undefined` is specified. This breaks out-of-tree users of `LLVM_USE_SANITIZER` since that file is not present. This patch fixes the issue by checking if the file exists first. Reviewers: mgorny, bogner, vitalybuka, krasin Reviewed By: krasin Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D29686 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294367 91177308-0d34-0410-b5e6-96231b3b80d8 Eric Fiselier 3 years ago
1 changed file(s) with 5 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
588588 append_common_sanitizer_flags()
589589 append("-fsanitize=undefined -fno-sanitize=vptr,function -fno-sanitize-recover=all"
590590 CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
591 append("-fsanitize-blacklist=${CMAKE_SOURCE_DIR}/utils/sanitizers/ubsan_blacklist.txt"
592 CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
591 set(BLACKLIST_FILE "${CMAKE_SOURCE_DIR}/utils/sanitizers/ubsan_blacklist.txt")
592 if (EXISTS "${BLACKLIST_FILE}")
593 append("-fsanitize-blacklist=${BLACKLIST_FILE}"
594 CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
595 endif()
593596 elseif (LLVM_USE_SANITIZER STREQUAL "Thread")
594597 append_common_sanitizer_flags()
595598 append("-fsanitize=thread" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)