[PATCH] D59523: Thread Safety: also look at ObjC methods
JF Bastien via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 19 16:53:03 PDT 2019
jfb added a comment.
I reduced the code I had to this:
struct __attribute__((capability("mutex"))) MyLock {
void lock() __attribute__((acquire_capability())) {}
void unlock() __attribute__((release_capability())) {}
};
template <class T> struct __attribute__((scoped_lockable)) Locker {
T &_l;
Locker(T &l) __attribute__((acquire_capability(l))) : _l(l) { _l.lock(); }
~Locker() __attribute__((release_capability())) { _l.unlock(); }
};
struct MyLockable {
MyLock lock;
};
@protocol MyProtocolBase;
@protocol MyProtocol <MyProtocolBase>
@end
@interface MyProtocol
@end
@interface MyProtocol ()
- (void)doIt:(struct MyLockable *)myLockable;
@end
@implementation MyProtocol
- (void)doIt:(struct MyLockable *)myLockable {
Locker<MyLock> lock(myLockable->lock);
}
@end
But now it doesn't repro... I probably missed something important :)
Repository:
rC Clang
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D59523/new/
https://reviews.llvm.org/D59523
More information about the cfe-commits
mailing list