This is an archive of the discontinued LLVM Phabricator instance.

Reland "Thread Safety Analysis: fix assert_capability.", add warnings
ClosedPublic

Authored by jmgao on Aug 2 2017, 1:25 PM.

Details

Summary

Reland "Thread Safety Analysis: fix assert_capability."

Delete the test that was broken by rL309725, and add it back in a
follow up commit. Also, improve the tests a bit.


Thread Safety Analysis: warn on nonsensical attributes.

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.

Diff Detail

Repository
rL LLVM

Event Timeline

jmgao created this revision.Aug 2 2017, 1:25 PM
jmgao edited the summary of this revision. (Show Details)Aug 2 2017, 1:26 PM
jmgao set the repository for this revision to rL LLVM.
jmgao added a subscriber: cfe-commits.
jmgao updated this revision to Diff 109411.Aug 2 2017, 1:28 PM

Remove accidental trailing backslash.

jmgao updated this revision to Diff 109412.Aug 2 2017, 1:30 PM

Fix commit messages.

delesley edited edge metadata.Aug 7 2017, 11:45 AM

Overall looks good. However, I would change the wording on the warning to the following. The terms "free function" and "instance method" may be confusing to some people. Also, warn_thread_attribute_noargs_static_method should not mention the capability attribute, which is checked separately in warn_thread_attribute_noargs_not_lockable.

def warn_thread_attribute_noargs_not_method: ... "%0 attribute without arguments can only be applied to a method of a class." ...
def warn_thread_attribute_noargs_static_method: ... "%0 attribute without arguments cannot be applied a static method." ...

jmgao updated this revision to Diff 110054.Aug 7 2017, 12:27 PM

Reword warnings.

delesley accepted this revision.Aug 8 2017, 9:17 AM
This revision is now accepted and ready to land.Aug 8 2017, 9:17 AM
This revision was automatically updated to reflect the committed changes.
This revision was automatically updated to reflect the committed changes.
jmgao added a comment.Aug 8 2017, 12:48 PM

Thanks for the review!