[PATCH] D84604: Thread safety analysis: Consider global variables in scope

Jordan Rupprecht via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 30 12:24:12 PDT 2020


rupprecht added a comment.

In D84604#2364568 <https://reviews.llvm.org/D84604#2364568>, @aaronpuchert wrote:

> In D84604#2363768 <https://reviews.llvm.org/D84604#2363768>, @rupprecht wrote:
>
>> I applied D87194 <https://reviews.llvm.org/D87194> locally and rebuilt the original source, and not only am I seeing the original issue (also firing on `DoThings()` when it should only be on `DoStuff()`), I'm also seeing: `error: acquiring mutex 'lock' requires negative capability '!lock' [-Werror,-Wthread-safety-negative]`, where `lock` is a local variable, defined as `MutexLock lock(mutex_)`.
>
> Oh yes, I need to rebase this, sorry if I wasted your time. This is still on top of the bug that @lebedev.ri pointed out in D84604#2262745 <https://reviews.llvm.org/D84604#2262745> and on top of the bug that you pointed out.

No worries, it was only a minute to patch, and then a few more minutes to take a snack break while it rebuilt :)

>> I'll work on getting a better repro for this.
>
> Maybe wait a bit with that, I'll add you as reviewer when I've done the rebase and then you can try it again. I hope to have covered both locals and static members now.
>
> Another issue is linkage, but I'll have to read up on that a bit.

Yep, I'm not qualified to actually review the code, but I'd be happy to test any patches.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D84604/new/

https://reviews.llvm.org/D84604



More information about the cfe-commits mailing list