[PATCH] D72635: Add "context" capability to Thread Safety Analysis

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 16 09:44:32 PST 2020


aaron.ballman added reviewers: aaronpuchert, delesley.
aaron.ballman added a comment.

In D72635#1822686 <https://reviews.llvm.org/D72635#1822686>, @eti-p-doray wrote:

> I added an example in the description.
>
> From doc https://clang.llvm.org/docs/ThreadSafetyAnalysis.html, 
>  it sounds like we should be allowed to declare our class with CAPABILITY("context"), but it turns out that only "mutex" and "role" are allowed.
>  I could otherwise update this CL to allow any string (single word lowercase?) as CAPABILITY?


I had to hop in a time machine to figure out what we were thinking with restricting the names to just `role` and `mutex` and did not see any reasonable rationale for the restriction and I'm in favor of lifting it now. I think the correct way forward here is to remove the diagnostic (allowing arbitrary capability names), remove the `isRole()` and `isMutex()` accessors from the attribute definition in Attr.td (they're unused), and then update the documentation to make it more clear that we allow arbitrary names for capabilities.

Adding a few more people who use these attributes to see if there are concerns with this approach.


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72635/new/

https://reviews.llvm.org/D72635





More information about the cfe-commits mailing list