[clang] Thread Safety Analysis: Improved pointer handling (PR #127396)
Ilya Biryukov via cfe-commits
cfe-commits at lists.llvm.org
Tue Feb 25 08:18:13 PST 2025
================
@@ -143,6 +143,11 @@ Improvements to Clang's diagnostics
- A statement attribute applied to a ``case`` label no longer suppresses
'bypassing variable initialization' diagnostics (#84072).
+- The :doc:`ThreadSafetyAnalysis` now supports ``-Wthread-safety-pointer``
----------------
ilya-biryukov wrote:
I propose to add some caveats here. As chatted offline, the analysis does not do any alias analysis and will miss cases like:
```cpp
struct Foo {
std::mutex mu;
int *p GUARDED_BY(mu);
int* do_something() {
mu.lock();
int* q = p;
mu.unlock();
return q;
}
};
```
This change is still very-very useful, I just want to make sure the folks don't misinterpret it as catching even more.
https://github.com/llvm/llvm-project/pull/127396
More information about the cfe-commits
mailing list