xref: /netbsd-src/external/gpl3/gdb.old/dist/gdb/compile/gcc-cp-plugin.h (revision 6881a4007f077b54e5f51159c52b9b25f57deb0d)
17f2ac410Schristos /* GCC C++ plug-in wrapper for GDB.
27f2ac410Schristos 
3*6881a400Schristos    Copyright (C) 2018-2023 Free Software Foundation, Inc.
47f2ac410Schristos 
57f2ac410Schristos    This file is part of GDB.
67f2ac410Schristos 
77f2ac410Schristos    This program is free software; you can redistribute it and/or modify
87f2ac410Schristos    it under the terms of the GNU General Public License as published by
97f2ac410Schristos    the Free Software Foundation; either version 3 of the License, or
107f2ac410Schristos    (at your option) any later version.
117f2ac410Schristos 
127f2ac410Schristos    This program is distributed in the hope that it will be useful,
137f2ac410Schristos    but WITHOUT ANY WARRANTY; without even the implied warranty of
147f2ac410Schristos    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
157f2ac410Schristos    GNU General Public License for more details.
167f2ac410Schristos 
177f2ac410Schristos    You should have received a copy of the GNU General Public License
187f2ac410Schristos    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
197f2ac410Schristos 
207f2ac410Schristos #ifndef COMPILE_GCC_CP_PLUGIN_H
217f2ac410Schristos #define COMPILE_GCC_CP_PLUGIN_H
227f2ac410Schristos 
237f2ac410Schristos /* A class representing the GCC C++ plug-in.  */
247f2ac410Schristos 
257f2ac410Schristos #include "gcc-cp-interface.h"
267f2ac410Schristos 
277f2ac410Schristos class gcc_cp_plugin
287f2ac410Schristos {
297f2ac410Schristos public:
307f2ac410Schristos 
317f2ac410Schristos   explicit gcc_cp_plugin (struct gcc_cp_context *gcc_cp)
327f2ac410Schristos     : m_context (gcc_cp)
337f2ac410Schristos   {
347f2ac410Schristos   }
357f2ac410Schristos 
367f2ac410Schristos   /* Set the oracle callbacks to be used by the compiler plug-in.  */
377f2ac410Schristos   void set_callbacks (gcc_cp_oracle_function *binding_oracle,
387f2ac410Schristos 		      gcc_cp_symbol_address_function *address_oracle,
397f2ac410Schristos 		      gcc_cp_enter_leave_user_expr_scope_function *enter_scope,
407f2ac410Schristos 		      gcc_cp_enter_leave_user_expr_scope_function *leave_scope,
417f2ac410Schristos 		      void *datum)
427f2ac410Schristos   {
437f2ac410Schristos     m_context->cp_ops->set_callbacks (m_context, binding_oracle,
447f2ac410Schristos 				      address_oracle, enter_scope, leave_scope,
457f2ac410Schristos 				      datum);
467f2ac410Schristos   }
477f2ac410Schristos 
487f2ac410Schristos   /* Returns the interface version of the compiler plug-in.  */
497f2ac410Schristos   int version () const { return m_context->cp_ops->cp_version; }
507f2ac410Schristos 
517f2ac410Schristos #define GCC_METHOD0(R, N) R N () const;
527f2ac410Schristos #define GCC_METHOD1(R, N, A) R N (A) const;
537f2ac410Schristos #define GCC_METHOD2(R, N, A, B) R N (A, B) const;
547f2ac410Schristos #define GCC_METHOD3(R, N, A, B, C) R N (A, B, C) const;
557f2ac410Schristos #define GCC_METHOD4(R, N, A, B, C, D) R N (A, B, C, D) const;
567f2ac410Schristos #define GCC_METHOD5(R, N, A, B, C, D, E) R N (A, B, C, D, E) const;
577f2ac410Schristos #define GCC_METHOD7(R, N, A, B, C, D, E, F, G) R N (A, B, C, D, E, F, G) const;
587f2ac410Schristos 
597f2ac410Schristos #include "gcc-cp-fe.def"
607f2ac410Schristos 
617f2ac410Schristos #undef GCC_METHOD0
627f2ac410Schristos #undef GCC_METHOD1
637f2ac410Schristos #undef GCC_METHOD2
647f2ac410Schristos #undef GCC_METHOD3
657f2ac410Schristos #undef GCC_METHOD4
667f2ac410Schristos #undef GCC_METHOD5
677f2ac410Schristos #undef GCC_METHOD7
687f2ac410Schristos 
697f2ac410Schristos   /* Special overloads of plug-in methods with added debugging information.  */
707f2ac410Schristos 
717f2ac410Schristos   gcc_expr build_decl (const char *debug_decltype, const char *name,
727f2ac410Schristos 		       enum gcc_cp_symbol_kind sym_kind, gcc_type sym_type,
737f2ac410Schristos 		       const char *substitution_name, gcc_address address,
747f2ac410Schristos 		       const char *filename, unsigned int line_number);
757f2ac410Schristos 
767f2ac410Schristos   gcc_type start_class_type (const char *debug_name, gcc_decl typedecl,
777f2ac410Schristos 			     const struct gcc_vbase_array *base_classes,
787f2ac410Schristos 			     const char *filename, unsigned int line_number);
797f2ac410Schristos 
807f2ac410Schristos   int finish_class_type (const char *debug_name, unsigned long size_in_bytes);
817f2ac410Schristos 
827f2ac410Schristos   int pop_binding_level (const char *debug_name);
837f2ac410Schristos 
847f2ac410Schristos private:
857f2ac410Schristos 
867f2ac410Schristos   /* The GCC C++ context.  */
877f2ac410Schristos   struct gcc_cp_context *m_context;
887f2ac410Schristos };
897f2ac410Schristos 
907f2ac410Schristos #endif /* COMPILE_GCC_CP_PLUGIN_H */
91