forked from OSchip/llvm-project
Properly add shared locks to the initial list of locks being tracked, instead of assuming unlock functions always use exclusive locks.
Patch by Aaron Puchert. llvm-svn: 338912
This commit is contained in:
parent
397985db51
commit
eaa18e60eb
|
@ -2242,8 +2242,8 @@ void ThreadSafetyAnalyzer::runAnalysis(AnalysisDeclContext &AC) {
|
|||
// We must ignore such methods.
|
||||
if (A->args_size() == 0)
|
||||
return;
|
||||
// FIXME -- deal with exclusive vs. shared unlock functions?
|
||||
getMutexIDs(ExclusiveLocksToAdd, A, nullptr, D);
|
||||
getMutexIDs(A->isShared() ? SharedLocksToAdd : ExclusiveLocksToAdd, A,
|
||||
nullptr, D);
|
||||
getMutexIDs(LocksReleased, A, nullptr, D);
|
||||
CapDiagKind = ClassifyDiagnostic(A);
|
||||
} else if (const auto *A = dyn_cast<AcquireCapabilityAttr>(Attr)) {
|
||||
|
|
|
@ -4078,6 +4078,14 @@ public:
|
|||
mu_.Unlock();
|
||||
}
|
||||
|
||||
void unlockExclusive() EXCLUSIVE_UNLOCK_FUNCTION(mu_) {
|
||||
mu_.Unlock();
|
||||
}
|
||||
|
||||
void unlockShared() SHARED_UNLOCK_FUNCTION(mu_) {
|
||||
mu_.ReaderUnlock();
|
||||
}
|
||||
|
||||
// Check failure to lock.
|
||||
void lockBad() EXCLUSIVE_LOCK_FUNCTION(mu_) { // expected-note {{mutex acquired here}}
|
||||
mu2_.Lock();
|
||||
|
|
Loading…
Reference in New Issue