diff options
author | Alexandr Ilin <alexilin@chromium.org> | 2018-07-12 06:47:30 +0900 |
---|---|---|
committer | Qijiang Fan <fqj@google.com> | 2020-06-05 09:56:59 +0900 |
commit | 401220c9516330b392669c29632199927b78835f (patch) | |
tree | f11eb585abe8ca886c89fd2d71104e3228e8f9d5 /ipc | |
parent | 01c1d139f7ed7336590b49d7b21959cbff31b59b (diff) | |
download | libchrome-401220c9516330b392669c29632199927b78835f.tar.gz |
ipc: Add defaulted move ctor/assignment to ipc structs
This CL provides explicitly defaulted definitions to the
IPC_STRUCT_BEGIN_WITH_PARENT macros for the special member functions:
- copy constructor
- copy assignment operator
- move constructor
- move assignment operator
The goal of this CL is to add the support of move operations to macros
generated structs. Move operations aren't implicitly declared for the structs
because a user-declared destructor is present.
It's important to make these functions explicitly defaulted on their first
declaration to avoid them being user-provided. This allows the compiler to
define them as deleted per 8.4.2.5 of the C++14 standard.
Change-Id: Ie949fa6a9c730a1069f1e75b2c6a8d9981d69431
Reviewed-on: https://chromium-review.googlesource.com/1133260
Reviewed-by: Ken Rockot <rockot@chromium.org>
Commit-Queue: Alexandr Ilin <alexilin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#574349}
CrOS-Libchrome-Original-Commit: e6cb9f56395acad6eb72628061f9cb609ce4030f
Diffstat (limited to 'ipc')
-rw-r--r-- | ipc/ipc_message_macros.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/ipc/ipc_message_macros.h b/ipc/ipc_message_macros.h index 2cab6fb258..b9e5b91679 100644 --- a/ipc/ipc_message_macros.h +++ b/ipc/ipc_message_macros.h @@ -218,6 +218,10 @@ IPC_STRUCT_TRAITS_END() \ struct IPC_MESSAGE_EXPORT struct_name : parent { \ struct_name(); \ + struct_name(const struct_name&) = default; \ + struct_name(struct_name&&) = default; \ + struct_name& operator=(const struct_name&) = default; \ + struct_name& operator=(struct_name&&) = default; \ ~struct_name(); // Optional variadic parameters specify the default value for this struct // member. They are passed through to the constructor for |type|. |