diff options
Diffstat (limited to 'libcc1/rpc.hh')
-rw-r--r-- | libcc1/rpc.hh | 113 |
1 files changed, 112 insertions, 1 deletions
diff --git a/libcc1/rpc.hh b/libcc1/rpc.hh index 01b793b..56a07c2 100644 --- a/libcc1/rpc.hh +++ b/libcc1/rpc.hh @@ -21,7 +21,6 @@ along with GCC; see the file COPYING3. If not see #define CC1_PLUGIN_RPC_HH #include "status.hh" -#include "marshall.hh" #include "connection.hh" namespace cc1_plugin @@ -126,6 +125,118 @@ namespace cc1_plugin argument_wrapper &operator= (const argument_wrapper &); }; +#ifdef GCC_CP_INTERFACE_H + // Specialization for gcc_vbase_array. + template<> + class argument_wrapper<const gcc_vbase_array *> + { + public: + argument_wrapper () : m_object (NULL) { } + ~argument_wrapper () + { + // It would be nicer if gcc_type_array could have a destructor. + // But, it is in code shared with gdb and cannot. + if (m_object != NULL) + { + delete[] m_object->flags; + delete[] m_object->elements; + } + delete m_object; + } + + operator const gcc_vbase_array * () const + { + return m_object; + } + + status unmarshall (connection *conn) + { + return ::cc1_plugin::unmarshall (conn, &m_object); + } + + 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. + template<> + class argument_wrapper<const gcc_cp_template_args *> + { + public: + argument_wrapper () : m_object (NULL) { } + ~argument_wrapper () + { + // It would be nicer if gcc_type_array could have a destructor. + // But, it is in code shared with gdb and cannot. + if (m_object != NULL) + { + delete[] m_object->elements; + delete[] m_object->kinds; + } + delete m_object; + } + + operator const gcc_cp_template_args * () const + { + return m_object; + } + + status unmarshall (connection *conn) + { + return ::cc1_plugin::unmarshall (conn, &m_object); + } + + 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. + template<> + class argument_wrapper<const gcc_cp_function_args *> + { + public: + argument_wrapper () : m_object (NULL) { } + ~argument_wrapper () + { + // It would be nicer if gcc_type_array could have a destructor. + // But, it is in code shared with gdb and cannot. + if (m_object != NULL) + { + delete[] m_object->elements; + } + delete m_object; + } + + operator const gcc_cp_function_args * () const + { + return m_object; + } + + status unmarshall (connection *conn) + { + return ::cc1_plugin::unmarshall (conn, &m_object); + } + + 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 */ + // There are two kinds of template functions here: "call" and // "callback". They are each repeated multiple times to handle // different numbers of arguments. (This would be improved with |