Bug 241501 - Lambdas passed to WebCore::subspaceForImpl()should use std::forward
Summary: Lambdas passed to WebCore::subspaceForImpl()should use std::forward
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Bindings (show other bugs)
Version: Other
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: David Kilzer (:ddkilzer)
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-06-09 21:02 PDT by David Kilzer (:ddkilzer)
Modified: 2022-06-24 08:21 PDT (History)
3 users (show)

See Also:


Attachments
Patch v1 (4.44 KB, patch)
2022-06-09 21:06 PDT, David Kilzer (:ddkilzer)
ews-feeder: commit-queue-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description David Kilzer (:ddkilzer) 2022-06-09 21:02:13 PDT
Lambdas passed to WebCore::subspaceForImpl()should use std::forward.

Found by clang static analyzer.
Comment 1 David Kilzer (:ddkilzer) 2022-06-09 21:03:04 PDT
The generated bindings code creates over 1700 bugprone-move-forwarding-reference warnings from clang-tidy in WebCore.
Comment 2 Radar WebKit Bug Importer 2022-06-09 21:03:13 PDT
<rdar://problem/94782118>
Comment 3 David Kilzer (:ddkilzer) 2022-06-09 21:06:26 PDT
Created attachment 460154 [details]
Patch v1
Comment 4 Darin Adler 2022-06-10 09:41:15 PDT
I worry that these errors indicate that some of our recent conversions from WTFMove(x) to std::forward<decltype(x)>(x) may have changed our code to copy rather than move. I don’t understand precisely what the issue is.
Comment 5 Darin Adler 2022-06-10 09:54:51 PDT
I think the mistake is in WebCoreJSClientData.h:

- setServer(subspaces, uniqueSubspace);
+ setServer(subspaces, WTFMove(uniqueSubspace));

- setClient(clientSubspaces, uniqueClientSubspace);
+ setClient(clientSubspaces, WTFMove(uniqueClientSubspace));

But also I think this idiom is peculiar where we are passing two copies of the same pointer.
Comment 6 Darin Adler 2022-06-10 09:55:48 PDT
(In reply to Darin Adler from comment #5)
> But also I think this idiom is peculiar where we are passing two copies of
> the same pointer.

Sorry that sentence was wrong, but I think the rest of the above is right.