mirror of
https://github.com/intel/llvm.git
synced 2026-01-20 10:58:11 +08:00
Summary: Also slightly cleaned up the comments and changed the header's extension back to `.h` as per comments on https://reviews.llvm.org/D65812. New methods added: * `ConsumeProbability` returns [0.0, 1.0] by consuming an unsigned integer value from the input data and dividing that value by the integer's max value. * `ConsumeFloatingPointInRange` returns a floating point value in the given range. Relies on `ConsumeProbability` method. This method does not have the limitation of `std::uniform_real_distribution` that requires the given range to be <= the floating point type's max. If the range is too large, this implementation will additionally call `ConsumeBool` to decide whether the result will be in the first or the second half of the range. * `ConsumeFloatingPoint` returns a floating point value in the range `[std::numeric_limits<T>::lowest(), std::numeric_limits<T>::min()]`. Tested on Linux, Mac, Windows. Reviewers: morehouse Reviewed By: morehouse Subscribers: kubamracek, mgorny, dberris, delcypher, #sanitizers, llvm-commits Tags: #llvm, #sanitizers Differential Revision: https://reviews.llvm.org/D65905 llvm-svn: 368331
84 lines
2.8 KiB
CMake
84 lines
2.8 KiB
CMake
if (COMPILER_RT_BUILD_SANITIZERS)
|
|
set(SANITIZER_HEADERS
|
|
sanitizer/allocator_interface.h
|
|
sanitizer/asan_interface.h
|
|
sanitizer/common_interface_defs.h
|
|
sanitizer/coverage_interface.h
|
|
sanitizer/dfsan_interface.h
|
|
sanitizer/hwasan_interface.h
|
|
sanitizer/linux_syscall_hooks.h
|
|
sanitizer/lsan_interface.h
|
|
sanitizer/msan_interface.h
|
|
sanitizer/netbsd_syscall_hooks.h
|
|
sanitizer/scudo_interface.h
|
|
sanitizer/tsan_interface.h
|
|
sanitizer/tsan_interface_atomic.h
|
|
)
|
|
set(FUZZER_HEADERS
|
|
fuzzer/FuzzedDataProvider.h
|
|
)
|
|
endif(COMPILER_RT_BUILD_SANITIZERS)
|
|
|
|
if (COMPILER_RT_BUILD_XRAY)
|
|
set(XRAY_HEADERS
|
|
xray/xray_interface.h
|
|
xray/xray_log_interface.h
|
|
xray/xray_records.h
|
|
)
|
|
endif(COMPILER_RT_BUILD_XRAY)
|
|
|
|
set(COMPILER_RT_HEADERS
|
|
${SANITIZER_HEADERS}
|
|
${FUZZER_HEADERS}
|
|
${XRAY_HEADERS})
|
|
|
|
set(output_dir ${COMPILER_RT_OUTPUT_DIR}/include)
|
|
|
|
# Copy compiler-rt headers to the build tree.
|
|
set(out_files)
|
|
foreach( f ${COMPILER_RT_HEADERS} )
|
|
set( src ${CMAKE_CURRENT_SOURCE_DIR}/${f} )
|
|
set( dst ${output_dir}/${f} )
|
|
add_custom_command(OUTPUT ${dst}
|
|
DEPENDS ${src}
|
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src} ${dst}
|
|
COMMENT "Copying compiler-rt's ${f}...")
|
|
list(APPEND out_files ${dst})
|
|
endforeach( f )
|
|
|
|
add_custom_target(compiler-rt-headers ALL DEPENDS ${out_files})
|
|
add_dependencies(compiler-rt compiler-rt-headers)
|
|
set_target_properties(compiler-rt-headers PROPERTIES FOLDER "Compiler-RT Misc")
|
|
|
|
# Install sanitizer headers.
|
|
install(FILES ${SANITIZER_HEADERS}
|
|
COMPONENT compiler-rt-headers
|
|
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
|
|
DESTINATION ${COMPILER_RT_INSTALL_PATH}/include/sanitizer)
|
|
# Install fuzzer headers.
|
|
install(FILES ${FUZZER_HEADERS}
|
|
COMPONENT compiler-rt-headers
|
|
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
|
|
DESTINATION ${COMPILER_RT_INSTALL_PATH}/include/fuzzer)
|
|
# Install xray headers.
|
|
install(FILES ${XRAY_HEADERS}
|
|
COMPONENT compiler-rt-headers
|
|
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
|
|
DESTINATION ${COMPILER_RT_INSTALL_PATH}/include/xray)
|
|
|
|
if (NOT CMAKE_CONFIGURATION_TYPES) # don't add this for IDEs.
|
|
add_custom_target(install-compiler-rt-headers
|
|
DEPENDS compiler-rt-headers
|
|
COMMAND "${CMAKE_COMMAND}"
|
|
-DCMAKE_INSTALL_COMPONENT="compiler-rt-headers"
|
|
-P "${CMAKE_BINARY_DIR}/cmake_install.cmake"
|
|
USES_TERMINAL)
|
|
add_custom_target(install-compiler-rt-headers-stripped
|
|
DEPENDS compiler-rt-headers
|
|
COMMAND "${CMAKE_COMMAND}"
|
|
-DCMAKE_INSTALL_COMPONENT="compiler-rt-headers"
|
|
-DCMAKE_INSTALL_DO_STRIP=1
|
|
-P "${CMAKE_BINARY_DIR}/cmake_install.cmake"
|
|
USES_TERMINAL)
|
|
endif()
|