diff options
Diffstat (limited to 'test/SemaCXX/warn-thread-safety-analysis.cpp')
-rw-r--r-- | test/SemaCXX/warn-thread-safety-analysis.cpp | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/test/SemaCXX/warn-thread-safety-analysis.cpp b/test/SemaCXX/warn-thread-safety-analysis.cpp index dfec94ca91..634a233430 100644 --- a/test/SemaCXX/warn-thread-safety-analysis.cpp +++ b/test/SemaCXX/warn-thread-safety-analysis.cpp @@ -208,8 +208,7 @@ void sls_fun_bad_6() { } void sls_fun_bad_7() { - sls_mu.Lock(); // \ - // expected-warning{{expecting mutex 'sls_mu' to be locked at start of each loop}} + sls_mu.Lock(); while (getBool()) { sls_mu.Unlock(); if (getBool()) { @@ -218,7 +217,7 @@ void sls_fun_bad_7() { } } sls_mu.Lock(); // \ - // expected-warning{{mutex 'sls_mu' is still locked at the end of its scope}} + // expected-warning{{expecting mutex 'sls_mu' to be locked at start of each loop}} } sls_mu.Unlock(); } @@ -257,6 +256,21 @@ void sls_fun_bad_11() { // expected-warning{{unlocking 'sls_mu' that was not locked}} } +void sls_fun_bad_12() { + sls_mu.Lock(); // \ + // expected-warning{{mutex 'sls_mu' is still locked at the end of its scope}} + while (getBool()) { + sls_mu.Unlock(); + if (getBool()) { + if (getBool()) { + break; + } + } + sls_mu.Lock(); + } + sls_mu.Unlock(); +} + //-----------------------------------------// // Handling lock expressions in attribute args // -------------------------------------------// @@ -1900,4 +1914,3 @@ void test() { } }; - |