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

Jordan Rupprecht via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 29 22:29:29 PDT 2020


rupprecht added a comment.

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

> Pushed a fix in rGbbed8cfe80cd27d3a47d877c7608d9be4e487d97 <https://reviews.llvm.org/rGbbed8cfe80cd27d3a47d877c7608d9be4e487d97>. For now we just consider all static members as inaccessible, so we'll treat them as we did before this change.

I can confirm this fixes the breakage -- thanks!

> I have proposed making the check stronger for non-static members in D87194 <https://reviews.llvm.org/D87194>, perhaps it makes sense to extend this to static members as well so that it fires on `DoStuff()` again.

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_)`.

I'll work on getting a better repro for this.


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