[analyzer] PthreadLock: Escape the pointers.
Needs ReviewPublic

Authored by NoQ on Wed, Sep 13, 9:16 AM.

Details

Summary

As usual, we need to invalidate mutex states when something may touch them. Implement this boilerplate for the thread lock checker.

The previous refactoring is handy for listing functions on which we don't need to invalidate mutex states because we model them instead.

Additionally, i don't invalidate mutex states when any system header function is called, unless the mutex is passed directly into it. The TODO here would be to model *all* system functions that may change mutex states, and then disable invalidation for the rest of them even if they take a mutex; that's what other checkers do.

Diff Detail

xazax.hun added inline comments.Thu, Sep 21, 1:44 AM
lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp
594

Wouldn't it be better to branch on IsLibraryFunction and in one branch iterate on Regions and in the other, iterate on ExplicitRegions?
That would avoid the possible quadratic explosion when lots of explicit regions are invalidated.