[clang] [clang][TSA] Make RequiresCapability a DeclOrType attribute (PR #67095)

Timm Baeder via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 19 03:10:45 PST 2025


tbaederr wrote:

One thing I'm unsure about right now:  This probably needs more work, especially regarding assigning function pointers, doesn't it? Even in the test case I added right now, `Foo_fun2` is declared with `SHARED_LOCKS_REQUIRED(mu2) EXCLUSIVE_LOCKS_REQUIRED(mu1)`, but then the function pointer I assign it to only requires `mu1` - so calling it via that function pointer makes it possible to call the function without holding `mu2`. 
Assigning it to the function pointer is only OK if the function pointer type needs a superset (or the same set) of the mutexes the function needs, otherwise it would ideally be an error. But not sure if we currently do anything similar for other TSA stuff.

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


More information about the cfe-commits mailing list