From 27805741410ddb1e62f451cd8a71ad5b92ed7dd8 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Mon, 27 Apr 2009 14:29:19 -0700 Subject: Warn if trying to dereference an enum In translate_components, give a cleaner warning about trying to dereference an enum type, rather than "unexpected type tag". --- tapsets.cxx | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'tapsets.cxx') diff --git a/tapsets.cxx b/tapsets.cxx index bc8df243..976540ed 100644 --- a/tapsets.cxx +++ b/tapsets.cxx @@ -2090,6 +2090,13 @@ struct dwflpp ++i; break; + case DW_TAG_enumeration_type: + throw semantic_error ("field '" + + e->components[i].second + + "' vs. enum type " + + string(dwarf_diename_integrate (die) ?: ""), + e->tok); + break; case DW_TAG_base_type: throw semantic_error ("field '" + e->components[i].second -- cgit From 56eb845656c89a1a7027887c1b3e3dfb3aa866d7 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Mon, 27 Apr 2009 14:38:20 -0700 Subject: Handle more types of types in declaration_resolve Instead of just structs and unions, we now also process typedefs, enums, and base types in iterate_over_globals, so declaration_resolve can find more variations. This especially useful to let @casts reference typedef names. --- tapsets.cxx | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'tapsets.cxx') diff --git a/tapsets.cxx b/tapsets.cxx index 976540ed..b040c622 100644 --- a/tapsets.cxx +++ b/tapsets.cxx @@ -2943,7 +2943,7 @@ dwflpp::has_single_line_record (dwarf_query * q, char const * srcfile, int linen * only picks up top level stuff (i.e. nothing in a lower scope) */ int dwflpp::iterate_over_globals (int (* callback)(Dwarf_Die *, void *), - void * data) + void * data) { int rc = DWARF_CB_OK; Dwarf_Die die; @@ -2955,18 +2955,20 @@ dwflpp::iterate_over_globals (int (* callback)(Dwarf_Die *, void *), if (dwarf_child(cu, &die) != 0) return rc; - do { - /* We're only currently looking for structures and unions, + do + /* We're only currently looking for named types, * although other types of declarations exist */ - if (dwarf_tag(&die) != DW_TAG_structure_type && - dwarf_tag(&die) != DW_TAG_union_type) - continue; - - rc = (*callback)(&die, data); - if (rc != DWARF_CB_OK) - break; - - } while (dwarf_siblingof(&die, &die) == 0); + switch (dwarf_tag(&die)) + { + case DW_TAG_base_type: + case DW_TAG_enumeration_type: + case DW_TAG_structure_type: + case DW_TAG_typedef: + case DW_TAG_union_type: + rc = (*callback)(&die, data); + break; + } + while (rc == DWARF_CB_OK && dwarf_siblingof(&die, &die) == 0); return rc; } -- cgit