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.
<rdar://problem/84664132>