Bug 192751

Summary: clang-tidy: loop variable is copied but only used as const reference in WebCore, WebKit, Tools
Product: WebKit Reporter: David Kilzer (:ddkilzer) <ddkilzer>
Component: WebCore Misc.Assignee: David Kilzer (:ddkilzer) <ddkilzer>
Status: RESOLVED FIXED    
Severity: Normal CC: achristensen, commit-queue, dbates, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Local Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=192661
Attachments:
Description Flags
Patch v1 none

Description David Kilzer (:ddkilzer) 2018-12-17 01:37:13 PST
Running `clang-tidy -header-filter=.* -checks='-*,performance-*,-performance-noexcept-*' ...` on WebCore, WebKit and Tools source files found these unnecessary object copies in for loop variables in trunk revision r239112.

WebCore:

Source/WebCore/platform/graphics/mac/ImageMac.mm:91:15: warning: loop variable is copied but only used as const reference; consider making it a const reference [performance-for-range-copy]
Source/WebCore/Modules/indexeddb/server/MemoryBackingStoreTransaction.cpp:224:15: warning: loop variable is copied but only used as const reference; consider making it a const reference [performance-for-range-copy]
Source/WebCore/Modules/indexeddb/server/MemoryBackingStoreTransaction.cpp:260:19: warning: loop variable is copied but only used as const reference; consider making it a const reference [performance-for-range-copy]
Source/WebCore/Modules/indexeddb/server/MemoryObjectStore.cpp:341:15: warning: loop variable is copied but only used as const reference; consider making it a const reference [performance-for-range-copy]
Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp:534:15: warning: loop variable is copied but only used as const reference; consider making it a const reference [performance-for-range-copy]
Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseTransaction.cpp:424:15: warning: loop variable is copied but only used as const reference; consider making it a const reference [performance-for-range-copy]
Source/WebCore/Modules/indexeddb/shared/IDBDatabaseInfo.cpp:50:15: warning: loop variable is copied but only used as const reference; consider making it a const reference [performance-for-range-copy]
Source/WebCore/Modules/mediasource/SourceBuffer.cpp:742:15: warning: loop variable is copied but only used as const reference; consider making it a const reference [performance-for-range-copy]
Source/WebCore/accessibility/AccessibilityRenderObject.cpp:2526:15: warning: loop variable is copied but only used as const reference; consider making it a const reference [performance-for-range-copy]
Source/WebCore/accessibility/AccessibilityTableRow.cpp:138:15: warning: loop variable is copied but only used as const reference; consider making it a const reference [performance-for-range-copy]
Source/WebCore/animation/KeyframeEffect.cpp:957:23: warning: loop variable is copied but only used as const reference; consider making it a const reference [performance-for-range-copy]
Source/WebCore/crypto/keys/CryptoKeyRSA.cpp:95:15: warning: loop variable is copied but only used as const reference; consider making it a const reference [performance-for-range-copy]
Source/WebCore/crypto/keys/CryptoKeyRSA.cpp:140:15: warning: loop variable is copied but only used as const reference; consider making it a const reference [performance-for-range-copy]
Source/WebCore/css/CSSComputedStyleDeclaration.cpp:1148:15: warning: loop variable is copied but only used as const reference; consider making it a const reference [performance-for-range-copy]
Source/WebCore/dom/DataTransfer.cpp:149:15: warning: loop variable is copied but only used as const reference; consider making it a const reference [performance-for-range-copy]
Source/WebCore/dom/TreeScope.cpp:409:15: warning: loop variable is copied but only used as const reference; consider making it a const reference [performance-for-range-copy]
Source/WebCore/inspector/agents/InspectorTimelineAgent.cpp:137:15: warning: loop variable is copied but only used as const reference; consider making it a const reference [performance-for-range-copy]
Source/WebCore/page/Page.cpp:1266:15: warning: loop variable is copied but only used as const reference; consider making it a const reference [performance-for-range-copy]
Source/WebCore/page/TextIndicator.cpp:255:15: warning: loop variable is copied but only used as const reference; consider making it a const reference [performance-for-range-copy]
Source/WebCore/page/animation/KeyframeAnimation.cpp:98:23: warning: loop variable is copied but only used as const reference; consider making it a const reference [performance-for-range-copy]
Source/WebCore/platform/graphics/DisplayRefreshMonitorManager.cpp:130:15: warning: loop variable is copied but only used as const reference; consider making it a const reference [performance-for-range-copy]
Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp:691:15: warning: loop variable is copied but only used as const reference; consider making it a const reference [performance-for-range-copy]
Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp:2849:19: warning: loop variable is copied but only used as const reference; consider making it a const reference [performance-for-range-copy]
Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp:2885:15: warning: loop variable is copied but only used as const reference; consider making it a const reference [performance-for-range-copy]
Source/WebCore/rendering/HitTestResult.cpp:685:19: warning: loop variable is copied but only used as const reference; consider making it a const reference [performance-for-range-copy]
Source/WebCore/html/track/WebVTTParser.cpp:341:19: warning: loop variable is copied but only used as const reference; consider making it a const reference [performance-for-range-copy]
Source/WebCore/testing/Internals.cpp:1071:15: warning: loop variable is copied but only used as const reference; consider making it a const reference [performance-for-range-copy]

