This is an archive of the discontinued LLVM Phabricator instance.

[analyzer] Preliminary version of retain count checking for OSObjects
ClosedPublic

Authored by george.karpenkov on Aug 16 2018, 6:50 PM.

Diff Detail

Repository
rL LLVM

Event Timeline

george.karpenkov edited the summary of this revision. (Show Details)
george.karpenkov retitled this revision from [analyzer] [WIP] Preliminary version of retain count checking for OSObjects to [analyzer] Preliminary version of retain count checking for OSObjects.
george.karpenkov edited the summary of this revision. (Show Details)
NoQ added a comment.Aug 21 2018, 5:10 PM

Tests have disappeared again.

clang/include/clang/StaticAnalyzer/Core/RetainSummaryManager.h
533–534 ↗(On Diff #161846)

I suspect that this line wasn't intended to be moved around.

clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountChecker.cpp
1403–1410 ↗(On Diff #161846)

Now enabling OSObjectRetainCount checker would enable the regular RetainCountChecker.

If we want to keep them separate, i guess we'll have to make it work both ways and add a flag for the regular retain count checker everywhere in its code.

It's easy to forget the check, so we might probably want to add assertions somewhere in emitReport that we at least don't throw warnings from disabled checkers.

clang/lib/StaticAnalyzer/Core/RetainSummaryManager.cpp
331–334 ↗(On Diff #161846)

Should we check TrackOSObjects here?

george.karpenkov marked an inline comment as done.Aug 21 2018, 5:31 PM
george.karpenkov added inline comments.
clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountChecker.cpp
1403–1410 ↗(On Diff #161846)

I think I'm fine with enabling the "regular" one, I don't think it would cause any issues with codebases using OSObject, as they probably would never have CFObject or NSObject.

Updated, now with tests.

NoQ accepted this revision.Aug 22 2018, 5:16 PM

Looks great. I enjoyed how we managed to re-use the infrastructure.

This revision is now accepted and ready to land.Aug 22 2018, 5:16 PM
This revision was automatically updated to reflect the committed changes.