diff options
author | Tom Tromey <tom@tromey.com> | 2021-05-04 15:26:58 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2021-05-05 00:06:16 -0600 |
commit | c10a3b13fec850effc68c8b4f8861158f7fa7fed (patch) | |
tree | 28e91c7827d116acb2a00a6eae6a5bcf1a0c143c /libcc1/rpc.hh | |
parent | 41f4381648feb1e5eaa27d108b21e2b95ad3739d (diff) | |
download | gcc-c10a3b13fec850effc68c8b4f8861158f7fa7fed.zip gcc-c10a3b13fec850effc68c8b4f8861158f7fa7fed.tar.gz gcc-c10a3b13fec850effc68c8b4f8861158f7fa7fed.tar.bz2 |
libcc1: delete copy constructor and assignment operators
Change libcc1 to use "= delete" for the copy constructor and
assignment operator, rather than the old approach of private methods
that are nowhere defined.
libcc1
* rpc.hh (argument_wrapper): Use delete for copy constructor.
* connection.hh (class connection): Use delete for copy
constructor.
* callbacks.hh (class callbacks): Use delete for copy constructor.
Diffstat (limited to 'libcc1/rpc.hh')
-rw-r--r-- | libcc1/rpc.hh | 42 |
1 files changed, 18 insertions, 24 deletions
diff --git a/libcc1/rpc.hh b/libcc1/rpc.hh index a8e3357..429aeb3 100644 --- a/libcc1/rpc.hh +++ b/libcc1/rpc.hh @@ -39,6 +39,9 @@ namespace cc1_plugin argument_wrapper () { } ~argument_wrapper () { } + argument_wrapper (const argument_wrapper &) = delete; + argument_wrapper &operator= (const argument_wrapper &) = delete; + operator T () const { return m_object; } status unmarshall (connection *conn) @@ -49,10 +52,6 @@ namespace cc1_plugin private: T m_object; - - // No copying or assignment allowed. - argument_wrapper (const argument_wrapper &); - argument_wrapper &operator= (const argument_wrapper &); }; // Specialization for any kind of pointer. This is declared but not @@ -72,6 +71,9 @@ namespace cc1_plugin delete[] m_object; } + argument_wrapper (const argument_wrapper &) = delete; + argument_wrapper &operator= (const argument_wrapper &) = delete; + operator const char * () const { return m_object; @@ -85,10 +87,6 @@ namespace cc1_plugin private: char *m_object; - - // No copying or assignment allowed. - argument_wrapper (const argument_wrapper &); - argument_wrapper &operator= (const argument_wrapper &); }; // Specialization for gcc_type_array. @@ -106,6 +104,9 @@ namespace cc1_plugin delete m_object; } + argument_wrapper (const argument_wrapper &) = delete; + argument_wrapper &operator= (const argument_wrapper &) = delete; + operator const gcc_type_array * () const { return m_object; @@ -119,10 +120,6 @@ namespace cc1_plugin private: gcc_type_array *m_object; - - // No copying or assignment allowed. - argument_wrapper (const argument_wrapper &); - argument_wrapper &operator= (const argument_wrapper &); }; #ifdef GCC_CP_INTERFACE_H @@ -144,6 +141,9 @@ namespace cc1_plugin delete m_object; } + argument_wrapper (const argument_wrapper &) = delete; + argument_wrapper &operator= (const argument_wrapper &) = delete; + operator const gcc_vbase_array * () const { return m_object; @@ -157,10 +157,6 @@ namespace cc1_plugin private: gcc_vbase_array *m_object; - - // No copying or assignment allowed. - argument_wrapper (const argument_wrapper &); - argument_wrapper &operator= (const argument_wrapper &); }; // Specialization for gcc_cp_template_args. @@ -181,6 +177,9 @@ namespace cc1_plugin delete m_object; } + argument_wrapper (const argument_wrapper &) = delete; + argument_wrapper &operator= (const argument_wrapper &) = delete; + operator const gcc_cp_template_args * () const { return m_object; @@ -194,10 +193,6 @@ namespace cc1_plugin private: gcc_cp_template_args *m_object; - - // No copying or assignment allowed. - argument_wrapper (const argument_wrapper &); - argument_wrapper &operator= (const argument_wrapper &); }; // Specialization for gcc_cp_function_args. @@ -217,6 +212,9 @@ namespace cc1_plugin delete m_object; } + argument_wrapper (const argument_wrapper &) = delete; + argument_wrapper &operator= (const argument_wrapper &) = delete; + operator const gcc_cp_function_args * () const { return m_object; @@ -230,10 +228,6 @@ namespace cc1_plugin private: gcc_cp_function_args *m_object; - - // No copying or assignment allowed. - argument_wrapper (const argument_wrapper &); - argument_wrapper &operator= (const argument_wrapper &); }; #endif /* GCC_CP_INTERFACE_H */ |