[PATCH] D104136: [analyzer] Add better tracking for RetainCountChecker leak warnings

Valeriy Savchenko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 11 11:08:24 PDT 2021


vsavchenko created this revision.
vsavchenko added reviewers: NoQ, xazax.hun, martong, steakhal, Szelethus, manas, RedDocMD.
Herald added subscribers: ASDenysPetrov, dkrupp, donat.nagy, mikhail.ramalho, a.sidorin, rnkovacs, szepet, baloghadamsoftware.
vsavchenko requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

RetainCountChecker models a group of calls that are interpreted as
"identity" functions.  bugreporter::Tracker couldn't see through
such calls and pick the right argument for tracking.

This commit introduces a new tag that helps to keep this information
from the actual analysis and reuse it later for tracking purposes.

So, in short, when we see a call `foo(x)` that we model as
"identity", we now add a tag that is saying that the result of
`foo(x)` is essentially `x`.  When the tracker, later on, tries to
track value from `foo(x)`, we point out that it should track `x`.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D104136

Files:
  clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountChecker.cpp
  clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountChecker.h
  clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountDiagnostics.cpp
  clang/test/Analysis/Inputs/expected-plists/retain-release.m.objc.plist
  clang/test/Analysis/Inputs/expected-plists/retain-release.m.objcpp.plist
  clang/test/Analysis/osobject-retain-release.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D104136.351507.patch
Type: text/x-patch
Size: 13952 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210611/03582d52/attachment-0001.bin>


More information about the cfe-commits mailing list