1e6c7e151Schristos /* Interface between GCC C++ FE and GDB 2e6c7e151Schristos 3*c42dbd0eSchristos Copyright (C) 2014-2022 Free Software Foundation, Inc. 4e6c7e151Schristos 5e6c7e151Schristos This file is part of GCC. 6e6c7e151Schristos 7e6c7e151Schristos This program is free software; you can redistribute it and/or modify 8e6c7e151Schristos it under the terms of the GNU General Public License as published by 9e6c7e151Schristos the Free Software Foundation; either version 3 of the License, or 10e6c7e151Schristos (at your option) any later version. 11e6c7e151Schristos 12e6c7e151Schristos This program is distributed in the hope that it will be useful, 13e6c7e151Schristos but WITHOUT ANY WARRANTY; without even the implied warranty of 14e6c7e151Schristos MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15e6c7e151Schristos GNU General Public License for more details. 16e6c7e151Schristos 17e6c7e151Schristos You should have received a copy of the GNU General Public License 18e6c7e151Schristos along with this program. If not, see <http://www.gnu.org/licenses/>. */ 19e6c7e151Schristos 20e6c7e151Schristos #ifndef GCC_CP_INTERFACE_H 21e6c7e151Schristos #define GCC_CP_INTERFACE_H 22e6c7e151Schristos 23e6c7e151Schristos #include "gcc-interface.h" 24e6c7e151Schristos 25e6c7e151Schristos /* This header defines the interface to the GCC API. It must be both 26e6c7e151Schristos valid C and valid C++, because it is included by both programs. */ 27e6c7e151Schristos 28e6c7e151Schristos #ifdef __cplusplus 29e6c7e151Schristos extern "C" { 30e6c7e151Schristos #endif 31e6c7e151Schristos 32e6c7e151Schristos /* Forward declaration. */ 33e6c7e151Schristos 34e6c7e151Schristos struct gcc_cp_context; 35e6c7e151Schristos 36e6c7e151Schristos /* 37e6c7e151Schristos * Definitions and declarations for the C++ front end. 38e6c7e151Schristos */ 39e6c7e151Schristos 40e6c7e151Schristos /* Defined versions of the C++ front-end API. */ 41e6c7e151Schristos 42e6c7e151Schristos enum gcc_cp_api_version 43e6c7e151Schristos { 44e6c7e151Schristos GCC_CP_FE_VERSION_0 = 0 45e6c7e151Schristos }; 46e6c7e151Schristos 47e6c7e151Schristos /* Qualifiers. */ 48e6c7e151Schristos 49e6c7e151Schristos enum gcc_cp_qualifiers 50e6c7e151Schristos { 51e6c7e151Schristos GCC_CP_QUALIFIER_CONST = 1, 52e6c7e151Schristos GCC_CP_QUALIFIER_VOLATILE = 2, 53e6c7e151Schristos GCC_CP_QUALIFIER_RESTRICT = 4 54e6c7e151Schristos }; 55e6c7e151Schristos 56e6c7e151Schristos /* Ref qualifiers. */ 57e6c7e151Schristos 58e6c7e151Schristos enum gcc_cp_ref_qualifiers { 59e6c7e151Schristos GCC_CP_REF_QUAL_NONE = 0, 60e6c7e151Schristos GCC_CP_REF_QUAL_LVALUE = 1, 61e6c7e151Schristos GCC_CP_REF_QUAL_RVALUE = 2 62e6c7e151Schristos }; 63e6c7e151Schristos 64e6c7e151Schristos /* Opaque typedef for unbound class templates. They are used for 65e6c7e151Schristos template arguments, and defaults for template template 66e6c7e151Schristos parameters. */ 67e6c7e151Schristos 68e6c7e151Schristos typedef unsigned long long gcc_utempl; 69e6c7e151Schristos 70e6c7e151Schristos /* Opaque typedef for expressions. They are used for template 71e6c7e151Schristos arguments, defaults for non-type template parameters, and defaults 72e6c7e151Schristos for function arguments. */ 73e6c7e151Schristos 74e6c7e151Schristos typedef unsigned long long gcc_expr; 75e6c7e151Schristos 76e6c7e151Schristos typedef enum 77e6c7e151Schristos { GCC_CP_TPARG_VALUE, GCC_CP_TPARG_CLASS, 78e6c7e151Schristos GCC_CP_TPARG_TEMPL, GCC_CP_TPARG_PACK } 79e6c7e151Schristos gcc_cp_template_arg_kind; 80e6c7e151Schristos 81e6c7e151Schristos typedef union 82e6c7e151Schristos { gcc_expr value; gcc_type type; gcc_utempl templ; gcc_type pack; } 83e6c7e151Schristos gcc_cp_template_arg; 84e6c7e151Schristos 85e6c7e151Schristos /* An array of template arguments. */ 86e6c7e151Schristos 87e6c7e151Schristos struct gcc_cp_template_args 88e6c7e151Schristos { 89e6c7e151Schristos /* Number of elements. */ 90e6c7e151Schristos 91e6c7e151Schristos int n_elements; 92e6c7e151Schristos 93e6c7e151Schristos /* kind[i] indicates what kind of template argument type[i] is. */ 94e6c7e151Schristos 95e6c7e151Schristos char /* gcc_cp_template_arg_kind */ *kinds; 96e6c7e151Schristos 97e6c7e151Schristos /* The template arguments. */ 98e6c7e151Schristos 99e6c7e151Schristos gcc_cp_template_arg *elements; 100e6c7e151Schristos }; 101e6c7e151Schristos 102e6c7e151Schristos /* An array of (default) function arguments. */ 103e6c7e151Schristos 104e6c7e151Schristos struct gcc_cp_function_args 105e6c7e151Schristos { 106e6c7e151Schristos /* Number of elements. */ 107e6c7e151Schristos 108e6c7e151Schristos int n_elements; 109e6c7e151Schristos 110e6c7e151Schristos /* The (default) values for each argument. */ 111e6c7e151Schristos 112e6c7e151Schristos gcc_expr *elements; 113e6c7e151Schristos }; 114e6c7e151Schristos 115e6c7e151Schristos /* This enumerates the kinds of decls that GDB can create. */ 116e6c7e151Schristos 117e6c7e151Schristos enum gcc_cp_symbol_kind 118e6c7e151Schristos { 119e6c7e151Schristos /* A function. */ 120e6c7e151Schristos 121e6c7e151Schristos GCC_CP_SYMBOL_FUNCTION, 122e6c7e151Schristos 123e6c7e151Schristos /* A variable. */ 124e6c7e151Schristos 125e6c7e151Schristos GCC_CP_SYMBOL_VARIABLE, 126e6c7e151Schristos 127e6c7e151Schristos /* A typedef, or an alias declaration (including template ones). */ 128e6c7e151Schristos 129e6c7e151Schristos GCC_CP_SYMBOL_TYPEDEF, 130e6c7e151Schristos 131e6c7e151Schristos /* A label. */ 132e6c7e151Schristos 133e6c7e151Schristos GCC_CP_SYMBOL_LABEL, 134e6c7e151Schristos 135e6c7e151Schristos /* A class, forward declared in build_decl (to be later defined in 136e6c7e151Schristos start_class_definition), or, in a template parameter list scope, 137e6c7e151Schristos a declaration of a template class, closing the parameter 138e6c7e151Schristos list. */ 139e6c7e151Schristos 140e6c7e151Schristos GCC_CP_SYMBOL_CLASS, 141e6c7e151Schristos 142e6c7e151Schristos /* A union, forward declared in build_decl (to be later defined in 143e6c7e151Schristos start_class_definition). */ 144e6c7e151Schristos 145e6c7e151Schristos GCC_CP_SYMBOL_UNION, 146e6c7e151Schristos 147e6c7e151Schristos /* An enumeration type being introduced with start_new_enum_type. */ 148e6c7e151Schristos 149e6c7e151Schristos GCC_CP_SYMBOL_ENUM, 150e6c7e151Schristos 151e6c7e151Schristos /* A nonstatic data member being introduced with new_field. */ 152e6c7e151Schristos 153e6c7e151Schristos GCC_CP_SYMBOL_FIELD, 154e6c7e151Schristos 155e6c7e151Schristos /* A base class in a gcc_vbase_array. */ 156e6c7e151Schristos 157e6c7e151Schristos GCC_CP_SYMBOL_BASECLASS, 158e6c7e151Schristos 159e6c7e151Schristos /* A using declaration in new_using_decl. */ 160e6c7e151Schristos 161e6c7e151Schristos GCC_CP_SYMBOL_USING, 162e6c7e151Schristos 163e6c7e151Schristos /* A (lambda) closure class type. In many regards this is just like 164e6c7e151Schristos a regular class, but it's not supposed to have base classes, some 165e6c7e151Schristos of the member functions that are usually implicitly-defined are 166e6c7e151Schristos deleted, and it should have an operator() member function that 167e6c7e151Schristos holds the lambda body. We can't instantiate objects of lambda 168e6c7e151Schristos types from the snippet, but we can interact with them in such 169e6c7e151Schristos ways as passing them to functions that take their types, and 170e6c7e151Schristos calling their body. */ 171e6c7e151Schristos 172e6c7e151Schristos GCC_CP_SYMBOL_LAMBDA_CLOSURE, 173e6c7e151Schristos 174e6c7e151Schristos /* Marker to check that we haven't exceeded GCC_CP_SYMBOL_MASK. */ 175e6c7e151Schristos GCC_CP_SYMBOL_END, 176e6c7e151Schristos 177e6c7e151Schristos GCC_CP_SYMBOL_MASK = 15, 178e6c7e151Schristos 179e6c7e151Schristos /* When defining a class member, at least one of the 180e6c7e151Schristos GCC_CP_ACCESS_MASK bits must be set; when defining a namespace- 181e6c7e151Schristos or union-scoped symbol, none of them must be set. */ 182e6c7e151Schristos 183e6c7e151Schristos GCC_CP_ACCESS_PRIVATE, 184e6c7e151Schristos GCC_CP_ACCESS_PUBLIC = GCC_CP_ACCESS_PRIVATE << 1, 185e6c7e151Schristos GCC_CP_ACCESS_MASK = (GCC_CP_ACCESS_PUBLIC 186e6c7e151Schristos | GCC_CP_ACCESS_PRIVATE), 187e6c7e151Schristos GCC_CP_ACCESS_PROTECTED = GCC_CP_ACCESS_MASK, 188e6c7e151Schristos GCC_CP_ACCESS_NONE = 0, 189e6c7e151Schristos 190e6c7e151Schristos GCC_CP_FLAG_BASE = GCC_CP_ACCESS_PRIVATE << 2, 191e6c7e151Schristos 192e6c7e151Schristos /* Flags to be used along with GCC_CP_SYMBOL_FUNCTION: */ 193e6c7e151Schristos 194e6c7e151Schristos /* This flag should be set for constructors, destructors and 195e6c7e151Schristos operators. */ 196e6c7e151Schristos GCC_CP_FLAG_SPECIAL_FUNCTION = GCC_CP_FLAG_BASE, 197e6c7e151Schristos 198e6c7e151Schristos /* We intentionally cannot express inline, constexpr, or virtual 199e6c7e151Schristos override for functions. We can't inline or constexpr-replace 200e6c7e151Schristos without a source-level body. The override keyword is only 201e6c7e151Schristos meaningful within the definition of the containing class. */ 202e6c7e151Schristos 203e6c7e151Schristos /* This indicates a "virtual" member function, explicitly or 204e6c7e151Schristos implicitly (due to a virtual function with the same name and 205e6c7e151Schristos prototype in a base class) declared as such. */ 206e6c7e151Schristos GCC_CP_FLAG_VIRTUAL_FUNCTION = GCC_CP_FLAG_BASE << 1, 207e6c7e151Schristos 208e6c7e151Schristos /* The following two flags should only be set when the flag above is 209e6c7e151Schristos set. */ 210e6c7e151Schristos 211e6c7e151Schristos /* This indicates a pure virtual member function, i.e., one that is 212e6c7e151Schristos declared with "= 0", even if a body is provided in the 213e6c7e151Schristos definition. */ 214e6c7e151Schristos GCC_CP_FLAG_PURE_VIRTUAL_FUNCTION = GCC_CP_FLAG_BASE << 2, 215e6c7e151Schristos 216e6c7e151Schristos /* This indicates a "final" virtual member function. */ 217e6c7e151Schristos GCC_CP_FLAG_FINAL_VIRTUAL_FUNCTION = GCC_CP_FLAG_BASE << 3, 218e6c7e151Schristos 219e6c7e151Schristos /* This indicates a special member function should have its default 220e6c7e151Schristos implementation. This either means the function declaration 221e6c7e151Schristos contains the "= default" tokens, or that the member function was 222e6c7e151Schristos implicitly generated by the compiler, although the latter use is 223e6c7e151Schristos discouraged: just let the compiler implicitly introduce it. 224e6c7e151Schristos 225e6c7e151Schristos A member function defaulted after its first declaration has 226e6c7e151Schristos slightly different ABI implications from one implicitly generated 227e6c7e151Schristos or explicitly defaulted at the declaration (and definition) 228e6c7e151Schristos point. To avoid silent (possibly harmless) violation of the one 229e6c7e151Schristos definition rule, it is recommended that this flag not be used for 230e6c7e151Schristos such functions, and that the address of the definition be 231e6c7e151Schristos supplied instead. */ 232e6c7e151Schristos GCC_CP_FLAG_DEFAULTED_FUNCTION = GCC_CP_FLAG_BASE << 4, 233e6c7e151Schristos 234e6c7e151Schristos /* This indicates a deleted member function, i.e., one that has been 235e6c7e151Schristos defined as "= delete" at its declaration point, or one that has 236e6c7e151Schristos been implicitly defined as deleted (with or without an explicit 237e6c7e151Schristos "= default" definition). 238e6c7e151Schristos 239e6c7e151Schristos This should not be used for implicitly-declared member functions 240e6c7e151Schristos that resolve to deleted definitions, as it may affect the 241e6c7e151Schristos implicit declaration of other member functions. */ 242e6c7e151Schristos GCC_CP_FLAG_DELETED_FUNCTION = GCC_CP_FLAG_BASE << 5, 243e6c7e151Schristos 244e6c7e151Schristos /* This indicates a constructor or type-conversion operator declared 245e6c7e151Schristos as "explicit". */ 246e6c7e151Schristos 247e6c7e151Schristos GCC_CP_FLAG_EXPLICIT_FUNCTION = GCC_CP_FLAG_BASE << 6, 248e6c7e151Schristos 249e6c7e151Schristos GCC_CP_FLAG_END_FUNCTION, 250e6c7e151Schristos GCC_CP_FLAG_MASK_FUNCTION = (((GCC_CP_FLAG_END_FUNCTION - 1) << 1) 251e6c7e151Schristos - GCC_CP_FLAG_BASE), 252e6c7e151Schristos 253e6c7e151Schristos /* Flags to be used along with GCC_CP_SYMBOL_VARIABLE: */ 254e6c7e151Schristos 255e6c7e151Schristos /* This indicates a variable declared as "constexpr". */ 256e6c7e151Schristos 257e6c7e151Schristos GCC_CP_FLAG_CONSTEXPR_VARIABLE = GCC_CP_FLAG_BASE, 258e6c7e151Schristos 259e6c7e151Schristos /* This indicates a variable declared as "thread_local". ??? What 260e6c7e151Schristos should the ADDRESS be? */ 261e6c7e151Schristos 262e6c7e151Schristos GCC_CP_FLAG_THREAD_LOCAL_VARIABLE = GCC_CP_FLAG_BASE << 1, 263e6c7e151Schristos 264e6c7e151Schristos GCC_CP_FLAG_END_VARIABLE, 265e6c7e151Schristos GCC_CP_FLAG_MASK_VARIABLE = (((GCC_CP_FLAG_END_VARIABLE - 1) << 1) 266e6c7e151Schristos - GCC_CP_FLAG_BASE), 267e6c7e151Schristos 268e6c7e151Schristos /* Flags to be used when defining nonstatic data members of classes 269e6c7e151Schristos with new_field. */ 270e6c7e151Schristos 271e6c7e151Schristos /* Use this when no flags are present. */ 272e6c7e151Schristos GCC_CP_FLAG_FIELD_NOFLAG = 0, 273e6c7e151Schristos 274e6c7e151Schristos /* This indicates the field is declared as mutable. */ 275e6c7e151Schristos GCC_CP_FLAG_FIELD_MUTABLE = GCC_CP_FLAG_BASE, 276e6c7e151Schristos 277e6c7e151Schristos GCC_CP_FLAG_END_FIELD, 278e6c7e151Schristos GCC_CP_FLAG_MASK_FIELD = (((GCC_CP_FLAG_END_FIELD - 1) << 1) 279e6c7e151Schristos - GCC_CP_FLAG_BASE), 280e6c7e151Schristos 281e6c7e151Schristos /* Flags to be used when defining an enum with 282e6c7e151Schristos start_new_enum_type. */ 283e6c7e151Schristos 284e6c7e151Schristos /* This indicates an enum type without any flags. */ 285e6c7e151Schristos GCC_CP_FLAG_ENUM_NOFLAG = 0, 286e6c7e151Schristos 287e6c7e151Schristos /* This indicates a scoped enum type. */ 288e6c7e151Schristos GCC_CP_FLAG_ENUM_SCOPED = GCC_CP_FLAG_BASE, 289e6c7e151Schristos 290e6c7e151Schristos GCC_CP_FLAG_END_ENUM, 291e6c7e151Schristos GCC_CP_FLAG_MASK_ENUM = (((GCC_CP_FLAG_END_ENUM - 1) << 1) 292e6c7e151Schristos - GCC_CP_FLAG_BASE), 293e6c7e151Schristos 294e6c7e151Schristos 295e6c7e151Schristos /* Flags to be used when introducing a class or a class template 296e6c7e151Schristos with build_decl. */ 297e6c7e151Schristos 298e6c7e151Schristos /* This indicates an enum type without any flags. */ 299e6c7e151Schristos GCC_CP_FLAG_CLASS_NOFLAG = 0, 300e6c7e151Schristos 301e6c7e151Schristos /* This indicates the class is actually a struct. This has no 302e6c7e151Schristos effect whatsoever on access control in this interface, since all 303e6c7e151Schristos class members must have explicit access control bits set, but it 304e6c7e151Schristos may affect error messages. */ 305e6c7e151Schristos GCC_CP_FLAG_CLASS_IS_STRUCT = GCC_CP_FLAG_BASE, 306e6c7e151Schristos 307e6c7e151Schristos GCC_CP_FLAG_END_CLASS, 308e6c7e151Schristos GCC_CP_FLAG_MASK_CLASS = (((GCC_CP_FLAG_END_CLASS - 1) << 1) 309e6c7e151Schristos - GCC_CP_FLAG_BASE), 310e6c7e151Schristos 311e6c7e151Schristos 312e6c7e151Schristos /* Flags to be used when introducing a virtual base class in a 313e6c7e151Schristos gcc_vbase_array. */ 314e6c7e151Schristos 315e6c7e151Schristos /* This indicates an enum type without any flags. */ 316e6c7e151Schristos GCC_CP_FLAG_BASECLASS_NOFLAG = 0, 317e6c7e151Schristos 318e6c7e151Schristos /* This indicates the class is actually a struct. This has no 319e6c7e151Schristos effect whatsoever on access control in this interface, since all 320e6c7e151Schristos class members must have explicit access control bits set, but it 321e6c7e151Schristos may affect error messages. */ 322e6c7e151Schristos GCC_CP_FLAG_BASECLASS_VIRTUAL = GCC_CP_FLAG_BASE, 323e6c7e151Schristos 324e6c7e151Schristos GCC_CP_FLAG_END_BASECLASS, 325e6c7e151Schristos GCC_CP_FLAG_MASK_BASECLASS = (((GCC_CP_FLAG_END_BASECLASS - 1) << 1) 326e6c7e151Schristos - GCC_CP_FLAG_BASE), 327e6c7e151Schristos 328e6c7e151Schristos 329e6c7e151Schristos GCC_CP_FLAG_MASK = (GCC_CP_FLAG_MASK_FUNCTION 330e6c7e151Schristos | GCC_CP_FLAG_MASK_VARIABLE 331e6c7e151Schristos | GCC_CP_FLAG_MASK_FIELD 332e6c7e151Schristos | GCC_CP_FLAG_MASK_ENUM 333e6c7e151Schristos | GCC_CP_FLAG_MASK_CLASS 334e6c7e151Schristos | GCC_CP_FLAG_MASK_BASECLASS 335e6c7e151Schristos ) 336e6c7e151Schristos }; 337e6c7e151Schristos 338e6c7e151Schristos 339e6c7e151Schristos /* An array of types used for creating lists of base classes. */ 340e6c7e151Schristos 341e6c7e151Schristos struct gcc_vbase_array 342e6c7e151Schristos { 343e6c7e151Schristos /* Number of elements. */ 344e6c7e151Schristos 345e6c7e151Schristos int n_elements; 346e6c7e151Schristos 347e6c7e151Schristos /* The base classes. */ 348e6c7e151Schristos 349e6c7e151Schristos gcc_type *elements; 350e6c7e151Schristos 351e6c7e151Schristos /* Flags for each base class. Used to indicate access control and 352e6c7e151Schristos virtualness. */ 353e6c7e151Schristos 354e6c7e151Schristos enum gcc_cp_symbol_kind *flags; 355e6c7e151Schristos }; 356e6c7e151Schristos 357e6c7e151Schristos 358e6c7e151Schristos /* This enumerates the types of symbols that GCC might request from 359e6c7e151Schristos GDB. */ 360e6c7e151Schristos 361e6c7e151Schristos enum gcc_cp_oracle_request 362e6c7e151Schristos { 363e6c7e151Schristos /* An identifier in namespace scope -- type, variable, function, 364e6c7e151Schristos namespace, template. All namespace-scoped symbols with the 365e6c7e151Schristos requested name, in any namespace (including the global 366e6c7e151Schristos namespace), should be defined in response to this request. */ 367e6c7e151Schristos 368e6c7e151Schristos GCC_CP_ORACLE_IDENTIFIER 369e6c7e151Schristos }; 370e6c7e151Schristos 371e6c7e151Schristos /* The type of the function called by GCC to ask GDB for a symbol's 372e6c7e151Schristos definition. DATUM is an arbitrary value supplied when the oracle 373e6c7e151Schristos function is registered. CONTEXT is the GCC context in which the 374e6c7e151Schristos request is being made. REQUEST specifies what sort of symbol is 375e6c7e151Schristos being requested, and IDENTIFIER is the name of the symbol. */ 376e6c7e151Schristos 377e6c7e151Schristos typedef void gcc_cp_oracle_function (void *datum, 378e6c7e151Schristos struct gcc_cp_context *context, 379e6c7e151Schristos enum gcc_cp_oracle_request request, 380e6c7e151Schristos const char *identifier); 381e6c7e151Schristos 382e6c7e151Schristos /* The type of the function called by GCC to ask GDB for a symbol's 383e6c7e151Schristos address. This should return 0 if the address is not known. */ 384e6c7e151Schristos 385e6c7e151Schristos typedef gcc_address gcc_cp_symbol_address_function (void *datum, 386e6c7e151Schristos struct gcc_cp_context *ctxt, 387e6c7e151Schristos const char *identifier); 388e6c7e151Schristos 389e6c7e151Schristos /* The type of the function called by GCC to ask GDB to enter or leave 390e6c7e151Schristos the user expression scope. */ 391e6c7e151Schristos 392e6c7e151Schristos typedef void gcc_cp_enter_leave_user_expr_scope_function (void *datum, 393e6c7e151Schristos struct gcc_cp_context 394e6c7e151Schristos *context); 395e6c7e151Schristos 396e6c7e151Schristos /* The vtable used by the C front end. */ 397e6c7e151Schristos 398e6c7e151Schristos struct gcc_cp_fe_vtable 399e6c7e151Schristos { 400e6c7e151Schristos /* The version of the C interface. The value is one of the 401e6c7e151Schristos gcc_cp_api_version constants. */ 402e6c7e151Schristos 403e6c7e151Schristos unsigned int cp_version; 404e6c7e151Schristos 405e6c7e151Schristos /* Set the callbacks for this context. 406e6c7e151Schristos 407e6c7e151Schristos The binding oracle is called whenever the C++ parser needs to 408e6c7e151Schristos look up a symbol. This gives the caller a chance to lazily 409e6c7e151Schristos instantiate symbols using other parts of the gcc_cp_fe_interface 410e6c7e151Schristos API. The symbol is looked up without a scope, and the oracle 411e6c7e151Schristos must supply a definition for ALL namespace-scoped definitions 412e6c7e151Schristos bound to the symbol. 413e6c7e151Schristos 414e6c7e151Schristos The address oracle is called whenever the C++ parser needs to 415e6c7e151Schristos look up a symbol. This may be called for symbols not provided by 416e6c7e151Schristos the symbol oracle, such as built-in functions where GCC provides 417e6c7e151Schristos the declaration; other internal symbols, such as those related 418e6c7e151Schristos with thunks, rtti, and virtual tables are likely to be queried 419e6c7e151Schristos through this interface too. The identifier is a mangled symbol 420e6c7e151Schristos name. 421e6c7e151Schristos 422e6c7e151Schristos DATUM is an arbitrary piece of data that is passed back verbatim 423e6c7e151Schristos to the callbacks in requests. */ 424e6c7e151Schristos 425e6c7e151Schristos void (*set_callbacks) (struct gcc_cp_context *self, 426e6c7e151Schristos gcc_cp_oracle_function *binding_oracle, 427e6c7e151Schristos gcc_cp_symbol_address_function *address_oracle, 428e6c7e151Schristos gcc_cp_enter_leave_user_expr_scope_function *enter_scope, 429e6c7e151Schristos gcc_cp_enter_leave_user_expr_scope_function *leave_scope, 430e6c7e151Schristos void *datum); 431e6c7e151Schristos 432e6c7e151Schristos #define GCC_METHOD0(R, N) \ 433e6c7e151Schristos R (*N) (struct gcc_cp_context *); 434e6c7e151Schristos #define GCC_METHOD1(R, N, A) \ 435e6c7e151Schristos R (*N) (struct gcc_cp_context *, A); 436e6c7e151Schristos #define GCC_METHOD2(R, N, A, B) \ 437e6c7e151Schristos R (*N) (struct gcc_cp_context *, A, B); 438e6c7e151Schristos #define GCC_METHOD3(R, N, A, B, C) \ 439e6c7e151Schristos R (*N) (struct gcc_cp_context *, A, B, C); 440e6c7e151Schristos #define GCC_METHOD4(R, N, A, B, C, D) \ 441e6c7e151Schristos R (*N) (struct gcc_cp_context *, A, B, C, D); 442e6c7e151Schristos #define GCC_METHOD5(R, N, A, B, C, D, E) \ 443e6c7e151Schristos R (*N) (struct gcc_cp_context *, A, B, C, D, E); 444e6c7e151Schristos #define GCC_METHOD7(R, N, A, B, C, D, E, F, G) \ 445e6c7e151Schristos R (*N) (struct gcc_cp_context *, A, B, C, D, E, F, G); 446e6c7e151Schristos 447e6c7e151Schristos #include "gcc-cp-fe.def" 448e6c7e151Schristos 449e6c7e151Schristos #undef GCC_METHOD0 450e6c7e151Schristos #undef GCC_METHOD1 451e6c7e151Schristos #undef GCC_METHOD2 452e6c7e151Schristos #undef GCC_METHOD3 453e6c7e151Schristos #undef GCC_METHOD4 454e6c7e151Schristos #undef GCC_METHOD5 455e6c7e151Schristos #undef GCC_METHOD7 456e6c7e151Schristos 457e6c7e151Schristos }; 458e6c7e151Schristos 459e6c7e151Schristos /* The C front end object. */ 460e6c7e151Schristos 461e6c7e151Schristos struct gcc_cp_context 462e6c7e151Schristos { 463e6c7e151Schristos /* Base class. */ 464e6c7e151Schristos 465e6c7e151Schristos struct gcc_base_context base; 466e6c7e151Schristos 467e6c7e151Schristos /* Our vtable. This is a separate field because this is simpler 468e6c7e151Schristos than implementing a vtable inheritance scheme in C. */ 469e6c7e151Schristos 470e6c7e151Schristos const struct gcc_cp_fe_vtable *cp_ops; 471e6c7e151Schristos }; 472e6c7e151Schristos 473e6c7e151Schristos /* The name of the .so that the compiler builds. We dlopen this 474e6c7e151Schristos later. */ 475e6c7e151Schristos 476e6c7e151Schristos #define GCC_CP_FE_LIBCC libcc1.so 477e6c7e151Schristos 478e6c7e151Schristos /* The compiler exports a single initialization function. This macro 479e6c7e151Schristos holds its name as a symbol. */ 480e6c7e151Schristos 481e6c7e151Schristos #define GCC_CP_FE_CONTEXT gcc_cp_fe_context 482e6c7e151Schristos 483e6c7e151Schristos /* The type of the initialization function. The caller passes in the 484e6c7e151Schristos desired base version and desired C-specific version. If the 485e6c7e151Schristos request can be satisfied, a compatible gcc_context object will be 486e6c7e151Schristos returned. Otherwise, the function returns NULL. */ 487e6c7e151Schristos 488e6c7e151Schristos typedef struct gcc_cp_context *gcc_cp_fe_context_function 489e6c7e151Schristos (enum gcc_base_api_version, 490e6c7e151Schristos enum gcc_cp_api_version); 491e6c7e151Schristos 492e6c7e151Schristos #ifdef __cplusplus 493e6c7e151Schristos } 494e6c7e151Schristos #endif 495e6c7e151Schristos 496e6c7e151Schristos #endif /* GCC_CP_INTERFACE_H */ 497