summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/Valgrind.cpp
diff options
context:
space:
mode:
authorNick Lewycky <nicholas@mxc.ca>2011-11-14 20:50:16 +0000
committerNick Lewycky <nicholas@mxc.ca>2011-11-14 20:50:16 +0000
commitfe856110aa71fa0d10972793a9b0af3c171aec30 (patch)
treefeddada18458bb2533b334613d4d5e2ae02c40f4 /llvm/lib/Support/Valgrind.cpp
parentfb13d32b3f8dbb4c789ee422a55596c586a4285a (diff)
downloadbcm5719-llvm-fe856110aa71fa0d10972793a9b0af3c171aec30.tar.gz
bcm5719-llvm-fe856110aa71fa0d10972793a9b0af3c171aec30.zip
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! llvm-svn: 144567
Diffstat (limited to 'llvm/lib/Support/Valgrind.cpp')
-rw-r--r--llvm/lib/Support/Valgrind.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/llvm/lib/Support/Valgrind.cpp b/llvm/lib/Support/Valgrind.cpp
index 703448524ed..078d705183d 100644
--- a/llvm/lib/Support/Valgrind.cpp
+++ b/llvm/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) {}
+}
OpenPOWER on IntegriCloud