aboutsummaryrefslogtreecommitdiff
path: root/gdb/compile
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@efficios.com>2020-05-14 13:46:38 -0400
committerSimon Marchi <simon.marchi@efficios.com>2020-05-14 13:46:38 -0400
commit7813437494ac39f3aef392d06ed5416e84fe386b (patch)
tree15290bf5b2bd9d23c59103a6a42b99adc0111d6d /gdb/compile
parent67607e24d0413828acdfa9bc38f6fbac40b860b9 (diff)
downloadbinutils-7813437494ac39f3aef392d06ed5416e84fe386b.zip
binutils-7813437494ac39f3aef392d06ed5416e84fe386b.tar.gz
binutils-7813437494ac39f3aef392d06ed5416e84fe386b.tar.bz2
gdb: remove TYPE_CODE macro
Remove TYPE_CODE, changing all the call sites to use type::code directly. This is quite a big diff, but this was mostly done using sed and coccinelle. A few call sites were done by hand. gdb/ChangeLog: * gdbtypes.h (TYPE_CODE): Remove. Change all call sites to use type::code instead.
Diffstat (limited to 'gdb/compile')
-rw-r--r--gdb/compile/compile-c-support.c2
-rw-r--r--gdb/compile/compile-c-symbols.c4
-rw-r--r--gdb/compile/compile-c-types.c6
-rw-r--r--gdb/compile/compile-cplus-symbols.c6
-rw-r--r--gdb/compile/compile-cplus-types.c22
-rw-r--r--gdb/compile/compile-object-load.c28
-rw-r--r--gdb/compile/compile-object-run.c2
7 files changed, 35 insertions, 35 deletions
diff --git a/gdb/compile/compile-c-support.c b/gdb/compile/compile-c-support.c
index b24a6c3..8499300 100644
--- a/gdb/compile/compile-c-support.c
+++ b/gdb/compile/compile-c-support.c
@@ -242,7 +242,7 @@ generate_register_struct (struct ui_file *stream, struct gdbarch *gdbarch,
maximally-aligned array of the correct size. */
fputs_unfiltered (" ", stream);
- switch (TYPE_CODE (regtype))
+ switch (regtype->code ())
{
case TYPE_CODE_PTR:
fprintf_filtered (stream, "__gdb_uintptr %s",
diff --git a/gdb/compile/compile-c-symbols.c b/gdb/compile/compile-c-symbols.c
index eb5af8e..ab9f442 100644
--- a/gdb/compile/compile-c-symbols.c
+++ b/gdb/compile/compile-c-symbols.c
@@ -99,7 +99,7 @@ convert_one_symbol (compile_c_instance *context,
break;
case LOC_CONST:
- if (TYPE_CODE (SYMBOL_TYPE (sym.symbol)) == TYPE_CODE_ENUM)
+ if (SYMBOL_TYPE (sym.symbol)->code () == TYPE_CODE_ENUM)
{
/* Already handled by convert_enum. */
return;
@@ -497,7 +497,7 @@ generate_vla_size (compile_instance *compiler,
if (TYPE_IS_REFERENCE (type))
type = check_typedef (TYPE_TARGET_TYPE (type));
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
case TYPE_CODE_RANGE:
{
diff --git a/gdb/compile/compile-c-types.c b/gdb/compile/compile-c-types.c
index 95bb537..ed4a6e9 100644
--- a/gdb/compile/compile-c-types.c
+++ b/gdb/compile/compile-c-types.c
@@ -94,11 +94,11 @@ convert_struct_or_union (compile_c_instance *context, struct type *type)
/* First we create the resulting type and enter it into our hash
table. This lets recursive types work. */
- if (TYPE_CODE (type) == TYPE_CODE_STRUCT)
+ if (type->code () == TYPE_CODE_STRUCT)
result = context->plugin ().build_record_type ();
else
{
- gdb_assert (TYPE_CODE (type) == TYPE_CODE_UNION);
+ gdb_assert (type->code () == TYPE_CODE_UNION);
result = context->plugin ().build_union_type ();
}
context->insert_type (type, result);
@@ -282,7 +282,7 @@ convert_type_basic (compile_c_instance *context, struct type *type)
| TYPE_INSTANCE_FLAG_RESTRICT)) != 0)
return convert_qualified (context, type);
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
case TYPE_CODE_PTR:
return convert_pointer (context, type);
diff --git a/gdb/compile/compile-cplus-symbols.c b/gdb/compile/compile-cplus-symbols.c
index fee2651..11a2d32 100644
--- a/gdb/compile/compile-cplus-symbols.c
+++ b/gdb/compile/compile-cplus-symbols.c
@@ -73,9 +73,9 @@ convert_one_symbol (compile_cplus_instance *instance,
switch (SYMBOL_CLASS (sym.symbol))
{
case LOC_TYPEDEF:
- if (TYPE_CODE (SYMBOL_TYPE (sym.symbol)) == TYPE_CODE_TYPEDEF)
+ if (SYMBOL_TYPE (sym.symbol)->code () == TYPE_CODE_TYPEDEF)
kind = GCC_CP_SYMBOL_TYPEDEF;
- else if (TYPE_CODE (SYMBOL_TYPE (sym.symbol)) == TYPE_CODE_NAMESPACE)
+ else if (SYMBOL_TYPE (sym.symbol)->code () == TYPE_CODE_NAMESPACE)
return;
break;
@@ -94,7 +94,7 @@ convert_one_symbol (compile_cplus_instance *instance,
break;
case LOC_CONST:
- if (TYPE_CODE (SYMBOL_TYPE (sym.symbol)) == TYPE_CODE_ENUM)
+ if (SYMBOL_TYPE (sym.symbol)->code () == TYPE_CODE_ENUM)
{
/* Already handled by convert_enum. */
return;
diff --git a/gdb/compile/compile-cplus-types.c b/gdb/compile/compile-cplus-types.c
index a179bd6..3dec3b2 100644
--- a/gdb/compile/compile-cplus-types.c
+++ b/gdb/compile/compile-cplus-types.c
@@ -88,7 +88,7 @@ get_field_access_flag (const struct type *type, int num)
enum gcc_cp_symbol_kind
get_method_access_flag (const struct type *type, int fni, int num)
{
- gdb_assert (TYPE_CODE (type) == TYPE_CODE_STRUCT);
+ gdb_assert (type->code () == TYPE_CODE_STRUCT);
/* If this type was not declared a class, everything is public. */
if (!TYPE_DECLARED_CLASS (type))
@@ -161,7 +161,7 @@ type_name_to_scope (const char *type_name, const struct block *block)
scope.push_back (comp);
- if (TYPE_CODE (SYMBOL_TYPE (bsymbol.symbol)) != TYPE_CODE_NAMESPACE)
+ if (SYMBOL_TYPE (bsymbol.symbol)->code () != TYPE_CODE_NAMESPACE)
{
/* We're done. */
break;
@@ -271,7 +271,7 @@ compile_cplus_instance::enter_scope (compile_scope &&new_scope)
(m_scopes.back ().begin (), m_scopes.back ().end () - 1,
[this] (const scope_component &comp)
{
- gdb_assert (TYPE_CODE (SYMBOL_TYPE (comp.bsymbol.symbol))
+ gdb_assert (SYMBOL_TYPE (comp.bsymbol.symbol)->code ()
== TYPE_CODE_NAMESPACE);
const char *ns = (comp.name == CP_ANONYMOUS_NAMESPACE_STR ? nullptr
@@ -313,7 +313,7 @@ compile_cplus_instance::leave_scope ()
std::for_each
(current.begin (),current.end () - 1,
[this] (const scope_component &comp) {
- gdb_assert (TYPE_CODE (SYMBOL_TYPE (comp.bsymbol.symbol))
+ gdb_assert (SYMBOL_TYPE (comp.bsymbol.symbol)->code ()
== TYPE_CODE_NAMESPACE);
this->plugin ().pop_binding_level (comp.name.c_str ());
});
@@ -413,7 +413,7 @@ compile_cplus_convert_reference (compile_cplus_instance *instance,
gcc_type target = instance->convert_type (TYPE_TARGET_TYPE (type));
enum gcc_cp_ref_qualifiers quals = GCC_CP_REF_QUAL_NONE;
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
case TYPE_CODE_REF:
quals = GCC_CP_REF_QUAL_LVALUE;
@@ -826,7 +826,7 @@ compile_cplus_convert_struct_or_union (compile_cplus_instance *instance,
table. This lets recursive types work. */
gcc_decl resuld;
- if (TYPE_CODE (type) == TYPE_CODE_STRUCT)
+ if (type->code () == TYPE_CODE_STRUCT)
{
const char *what = TYPE_DECLARED_CLASS (type) ? "struct" : "class";
@@ -839,14 +839,14 @@ compile_cplus_convert_struct_or_union (compile_cplus_instance *instance,
}
else
{
- gdb_assert (TYPE_CODE (type) == TYPE_CODE_UNION);
+ gdb_assert (type->code () == TYPE_CODE_UNION);
resuld = instance->plugin ().build_decl
("union", name.get (), GCC_CP_SYMBOL_UNION | nested_access,
0, nullptr, 0, filename, line);
}
gcc_type result;
- if (TYPE_CODE (type) == TYPE_CODE_STRUCT)
+ if (type->code () == TYPE_CODE_STRUCT)
{
struct gcc_vbase_array bases;
int num_baseclasses = TYPE_N_BASECLASSES (type);
@@ -878,7 +878,7 @@ compile_cplus_convert_struct_or_union (compile_cplus_instance *instance,
}
else
{
- gdb_assert (TYPE_CODE (type) == TYPE_CODE_UNION);
+ gdb_assert (type->code () == TYPE_CODE_UNION);
result = instance->plugin ().start_class_type
(name.get (), resuld, nullptr, filename, line);
}
@@ -1140,7 +1140,7 @@ convert_type_cplus_basic (compile_cplus_instance *instance,
| TYPE_INSTANCE_FLAG_RESTRICT)) != 0)
return compile_cplus_convert_qualified (instance, type);
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
case TYPE_CODE_REF:
case TYPE_CODE_RVALUE_REF:
@@ -1198,7 +1198,7 @@ convert_type_cplus_basic (compile_cplus_instance *instance,
}
std::string s = string_printf (_("unhandled TYPE_CODE %d"),
- TYPE_CODE (type));
+ type->code ());
return instance->plugin ().error (s.c_str ());
}
diff --git a/gdb/compile/compile-object-load.c b/gdb/compile/compile-object-load.c
index be4fa76..55a46a3 100644
--- a/gdb/compile/compile-object-load.c
+++ b/gdb/compile/compile-object-load.c
@@ -452,7 +452,7 @@ get_out_value_type (struct symbol *func_sym, struct objfile *objfile,
error (_("No \"%s\" symbol found"), COMPILE_I_EXPR_PTR_TYPE);
gdb_ptr_type = SYMBOL_TYPE (gdb_ptr_type_sym);
gdb_ptr_type = check_typedef (gdb_ptr_type);
- if (TYPE_CODE (gdb_ptr_type) != TYPE_CODE_PTR)
+ if (gdb_ptr_type->code () != TYPE_CODE_PTR)
error (_("Type of \"%s\" is not a pointer"), COMPILE_I_EXPR_PTR_TYPE);
gdb_type_from_ptr = check_typedef (TYPE_TARGET_TYPE (gdb_ptr_type));
@@ -464,14 +464,14 @@ get_out_value_type (struct symbol *func_sym, struct objfile *objfile,
return gdb_type;
}
- if (TYPE_CODE (gdb_type) != TYPE_CODE_PTR)
+ if (gdb_type->code () != TYPE_CODE_PTR)
error (_("Invalid type code %d of symbol \"%s\" "
"in compiled module \"%s\"."),
- TYPE_CODE (gdb_type_from_ptr), COMPILE_I_EXPR_VAL,
+ gdb_type_from_ptr->code (), COMPILE_I_EXPR_VAL,
objfile_name (objfile));
retval = gdb_type_from_ptr;
- switch (TYPE_CODE (gdb_type_from_ptr))
+ switch (gdb_type_from_ptr->code ())
{
case TYPE_CODE_ARRAY:
gdb_type_from_ptr = TYPE_TARGET_TYPE (gdb_type_from_ptr);
@@ -481,7 +481,7 @@ get_out_value_type (struct symbol *func_sym, struct objfile *objfile,
default:
error (_("Invalid type code %d of symbol \"%s\" "
"in compiled module \"%s\"."),
- TYPE_CODE (gdb_type_from_ptr), COMPILE_I_EXPR_PTR_TYPE,
+ gdb_type_from_ptr->code (), COMPILE_I_EXPR_PTR_TYPE,
objfile_name (objfile));
}
if (!types_deeply_equal (gdb_type_from_ptr,
@@ -509,17 +509,17 @@ get_regs_type (struct symbol *func_sym, struct objfile *objfile)
return NULL;
regsp_type = check_typedef (TYPE_FIELD_TYPE (func_type, 0));
- if (TYPE_CODE (regsp_type) != TYPE_CODE_PTR)
+ if (regsp_type->code () != TYPE_CODE_PTR)
error (_("Invalid type code %d of first parameter of function \"%s\" "
"in compiled module \"%s\"."),
- TYPE_CODE (regsp_type), GCC_FE_WRAPPER_FUNCTION,
+ regsp_type->code (), GCC_FE_WRAPPER_FUNCTION,
objfile_name (objfile));
regs_type = check_typedef (TYPE_TARGET_TYPE (regsp_type));
- if (TYPE_CODE (regs_type) != TYPE_CODE_STRUCT)
+ if (regs_type->code () != TYPE_CODE_STRUCT)
error (_("Invalid type code %d of dereferenced first parameter "
"of function \"%s\" in compiled module \"%s\"."),
- TYPE_CODE (regs_type), GCC_FE_WRAPPER_FUNCTION,
+ regs_type->code (), GCC_FE_WRAPPER_FUNCTION,
objfile_name (objfile));
return regs_type;
@@ -555,10 +555,10 @@ store_regs (struct type *regs_type, CORE_ADDR regs_base)
reg_name, pulongest (reg_bitpos), pulongest (reg_bitsize));
reg_offset = reg_bitpos / 8;
- if (TYPE_CODE (reg_type) != TYPE_CODE_INT
- && TYPE_CODE (reg_type) != TYPE_CODE_PTR)
+ if (reg_type->code () != TYPE_CODE_INT
+ && reg_type->code () != TYPE_CODE_PTR)
error (_("Invalid register \"%s\" type code %d"), reg_name,
- TYPE_CODE (reg_type));
+ reg_type->code ());
regnum = compile_register_name_demangle (gdbarch, reg_name);
@@ -646,10 +646,10 @@ compile_object_load (const compile_file_names &file_names,
error (_("Cannot find function \"%s\" in compiled module \"%s\"."),
GCC_FE_WRAPPER_FUNCTION, objfile_name (objfile));
func_type = SYMBOL_TYPE (func_sym);
- if (TYPE_CODE (func_type) != TYPE_CODE_FUNC)
+ if (func_type->code () != TYPE_CODE_FUNC)
error (_("Invalid type code %d of function \"%s\" in compiled "
"module \"%s\"."),
- TYPE_CODE (func_type), GCC_FE_WRAPPER_FUNCTION,
+ func_type->code (), GCC_FE_WRAPPER_FUNCTION,
objfile_name (objfile));
switch (scope)
diff --git a/gdb/compile/compile-object-run.c b/gdb/compile/compile-object-run.c
index 9cef786..cef1d06 100644
--- a/gdb/compile/compile-object-run.c
+++ b/gdb/compile/compile-object-run.c
@@ -149,7 +149,7 @@ compile_object_run (struct compile_module *module)
func_type = copy_type_recursive (objfile, func_type, copied_types);
htab_delete (copied_types);
- gdb_assert (TYPE_CODE (func_type) == TYPE_CODE_FUNC);
+ gdb_assert (func_type->code () == TYPE_CODE_FUNC);
func_val = value_from_pointer (lookup_pointer_type (func_type),
BLOCK_ENTRY_PC (SYMBOL_BLOCK_VALUE (func_sym)));