[all-commits] [llvm/llvm-project] f664e2: Thread safety analysis: Always warn when dropping ...

Aaron Puchert via All-commits all-commits at lists.llvm.org
Tue Jun 29 14:57:10 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f664e2ec371f61b69e11147d7f9e045083335917
      https://github.com/llvm/llvm-project/commit/f664e2ec371f61b69e11147d7f9e045083335917
  Author: Aaron Puchert <aaron.puchert at sap.com>
  Date:   2021-06-29 (Tue, 29 Jun 2021)

  Changed paths:
    M clang/lib/Analysis/ThreadSafety.cpp
    M clang/test/SemaCXX/warn-thread-safety-analysis.cpp

  Log Message:
  -----------
  Thread safety analysis: Always warn when dropping locks on back edges

We allow branches to join where one holds a managed lock but the other
doesn't, but we can't do so for back edges: because there we can't drop
them from the lockset, as we have already analyzed the loop with the
larger lockset. So we can't allow dropping managed locks on back edges.

We move the managed() check from handleRemovalFromIntersection up to
intersectAndWarn, where we additionally check if we're on a back edge if
we're removing from the first lock set (the entry set of the next block)
but not if we're removing from the second lock set (the exit set of the
previous block). Now that the order of arguments matters, I had to swap
them in one invocation, which also causes some minor differences in the
tests.

Reviewed By: delesley

Differential Revision: https://reviews.llvm.org/D104261


  Commit: e0b90771c318625e51c34c67db3f3dfbbb686df8
      https://github.com/llvm/llvm-project/commit/e0b90771c318625e51c34c67db3f3dfbbb686df8
  Author: Aaron Puchert <aaron.puchert at sap.com>
  Date:   2021-06-29 (Tue, 29 Jun 2021)

  Changed paths:
    M clang/lib/Analysis/ThreadSafety.cpp

  Log Message:
  -----------
  Thread safety analysis: Rename parameters of ThreadSafetyAnalyzer::intersectAndWarn (NFC)

In D104261 we made the parameters' meaning slightly more specific, this
changes their names accordingly. In all uses we're building a new lock
set by intersecting existing locksets. The first (modifiable) argument
is the new lock set being built, the second (non-modifiable) argument is
the exit set of a preceding block.

Reviewed By: aaron.ballman, delesley

Differential Revision: https://reviews.llvm.org/D104649


Compare: https://github.com/llvm/llvm-project/compare/cb3580e7ad24...e0b90771c318


More information about the All-commits mailing list