[PATCH] D37806: [analyzer] PthreadLock: Fix return values of XNU lock functions.

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Sep 17 12:49:35 PDT 2017


NoQ added inline comments.


================
Comment at: lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp:271
     }
-    assert(lockFail && lockSucc);
-    C.addTransition(lockFail);
-
+    // We might want to handle the case when the mutex lock function was inlined
+    // and returned an Unknown or Undefined value.
----------------
zaks.anna wrote:
> This comment is repeated several times...
Because it is relevant in both places. Should i rephrase with "also"/"as well"/"here too"?


================
Comment at: test/Analysis/Inputs/system-header-simulator-for-pthread-lock.h:29
+extern void lck_mtx_unlock(lck_mtx_t *);
+extern boolean_t lck_mtx_try_lock(lck_mtx_t *);
 extern void lck_mtx_destroy(lck_mtx_t *lck, lck_grp_t *grp);
----------------
zaks.anna wrote:
> Should there be a test added that uses the function?
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.


https://reviews.llvm.org/D37806





More information about the cfe-commits mailing list