Bug 1317954 - Replace default bodies of special member functions with = default; in xpcom/. draft
authorAndi-Bogdan Postelnicu <bpostelnicu@mozilla.com>
Wed, 16 Nov 2016 14:25:31 +0200
changeset 441043 6ae98db03f15a9cd72f1f399282e381a05e4f488
parent 441042 97ada36249a8ec47a975a685b04cd66f7505866f
child 441044 fb7a697c952ef7e745e8e4369c6f56079e54937f
push id36341
push userbmo:bpostelnicu@mozilla.com
push dateFri, 18 Nov 2016 09:38:52 +0000
bugs1317954
milestone53.0a1
Bug 1317954 - Replace default bodies of special member functions with = default; in xpcom/. MozReview-Commit-ID: 5GXchMr0VvV
xpcom/build/FileLocation.cpp
xpcom/components/nsCategoryManager.cpp
xpcom/glue/nsArrayEnumerator.cpp
xpcom/glue/nsCategoryCache.cpp
xpcom/glue/nsEnumeratorUtils.cpp
xpcom/tests/gtest/TestHashtables.cpp
xpcom/tests/gtest/TestNsRefPtr.cpp
--- a/xpcom/build/FileLocation.cpp
+++ b/xpcom/build/FileLocation.cpp
@@ -5,23 +5,19 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "FileLocation.h"
 #include "nsZipArchive.h"
 #include "nsURLHelper.h"
 
 namespace mozilla {
 
-FileLocation::FileLocation()
-{
-}
+FileLocation::FileLocation() = default;
 
-FileLocation::~FileLocation()
-{
-}
+FileLocation::~FileLocation() = default;
 
 FileLocation::FileLocation(nsIFile* aFile)
 {
   Init(aFile);
 }
 
 FileLocation::FileLocation(nsIFile* aFile, const char* aPath)
 {
--- a/xpcom/components/nsCategoryManager.cpp
+++ b/xpcom/components/nsCategoryManager.cpp
@@ -201,19 +201,17 @@ EntryEnumerator::Create(nsTHashtable<Cat
 //
 
 CategoryNode*
 CategoryNode::Create(PLArenaPool* aArena)
 {
   return new (aArena) CategoryNode();
 }
 
-CategoryNode::~CategoryNode()
-{
-}
+CategoryNode::~CategoryNode() = default;
 
 void*
 CategoryNode::operator new(size_t aSize, PLArenaPool* aArena)
 {
   void* p;
   PL_ARENA_ALLOCATE(p, aArena, aSize);
   return p;
 }
--- a/xpcom/glue/nsArrayEnumerator.cpp
+++ b/xpcom/glue/nsArrayEnumerator.cpp
@@ -27,17 +27,17 @@ public:
   // nsSimpleArrayEnumerator methods
   explicit nsSimpleArrayEnumerator(nsIArray* aValueArray)
     : mValueArray(aValueArray)
     , mIndex(0)
   {
   }
 
 private:
-  ~nsSimpleArrayEnumerator() {}
+  ~nsSimpleArrayEnumerator() = default;
 
 protected:
   nsCOMPtr<nsIArray> mValueArray;
   uint32_t mIndex;
 };
 
 NS_IMPL_ISUPPORTS(nsSimpleArrayEnumerator, nsISimpleEnumerator)
 
--- a/xpcom/glue/nsCategoryCache.cpp
+++ b/xpcom/glue/nsCategoryCache.cpp
@@ -57,19 +57,17 @@ nsCategoryObserver::nsCategoryObserver(c
   if (serv) {
     serv->AddObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID, false);
     serv->AddObserver(this, NS_XPCOM_CATEGORY_ENTRY_ADDED_OBSERVER_ID, false);
     serv->AddObserver(this, NS_XPCOM_CATEGORY_ENTRY_REMOVED_OBSERVER_ID, false);
     serv->AddObserver(this, NS_XPCOM_CATEGORY_CLEARED_OBSERVER_ID, false);
   }
 }
 
-nsCategoryObserver::~nsCategoryObserver()
-{
-}
+nsCategoryObserver::~nsCategoryObserver() = default;
 
 NS_IMPL_ISUPPORTS(nsCategoryObserver, nsIObserver)
 
 void
 nsCategoryObserver::ListenerDied()
 {
   RemoveObservers();
 }
--- a/xpcom/glue/nsEnumeratorUtils.cpp
+++ b/xpcom/glue/nsEnumeratorUtils.cpp
@@ -117,19 +117,17 @@ protected:
 };
 
 nsSingletonEnumerator::nsSingletonEnumerator(nsISupports* aValue)
   : mValue(aValue)
 {
   mConsumed = (mValue ? false : true);
 }
 
