[Webkit-unassigned] [Bug 231954] New: clang-tidy checker to find places where WTFMove/std::move are missing with RetainPtr<>
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Tue Oct 19 08:18:08 PDT 2021
https://bugs.webkit.org/show_bug.cgi?id=231954
Bug ID: 231954
Summary: clang-tidy checker to find places where
WTFMove/std::move are missing with RetainPtr<>
Product: WebKit
Version: WebKit Nightly Build
Hardware: Unspecified
OS: Unspecified
Status: NEW
Severity: Normal
Priority: P2
Component: Tools / Tests
Assignee: webkit-unassigned at lists.webkit.org
Reporter: ddkilzer at webkit.org
CC: darin at apple.com
clang-tidy checker to find places where WTFMove/std::move are missing with RetainPtr<>.
In Bug 231814 Comment #6 and Bug 231814 Comment #11, I reimplemented a suggestion from Darin, but I missed adding a WTFMove() of a RetainPtr<> object that was going out of scope, resulting in some ref count churn:
RetainPtr<SecKeyRef> LocalConnection::createCredentialPrivateKey(...)
{
RetainPtr privateKeyAttributes = @{ ... };
if (context) {
auto mutableCopy = adoptNS([privateKeyAttributes mutableCopy]);
mutableCopy.get()[(id)kSecUseAuthenticationContext] = context;
privateKeyAttributes = mutableCopy; // FIXME: Missing WTFMove(mutableCopy)
}
[...]
}
A clang-tidy checker would be useful that warns about a missing WTFMove/std::move where a RetainPtr<> object is last referenced in a block/function using an assignment operator to another RetainPtr<> variable.
I'm sure there are more of these cases in WebKit, and such a checker could probably be made generic enough for any class with an operator=(&&) implementation.
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20211019/4ba9cc2e/attachment-0001.htm>
More information about the webkit-unassigned
mailing list