[PATCH] D32449: Modifying PthreadLockChecker.cpp to reduce false positives.

Malhar Thakkar via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat May 20 09:41:17 PDT 2017


malhar1995 added inline comments.


================
Comment at: lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp:143-146
+    if(lstate->isSchrodingerUntouched())
+      state = state->remove<LockMap>(lockR);
+    else if(lstate->isSchrodingerUnlocked())
+      state = state->set<LockMap>(lockR, LockState::getUnlocked());
----------------
NoQ wrote:
> I think we can be certain that the lock is in one of these states, and assert that.
We can be certain that the lock state will be either of the two only if I add the following statement before returning from this function.
```
state = state->remove<DestroyRetVal>(lockR);
```
If I don't add the above statement, a return value symbol for the region specified by lockR will still be in DestroyRetVal and it may have an actual lock state (locked, unlocked or destroyed).


Repository:
  rL LLVM

https://reviews.llvm.org/D32449





More information about the cfe-commits mailing list