[clang] Thread Safety Analysis: Warn when using negative reentrant capability (PR #141599)

Aaron Puchert via cfe-commits cfe-commits at lists.llvm.org
Sun Aug 3 14:38:05 PDT 2025


aaronpuchert wrote:

I've been trying to implement this in `ThreadSafety.cpp`, and it does seem to work, but I ended up at the same conclusion that you had originally: that we don't need to warn about this. It's certainly a strange thing to write, but warnings are mostly about preventing accidental mistakes, and this doesn't seem like something that would accidentally happen. You need to implement `operator!` for your reentrant capability and then explicitly add negative requirements. (With #150857 we're not going to ask you for that.) So it's a weird thing thing to write, but you know what you're doing, and we will propagate the negative capability according to the usual rules.

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


More information about the cfe-commits mailing list