[PATCH] D102025: Thread safety analysis: Factor out function for merging locks (NFC)

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu May 13 07:20:32 PDT 2021


aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

LGTM!



================
Comment at: clang/lib/Analysis/ThreadSafety.cpp:2199
+    // Take the exclusive capability to reduce further warnings.
+    return B.kind() == LK_Exclusive;
+  } else {
----------------
aaronpuchert wrote:
> aaron.ballman wrote:
> > The old code was looking at `LDat1.kind() != LK_Exclusive` -- any reason this isn't `A.kind() != LK_Exclusive` as well?
> 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.
Oohhhh, derp. I was forgetting that there were only two kinds. This looks fine to me, thanks!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D102025/new/

https://reviews.llvm.org/D102025



More information about the cfe-commits mailing list