clang-tidy: Fix unnecessary copy of objects for operator==() methods
authorddkilzer@apple.com <ddkilzer@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 14 Dec 2018 23:23:10 +0000 (23:23 +0000)
committerddkilzer@apple.com <ddkilzer@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 14 Dec 2018 23:23:10 +0000 (23:23 +0000)
<https://webkit.org/b/192712>
<rdar://problem/46739332>

Reviewed by Andy Estes.

Source/JavaScriptCore:

* b3/air/AirAllocateRegistersByGraphColoring.cpp:
(JSC::B3::Air::(anonymous namespace)::AbstractColoringAllocator::InterferenceEdge::operator==):
- Change argument from const to const reference to avoid a copy.

Source/WebCore:

* contentextensions/HashableActionList.h:
(WebCore::ContentExtensions::HashableActionList::operator== const):
(WebCore::ContentExtensions::HashableActionList::operator!= const):
* platform/network/FormData.h:
(WebCore::FormDataElement::EncodedFileData::operator== const):
(WebCore::FormDataElement::EncodedBlobData::operator== const):
- Change arguments from const to const reference to avoid
  copies.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239237 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/b3/air/AirAllocateRegistersByGraphColoring.cpp
Source/WebCore/ChangeLog
Source/WebCore/contentextensions/HashableActionList.h
Source/WebCore/platform/network/FormData.h

index b02feb8..beba6c0 100644 (file)
@@ -1,3 +1,15 @@
+2018-12-14  David Kilzer  <ddkilzer@apple.com>
+
+        clang-tidy: Fix unnecessary copy of objects for operator==() methods
+        <https://webkit.org/b/192712>
+        <rdar://problem/46739332>
+
+        Reviewed by Andy Estes.
+
+        * b3/air/AirAllocateRegistersByGraphColoring.cpp:
+        (JSC::B3::Air::(anonymous namespace)::AbstractColoringAllocator::InterferenceEdge::operator==):
+        - Change argument from const to const reference to avoid a copy.
+
 2018-12-14  Commit Queue  <commit-queue@webkit.org>
 
         Unreviewed, rolling out r239153, r239154, and r239155.
index 26acffc..c282d50 100644 (file)
@@ -466,7 +466,7 @@ protected:
             return m_value & 0xffffffff;
         }
 
-        bool operator==(const InterferenceEdge other) const
+        bool operator==(const InterferenceEdge& other) const
         {
             return m_value == other.m_value;
         }
index ae8af07..cf86b8a 100644 (file)
@@ -1,3 +1,20 @@
+2018-12-14  David Kilzer  <ddkilzer@apple.com>
+
+        clang-tidy: Fix unnecessary copy of objects for operator==() methods
+        <https://webkit.org/b/192712>
+        <rdar://problem/46739332>
+
+        Reviewed by Andy Estes.
+
+        * contentextensions/HashableActionList.h:
+        (WebCore::ContentExtensions::HashableActionList::operator== const):
+        (WebCore::ContentExtensions::HashableActionList::operator!= const):
+        * platform/network/FormData.h:
+        (WebCore::FormDataElement::EncodedFileData::operator== const):
+        (WebCore::FormDataElement::EncodedBlobData::operator== const):
+        - Change arguments from const to const reference to avoid
+          copies.
+
 2018-12-14  Jer Noble  <jer.noble@apple.com>
 
         CRASH in CDMInstanceSessionFairPlayStreamingAVFObjC::closeSession(WTF::String const&, WTF::Function<void ()>&&)
index 1039c1d..8875703 100644 (file)
@@ -53,12 +53,12 @@ struct HashableActionList {
     bool isEmptyValue() const { return state == Empty; }
     bool isDeletedValue() const { return state == Deleted; }
 
-    bool operator==(const HashableActionList other) const
+    bool operator==(const HashableActionList& other) const
     {
         return state == other.state && actions == other.actions;
     }
 
-    bool operator!=(const HashableActionList other) const
+    bool operator!=(const HashableActionList& other) const
     {
         return !(*this == other);
     }
index 59f55f8..d7c1e5f 100644 (file)
@@ -85,7 +85,7 @@ struct FormDataElement {
             return { filename.isolatedCopy(), fileStart, fileLength, expectedFileModificationTime, generatedFilename.isolatedCopy(), shouldGenerateFile, ownsGeneratedFile };
         }
         
-        bool operator==(const EncodedFileData other) const
+        bool operator==(const EncodedFileData& other) const
         {
             return filename == other.filename
                 && fileStart == other.fileStart
@@ -149,7 +149,7 @@ struct FormDataElement {
     struct EncodedBlobData {
         URL url;
 
-        bool operator==(const EncodedBlobData other) const
+        bool operator==(const EncodedBlobData& other) const
         {
             return url == other.url;
         }