[clang] Thread Safety Analysis: Support reentrant capabilities (PR #137133)

Marco Elver via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 25 06:16:57 PDT 2025


================
@@ -434,6 +434,16 @@ class can be used as a capability.  The string argument specifies the kind of
 capability in error messages, e.g. ``"mutex"``.  See the ``Container`` example
 given above, or the ``Mutex`` class in :ref:`mutexheader`.
 
+REENTRANT
+---------
+
+``REENTRANT`` is an attribute on capability classes, denoting that they are
+reentrant. Marking a capability as reentrant means that acquiring the same
+capability multiple times is safe.
+
+Note that acquiring the same capability with different access privileges
+(exclusive vs. shared) again is not considered reentrant by the analysis.
----------------
melver wrote:

Added a Note. PTAL.

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


More information about the cfe-commits mailing list