[analyzer] PthreadLock: Refactor, use PostCall API. NFC.
Needs ReviewPublic

Authored by NoQ on Sep 13 2017, 7:04 AM.

Details

Summary

Use CallEvent and CallDescription everywhere. Unhardcode argument numbers in AcquireLock() etc. Have a list of supported functions in one place. Other misc cleanup. No functional change intended anywhere.

Diff Detail

NoQ created this revision.Sep 13 2017, 7:04 AM
NoQ updated this revision to Diff 115042.Sep 13 2017, 7:19 AM

Don't forget to check that the function is a global C function in post-call.

How about committing the refactor of the code without test modifications. And committing changes to the test separately?

NoQ updated this revision to Diff 115586.Sep 17 2017, 1:02 PM

Remove the changes in tests for now. I guess they'd need more cleanup anyway.

I like this refactoring. I wrote some things that are not clear for me inline.

lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp
107

In the code below lock is always Call.getSVal(ArgNo). Should we remove it and put SVal acquisition into callees?

108

According to naming conventions , it should be Lock and IsTryLock. But I'm not sure that this corresponds to the file's code style so I do not insist.

188

break?

262

Could you add comments describing what arguments should do? I.e. `/* ArgNo= */ 0, /* Lock= */...? It's hard to remember what do these parameters correspond to.