Thread safety analysis: Add note for double unlock
authorAaron Puchert <aaron.puchert@sap.com>
Mon, 8 Jun 2020 14:30:06 +0000 (16:30 +0200)
committerAaron Puchert <aaron.puchert@sap.com>
Mon, 8 Jun 2020 15:00:29 +0000 (17:00 +0200)
commitf70912f885f991d5af11d8ecb10b703f3cbed982
tree406beb7cf18f5469791ef0cda43d467f07e3936c
parent1850f56c8abae637c2cc1b8d27b8577c5700101a
Thread safety analysis: Add note for double unlock

Summary:
When getting a warning that we release a capability that isn't held it's
sometimes not clear why. So just like we do for double locking, we add a
note on the previous release operation, which marks the point since when
the capability isn't held any longer.

We can find this previous release operation by looking up the
corresponding negative capability.

Reviewers: aaron.ballman, delesley

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D81352
clang/include/clang/Analysis/Analyses/ThreadSafety.h
clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/lib/Analysis/ThreadSafety.cpp
clang/lib/Sema/AnalysisBasedWarnings.cpp
clang/test/Sema/warn-thread-safety-analysis.c
clang/test/SemaCXX/warn-thread-safety-analysis.cpp