[all-commits] [llvm/llvm-project] 1dad8c: [analyzer][NFC] Remove duplicated work from retain...

Valeriy Savchenko via All-commits all-commits at lists.llvm.org
Wed Apr 28 08:38:29 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 1dad8c5036bc912078f7859d89e3ea571616fc4a
      https://github.com/llvm/llvm-project/commit/1dad8c5036bc912078f7859d89e3ea571616fc4a
  Author: Valeriy Savchenko <vsavchenko at apple.com>
  Date:   2021-04-28 (Wed, 28 Apr 2021)

  Changed paths:
    M clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountDiagnostics.cpp

  Log Message:
  -----------
  [analyzer][NFC] Remove duplicated work from retain count leak report

Allocation site is the key location for the leak checker.  It is a
uniqueing location for the report and a source of information for
the warning's message.

Before this patch, we calculated and used it twice in bug report and
in bug report visitor.  Such duplication is not only harmful
performance-wise (not much, but still), but also design-wise.  Because
changing something about the end piece of the report should've been
repeated for description as well.

Differential Revision: https://reviews.llvm.org/D100626


  Commit: 61ae2db2d7a97af5206afe609a303071711f9e6e
      https://github.com/llvm/llvm-project/commit/61ae2db2d7a97af5206afe609a303071711f9e6e
  Author: Valeriy Savchenko <vsavchenko at apple.com>
  Date:   2021-04-28 (Wed, 28 Apr 2021)

  Changed paths:
    M clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountDiagnostics.cpp
    M clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountDiagnostics.h
    M clang/test/Analysis/Inputs/expected-plists/edges-new.mm.plist
    M clang/test/Analysis/Inputs/expected-plists/retain-release-path-notes.m.plist
    M clang/test/Analysis/Inputs/expected-plists/retain-release.m.objc.plist
    M clang/test/Analysis/Inputs/expected-plists/retain-release.m.objcpp.plist
    M clang/test/Analysis/osobject-retain-release.cpp
    M clang/test/Analysis/retain-release-path-notes.m
    M clang/test/Analysis/retain-release.m

  Log Message:
  -----------
  [analyzer] Adjust the reported variable name in retain count checker

When reporting leaks, we try to attach the leaking object to some
variable, so it's easier to understand.  Before the patch, we always
tried to use the first variable that stored the object in question.
This can get very confusing for the user, if that variable doesn't
contain that object at the moment of the actual leak.  In many cases,
the warning is dismissed as false positive and it is effectively a
false positive when we fail to properly explain the warning to the
user.

This patch addresses the bigest issue in cases like this.  Now we
check if the variable still contains the leaking symbolic object.
If not, we look for the last variable to actually hold it and use
that variable instead.

rdar://76645710

Differential Revision: https://reviews.llvm.org/D100839


  Commit: e273918038a7aa300cb8e6afebd9714bf647eed0
      https://github.com/llvm/llvm-project/commit/e273918038a7aa300cb8e6afebd9714bf647eed0
  Author: Valeriy Savchenko <vsavchenko at apple.com>
  Date:   2021-04-28 (Wed, 28 Apr 2021)

  Changed paths:
    M clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountDiagnostics.cpp
    M clang/test/Analysis/Inputs/expected-plists/edges-new.mm.plist
    M clang/test/Analysis/Inputs/expected-plists/retain-release-path-notes.m.plist
    M clang/test/Analysis/Inputs/expected-plists/retain-release.m.objc.plist
    M clang/test/Analysis/Inputs/expected-plists/retain-release.m.objcpp.plist
    M clang/test/Analysis/osobject-retain-release.cpp
    M clang/test/Analysis/retain-release-path-notes.m

  Log Message:
  -----------
  [analyzer] Track leaking object through stores

Since we can report memory leaks on one variable, while the originally
allocated object was stored into another one, we should explain
how did it get there.

rdar://76645710

Differential Revision: https://reviews.llvm.org/D100852


  Commit: ab5823867c4aee7f3e02ddfaa217905c87471bf9
      https://github.com/llvm/llvm-project/commit/ab5823867c4aee7f3e02ddfaa217905c87471bf9
  Author: Valeriy Savchenko <vsavchenko at apple.com>
  Date:   2021-04-28 (Wed, 28 Apr 2021)

  Changed paths:
    M clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
    M clang/test/Analysis/Inputs/expected-plists/retain-release-path-notes.m.plist
    M clang/test/Analysis/diagnostics/deref-track-symbolic-region.cpp
    M clang/test/Analysis/osobject-retain-release.cpp
    M clang/test/Analysis/retain-release-path-notes.m
    M clang/test/Analysis/uninit-const.c
    M clang/test/Analysis/uninit-const.cpp

  Log Message:
  -----------
  [analyzer] Find better description for tracked symbolic values

When searching for stores and creating corresponding notes, the
analyzer is more specific about the target region of the store
as opposed to the stored value.  While this description was tweaked
for constant and undefined values, it lacked in the most general
case of symbolic values.

This patch tries to find a memory region, where this value is stored,
to use it as a better alias for the value.

rdar://76645710

Differential Revision: https://reviews.llvm.org/D101041


Compare: https://github.com/llvm/llvm-project/compare/b8baa2a91324...ab5823867c4a


More information about the All-commits mailing list