Commit cb784ec3 authored by Kenton Varda's avatar Kenton Varda

Add noexcept to various move constructors.

parent d2689f41
...@@ -1608,13 +1608,14 @@ DynamicValue::Reader DynamicValue::Builder::asReader() const { ...@@ -1608,13 +1608,14 @@ DynamicValue::Reader DynamicValue::Builder::asReader() const {
return Reader(); return Reader();
} }
DynamicValue::Pipeline::Pipeline(Pipeline&& other): type(other.type) { DynamicValue::Pipeline::Pipeline(Pipeline&& other) noexcept: type(other.type) {
switch (type) { switch (type) {
case UNKNOWN: break; case UNKNOWN: break;
case STRUCT: kj::ctor(structValue, kj::mv(other.structValue)); break; case STRUCT: kj::ctor(structValue, kj::mv(other.structValue)); break;
case CAPABILITY: kj::ctor(capabilityValue, kj::mv(other.capabilityValue)); break; case CAPABILITY: kj::ctor(capabilityValue, kj::mv(other.capabilityValue)); break;
default: default:
KJ_FAIL_ASSERT("Unexpected pipeline type.", (uint)type) { type = UNKNOWN; break; } KJ_LOG(ERROR, "Unexpected pipeline type.", (uint)type);
type = UNKNOWN;
break; break;
} }
} }
......
...@@ -743,7 +743,7 @@ public: ...@@ -743,7 +743,7 @@ public:
inline Pipeline(DynamicStruct::Pipeline&& value); inline Pipeline(DynamicStruct::Pipeline&& value);
inline Pipeline(DynamicCapability::Client&& value); inline Pipeline(DynamicCapability::Client&& value);
Pipeline(Pipeline&& other); Pipeline(Pipeline&& other) noexcept;
Pipeline& operator=(Pipeline&& other); Pipeline& operator=(Pipeline&& other);
~Pipeline() noexcept(false); ~Pipeline() noexcept(false);
......
...@@ -706,7 +706,7 @@ class OrphanBuilder { ...@@ -706,7 +706,7 @@ class OrphanBuilder {
public: public:
inline OrphanBuilder(): segment(nullptr), location(nullptr) { memset(&tag, 0, sizeof(tag)); } inline OrphanBuilder(): segment(nullptr), location(nullptr) { memset(&tag, 0, sizeof(tag)); }
OrphanBuilder(const OrphanBuilder& other) = delete; OrphanBuilder(const OrphanBuilder& other) = delete;
inline OrphanBuilder(OrphanBuilder&& other); inline OrphanBuilder(OrphanBuilder&& other) noexcept;
inline ~OrphanBuilder() noexcept(false); inline ~OrphanBuilder() noexcept(false);
static OrphanBuilder initStruct(BuilderArena* arena, StructSize size); static OrphanBuilder initStruct(BuilderArena* arena, StructSize size);
...@@ -1017,7 +1017,7 @@ inline PointerReader ListReader::getPointerElement(ElementCount index) const { ...@@ -1017,7 +1017,7 @@ inline PointerReader ListReader::getPointerElement(ElementCount index) const {
// ------------------------------------------------------------------- // -------------------------------------------------------------------
inline OrphanBuilder::OrphanBuilder(OrphanBuilder&& other) inline OrphanBuilder::OrphanBuilder(OrphanBuilder&& other) noexcept
: segment(other.segment), location(other.location) { : segment(other.segment), location(other.location) {
memcpy(&tag, &other.tag, sizeof(tag)); // Needs memcpy to comply with aliasing rules. memcpy(&tag, &other.tag, sizeof(tag)); // Needs memcpy to comply with aliasing rules.
other.segment = nullptr; other.segment = nullptr;
......
...@@ -1982,7 +1982,7 @@ private: ...@@ -1982,7 +1982,7 @@ private:
RpcSystemBase::RpcSystemBase(VatNetworkBase& network, kj::Maybe<SturdyRefRestorerBase&> restorer, RpcSystemBase::RpcSystemBase(VatNetworkBase& network, kj::Maybe<SturdyRefRestorerBase&> restorer,
const kj::EventLoop& eventLoop) const kj::EventLoop& eventLoop)
: impl(kj::heap<Impl>(network, restorer, eventLoop)) {} : impl(kj::heap<Impl>(network, restorer, eventLoop)) {}
RpcSystemBase::RpcSystemBase(RpcSystemBase&& other) = default; RpcSystemBase::RpcSystemBase(RpcSystemBase&& other) noexcept = default;
RpcSystemBase::~RpcSystemBase() noexcept(false) {} RpcSystemBase::~RpcSystemBase() noexcept(false) {}
Capability::Client RpcSystemBase::baseRestore( Capability::Client RpcSystemBase::baseRestore(
......
...@@ -82,7 +82,7 @@ class RpcSystemBase { ...@@ -82,7 +82,7 @@ class RpcSystemBase {
public: public:
RpcSystemBase(VatNetworkBase& network, kj::Maybe<SturdyRefRestorerBase&> restorer, RpcSystemBase(VatNetworkBase& network, kj::Maybe<SturdyRefRestorerBase&> restorer,
const kj::EventLoop& eventLoop); const kj::EventLoop& eventLoop);
RpcSystemBase(RpcSystemBase&& other); RpcSystemBase(RpcSystemBase&& other) noexcept;
~RpcSystemBase() noexcept(false); ~RpcSystemBase() noexcept(false);
private: private:
......
...@@ -236,7 +236,7 @@ public: ...@@ -236,7 +236,7 @@ public:
inline AutoCloseFd(): fd(-1) {} inline AutoCloseFd(): fd(-1) {}
inline AutoCloseFd(decltype(nullptr)): fd(-1) {} inline AutoCloseFd(decltype(nullptr)): fd(-1) {}
inline explicit AutoCloseFd(int fd): fd(fd) {} inline explicit AutoCloseFd(int fd): fd(fd) {}
inline AutoCloseFd(AutoCloseFd&& other): fd(other.fd) { other.fd = -1; } inline AutoCloseFd(AutoCloseFd&& other) noexcept: fd(other.fd) { other.fd = -1; }
KJ_DISALLOW_COPY(AutoCloseFd); KJ_DISALLOW_COPY(AutoCloseFd);
~AutoCloseFd() noexcept(false); ~AutoCloseFd() noexcept(false);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment