Bug 192661

Summary: clang-tidy: loop variable is copied but only used as const reference in Document.cpp, Element.cpp
Product: WebKit Reporter: David Kilzer (:ddkilzer) <ddkilzer>
Component: DOMAssignee: David Kilzer (:ddkilzer) <ddkilzer>
Status: RESOLVED FIXED    
Severity: Normal CC: ajuma, cdumez, cmarcelo, commit-queue, dbates, esprehn+autocc, ews-watchlist, kangil.han, simon.fraser, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Local Build   
Hardware: Unspecified   
OS: Unspecified   
URL: http://clang.llvm.org/extra/clang-tidy/checks/performance-for-range-copy.html
See Also: https://bugs.webkit.org/show_bug.cgi?id=192751
Bug Depends on: 188670    
Bug Blocks:    
Attachments:
Description Flags
Patch v1 none

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.