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_C_PLUGIN_H 217f2ac410Schristos #define COMPILE_GCC_C_PLUGIN_H 227f2ac410Schristos 237f2ac410Schristos #include "compile-internal.h" 247f2ac410Schristos 257f2ac410Schristos /* A class representing the C plug-in. */ 267f2ac410Schristos 277f2ac410Schristos class gcc_c_plugin 287f2ac410Schristos { 297f2ac410Schristos public: 307f2ac410Schristos 317f2ac410Schristos explicit gcc_c_plugin (struct gcc_c_context *gcc_c) 327f2ac410Schristos : m_context (gcc_c) 337f2ac410Schristos { 347f2ac410Schristos } 357f2ac410Schristos 367f2ac410Schristos /* Set the oracle callbacks to be used by the compiler plug-in. */ 377f2ac410Schristos void set_callbacks (gcc_c_oracle_function *binding_oracle, 387f2ac410Schristos gcc_c_symbol_address_function *address_oracle, 397f2ac410Schristos void *datum) 407f2ac410Schristos { 417f2ac410Schristos m_context->c_ops->set_callbacks (m_context, binding_oracle, 427f2ac410Schristos address_oracle, datum); 437f2ac410Schristos } 447f2ac410Schristos 457f2ac410Schristos /* Returns the interface version of the compiler plug-in. */ 467f2ac410Schristos int version () const { return m_context->c_ops->c_version; } 477f2ac410Schristos 487f2ac410Schristos #define GCC_METHOD0(R, N) R N () const; 497f2ac410Schristos #define GCC_METHOD1(R, N, A) R N (A) const; 507f2ac410Schristos #define GCC_METHOD2(R, N, A, B) R N (A, B) const; 517f2ac410Schristos #define GCC_METHOD3(R, N, A, B, C) R N (A, B, C) const; 527f2ac410Schristos #define GCC_METHOD4(R, N, A, B, C, D) R N (A, B, C, D) const; 537f2ac410Schristos #define GCC_METHOD5(R, N, A, B, C, D, E) R N (A, B, C, D, E) const; 547f2ac410Schristos #define GCC_METHOD7(R, N, A, B, C, D, E, F, G) R N (A, B, C, D, E, F, G) const; 557f2ac410Schristos 567f2ac410Schristos #include "gcc-c-fe.def" 577f2ac410Schristos 587f2ac410Schristos #undef GCC_METHOD0 597f2ac410Schristos #undef GCC_METHOD1 607f2ac410Schristos #undef GCC_METHOD2 617f2ac410Schristos #undef GCC_METHOD3 627f2ac410Schristos #undef GCC_METHOD4 637f2ac410Schristos #undef GCC_METHOD5 647f2ac410Schristos #undef GCC_METHOD7 657f2ac410Schristos 667f2ac410Schristos private: 677f2ac410Schristos /* The GCC C context. */ 687f2ac410Schristos struct gcc_c_context *m_context; 697f2ac410Schristos }; 707f2ac410Schristos 717f2ac410Schristos #endif /* COMPILE_GCC_C_PLUGIN_H */ 72