1 /* Interface between GCC C FE and GDB -*- c -*-
3 Copyright (C) 2014-2018 Free Software Foundation, Inc.
5 This file is part of GCC.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
22 /* Create a new "decl" in GCC. A decl is a declaration, basically a
25 NAME is the name of the new symbol. SYM_KIND is the kind of
26 symbol being requested. SYM_TYPE is the new symbol's C type;
27 except for labels, where this is not meaningful and should be
28 zero. If SUBSTITUTION_NAME is not NULL, then a reference to this
29 decl in the source will later be substituted with a dereference
30 of a variable of the given name. Otherwise, for symbols having
31 an address (e.g., functions), ADDRESS is the address. FILENAME
32 and LINE_NUMBER refer to the symbol's source location. If this
33 is not known, FILENAME can be NULL and LINE_NUMBER can be 0.
34 This function returns the new decl. */
36 GCC_METHOD7 (gcc_decl, build_decl,
37 const char *, /* Argument NAME. */
38 enum gcc_c_symbol_kind, /* Argument SYM_KIND. */
39 gcc_type, /* Argument SYM_TYPE. */
40 const char *, /* Argument SUBSTITUTION_NAME. */
41 gcc_address, /* Argument ADDRESS. */
42 const char *, /* Argument FILENAME. */
43 unsigned int) /* Argument LINE_NUMBER. */
45 /* Insert a GCC decl into the symbol table. DECL is the decl to
46 insert. IS_GLOBAL is true if this is an outermost binding, and
47 false if it is a possibly-shadowing binding. */
49 GCC_METHOD2 (int /* bool */, bind,
50 gcc_decl, /* Argument DECL. */
51 int /* bool */) /* Argument IS_GLOBAL. */
53 /* Insert a tagged type into the symbol table. NAME is the tag name
54 of the type and TAGGED_TYPE is the type itself. TAGGED_TYPE must
55 be either a struct, union, or enum type, as these are the only
56 types that have tags. FILENAME and LINE_NUMBER refer to the type's
57 source location. If this is not known, FILENAME can be NULL and
58 LINE_NUMBER can be 0. */
60 GCC_METHOD4 (int /* bool */, tagbind,
61 const char *, /* Argument NAME. */
62 gcc_type, /* Argument TAGGED_TYPE. */
63 const char *, /* Argument FILENAME. */
64 unsigned int) /* Argument LINE_NUMBER. */
66 /* Return the type of a pointer to a given base type. */
68 GCC_METHOD1 (gcc_type, build_pointer_type,
69 gcc_type) /* Argument BASE_TYPE. */
71 /* Create a new 'struct' type. Initially it has no fields. */
73 GCC_METHOD0 (gcc_type, build_record_type)
75 /* Create a new 'union' type. Initially it has no fields. */
77 GCC_METHOD0 (gcc_type, build_union_type)
79 /* Add a field to a struct or union type. FIELD_NAME is the field's
80 name. FIELD_TYPE is the type of the field. BITSIZE and BITPOS
81 indicate where in the struct the field occurs. */
83 GCC_METHOD5 (int /* bool */, build_add_field,
84 gcc_type, /* Argument RECORD_OR_UNION_TYPE. */
85 const char *, /* Argument FIELD_NAME. */
86 gcc_type, /* Argument FIELD_TYPE. */
87 unsigned long, /* Argument BITSIZE. */
88 unsigned long) /* Argument BITPOS. */
90 /* After all the fields have been added to a struct or union, the
91 struct or union type must be "finished". This does some final
94 GCC_METHOD2 (int /* bool */, finish_record_or_union,
95 gcc_type, /* Argument RECORD_OR_UNION_TYPE. */
96 unsigned long) /* Argument SIZE_IN_BYTES. */
98 /* Create a new 'enum' type. The new type initially has no
99 associated constants. */
101 GCC_METHOD1 (gcc_type, build_enum_type,
102 gcc_type) /* Argument UNDERLYING_INT_TYPE. */
104 /* Add a new constant to an enum type. NAME is the constant's
105 name and VALUE is its value. */
107 GCC_METHOD3 (int /* bool */, build_add_enum_constant,
108 gcc_type, /* Argument ENUM_TYPE. */
109 const char *, /* Argument NAME. */
110 unsigned long) /* Argument VALUE. */
112 /* After all the constants have been added to an enum, the type must
113 be "finished". This does some final cleanups in GCC. */
115 GCC_METHOD1 (int /* bool */, finish_enum_type,
116 gcc_type) /* Argument ENUM_TYPE. */
118 /* Create a new function type. RETURN_TYPE is the type returned by
119 the function, and ARGUMENT_TYPES is a vector, of length NARGS, of
120 the argument types. IS_VARARGS is true if the function is
123 GCC_METHOD3 (gcc_type, build_function_type,
124 gcc_type, /* Argument RETURN_TYPE. */
125 const struct gcc_type_array *, /* Argument ARGUMENT_TYPES. */
126 int /* bool */) /* Argument IS_VARARGS. */
128 /* Return an integer type with the given properties.
129 Deprecated in v1, use int_type instead. */
131 GCC_METHOD2 (gcc_type, int_type_v0,
132 int /* bool */, /* Argument IS_UNSIGNED. */
133 unsigned long) /* Argument SIZE_IN_BYTES. */
135 /* Return a floating point type with the given properties.
136 Deprecated in v1, use float_type instead. */
138 GCC_METHOD1 (gcc_type, float_type_v0,
139 unsigned long) /* Argument SIZE_IN_BYTES. */
141 /* Return the 'void' type. */
143 GCC_METHOD0 (gcc_type, void_type)
145 /* Return the 'bool' type. */
147 GCC_METHOD0 (gcc_type, bool_type)
149 /* Create a new array type. If NUM_ELEMENTS is -1, then the array
150 is assumed to have an unknown length. */
152 GCC_METHOD2 (gcc_type, build_array_type,
153 gcc_type, /* Argument ELEMENT_TYPE. */
154 int) /* Argument NUM_ELEMENTS. */
156 /* Create a new variably-sized array type. UPPER_BOUND_NAME is the
157 name of a local variable that holds the upper bound of the array;
158 it is one less than the array size. */
160 GCC_METHOD2 (gcc_type, build_vla_array_type,
161 gcc_type, /* Argument ELEMENT_TYPE. */
162 const char *) /* Argument UPPER_BOUND_NAME. */
164 /* Return a qualified variant of a given base type. QUALIFIERS says
165 which qualifiers to use; it is composed of or'd together
166 constants from 'enum gcc_qualifiers'. */
168 GCC_METHOD2 (gcc_type, build_qualified_type,
169 gcc_type, /* Argument UNQUALIFIED_TYPE. */
170 enum gcc_qualifiers) /* Argument QUALIFIERS. */
172 /* Build a complex type given its element type. */
174 GCC_METHOD1 (gcc_type, build_complex_type,
175 gcc_type) /* Argument ELEMENT_TYPE. */
177 /* Build a vector type given its element type and number of
180 GCC_METHOD2 (gcc_type, build_vector_type,
181 gcc_type, /* Argument ELEMENT_TYPE. */
182 int) /* Argument NUM_ELEMENTS. */
184 /* Build a constant. NAME is the constant's name and VALUE is its
185 value. FILENAME and LINE_NUMBER refer to the type's source
186 location. If this is not known, FILENAME can be NULL and
187 LINE_NUMBER can be 0. */
189 GCC_METHOD5 (int /* bool */, build_constant,
190 gcc_type, /* Argument TYPE. */
191 const char *, /* Argument NAME. */
192 unsigned long, /* Argument VALUE. */
193 const char *, /* Argument FILENAME. */
194 unsigned int) /* Argument LINE_NUMBER. */
196 /* Emit an error and return an error type object. */
198 GCC_METHOD1 (gcc_type, error,
199 const char *) /* Argument MESSAGE. */
201 /* Return an integer type with the given properties. If BUILTIN_NAME
202 is non-NULL, it must name a builtin integral type with the given
203 signedness and size, and that is the type that will be returned. */
205 GCC_METHOD3 (gcc_type, int_type,
206 int /* bool */, /* Argument IS_UNSIGNED. */
207 unsigned long, /* Argument SIZE_IN_BYTES. */
208 const char *) /* Argument BUILTIN_NAME. */
210 /* Return the 'char' type, a distinct type from both 'signed char' and
211 'unsigned char' returned by int_type. */
213 GCC_METHOD0 (gcc_type, char_type)
215 /* Return a floating point type with the given properties. If BUILTIN_NAME
216 is non-NULL, it must name a builtin integral type with the given
217 signedness and size, and that is the type that will be returned. */
219 GCC_METHOD2 (gcc_type, float_type,
220 unsigned long, /* Argument SIZE_IN_BYTES. */
221 const char *) /* Argument BUILTIN_NAME. */