-nsSingletonEnumerator::~nsSingletonEnumerator()
-{
-}
+nsSingletonEnumerator::~nsSingletonEnumerator() = default;
 
 NS_IMPL_ISUPPORTS(nsSingletonEnumerator, nsISimpleEnumerator)
 
 NS_IMETHODIMP
 nsSingletonEnumerator::HasMoreElements(bool* aResult)
 {
   NS_PRECONDITION(aResult != 0, "null ptr");
   if (!aResult) {
@@ -196,19 +194,17 @@ nsUnionEnumerator::nsUnionEnumerator(nsI
                                      nsISimpleEnumerator* aSecondEnumerator)
   : mFirstEnumerator(aFirstEnumerator)
   , mSecondEnumerator(aSecondEnumerator)
   , mConsumed(false)
   , mAtSecond(false)
 {
 }
 
-nsUnionEnumerator::~nsUnionEnumerator()
-{
-}
+nsUnionEnumerator::~nsUnionEnumerator() = default;
 
 NS_IMPL_ISUPPORTS(nsUnionEnumerator, nsISimpleEnumerator)
 
 NS_IMETHODIMP
 nsUnionEnumerator::HasMoreElements(bool* aResult)
 {
   NS_PRECONDITION(aResult != 0, "null ptr");
   if (!aResult) {
--- a/xpcom/tests/gtest/TestHashtables.cpp
+++ b/xpcom/tests/gtest/TestHashtables.cpp
@@ -22,19 +22,17 @@ namespace TestHashtables {
 class TestUniChar // for nsClassHashtable
 {
 public:
   explicit TestUniChar(uint32_t aWord)
   {
     mWord = aWord;
   }
 
-  ~TestUniChar()
-  {
-  }
+  ~TestUniChar() = default;
 
   uint32_t GetChar() const { return mWord; }
 
 private:
   uint32_t mWord;
 };
 
 struct EntityNode {
@@ -66,17 +64,17 @@ EntityNode gEntities[] = {
 class EntityToUnicodeEntry : public PLDHashEntryHdr
 {
 public:
   typedef const char* KeyType;
   typedef const char* KeyTypePointer;
 
   explicit EntityToUnicodeEntry(const char* aKey) { mNode = nullptr; }
   EntityToUnicodeEntry(const EntityToUnicodeEntry& aEntry) { mNode = aEntry.mNode; }
-  ~EntityToUnicodeEntry() { }
+  ~EntityToUnicodeEntry() = default;
 
   bool KeyEquals(const char* aEntity) const { return !strcmp(mNode->mStr, aEntity); }
   static const char* KeyToPointer(const char* aEntity) { return aEntity; }
   static PLDHashNumber HashKey(const char* aEntity) { return mozilla::HashString(aEntity); }
   enum { ALLOW_MEMMOVE = true };
 
   const EntityNode* mNode;
 };
--- a/xpcom/tests/gtest/TestNsRefPtr.cpp
+++ b/xpcom/tests/gtest/TestNsRefPtr.cpp
@@ -414,19 +414,17 @@ NS_METHOD_(MozExternalRefCountType) Rele
 protected:                                                                  \
 mutable ::mozilla::ThreadSafeAutoRefCnt mRefCnt;                            \
 public:
 
 class ObjectForConstPtr
 {
   private:
     // Reference-counted classes cannot have public destructors.
-    ~ObjectForConstPtr()
-    {
-    }
+    ~ObjectForConstPtr() = default;
   public:
     NS_INLINE_DECL_THREADSAFE_MUTABLE_REFCOUNTING(ObjectForConstPtr)
       void ConstMemberFunction( int aArg1, int* aArgPtr, int& aArgRef ) const
       {
       }
 };
 #undef NS_INLINE_DECL_THREADSAFE_MUTABLE_REFCOUNTING