summaryrefslogtreecommitdiffstats
path: root/clang/test/Sema/attr-capabilities.c
Commit message (Collapse)AuthorAgeFilesLines
* Thread Safety Analysis: warnings for attributes without argumentsAaron Puchert2018-09-201-2/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: When thread safety annotations are used without capability arguments, they are assumed to apply to `this` instead. So we warn when either `this` doesn't exist, or the class is not a capability type. This is based on earlier work by Josh Gao that was committed in r310403, but reverted in r310698 because it didn't properly work in template classes. See also D36237. The solution is not to go via the QualType of `this`, which is then a template type, hence the attributes are not known because it could be specialized. Instead we look directly at the class in which we are contained. Additionally I grouped two of the warnings together. There are two issues here: the existence of `this`, which requires us to be a non-static member function, and the appropriate annotation on the class we are contained in. So we don't distinguish between not being in a class and being static, because in both cases we don't have `this`. Fixes PR38399. Reviewers: aaron.ballman, delesley, jmgao, rtrieu Reviewed By: delesley Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D51901 llvm-svn: 342605
* Determine the attribute subject for diagnostics based on declarative ↵Aaron Ballman2017-11-261-2/+2
| | | | | | | | | | information in DeclNodes.td. This greatly reduces the number of enumerated values used for more complex diagnostics; these are now only required when the "attribute only applies to" diagnostic needs to be generated manually as part of semantic processing. This also clarifies some terminology used by the diagnostic (methods -> Objective-C methods, fields -> non-static data members, etc). Many of the tests needed to be updated in multiple places for the diagnostic wording tweaks. The first instance of the diagnostic for that attribute is fully specified and subsequent instances cut off the complete list (to make it easier if additional subjects are added in the future for the attribute). llvm-svn: 319002
* Revert "Thread Safety Analysis: warn on nonsensical attributes."Josh Gao2017-08-111-12/+2
| | | | | | | This reverts commit rL310403, which caused spurious warnings in libc++, because it didn't properly handle templated scoped lockable types. llvm-svn: 310698
* Thread Safety Analysis: warn on nonsensical attributes.Josh Gao2017-08-081-2/+12
| | | | | | | | | | | | | Add warnings in cases where an implicit `this` argument is expected to attributes because either `this` doesn't exist because the attribute is on a free function, or because `this` is on a type that doesn't have a corresponding capability/lockable/scoped_lockable attribute. Reviewers: delesley, aaron.ballman Differential Revision: https://reviews.llvm.org/D36237 llvm-svn: 310403
* Reland "Thread Safety Analysis: fix assert_capability."Josh Gao2017-08-081-3/+0
| | | | | | | | | | | Delete the test that was broken by rL309725, and add it back in a follow up commit. Also, improve the tests a bit. Reviewers: delesley, aaron.ballman Differential Revision: https://reviews.llvm.org/D36237 llvm-svn: 310402
* Thread Safety Analysis: allow capability attribute on unions.DeLesley Hutchins2015-09-291-2/+6
| | | | llvm-svn: 248805
* Allow objc_bridge(id) to be used on typedefs of [cv] void*.John McCall2015-02-011-2/+2
| | | | | | rdar://19678874 llvm-svn: 227774
* In preparation for being able to use simple Boolean logic expressions ↵Aaron Ballman2014-04-041-1/+10
| | | | | | involving capabilities, the semantics for attributes now looks through the types of the constituent parts of a capability expression instead of at the aggregate expression type. llvm-svn: 205629
* Capability attributes can now be declared on a typedef declaration as well ↵Aaron Ballman2014-03-241-5/+5
| | | | | | as a structure declaration. This allows for C code to use Boolean expressions on a capability as part of another attribute. Eg) __attribute__((requires_capability(!SomeCapability))) llvm-svn: 204657
* Fixed newlines.Alexander Kornienko2014-03-211-52/+52
| | | | llvm-svn: 204413
* Replacing the exclusive_lock_function, shared_lock_function and ↵Aaron Ballman2014-03-201-9/+2
| | | | | | | | unlock_function attributes with the acquire_capability and release_capability attributes. The old spellings will continue to work, but the underlying semantic attributes have been replaced. Downgraded the capability diagnostics from error to warning to match the desired behavior, and updated the existing test cases. llvm-svn: 204350
* Capabilities are required to pass a name specifying what type of capability ↵Aaron Ballman2014-03-051-1/+4
| | | | | | | | is being annotated. There are currently only two supported names: mutex and role. Adding functionality to check for the capability name and diagnose when it's unexpected. Note that for backwards compatibility, an unnamed capability will default to being a "mutex." This allows the deprecated lockable attribute to continue to function. llvm-svn: 203012
* Adding role-based capability attributes that allow you to express role ↵Aaron Ballman2014-02-211-0/+32
| | | | | | | | management: asserting a capability is held, acquiring a capability and releasing a capability. Also includes some skeleton documentation for these new attributes. This functionality should be considered a WIP. llvm-svn: 201890
* DeLesley Hutchins (who wrote the original thread-safety attribute ↵Aaron Ballman2014-02-181-0/+25
functionality) and I have agreed to start migrating from lock-specific terminology to "capability"-specific terminology. This opens the door for future threading-related analysis passes so that a common nomenclature can be used. The following attributes have been (silently) deprecated, with their replacements listed: lockable => capability exclusive_locks_required => requires_capability shared_locks_required => requires_shared_capability locks_excluded => requires_capability There are no functional changes intended. llvm-svn: 201585
OpenPOWER on IntegriCloud