Bug 192661 - clang-tidy: loop variable is copied but only used as const reference in Document.cpp, Element.cpp
Summary: clang-tidy: loop variable is copied but only used as const reference in Docum...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: WebKit Local Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: David Kilzer (:ddkilzer)
URL: http://clang.llvm.org/extra/clang-tid...
Keywords: InRadar
Depends on: 188670
Blocks:
  Show dependency treegraph
 
Reported: 2018-12-13 04:10 PST by David Kilzer (:ddkilzer)
Modified: 2018-12-17 01:37 PST (History)
10 users (show)

See Also:


Attachments
Patch v1 (3.35 KB, patch)
2018-12-13 05:33 PST, 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) 2018-12-13 04:10:30 PST
Running `clang-tidy '-checks=-*,performance-for-range-copy' ...` on Document.cpp and Element.cpp finds these unnecessary copies:

Source/WebCore/dom/Document.cpp:7907:15: warning: loop variable is copied but only used as const reference; consider making it a const reference [performance-for-range-copy]
    for (auto observer : m_intersectionObserversWithPendingNotifications) {
              ^
         const  &

Source/WebCore/dom/Element.cpp:1777:19: warning: loop variable is copied but only used as const reference; consider making it a const reference [performance-for-range-copy]
        for (auto observer : observerData->observers) {
                  ^
             const  &
Source/WebCore/dom/Element.cpp:3399:15: warning: loop variable is copied but only used as const reference; consider making it a const reference [performance-for-range-copy]
    for (auto observer : observerData->observers)
              ^
         const  &
Comment 1 Radar WebKit Bug Importer 2018-12-13 04:11:29 PST
<rdar://problem/46694035>
Comment 2 David Kilzer (:ddkilzer) 2018-12-13 05:33:03 PST
Created attachment 357226 [details]
Patch v1
Comment 3 WebKit Commit Bot 2018-12-13 06:44:36 PST
Comment on attachment 357226 [details]
Patch v1

Clearing flags on attachment: 357226

Committed r239160: <https://trac.webkit.org/changeset/239160>
Comment 4 WebKit Commit Bot 2018-12-13 06:44:38 PST
All reviewed patches have been landed.  Closing bug.