This is an archive of the discontinued LLVM Phabricator instance.

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

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

Event Timeline

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.

zaks.anna edited edge metadata.Sep 13 2017, 8:46 AM

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.

a.sidorin edited edge metadata.Nov 13 2017, 8:14 AM

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.

NoQ accepted this revision.Aug 10 2020, 8:33 PM

This patch has already landed as rG152bc7ffdcd8f62b2279803642f162610154cd2e. I forgot the magic word.

This revision is now accepted and ready to land.Aug 10 2020, 8:33 PM
NoQ closed this revision.Aug 10 2020, 8:33 PM