[analyzer] PthreadLock: Fix return values of XNU lock functions.
Needs ReviewPublic

Authored by NoQ on Wed, Sep 13, 6:38 AM.

Details

Summary

lck_mtx_lock() returns void. The analyzer failed to model its effect because he was surprised that the return value is Unknown. Prepare for the aforementioned surprise and fix the tests accordingly.

Diff Detail

NoQ created this revision.Wed, Sep 13, 6:38 AM
zaks.anna added inline comments.Wed, Sep 13, 8:51 AM
lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp
271

This comment is repeated several times...

test/Analysis/Inputs/system-header-simulator-for-pthread-lock.h
29

Should there be a test added that uses the function?

NoQ added inline comments.Sun, Sep 17, 12:49 PM
lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp
271

Because it is relevant in both places. Should i rephrase with "also"/"as well"/"here too"?

test/Analysis/Inputs/system-header-simulator-for-pthread-lock.h
29

The tests are already there for all three functions. I just fixed their prototype to match the real-world prototype, and then adjusted the code accordingly, so that the existing tests kept passing.