File tree Expand file tree Collapse file tree 3 files changed +13
-1
lines changed Expand file tree Collapse file tree 3 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ option(UR_FORMAT_CPP_STYLE "format code style of C++ sources" OFF)
30
30
option (UR_USE_ASAN "enable AddressSanitizer" OFF )
31
31
option (UR_USE_UBSAN "enable UndefinedBehaviorSanitizer" OFF )
32
32
option (UR_USE_MSAN "enable MemorySanitizer" OFF )
33
+ option (UR_USE_TSAN "enable ThreadSanitizer" OFF )
33
34
option (UMF_BUILD_SHARED_LIBRARY "Build UMF as shared library" OFF )
34
35
option (UR_ENABLE_TRACING "enable api tracing through xpti" OFF )
35
36
option (VAL_USE_LIBBACKTRACE_BACKTRACE "enable libbacktrace validation backtrace for linux" OFF )
@@ -116,6 +117,10 @@ if(UR_USE_UBSAN)
116
117
add_sanitizer_flag (undefined )
117
118
endif ()
118
119
120
+ if (UR_USE_TSAN )
121
+ add_sanitizer_flag (thread )
122
+ endif ()
123
+
119
124
if (UR_USE_MSAN )
120
125
message (WARNING "MemorySanitizer requires that all code is built with
121
126
its instrumentation, otherwise false positives are possible.
Original file line number Diff line number Diff line change @@ -108,6 +108,7 @@ List of options provided by CMake:
108
108
| UR_FORMAT_CPP_STYLE | Format code style | ON/OFF | OFF |
109
109
| UR_DEVELOPER_MODE | Treat warnings as errors and enables additional checks | ON/OFF | OFF |
110
110
| UR_USE_ASAN | Enable AddressSanitizer | ON/OFF | OFF |
111
+ | UR_USE_TSAN | Enable ThreadSanitizer | ON/OFF | OFF |
111
112
| UR_USE_UBSAN | Enable UndefinedBehavior Sanitizer | ON/OFF | OFF |
112
113
| UR_USE_MSAN | Enable MemorySanitizer (clang only) | ON/OFF | OFF |
113
114
| UR_ENABLE_TRACING | Enable XPTI-based tracing layer | ON/OFF | OFF |
Original file line number Diff line number Diff line change @@ -42,13 +42,19 @@ inline int ur_getpid(void) { return static_cast<int>(getpid()); }
42
42
#define SANITIZER_ADDRESS
43
43
#endif
44
44
45
+ /* define for running with memory sanitizer */
46
+ #if CLANG_HAS_FEATURE(thread_sanitizer) || defined(__SANITIZE_THREAD__)
47
+ #define SANITIZER_THREAD
48
+ #endif
49
+
45
50
/* define for running with memory sanitizer */
46
51
#if CLANG_HAS_FEATURE(memory_sanitizer)
47
52
#define SANITIZER_MEMORY
48
53
#endif
49
54
50
55
/* define for running with any sanitizer runtime */
51
- #if defined(SANITIZER_MEMORY) || defined(SANITIZER_ADDRESS)
56
+ #if defined(SANITIZER_MEMORY) || defined(SANITIZER_ADDRESS) || \
57
+ defined (SANITIZER_THREAD)
52
58
#define SANITIZER_ANY
53
59
#endif
54
60
// /////////////////////////////////////////////////////////////////////////////
You can’t perform that action at this time.
0 commit comments