[PATCH] D84604: Thread safety analysis: Consider global variables in scope
Aaron Puchert via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sun Oct 25 10:58:57 PDT 2020
aaronpuchert added inline comments.
================
Comment at: clang/test/SemaCXX/warn-thread-safety-negative.cpp:87-89
+ void test4() {
+ MutexLock lock(&mu); // expected-warning {{acquiring mutex 'mu' requires negative capability '!mu'}}
+ }
----------------
lebedev.ri wrote:
> aaronpuchert wrote:
> > @lebedev.ri, I think that's pretty much your case. On my original change, this would have also warned about `scope`, not just `mu`.
> I think i'm missing the point here.
> I originally reverted this because the diagnostics i was seeing were pretty unambiguously )to me) bogus.
> But the only test change since then ensures that diagnostic is emitted in some case,
> there are no tests to ensure it is not emitted in some cases.
> So either my revert was wrong, or this still is either issuing seemingly bogus diagnostic,
> or lacks test coverage that it doesn't issue said diagnostic.
>
> Which one is it?
This test fails on the original, reverted change as follows:
```
error: 'warning' diagnostics seen but not expected:
File [...]/clang/test/SemaCXX/warn-thread-safety-negative.cpp Line 88: acquiring mutex 'lock' requires negative capability '!lock'
1 error generated.
```
Maybe you're not familiar with the `-verify` mechanism: it doesn't just check that the expected errors/warnings/notes are emitted, it also checks that nothing more is emitted.
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