[Threading][TSan] Fix builds where TSan isn't supported.

On builds where TSan isn't supported, don't include any code in
ThreadSanitizer.cpp.

rdar://110665213
This commit is contained in:
Alastair Houghton
2023-06-20 09:12:29 +01:00
parent 3f0018df97
commit 18b359ffcf
2 changed files with 11 additions and 1 deletions

View File

@@ -25,6 +25,9 @@
namespace swift {
#if defined(_WIN32) || defined(__wasi__) || !__has_include(<dlfcn.h>)
#define SWIFT_THREADING_TSAN_SUPPORT 0
namespace tsan {
inline bool enabled() { return false; }
@@ -34,6 +37,8 @@ template <typename T> T *release(T *ptr) { return ptr; }
} // namespace tsan
#else
#define SWIFT_THREADING_TSAN_SUPPORT 1
// If we're static linking to libswiftThreading.a, these symbols can come
// from there. If, on the other hand, we're dynamically linked, we want
// to get them from libswiftCore.dylib instead.