[compiler-rt] 3c23807 - Add convenient composed tsan constants

Dmitry Vyukov via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 15 01:26:14 PDT 2021


Author: Martijn Vels
Date: 2021-04-15T10:25:41+02:00
New Revision: 3c23807569f0c5ff8fe5ef64c5e51f4e3e33dd03

URL: https://github.com/llvm/llvm-project/commit/3c23807569f0c5ff8fe5ef64c5e51f4e3e33dd03
DIFF: https://github.com/llvm/llvm-project/commit/3c23807569f0c5ff8fe5ef64c5e51f4e3e33dd03.diff

LOG: Add convenient composed tsan constants

This change adds convenient composed constants to be used for tsan_read_try_lock annotations, reducing the boilerplate at the instrumentation site.

Reviewed By: dvyukov

Differential Revision: https://reviews.llvm.org/D99595

Added: 
    

Modified: 
    compiler-rt/include/sanitizer/tsan_interface.h

Removed: 
    


################################################################################
diff  --git a/compiler-rt/include/sanitizer/tsan_interface.h b/compiler-rt/include/sanitizer/tsan_interface.h
index cfa9d3b5f632d..565aa391a9fac 100644
--- a/compiler-rt/include/sanitizer/tsan_interface.h
+++ b/compiler-rt/include/sanitizer/tsan_interface.h
@@ -67,6 +67,12 @@ static const unsigned __tsan_mutex_recursive_lock   = 1 << 6;
 // the corresponding __tsan_mutex_post_lock annotation.
 static const unsigned __tsan_mutex_recursive_unlock = 1 << 7;
 
+// Convenient composed constants.
+static const unsigned __tsan_mutex_try_read_lock =
+    __tsan_mutex_read_lock | __tsan_mutex_try_lock;
+static const unsigned __tsan_mutex_try_read_lock_failed =
+    __tsan_mutex_try_read_lock | __tsan_mutex_try_lock_failed;
+
 // Annotate creation of a mutex.
 // Supported flags: mutex creation flags.
 void __tsan_mutex_create(void *addr, unsigned flags);


        


More information about the llvm-commits mailing list