From cc8b0e1746cfc6fdc99582fdb09e7624b14d9d0e Mon Sep 17 00:00:00 2001 From: "Thiago Marcos P. Santos" Date: Fri, 27 Mar 2020 18:30:35 +0200 Subject: [core] Fix performance-noexcept-move-constructor in header files As reported by clang-tidy-8. --- include/mbgl/style/conversion_impl.hpp | 4 ++-- include/mbgl/util/image.hpp | 8 ++------ include/mbgl/util/immutable.hpp | 8 ++++---- 3 files changed, 8 insertions(+), 12 deletions(-) (limited to 'include') diff --git a/include/mbgl/style/conversion_impl.hpp b/include/mbgl/style/conversion_impl.hpp index 1a2d13d7e2..11d3bae9ce 100644 --- a/include/mbgl/style/conversion_impl.hpp +++ b/include/mbgl/style/conversion_impl.hpp @@ -102,7 +102,7 @@ public: new (static_cast(&storage)) std::decay_t(std::forward(value)); } - Convertible(Convertible&& v) : vtable(v.vtable) { + Convertible(Convertible&& v) noexcept : vtable(v.vtable) { // NOLINTNEXTLINE(performance-move-const-arg) vtable->move(std::move(v.storage), storage); } @@ -111,7 +111,7 @@ public: vtable->destroy(storage); } - Convertible& operator=(Convertible&& v) { + Convertible& operator=(Convertible&& v) noexcept { if (this != &v) { vtable->destroy(storage); vtable = v.vtable; diff --git a/include/mbgl/util/image.hpp b/include/mbgl/util/image.hpp index 75a49550b1..e0ee694434 100644 --- a/include/mbgl/util/image.hpp +++ b/include/mbgl/util/image.hpp @@ -34,13 +34,9 @@ public: Image(Size size_, std::unique_ptr data_) : size(size_), data(std::move(data_)) {} - Image(Image&& o) - : size(o.size), - data(std::move(o.data)) { - o.size.width = o.size.height = 0; - } + Image(Image&& o) noexcept : size(o.size), data(std::move(o.data)) { o.size.width = o.size.height = 0; } - Image& operator=(Image&& o) { + Image& operator=(Image&& o) noexcept { size = o.size; data = std::move(o.data); o.size.width = o.size.height = 0; diff --git a/include/mbgl/util/immutable.hpp b/include/mbgl/util/immutable.hpp index bc6a0467ae..fbd3ac9b34 100644 --- a/include/mbgl/util/immutable.hpp +++ b/include/mbgl/util/immutable.hpp @@ -21,8 +21,8 @@ namespace mbgl { template class Mutable { public: - Mutable(Mutable&&) = default; - Mutable& operator=(Mutable&&) = default; + Mutable(Mutable&&) noexcept = default; + Mutable& operator=(Mutable&&) noexcept = default; Mutable(const Mutable&) = delete; Mutable& operator=(const Mutable&) = delete; @@ -74,7 +74,7 @@ public: Immutable(Immutable s) : ptr(std::move(s.ptr)) {} - Immutable(Immutable&&) = default; + Immutable(Immutable&&) noexcept = default; Immutable(const Immutable&) = default; template @@ -83,7 +83,7 @@ public: return *this; } - Immutable& operator=(Immutable&&) = default; + Immutable& operator=(Immutable&&) noexcept = default; Immutable& operator=(const Immutable&) = default; const T* get() const { return ptr.get(); } -- cgit v1.2.1