aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/cgraph.h5
-rw-r--r--gcc/symtab.cc15
2 files changed, 16 insertions, 4 deletions
diff --git a/gcc/cgraph.h b/gcc/cgraph.h
index a937d0a..aa2207b 100644
--- a/gcc/cgraph.h
+++ b/gcc/cgraph.h
@@ -38,6 +38,8 @@ class ipa_opt_pass_d;
typedef ipa_opt_pass_d *ipa_opt_pass;
/* Toplevel consists of functions, variables and assembly.
+ Make sure toplevel_type_names in symtab.cc is kept in sync
+ with this.
TODO: add labels and CONST_DECLs. */
enum toplevel_type
{
@@ -45,7 +47,8 @@ enum toplevel_type
TOPLEVEL_ASM,
SYMTAB_SYMBOL,
SYMTAB_FUNCTION,
- SYMTAB_VARIABLE
+ SYMTAB_VARIABLE,
+ TOPLEVEL_MAX
};
/* Section names are stored as reference counted strings in GGC safe hashtable
diff --git a/gcc/symtab.cc b/gcc/symtab.cc
index 20dfe09..fb2aca5 100644
--- a/gcc/symtab.cc
+++ b/gcc/symtab.cc
@@ -873,7 +873,16 @@ symtab_node::dump_referring (FILE *file)
fprintf (file, "\n");
}
-static const char * const symtab_type_names[] = {"symbol", "function", "variable"};
+static const char * const toplevel_type_names[] =
+{
+ "base",
+ "asm",
+ "symbol",
+ "function",
+ "variable",
+};
+
+static_assert (ARRAY_SIZE(toplevel_type_names)==TOPLEVEL_MAX);
/* Dump the visibility of the symbol. */
@@ -889,7 +898,7 @@ symtab_node::get_visibility_string () const
const char *
symtab_node::get_symtab_type_string () const
{
- return symtab_type_names[type];
+ return toplevel_type_names[type];
}
/* Dump base fields of symtab nodes to F. Not to be used directly. */
@@ -904,7 +913,7 @@ symtab_node::dump_base (FILE *f)
fprintf (f, "%s (%s)", dump_asm_name (), name ());
if (dump_flags & TDF_ADDRESS)
dump_addr (f, " @", (void *)this);
- fprintf (f, "\n Type: %s", symtab_type_names[type]);
+ fprintf (f, "\n Type: %s", toplevel_type_names[type]);
if (definition)
fprintf (f, " definition");