[core] Fix performance-noexcept-move-constructor in header files

As reported by clang-tidy-8.
This commit is contained in:
Thiago Marcos P. Santos
2020-03-27 18:30:35 +02:00
parent b49517b737
commit cc8b0e1746
7 changed files with 16 additions and 17 deletions

View File

@@ -102,7 +102,7 @@ public:
new (static_cast<void*>(&storage)) std::decay_t<T>(std::forward<T>(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;

View File

@@ -34,13 +34,9 @@ public:
Image(Size size_, std::unique_ptr<uint8_t[]> 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;

View File

@@ -21,8 +21,8 @@ namespace mbgl {
template <class T>
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> s)
: ptr(std::move(s.ptr)) {}
Immutable(Immutable&&) = default;
Immutable(Immutable&&) noexcept = default;
Immutable(const Immutable&) = default;
template <class S>
@@ -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(); }

View File

@@ -10,9 +10,7 @@ public:
scope->pushDebugGroup(name);
}
DebugGroup(DebugGroup&& rhs) : scope(rhs.scope) {
rhs.scope = nullptr;
}
DebugGroup(DebugGroup&& rhs) noexcept : scope(rhs.scope) { rhs.scope = nullptr; }
~DebugGroup() {
if (scope) {

View File

@@ -22,6 +22,11 @@ public:
indexLength(indexLength_),
sortKey(sortKey_) {}
// FIXME: clang-tidy-8 still complains here and clang-cl
// on Windows gives the error: "exception specification of
// explicitly defaulted move constructor does not match
// the calculated one" when marking this 'noexcept'.
// NOLINTNEXTLINE(performance-noexcept-move-constructor)
Segment(Segment&&) = default;
const std::size_t vertexOffset;

View File

@@ -619,7 +619,7 @@ public:
(void)z; // Workaround for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56958
}
PaintPropertyBinders(PaintPropertyBinders&&) = default;
PaintPropertyBinders(PaintPropertyBinders&&) noexcept = default;
PaintPropertyBinders(const PaintPropertyBinders&) = delete;
void populateVertexVectors(const GeometryTileFeature& feature,

View File

@@ -33,7 +33,7 @@ struct Bound {
currentPoint = rhs.currentPoint;
winding = rhs.winding;
}
Bound& operator=(Bound&& rhs) {
Bound& operator=(Bound&& rhs) noexcept {
points = std::move(rhs.points);
currentPoint = rhs.currentPoint;
winding = rhs.winding;