diff --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt --- a/llvm/CMakeLists.txt +++ b/llvm/CMakeLists.txt @@ -862,6 +862,8 @@ " no longer supported.") endif() +set(LLVM_CRASH_REPORT_DIR "" CACHE STRING "Define directory name for crash reports" ) + include(HandleLLVMOptions) ###### diff --git a/llvm/cmake/modules/HandleLLVMOptions.cmake b/llvm/cmake/modules/HandleLLVMOptions.cmake --- a/llvm/cmake/modules/HandleLLVMOptions.cmake +++ b/llvm/cmake/modules/HandleLLVMOptions.cmake @@ -85,6 +85,10 @@ endif() endif() +if(DEFINED LLVM_CRASH_REPORT_DIR AND CMAKE_CXX_COMPILER_ID MATCHES "Clang") + append("-fcrash-diagnostics-dir=${LLVM_CRASH_REPORT_DIR}" CMAKE_CXX_FLAGS CMAKE_C_FLAGS) +endif() + if(LLVM_ENABLE_EXPENSIVE_CHECKS) add_definitions(-DEXPENSIVE_CHECKS) diff --git a/llvm/runtimes/CMakeLists.txt b/llvm/runtimes/CMakeLists.txt --- a/llvm/runtimes/CMakeLists.txt +++ b/llvm/runtimes/CMakeLists.txt @@ -83,6 +83,7 @@ PASSTHROUGH_PREFIXES COMPILER_RT DARWIN SANITIZER + LLVM_CRASH_REPORT_DIR USE_TOOLCHAIN TARGET_TRIPLE ${LLVM_TARGET_TRIPLE} ${EXTRA_ARGS}) @@ -242,6 +243,7 @@ ${RUNTIMES_CMAKE_ARGS} PASSTHROUGH_PREFIXES LLVM_ENABLE_RUNTIMES LLVM_USE_LINKER + LLVM_CRASH_REPORT_DIR ${ARG_PREFIXES} EXTRA_TARGETS ${extra_targets} ${test_targets} @@ -340,6 +342,10 @@ list(APPEND ${name}_extra_args -DLLVM_USE_LINKER=${LLVM_USE_LINKER}) endif() + if(NOT RUNTIMES_${name}_LLVM_CRASH_REPORT_DIR AND NOT RUNTIMES_${target}_LLVM_CRASH_REPORT_DIR) + list(APPEND ${name}_extra_args -DLLVM_CRASH_REPORT_DIR=${LLVM_CRASH_REPORT_DIR}) + endif() + llvm_ExternalProject_Add(runtimes-${name} ${CMAKE_CURRENT_SOURCE_DIR}/../../runtimes DEPENDS ${${name}_deps}