From c67847a0d05f8c7207513e79378fc8d84563e109 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Fri, 31 Jul 2009 17:00:09 -0700 Subject: Make a real type for target_symbol->components Now the dereferences on target_symbol and cast_op are tracked with a struct instead of just a generic pair. The first immediate benefit is that we can track the token for more exact error reporting. * staptree.h (target_symbol): Add a new component type. * staptree.cxx (target_symbol::component::print): New. (operator<<(ostream&, target_symbol::component&): New. (target_symbol::print): Adapt component printing. (cast_op::print): Ditto. * parse.cxx (parser::parse_target_symbol_components): Adapt to the new component construction. * dwflpp.cxx (dwflpp::find_struct_member): take the component as a parameter for a better token in error messages (dwflpp::translate_components): Adapt to the new component type. * tapsets.cxx (dwarf_var_expanding_visitor::visit_target_symbol): Don't overwrite the token in target_symbol saved errors. (tracepoint_var_expanding_visitor::visit_target_symbol_arg): Ditto. --- parse.cxx | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'parse.cxx') diff --git a/parse.cxx b/parse.cxx index 29d97589..9d4a06a6 100644 --- a/parse.cxx +++ b/parse.cxx @@ -2571,21 +2571,20 @@ parser::parse_target_symbol_components (target_symbol* e) { while (true) { - string c; if (peek_op ("->")) { - next(); - expect_ident_or_keyword (c); - e->components.push_back - (make_pair (target_symbol::comp_struct_member, c)); + const token* t = next(); + string member; + expect_ident_or_keyword (member); + e->components.push_back (target_symbol::component(t, member)); } else if (peek_op ("[")) { - next(); - expect_unknown (tok_number, c); + const token* t = next(); + int64_t index; + expect_number (index); + e->components.push_back (target_symbol::component(t, index)); expect_op ("]"); - e->components.push_back - (make_pair (target_symbol::comp_literal_array_index, c)); } else break; -- cgit