This is an archive of the discontinued LLVM Phabricator instance.

Thread safety analysis: Factor out function for merging locks (NFC)
ClosedPublic

Authored by aaronpuchert on May 6 2021, 2:13 PM.

Details

Summary

It's going to become a bit more complicated, so let's have it separate.

Diff Detail

Event Timeline

aaronpuchert requested review of this revision.May 6 2021, 2:13 PM
aaronpuchert created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptMay 6 2021, 2:13 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
aaron.ballman added inline comments.May 13 2021, 5:22 AM
clang/lib/Analysis/ThreadSafety.cpp
2199

The old code was looking at LDat1.kind() != LK_Exclusive -- any reason this isn't A.kind() != LK_Exclusive as well?

aaronpuchert added inline comments.May 13 2021, 7:05 AM
clang/lib/Analysis/ThreadSafety.cpp
2199

Given that both should be equivalent (knowing A.kind() != B.kind() and that there are just two kinds), I thought this condition fits better to the comment: we select the lock that's exclusive, instead of not selecting the lock that's not exclusive.

But I don't have a problem with A.kind() != LK_Exclusive if that sounds more natural to you.

aaron.ballman accepted this revision.May 13 2021, 7:20 AM

LGTM!

clang/lib/Analysis/ThreadSafety.cpp
2199

Oohhhh, derp. I was forgetting that there were only two kinds. This looks fine to me, thanks!

This revision is now accepted and ready to land.May 13 2021, 7:20 AM