Bug 241501

Summary: Lambdas passed to WebCore::subspaceForImpl()should use std::forward
Product: WebKit Reporter: David Kilzer (:ddkilzer) <ddkilzer>
Component: BindingsAssignee: David Kilzer (:ddkilzer) <ddkilzer>
Status: RESOLVED DUPLICATE    
Severity: Normal CC: cdumez, darin, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: Other   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch v1 ews-feeder: commit-queue-

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.
Comment 7 David Kilzer (:ddkilzer) 2022-12-29 20:01:20 PST
Dupe of:  Bug 248645: Replace WTFMove() with std::forward() in CodeGeneratorJS.pm

*** This bug has been marked as a duplicate of bug 248645 ***