WebKit:

Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm:520:40: warning: loop variable is copied but only used as const reference; consider making it a const reference [performance-for-range-copy]
Source/WebKit/UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:639:15: warning: loop variable is copied but only used as const reference; consider making it a const reference [performance-for-range-copy]
Source/WebKit/UIProcess/ResourceLoadStatisticsMemoryStore.cpp:231:15: warning: loop variable is copied but only used as const reference; consider making it a const reference [performance-for-range-copy]
Source/WebKit/UIProcess/ResourceLoadStatisticsMemoryStore.cpp:880:15: warning: loop variable is copied but only used as const reference; consider making it a const reference [performance-for-range-copy]
Source/WebKit/UIProcess/WebPageProxy.cpp:8138:15: warning: loop variable is copied but only used as const reference; consider making it a const reference [performance-for-range-copy]
Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp:1201:15: warning: loop variable is copied but only used as const reference; consider making it a const reference [performance-for-range-copy]
Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp:1642:15: warning: loop variable is copied but only used as const reference; consider making it a const reference [performance-for-range-copy]
Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp:1749:15: warning: loop variable is copied but only used as const reference; consider making it a const reference [performance-for-range-copy]
Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp:1784:15: warning: loop variable is copied but only used as const reference; consider making it a const reference [performance-for-range-copy]
Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp:1796:19: warning: loop variable is copied but only used as const reference; consider making it a const reference [performance-for-range-copy]
Source/WebKit/UIProcess/Plugins/PluginProcessManager.cpp:126:15: warning: loop variable is copied but only used as const reference; consider making it a const reference [performance-for-range-copy]
Source/WebKit/UIProcess/WebStorage/LocalStorageDatabaseTracker.cpp:88:15: warning: loop variable is copied but only used as const reference; consider making it a const reference [performance-for-range-copy]
Source/WebKit/UIProcess/WebStorage/LocalStorageDatabaseTracker.cpp:121:15: warning: loop variable is copied but only used as const reference; consider making it a const reference [performance-for-range-copy]
Source/WebKit/UIProcess/WebStorage/LocalStorageDatabaseTracker.cpp:140:15: warning: loop variable is copied but only used as const reference; consider making it a const reference [performance-for-range-copy]
Source/WebKit/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:532:15: warning: loop variable is copied but only used as const reference; consider making it a const reference [performance-for-range-copy]
Source/WebKit/WebProcess/WebPage/WebPage.cpp:617:15: warning: loop variable is copied but only used as const reference; consider making it a const reference [performance-for-range-copy]
Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerConnection.cpp:75:15: warning: loop variable is copied but only used as const reference; consider making it a const reference [performance-for-range-copy]

Tools:

Tools/DumpRenderTree/mac/DumpRenderTreePasteboard.mm:243:15: warning: loop variable is copied but only used as const reference; consider making it a const reference [performance-for-range-copy]
Comment 1 Radar WebKit Bug Importer 2018-12-17 01:37:41 PST
<rdar://problem/46771623>
Comment 2 David Kilzer (:ddkilzer) 2018-12-17 01:57:18 PST
Created attachment 357431 [details]
Patch v1
Comment 3 WebKit Commit Bot 2018-12-17 06:22:50 PST
Comment on attachment 357431 [details]
Patch v1

Clearing flags on attachment: 357431

Committed r239266: <https://trac.webkit.org/changeset/239266>
Comment 4 WebKit Commit Bot 2018-12-17 06:22:52 PST
All reviewed patches have been landed.  Closing bug.