[PATCH] D102026: Thread safety analysis: Allow exlusive/shared joins for managed and asserted capabilities
Delesley Hutchins via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue May 25 12:48:07 PDT 2021
delesley accepted this revision.
delesley added a comment.
This revision is now accepted and ready to land.
Thanks for taking the time to discuss things with me. :-)
Wrt. to the TEST_LOCKED_FUNCTION, I agree that you can simulate the behavior using Assert and Lock. But that pattern is too general/powerful, because it also allows you to write nonsensical and unsound code. Philosophically, static analysis is concerned with allowing things that are sound, but preventing things that are not, so I would prefer to allow the valid case, but warn on the nonsensical/unsound code. The goal is not to provide powerful back doors so that you can squeeze anything past the checker -- doing so kind of defeats the point. :-) That being said, I'm not certainly no asking you to implement TEST_LOCKED functionality in this particular patch, and I totally understand that it may simply not be worth the effort.
Wrt. to unlocking an Assert, I see no problem. It makes perfect sense to dynamically assert that a mutex is held, then do something, and then unlock the mutex afterwards; after all, the caller asserted that it was held before unlocking. You shouldn't disallow that.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D102026/new/
https://reviews.llvm.org/D102026
More information about the cfe-commits
mailing list