[webkit-changes] [WebKit/WebKit] 611c1a: RetainPtr<>::leakRef() should have NS/CF_RETURNS_R...

Commit Queue noreply at github.com
Fri May 5 18:58:12 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 611c1a1ceeaf4a530810d3d60c7460ff89bf1767
      https://github.com/WebKit/WebKit/commit/611c1a1ceeaf4a530810d3d60c7460ff89bf1767
  Author: David Kilzer <ddkilzer at apple.com>
  Date:   2023-05-05 (Fri, 05 May 2023)

  Changed paths:
    M Source/WTF/wtf/RetainPtr.h

  Log Message:
  -----------
  RetainPtr<>::leakRef() should have NS/CF_RETURNS_RETAINED attributes
https://bugs.webkit.org/show_bug.cgi?id=256311
<rdar://108895655>

Reviewed by Alex Christensen and Darin Adler.

Use template specialization with SFINAE to add the
CF_RETAINS_RETAINED attribute for CFType objects and the
NS_RETURNS_RETAINED attribute for Cocoa objects.

This allows the clang static analyzer to reason about the
leakRef() method.

* Source/WTF/wtf/RetainPtr.h:
(WTF::RetainPtr<T>::leakRef):
- Use a technique to allow for template specialization without
  using the class template type.
- Note that this specialization must also cover the case of
  using `id` in C++ code.

Canonical link: https://commits.webkit.org/263742@main




More information about the webkit-changes mailing list