Bug 241426 - WTF::CrossThreadCopierBase::copy() should use std::forward
Summary: WTF::CrossThreadCopierBase::copy() should use std::forward
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Template Framework (show other bugs)
Version: Other
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: David Kilzer (:ddkilzer)
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-06-08 10:52 PDT by David Kilzer (:ddkilzer)
Modified: 2022-06-08 16:27 PDT (History)
6 users (show)

See Also:


Attachments
Patch v1 (1.26 KB, patch)
2022-06-08 10:57 PDT, David Kilzer (:ddkilzer)
no flags 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-08 10:52:52 PDT
WTF::CrossThreadCopierBase::copy() should use std::forward.

Found by clang static analyzer:

In file included from OpenSource/Source/WTF/wtf/Language.cpp:29:
OpenSource/Source/WTF/wtf/CrossThreadCopier.h:225:106: warning: Forwarding reference passed to std::move(), which may unexpectedly cause lvalues to be moved; use std::forward() instead [bugprone-move-forwarding-reference]
            return CrossThreadCopier<std::remove_const_t<std::remove_reference_t<decltype(type)>>>::copy(WTFMove(type));
                                                                                                         ^
Comment 1 Radar WebKit Bug Importer 2022-06-08 10:53:27 PDT
<rdar://problem/94648592>
Comment 2 David Kilzer (:ddkilzer) 2022-06-08 10:57:51 PDT
Created attachment 460098 [details]
Patch v1
Comment 3 David Kilzer (:ddkilzer) 2022-06-08 15:00:39 PDT
Comment on attachment 460098 [details]
Patch v1

Marking cq+ as enough builds and test runs have completed that I think it's safe to land this.
Comment 4 EWS 2022-06-08 16:27:04 PDT
Committed r295400 (251406@main): <https://commits.webkit.org/251406@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 460098 [details].