This is an archive of the discontinued LLVM Phabricator instance.

[analyzer] Process state in checkEndFunction in RetainCountChecker
ClosedPublic

Authored by george.karpenkov on Sep 20 2018, 7:02 PM.

Details

Summary
Modify the RetainCountChecker to perform state "adjustments" in
checkEndFunction, as performing work in PreStmt<ReturnStmt> does not
work with destructors.
The previous version made an implicit assumption that no code runs
after the return statement is executed.

rdar://43945028

Diff Detail

Event Timeline

NoQ accepted this revision.Sep 21 2018, 12:30 PM

I suspect that other checkers may suffer from the same problem.

clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountChecker.cpp
817

Whitespace.

946

Let's use generateNonFatalErrorNode() here, in order to indicate that we're going to throw a report against it.

973

Same here.

clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountChecker.h
430

Whitespace.

This revision is now accepted and ready to land.Sep 21 2018, 12:30 PM
This revision was automatically updated to reflect the committed changes.
This revision was automatically updated to reflect the committed changes.