Thread safety analysis: Handle compound assignment and ->* overloads
authorAaron Puchert <aaron.puchert@sap.com>
Mon, 9 May 2022 13:34:09 +0000 (15:34 +0200)
committerAaron Puchert <aaron.puchert@sap.com>
Mon, 9 May 2022 13:35:43 +0000 (15:35 +0200)
commit44ae49e1a72576ca6aa8835b3f72df9605516403
tree29aaa5828befc8344aa0606a85fad6b6c64a89b2
parentf1a9c4b717be9a9a730f837dfd70df69d1daf44f
Thread safety analysis: Handle compound assignment and ->* overloads

Like regular assignment, compound assignment operators can be assumed to
write to their left-hand side operand. So we strengthen the requirements
there. (Previously only the default read access had been required.)

Just like operator->, operator->* can also be assumed to dereference the
left-hand side argument, so we require read access to the pointee. This
will generate new warnings if the left-hand side has a pt_guarded_by
attribute. This overload is rarely used, but it was trivial to add, so
why not. (Supporting the builtin operator requires changes to the TIL.)

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D124966
clang/docs/ReleaseNotes.rst
clang/lib/Analysis/ThreadSafety.cpp
clang/test/SemaCXX/warn-thread-safety-analysis.cpp