[all-commits] [llvm/llvm-project] c26d09: [alpha.webkit.RetainPtrCtorAdoptChecker] Support a...

Ryosuke Niwa via All-commits all-commits at lists.llvm.org
Thu Apr 10 15:26:33 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: c26d097d0c3e0e3924e273c0ec2d1e57192e66c8
      https://github.com/llvm/llvm-project/commit/c26d097d0c3e0e3924e273c0ec2d1e57192e66c8
  Author: Ryosuke Niwa <rniwa at webkit.org>
  Date:   2025-04-10 (Thu, 10 Apr 2025)

  Changed paths:
    M clang/lib/StaticAnalyzer/Checkers/WebKit/PtrTypesSemantics.cpp
    M clang/lib/StaticAnalyzer/Checkers/WebKit/PtrTypesSemantics.h
    M clang/lib/StaticAnalyzer/Checkers/WebKit/RawPtrRefCallArgsChecker.cpp
    M clang/lib/StaticAnalyzer/Checkers/WebKit/RawPtrRefLocalVarsChecker.cpp
    M clang/lib/StaticAnalyzer/Checkers/WebKit/RetainPtrCtorAdoptChecker.cpp
    M clang/test/Analysis/Checkers/WebKit/objc-mock-types.h
    M clang/test/Analysis/Checkers/WebKit/retain-ptr-ctor-adopt-use-arc.mm
    M clang/test/Analysis/Checkers/WebKit/retain-ptr-ctor-adopt-use.mm

  Log Message:
  -----------
  [alpha.webkit.RetainPtrCtorAdoptChecker] Support adopt(cast(copy(~)) (#132316)

This PR adds the support for recognizing calling adoptCF/adoptNS on the
result of a cast operation on the return value of a function which
creates NS or CF types. It also fixes a bug that we weren't reporting
memory leaks when CF types are created without ever calling RetainPtr's
constructor, adoptCF, or adoptNS.

To do this, this PR adds a new mechanism to report a memory leak
whenever create or copy CF functions are invoked unless this CallExpr
has already been visited while validating a call to adoptCF. Also added
an early exit when isOwned returns IsOwnedResult::Skip due to an
unresolved template argument.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list