[PATCH] D49885: Thread safety analysis: Allow relockable scopes

Aaron Puchert via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 13 19:11:35 PDT 2018


aaronpuchert added a comment.

The case distinction in `case attr::AcquireCapability` is not very beautiful, but it's due to the fact that scoped capabilities are not "real" capabilities and so we need to distinguish them.

What this still doesn't allow for is attributes on other classes than the scoped capability that reacquire it from the outside. So maybe this isn't the right solution, and we need to approach it in a different way. Maybe instead of modifying the `BuildLockset::handleCall`, we should change `ThreadSafetyAnalyzer::addLock`. I'll think about that, but not today.



================
Comment at: test/SemaCXX/warn-thread-safety-analysis.cpp:2769-2781
+class SCOPED_LOCKABLE MemberLock {
+ public:
+  MemberLock() EXCLUSIVE_LOCK_FUNCTION(mutex);
+  ~MemberLock() UNLOCK_FUNCTION(mutex);
+  void Lock() EXCLUSIVE_LOCK_FUNCTION(mutex);
+  Mutex mutex;
+};
----------------
@hokein This is your test case, I just renamed some things.


Repository:
  rC Clang

https://reviews.llvm.org/D49885





More information about the cfe-commits mailing list