summaryrefslogtreecommitdiff
path: root/lib/lsan
diff options
context:
space:
mode:
authorDan Liew <dan@su-root.co.uk>2018-07-10 13:00:17 +0000
committerDan Liew <dan@su-root.co.uk>2018-07-10 13:00:17 +0000
commit03ff187676c405d5b6b4e50ccaf347f7d6f48ffd (patch)
tree7a838bb7ef520e439e351716f0428194e7d2979e /lib/lsan
parentbd0cb5dcb47a07022a7031220b01fd347f9df4bb (diff)
[CMake] Add compiler-rt header files to the list of sources for targets
when building with an IDE so that header files show up in the UI. This massively improves the development workflow in IDEs. To implement this a new function `compiler_rt_process_sources(...)` has been added that adds header files to the list of sources when the generator is an IDE. For non-IDE generators (e.g. Ninja/Makefile) no changes are made to the list of source files. The function can be passed a list of headers via the `ADDITIONAL_HEADERS` argument. For each runtime library a list of explicit header files has been added and passed via `ADDITIONAL_HEADERS`. For `tsan` and `sanitizer_common` a list of headers was already present but it was stale and has been updated to reflect the current state of the source tree. The original version of this patch used file globbing (`*.{h,inc,def}`) to find the headers but the approach was changed due to this being a CMake anti-pattern (if the list of headers changes CMake won't automatically re-generate if globbing is used). The LLVM repo contains a similar function named `llvm_process_sources()` but we don't use it here for several reasons: * It depends on the `LLVM_ENABLE_OPTION` cache variable which is not set in standalone compiler-rt builds. * We would have to `include(LLVMProcessSources)` which I'd like to avoid because it would include a bunch of stuff we don't need. Differential Revision: https://reviews.llvm.org/D48422 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@336663 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/lsan')
-rw-r--r--lib/lsan/CMakeLists.txt10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/lsan/CMakeLists.txt b/lib/lsan/CMakeLists.txt
index c1700dd06..34f686135 100644
--- a/lib/lsan/CMakeLists.txt
+++ b/lib/lsan/CMakeLists.txt
@@ -18,12 +18,20 @@ set(LSAN_SOURCES
lsan_preinit.cc
lsan_thread.cc)
+set(LSAN_HEADERS
+ lsan.h
+ lsan_allocator.h
+ lsan_common.h
+ lsan_flags.inc
+ lsan_thread.h)
+
set(LSAN_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR})
add_compiler_rt_object_libraries(RTLSanCommon
OS ${SANITIZER_COMMON_SUPPORTED_OS}
ARCHS ${LSAN_COMMON_SUPPORTED_ARCH}
SOURCES ${LSAN_COMMON_SOURCES}
+ ADDITIONAL_HEADERS ${LSAN_HEADERS}
CFLAGS ${LSAN_CFLAGS})
if(COMPILER_RT_HAS_LSAN)
@@ -39,6 +47,7 @@ if(COMPILER_RT_HAS_LSAN)
OS ${SANITIZER_COMMON_SUPPORTED_OS}
ARCHS ${LSAN_SUPPORTED_ARCH}
SOURCES ${LSAN_SOURCES}
+ ADDITIONAL_HEADERS ${LSAN_HEADERS}
OBJECT_LIBS RTLSanCommon
RTInterception
RTSanitizerCommon
@@ -61,6 +70,7 @@ if(COMPILER_RT_HAS_LSAN)
$<TARGET_OBJECTS:RTSanitizerCommonCoverage.${arch}>
$<TARGET_OBJECTS:RTSanitizerCommonSymbolizer.${arch}>
$<TARGET_OBJECTS:RTLSanCommon.${arch}>
+ ADDITIONAL_HEADERS ${LSAN_HEADERS}
CFLAGS ${LSAN_CFLAGS}
PARENT_TARGET lsan)
endforeach()