This is an archive of the discontinued LLVM Phabricator instance.

Thread safety analysis: Add note for unlock kind mismatch
ClosedPublic

Authored by aaronpuchert on Mar 16 2019, 8:22 AM.

Details

Diff Detail

Repository
rC Clang

Event Timeline

aaronpuchert created this revision.Mar 16 2019, 8:22 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 16 2019, 8:22 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript

Factor out some common code.

aaron.ballman accepted this revision.Mar 18 2019, 1:07 PM

LGTM aside from a small nit.

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

Can you rename this one to LocUnlocked to mirror the new parameter?

lib/Sema/AnalysisBasedWarnings.cpp
1690

Same suggestion here.

This revision is now accepted and ready to land.Mar 18 2019, 1:07 PM
aaronpuchert added inline comments.Mar 18 2019, 1:32 PM
include/clang/Analysis/Analyses/ThreadSafety.h
127

This was supposed to mirror the following function (handleDoubleLock), where similarly Loc is the place of the issue itself and LocLocked indicates where the lock is coming from. If we want to change this, I would suggest to use present tense here: LocUnlock. The lock from LocLocked "happened in the past" (meaning earlier in the code), but the unlock "happens now" (meaning at the current location).

aaron.ballman added inline comments.Mar 18 2019, 2:24 PM
include/clang/Analysis/Analyses/ThreadSafety.h
127

Ah, good call on the tense of the identifier! Given that it's following a pattern, I'd say you can commit as-is. If you're similarly bothered by the name, then you could have a follow-up NFC commit that renames consistently across APIs.

This revision was automatically updated to reflect the committed changes.
aaronpuchert marked 4 inline comments as done.Mar 18 2019, 5:14 PM
aaronpuchert added inline comments.
include/clang/Analysis/Analyses/ThreadSafety.h
127

Changed in rC356430.