diff options
author | Nick Lewycky <nicholas@mxc.ca> | 2011-11-14 20:50:16 +0000 |
---|---|---|
committer | Nick Lewycky <nicholas@mxc.ca> | 2011-11-14 20:50:16 +0000 |
commit | 4d0a9ff36574da0c042e9bd3ae816301b392ac41 (patch) | |
tree | c5e1c2d7d88829785d73dbe6173da013f4554af3 /lib/Support/Valgrind.cpp | |
parent | 76c8f08567c1e06e8555a910e919d4896f18f5e2 (diff) |
Add support for tsan annotations (thread sanitizer, a valgrind-based tool).
These annotations are disabled entirely when either ENABLE_THREADS is off, or
building a release build. When enabled, they add calls to functions with no
statements to ManagedStatic's getters.
Use these annotations to inform tsan that the race used inside ManagedStatic
initialization is actually benign. Thanks to Kostya Serebryany for helping
write this patch!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@144567 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support/Valgrind.cpp')
-rw-r--r-- | lib/Support/Valgrind.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/Support/Valgrind.cpp b/lib/Support/Valgrind.cpp index 703448524e..078d705183 100644 --- a/lib/Support/Valgrind.cpp +++ b/lib/Support/Valgrind.cpp @@ -52,3 +52,14 @@ void llvm::sys::ValgrindDiscardTranslations(const void *Addr, size_t Len) { } #endif // !HAVE_VALGRIND_VALGRIND_H + +// These functions require no implementation, tsan just looks at the arguments +// they're called with. +extern "C" { +void AnnotateHappensBefore(const char *file, int line, + const volatile void *cv) {} +void AnnotateHappensAfter(const char *file, int line, + const volatile void *cv) {} +void AnnotateIgnoreWritesBegin(const char *file, int line) {} +void AnnotateIgnoreWritesEnd(const char *file, int line) {} +} |