================ @@ -3566,6 +3565,38 @@ void releaseMemberCall() { ReleasableMutexLock lock(&obj.mu); releaseMember(obj, lock); } +#ifdef __cpp_guaranteed_copy_elision +// expected-note@+2{{mutex acquired here}} +// expected-note@+1{{see attribute on function here}} +RelockableScope returnUnmatchTest() EXCLUSIVE_LOCK_FUNCTION(mu){ + // expected-note@+1{{mutex acquired here}} + return RelockableScope(&mu2); // expected-warning{{mutex managed by '<temporary>' is 'mu2' instead of 'mu'}} +} // expected-warning{{mutex 'mu2' is still held at the end of function}} + // expected-warning@-1{{expecting mutex 'mu' to be held at the end of function}} + +// expected-note@+2{{mutex acquired here}} +// expected-note@+1{{see attribute on function here}} +RelockableScope returnMoreTest() EXCLUSIVE_LOCK_FUNCTION(mu, mu2){ + return RelockableScope(&mu); // expected-warning{{mutex 'mu2' not managed by '<temporary>'}} +} // expected-warning{{expecting mutex 'mu2' to be held at the end of function}} + +// expected-note@+1{{see attribute on function here}} +DoubleMutexLock returnFewerTest() EXCLUSIVE_LOCK_FUNCTION(mu){ + // expected-note@+1{{mutex acquired here}} + return DoubleMutexLock(&mu,&mu2); // expected-warning{{did not expect mutex 'mu2' to be managed by '<temporary>'}} ---------------- aaronpuchert wrote:
```suggestion return DoubleMutexLock(&mu, &mu2); // expected-warning{{did not expect mutex 'mu2' to be managed by '<temporary>'}} ``` https://github.com/llvm/llvm-project/pull/131831 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits