[all-commits] [llvm/llvm-project] a5e354: [analyzer] Fixing a bug raising false positives of...

Ziqing Luo via All-commits all-commits at lists.llvm.org
Fri Aug 26 12:20:31 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a5e354ec4da14cfc02b9847be314524e8deb93c6
      https://github.com/llvm/llvm-project/commit/a5e354ec4da14cfc02b9847be314524e8deb93c6
  Author: ziqingluo-90 <ziqing at udel.edu>
  Date:   2022-08-26 (Fri, 26 Aug 2022)

  Changed paths:
    M clang/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp
    M clang/lib/StaticAnalyzer/Core/MemRegion.cpp
    M clang/test/Analysis/stack-capture-leak-arc.mm
    M clang/test/Analysis/stack-capture-leak-no-arc.mm

  Log Message:
  -----------
  [analyzer] Fixing a bug raising false positives of stack block object
leaking in ARC mode

When ARC (automatic reference count) is enabled, (objective-c) block
objects are automatically retained and released thus they do not leak.
Without ARC, they still can leak from an expiring stack frame like
other stack variables.
With this commit, the static analyzer now puts a block object in an
"unknown" region if ARC is enabled because it is up to the
implementation to choose whether to put the object on stack initially
(then move to heap when needed) or in heap directly under ARC.
Therefore, the `StackAddrEscapeChecker` has no need to know
specifically about ARC at all and it will not report errors on objects
in "unknown" regions.

Reviewed By: NoQ (Artem Dergachev)

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




More information about the All-commits mailing list