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

Authored by NoQ on Sep 13 2017, 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.Sep 13 2017, 6:38 AM
zaks.anna added inline comments.Sep 13 2017, 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.Sep 17 2017, 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.

Hi Artem,

Sorry for long delay for reviews. Unfortunately, hospital is a bad place to do a code review and broken hand is a bad review assistant. This patch looks good to me, I have just a minor comment nit.

lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp
282

TODO?