[PATCH] D72635: Allow arbitrary capability name in Thread Safety Analysis

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Mar 8 09:35:29 PDT 2020


aaron.ballman added a comment.

In D72635#1911495 <https://reviews.llvm.org/D72635#1911495>, @aaronpuchert wrote:

> @aaron.ballman, I've just noted that one of the `-Wthread-safety-attributes` warnings says <https://clang.llvm.org/docs/DiagnosticsReference.html#wthread-safety-attributes>
>
> > //A// attribute can only be applied in a context annotated with ‘capability(“mutex”)’ attribute
>
> This should be changed then, right? We never enforced the name anyway.


Yeah, something needs to change here. For this diagnostic specifically, we care that the type is a capability-annotated type and if it's not, we want to diagnose. However, do we want to diagnose when the capability strings are different? e.g.,

  typedef int __attribute__((capability("role"))) ThreadRole;
  typedef int __attribute__((capability("noodle"))) Noodle;
  
  Noodle N;
  ThreadRole Data __attribute__((acquired_before(N)));


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

https://reviews.llvm.org/D72635





More information about the cfe-commits mailing list