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

Marco Elver via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 4 00:55:04 PDT 2025


melver 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.

Thanks for investigating.

Let's shelve this one.

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


More information about the cfe-commits mailing list