This is an archive of the discontinued LLVM Phabricator instance.

Thread safety analysis: Add note for double unlock
ClosedPublic

Authored by aaronpuchert on Jun 7 2020, 3:27 PM.

Details

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.

Diff Detail

Event Timeline

aaronpuchert created this revision.Jun 7 2020, 3:27 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 7 2020, 3:27 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
aaron.ballman accepted this revision.Jun 8 2020, 6:05 AM

LGTM aside from a nit.

clang/include/clang/Analysis/Analyses/ThreadSafety.h
111

The parameter itself isn't optional, so the "optionally" seems a bit strange to me. I think it should say, If the source location is valid, it represents the location of a previous Unlock, or rework the interface to use an llvm::Optional.

This revision is now accepted and ready to land.Jun 8 2020, 6:05 AM
aaronpuchert marked 2 inline comments as done.Jun 8 2020, 7:27 AM
aaronpuchert added inline comments.
clang/include/clang/Analysis/Analyses/ThreadSafety.h
111

The former (not available = invalid) is what I intended, so I'll rephrase this.

This revision was automatically updated to reflect the committed changes.
aaronpuchert marked an inline comment as done.