mirror of
https://github.com/Gericom/teak-llvm.git
synced 2025-06-19 11:35:51 -04:00
[analyzer] PthreadLock: Implement dead region cleanup.
Differential Revision: https://reviews.llvm.org/D37963
This commit is contained in:
parent
dd22be1e3d
commit
1484d0f12a
@ -536,19 +536,24 @@ void PthreadLockChecker::checkDeadSymbols(SymbolReaper &SymReaper,
|
|||||||
CheckerContext &C) const {
|
CheckerContext &C) const {
|
||||||
ProgramStateRef State = C.getState();
|
ProgramStateRef State = C.getState();
|
||||||
|
|
||||||
// TODO: Clean LockMap when a mutex region dies.
|
for (auto I : State->get<DestroyRetVal>()) {
|
||||||
|
// Once the return value symbol dies, no more checks can be performed
|
||||||
DestroyRetValTy TrackedSymbols = State->get<DestroyRetVal>();
|
// against it. See if the return value was checked before this point.
|
||||||
for (DestroyRetValTy::iterator I = TrackedSymbols.begin(),
|
// This would remove the symbol from the map as well.
|
||||||
E = TrackedSymbols.end();
|
if (SymReaper.isDead(I.second))
|
||||||
I != E; ++I) {
|
State = resolvePossiblyDestroyedMutex(State, I.first, &I.second);
|
||||||
const SymbolRef Sym = I->second;
|
|
||||||
const MemRegion *lockR = I->first;
|
|
||||||
bool IsSymDead = SymReaper.isDead(Sym);
|
|
||||||
// Remove the dead symbol from the return value symbols map.
|
|
||||||
if (IsSymDead)
|
|
||||||
State = resolvePossiblyDestroyedMutex(State, lockR, &Sym);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (auto I : State->get<LockMap>()) {
|
||||||
|
// Stop tracking dead mutex regions as well.
|
||||||
|
if (!SymReaper.isLiveRegion(I.first))
|
||||||
|
State = State->remove<LockMap>(I.first);
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: We probably need to clean up the lock stack as well.
|
||||||
|
// It is tricky though: even if the mutex cannot be unlocked anymore,
|
||||||
|
// it can still participate in lock order reversal resolution.
|
||||||
|
|
||||||
C.addTransition(State);
|
C.addTransition(State);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user