aaronpuchert added a reviewer: aaron.ballman. aaronpuchert added a comment.
What distinguishes a shared from an exclusive negative capability? Negative capabilities (as I understand them) express the mutex not being held at all, meaning neither in shared nor in exclusive mode. ================ Comment at: clang/lib/Analysis/ThreadSafety.cpp:2188-2190 +/// shared + exclusive = exclusive +/// generic + exclusive = exclusive +/// generic + shared = shared ---------------- What do these lines mean? That we accept if a lock is shared in one branch and exclusive in the other, and that we make it exclusive after the merge point? ================ Comment at: clang/test/SemaCXX/warn-thread-safety-negative.cpp:135-140 + if (condition) { + assertNotHeld(); // expected-warning {{mutex '!mu' is acquired exclusively and shared in the same scope}} + } else { + mu.Lock(); + mu.Unlock(); // expected-warning {{the other acquisition of mutex '!mu' is here}} + } ---------------- Why would I want these warnings here? This code seems fine to me. However, I don't see why we don't get `acquiring mutex 'mu' requires negative capability '!mu'` at line 138, or does that disappear because of the assertion? Repository: rL LLVM CHANGES SINCE LAST ACTION https://reviews.llvm.org/D65184/new/ https://reviews.llvm.org/D65184 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits