Commit 614eb717 authored by Igor Sugak's avatar Igor Sugak Committed by Facebook Github Bot

add FOLLY_SANITIZE macro

Summary: Most of the time we want to guard some code when any of the sanitizers are enabled not just one.

Reviewed By: yfeldblum

Differential Revision: D6429720

fbshipit-source-id: 7157a0a13f2b2acabd36a19c61b9fdbf38ba96b8
parent 153c4233
......@@ -93,6 +93,15 @@
# define FOLLY_SANITIZE_THREAD 1
#endif
/**
* Define a convenience macro to test when ASAN, UBSAN or TSAN sanitizer are
* being used
*/
#if defined(FOLLY_SANITIZE_ADDRESS) || defined(FOLLY_SANITIZE_THREAD) || \
defined(UNDEFINED_SANITIZER)
#define FOLLY_SANITIZE 1
#endif
/**
* ASAN/MSAN/TSAN define pre-processor symbols:
* ADDRESS_SANITIZER/MEMORY_SANITIZER/THREAD_SANITIZER.
......
......@@ -199,6 +199,12 @@ constexpr bool kIsSanitizeThread = true;
#else
constexpr bool kIsSanitizeThread = false;
#endif
#if FOLLY_SANITIZE
constexpr bool kIsSanitize = true;
#else
constexpr bool kIsSanitize = false;
#endif
} // namespace folly
// packing is very ugly in msvc
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment