<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/107196>107196</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Thread Safety Analysis - some types of unsupported marking leads to many false positives
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          ethouris
      </td>
    </tr>
</table>

<pre>
    This can be treated as a feature request, but here it is:

1. TSA can't properly handle "inverted lock" classes, that is, a class that unlocks given mutex in constructor and then locks it back in destructor. Even if the constructor and destructor of that class are properly marked with RELEASE and ACQUIRE markers, they look like being ignored by clang in TSA mode. For example by reporting that a mutex is acquired while it was acquired already, which isn't true. Adding the "scoped capability" to the InvertedLock class only makes more false positive warnings.
2. There are sometimes situations where a given object is defined as a field in some class and it is protected by a mutex located in another class, which's header isn't included by the header file defining that first class. There's completely no way to provide the information about this mutex as the one that should guard access to this field because any specification would refer to an undefined symbol. Could that be possible that the resolution of this symbol is deferred to the moment when the field in question is being used in the compiled code?
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxkVMGS4jgM_ZpwUQ0FBobmkAPb01RN1Vx2uvcDFFshWhw7Y9kw-fst2-nu3doLVGzpWXrvSSjCV0fUNoc_msO3FaY4-NBSHHwKLKvOm7l9G1hAo4OOIAbCSAZQAKEnjCkQBPqVSGKjnqFLEQYKBByBpdmdm823ZrP8btfw9nrOUI06RpiCnyjYGQZ0xhI0SrG7U8j41utboxRoiyIkGToOWDDVM2A9r0fJ5WCBK9_JwZgi_QZ2oL2TGJKOPgA6A3EgBzWSI3SobznK0HvQGl5yPvc58n_Zn3Hg-_puLQEDfTYyYriRgQfHAX6-_Hg5v76U7PPzn399__lS78PSDc1gvb-B5RtBR-yuwFfnAxno5oyeD1xhbPSG1nDxAeg3jpOlHBFo8iHmtFIOvrcugPpX4oz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