[clang] [analyzer] Fix false positive for mutexes inheriting mutex_base (PR #106240)

Arseniy Zaostrovnykh via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 28 00:14:55 PDT 2024


necto wrote:

> Could you also add this test case?
> 
> ```c++
> ```
> 
> Or is it already implied by other tests?

My first test

``` C++
void no_false_positive_gh_104241() {
  std::mutex m;
  m.lock();
  // If inheritance not handled properly, this unlock might not match the lock
  // above because technically they act on different memory regions:
  // __mutex_base and mutex.
  m.unlock();
  sleep(10); // no-warning
}
```

Was derived from your example, so I guess it is implied, but I added your example as is with 0d95583 to make it extra clear.

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


More information about the cfe-commits mailing list