[clang] Thread Safety Analysis: Support passing scoped locks between functions with appropriate annotations (PR #110523)

Aaron Puchert via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 30 15:47:29 PDT 2024


================
@@ -211,17 +214,35 @@ must be held on entry to the function, *and must still be held on exit*.
     mu1.Unlock();
   }
 
+  void require(MutexLocker& scope REQUIRES(mu1)) {
+    scope.Unlock();
+    a=0; // Warning!  Requires mu1.
----------------
aaronpuchert wrote:

Nitpick: spaces around operators.
```suggestion
    a = 0; // Warning!  Requires mu1.
```

https://github.com/llvm/llvm-project/pull/110523


More information about the cfe-commits mailing list