34 return context->
plugin ().build_pointer_type (target);
42 gcc_type element_type;
47 if (!
range->bounds ()->low.is_constant ())
48 return context->
plugin ().error (_(
"array type with non-constant"
49 " lower bound is not supported"));
50 if (
range->bounds ()->low.const_val () != 0)
51 return context->
plugin ().error (_(
"cannot convert array type with "
52 "non-zero lower bound to C"));
60 return context->
plugin ().error (_(
"variably-sized vector type"
61 " is not supported"));
63 std::string upper_bound
65 result = context->
plugin ().build_vla_array_type (element_type,
66 upper_bound.c_str ());
71 LONGEST low_bound, high_bound, count;
77 gdb_assert (low_bound == 0);
78 count = high_bound + 1;
82 return context->
plugin ().build_vector_type (element_type, count);
83 return context->
plugin ().build_array_type (element_type, count);
97 if (
type->
code () == TYPE_CODE_STRUCT)
98 result = context->
plugin ().build_record_type ();
101 gdb_assert (
type->
code () == TYPE_CODE_UNION);
102 result = context->
plugin ().build_union_type ();
114 context->
plugin ().build_add_field (result,
130 gcc_type int_type, result;
136 result = context->
plugin ().build_enum_type (int_type);
139 context->
plugin ().build_add_enum_constant
143 context->
plugin ().finish_enum_type (result);
154 gcc_type result, return_type;
155 struct gcc_type_array array;
168 warning (_(
"function has unknown return type; assuming int"));
176 std::vector<gcc_type> elements (array.n_elements);
177 array.elements = elements.data ();
181 result = context->
plugin ().build_function_type (return_type,
197 return context->
plugin ().char_type ();
225 return context->
plugin ().void_type ();
233 return context->
plugin ().bool_type ();
242 gcc_type unqual_converted;
243 gcc_qualifiers_flags quals = 0;
248 quals |= GCC_QUALIFIER_CONST;
250 quals |= GCC_QUALIFIER_VOLATILE;
252 quals |= GCC_QUALIFIER_RESTRICT;
254 return context->
plugin ().build_qualified_type (unqual_converted,
265 return context->
plugin ().build_complex_type (base);
288 case TYPE_CODE_ARRAY:
291 case TYPE_CODE_STRUCT:
292 case TYPE_CODE_UNION:
313 case TYPE_CODE_COMPLEX:
316 case TYPE_CODE_ERROR:
323 warning (_(
"variable has unknown type; assuming int"));
328 return context->
plugin ().error (_(
"cannot convert gdb type to gcc type"));
338 " -Wno-implicit-function-declaration";
362#define FORWARD(OP,...) m_context->c_ops->OP(m_context, ##__VA_ARGS__)
363#define GCC_METHOD0(R, N) \
364 R gcc_c_plugin::N () const \
365 { return FORWARD (N); }
366#define GCC_METHOD1(R, N, A) \
367 R gcc_c_plugin::N (A a) const \
368 { return FORWARD (N, a); }
369#define GCC_METHOD2(R, N, A, B) \
370 R gcc_c_plugin::N (A a, B b) const \
371 { return FORWARD (N, a, b); }
372#define GCC_METHOD3(R, N, A, B, C) \
373 R gcc_c_plugin::N (A a, B b, C c) const \
374 { return FORWARD (N, a, b, c); }
375#define GCC_METHOD4(R, N, A, B, C, D) \
376 R gcc_c_plugin::N (A a, B b, C c, D d) const \
377 { return FORWARD (N, a, b, c, d); }
378#define GCC_METHOD5(R, N, A, B, C, D, E) \
379 R gcc_c_plugin::N (A a, B b, C c, D d, E e) const \
380 { return FORWARD (N, a, b, c, d, e); }
381#define GCC_METHOD7(R, N, A, B, C, D, E, F, G) \
382 R gcc_c_plugin::N (A a, B b, C c, D d, E e, F f, G g) const \
383 { return FORWARD (N, a, b, c, d, e, f, g); }
385#include "gcc-c-fe.def"
gcc_type convert_type(struct type *type)
static const char * m_default_cflags
bool get_cached_type(struct type *type, gcc_type *ret) const
void insert_type(struct type *type, gcc_type gcc_type)
std::string c_get_range_decl_name(const struct dynamic_prop *prop)
static gcc_type convert_complex(compile_c_instance *context, struct type *type)
static gcc_type convert_func(compile_c_instance *context, struct type *type)
static gcc_type convert_qualified(compile_c_instance *context, struct type *type)
static gcc_type convert_array(compile_c_instance *context, struct type *type)
static gcc_type convert_type_basic(compile_c_instance *context, struct type *type)
static gcc_type convert_enum(compile_c_instance *context, struct type *type)
static gcc_type convert_pointer(compile_c_instance *context, struct type *type)
static gcc_type convert_bool(compile_c_instance *context, struct type *type)
static gcc_type convert_float(compile_c_instance *context, struct type *type)
static gcc_type convert_void(compile_c_instance *context, struct type *type)
static gcc_type convert_int(compile_c_instance *context, struct type *type)
static gcc_type convert_struct_or_union(compile_c_instance *context, struct type *type)
struct type * make_unqualified_type(struct type *type)
bool get_array_bounds(struct type *type, LONGEST *low_bound, LONGEST *high_bound)
const struct builtin_type * builtin_type(struct gdbarch *gdbarch)
struct type * check_typedef(struct type *type)
@ TYPE_INSTANCE_FLAG_CONST
@ TYPE_INSTANCE_FLAG_VOLATILE
@ TYPE_INSTANCE_FLAG_RESTRICT
struct type * builtin_int
LONGEST loc_bitpos() const
LONGEST loc_enumval() const
const char * name() const
unsigned int bitsize() const
struct type * type() const
struct type * target_type() const
struct field & field(int idx) const
bool has_no_signedness() const
unsigned int num_fields() const
const char * name() const
type * index_type() const
bool is_prototyped() const
const type_instance_flags instance_flags() const