[PATCH] D101202: Thread safety analysis: Fix false negative on break

Aaron Puchert via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 23 14:49:47 PDT 2021


aaronpuchert added inline comments.


================
Comment at: clang/test/SemaCXX/warn-thread-safety-analysis.cpp:341
+  sls_mu.Unlock(); // \
+    // expected-warning{{releasing mutex 'sls_mu' that was not held}}
 }
----------------
This is just a side effect, not the reason I did the change.

It's consistent though with our usual behavior on joining forward edges, see e.g. `sls_fun_bad_11`.


================
Comment at: clang/test/SemaCXX/warn-thread-safety-analysis.cpp:2634
+  // No warning on join point because the lock will be released by the scope object anyway
+  a = 1; // expected-warning {{writing variable 'a' requires holding mutex 'mu_' exclusively}}
+}
----------------
This warning was missing, and is the reason for this change.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D101202/new/

https://reviews.llvm.org/D101202



More information about the cfe-commits mailing list