courbet added a comment. In D153131#4456019 <https://reviews.llvm.org/D153131#4456019>, @aaronpuchert wrote:
> Tried this on our code base, and the number of new warnings seems acceptable. > I'll still need to look through them in more detail, but there is one > suspicious warning that boils down to this: > > > cat reference-bug.cpp > struct __attribute__((capability("mutex"))) Mutex {} mu; > int* p __attribute__((pt_guarded_by(mu))); > > int& f() { > return *p; > } > > clang-16 -fsyntax-only -Wthread-safety-analysis reference-bug.cpp > > clang-16-D153131 -fsyntax-only -Wthread-safety-analysis reference-bug.cpp > reference-bug.cpp:5:11: warning: writing the value pointed to by 'p' > requires holding mutex 'mu' exclusively [-Wthread-safety-analysis] > return *p; > ^ > 1 warning generated. > > That we're warning here is correct, but the warning message is a bit off > (we're not quite writing here), and it's under `-Wthread-safety-analysis` > instead of `-Wthread-safety-reference`. Right. I was relying on the fallback "imprecise" warning for this one. I added a `pt_garded` value just like for `pass_by_value` and added a test. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D153131/new/ https://reviews.llvm.org/D153131 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits