From 56569acb6daa4d487a3d3eccce5784028873651c Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Thu, 30 Nov 2017 15:17:41 +0000 Subject: Run clang-tidy modernize-use-equals-{delete,default} on //third_party/pdfium See the bugs and cxx post for justification and details: https://groups.google.com/a/chromium.org/forum/#!topic/cxx/RkOHzIK6Tq8 This change was done using clang-tidy as described here: https://chromium.googlesource.com/chromium/src/+/lkcr/docs/clang_tidy.md In some cases the the tool leaves behind a string of commas where it replaced a member initializer list (https://bugs.llvm.org/show_bug.cgi?id=35051). They were cleaned up with: git diff --name-only | \ xargs sed -E -i 's/(^\s*|\)\s*):[ ,]*= default/\1 = default/' Bug: chromium:778959, chromium:778957 Change-Id: I23e60d3d6c8bc9e8574d425710a0441cb5510d6b Reviewed-on: https://pdfium-review.googlesource.com/19970 Reviewed-by: Lei Zhang Commit-Queue: dsinclair --- core/fxcrt/fx_coordinates.h | 8 +------- core/fxcrt/observable.h | 2 +- core/fxcrt/retain_ptr.h | 4 ++-- core/fxcrt/unowned_ptr.h | 2 +- core/fxcrt/weak_ptr.h | 4 ++-- core/fxge/fx_font.h | 2 +- core/fxge/ifx_systemfontinfo.h | 2 +- third_party/base/numerics/safe_math.h | 2 +- third_party/base/optional.h | 2 +- xfa/fgas/font/cfgas_fontmgr.h | 2 +- 10 files changed, 12 insertions(+), 18 deletions(-) diff --git a/core/fxcrt/fx_coordinates.h b/core/fxcrt/fx_coordinates.h index 0c0ccb065f..5840a14815 100644 --- a/core/fxcrt/fx_coordinates.h +++ b/core/fxcrt/fx_coordinates.h @@ -590,13 +590,7 @@ class CFX_Matrix { explicit CFX_Matrix(const float n[6]) : a(n[0]), b(n[1]), c(n[2]), d(n[3]), e(n[4]), f(n[5]) {} - CFX_Matrix(const CFX_Matrix& other) - : a(other.a), - b(other.b), - c(other.c), - d(other.d), - e(other.e), - f(other.f) {} + CFX_Matrix(const CFX_Matrix& other) = default; CFX_Matrix(float a1, float b1, float c1, float d1, float e1, float f1) : a(a1), b(b1), c(c1), d(d1), e(e1), f(f1) {} diff --git a/core/fxcrt/observable.h b/core/fxcrt/observable.h index 659f8ad5b9..2013b75be9 100644 --- a/core/fxcrt/observable.h +++ b/core/fxcrt/observable.h @@ -55,7 +55,7 @@ class Observable { T* m_pObservable; }; - Observable() {} + Observable() = default; Observable(const Observable& that) = delete; ~Observable() { NotifyObservedPtrs(); } void AddObservedPtr(ObservedPtr* pObservedPtr) { diff --git a/core/fxcrt/retain_ptr.h b/core/fxcrt/retain_ptr.h index 481bfbba56..e14b1ef5dc 100644 --- a/core/fxcrt/retain_ptr.h +++ b/core/fxcrt/retain_ptr.h @@ -28,7 +28,7 @@ class RetainPtr { m_pObj->Retain(); } - RetainPtr() {} + RetainPtr() = default; RetainPtr(const RetainPtr& that) : RetainPtr(that.Get()) {} RetainPtr(RetainPtr&& that) noexcept { Swap(that); } @@ -89,7 +89,7 @@ class Retainable { bool HasOneRef() const { return m_nRefCount == 1; } protected: - virtual ~Retainable() {} + virtual ~Retainable() = default; private: template diff --git a/core/fxcrt/unowned_ptr.h b/core/fxcrt/unowned_ptr.h index 012af3ddf7..f9753cde37 100644 --- a/core/fxcrt/unowned_ptr.h +++ b/core/fxcrt/unowned_ptr.h @@ -39,7 +39,7 @@ namespace fxcrt { template class UnownedPtr { public: - UnownedPtr() {} + UnownedPtr() = default; UnownedPtr(const UnownedPtr& that) : UnownedPtr(that.Get()) {} template diff --git a/core/fxcrt/weak_ptr.h b/core/fxcrt/weak_ptr.h index eb8523bd3d..3ec3942c5f 100644 --- a/core/fxcrt/weak_ptr.h +++ b/core/fxcrt/weak_ptr.h @@ -19,7 +19,7 @@ namespace fxcrt { template > class WeakPtr { public: - WeakPtr() {} + WeakPtr() = default; WeakPtr(const WeakPtr& that) : m_pHandle(that.m_pHandle) {} WeakPtr(WeakPtr&& that) noexcept { Swap(that); } explicit WeakPtr(std::unique_ptr pObj) @@ -76,7 +76,7 @@ class WeakPtr { bool HasOneRef() const { return m_nCount == 1; } private: - ~Handle() {} + ~Handle() = default; intptr_t m_nCount; std::unique_ptr m_pObj; diff --git a/core/fxge/fx_font.h b/core/fxge/fx_font.h index f2550d0488..c617376757 100644 --- a/core/fxge/fx_font.h +++ b/core/fxge/fx_font.h @@ -81,7 +81,7 @@ class CFX_GlyphBitmap { inline CFX_GlyphBitmap::CFX_GlyphBitmap() : m_pBitmap(pdfium::MakeRetain()) {} -inline CFX_GlyphBitmap::~CFX_GlyphBitmap() {} +inline CFX_GlyphBitmap::~CFX_GlyphBitmap() = default; class FXTEXT_GLYPHPOS { public: diff --git a/core/fxge/ifx_systemfontinfo.h b/core/fxge/ifx_systemfontinfo.h index b6d6626552..391baa2cdd 100644 --- a/core/fxge/ifx_systemfontinfo.h +++ b/core/fxge/ifx_systemfontinfo.h @@ -20,7 +20,7 @@ class IFX_SystemFontInfo { static std::unique_ptr CreateDefault( const char** pUserPaths); - virtual ~IFX_SystemFontInfo() {} + virtual ~IFX_SystemFontInfo() = default; virtual bool EnumFontList(CFX_FontMapper* pMapper) = 0; virtual void* MapFont(int weight, diff --git a/third_party/base/numerics/safe_math.h b/third_party/base/numerics/safe_math.h index 8574fdd595..f24ba024eb 100644 --- a/third_party/base/numerics/safe_math.h +++ b/third_party/base/numerics/safe_math.h @@ -100,7 +100,7 @@ class CheckedNumeric { public: using type = T; - constexpr CheckedNumeric() {} + constexpr CheckedNumeric() = default; // Copy constructor. template diff --git a/third_party/base/optional.h b/third_party/base/optional.h index 4cf91e9b2b..ae25724e73 100644 --- a/third_party/base/optional.h +++ b/third_party/base/optional.h @@ -120,7 +120,7 @@ class Optional { public: using value_type = T; - constexpr Optional() {} + constexpr Optional() = default; constexpr Optional(nullopt_t) {} diff --git a/xfa/fgas/font/cfgas_fontmgr.h b/xfa/fgas/font/cfgas_fontmgr.h index 42171de804..94e446c077 100644 --- a/xfa/fgas/font/cfgas_fontmgr.h +++ b/xfa/fgas/font/cfgas_fontmgr.h @@ -108,7 +108,7 @@ class CFX_FontSourceEnum_File { private: struct HandleParentPath { - HandleParentPath() {} + HandleParentPath() = default; HandleParentPath(const HandleParentPath& x) { pFileHandle = x.pFileHandle; bsParentPath = x.bsParentPath; -- cgit v1.2.3