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. --- staptree.h | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'staptree.h') diff --git a/staptree.h b/staptree.h index 16f0256a..70746f31 100644 --- a/staptree.h +++ b/staptree.h @@ -229,9 +229,24 @@ struct target_symbol: public symbol comp_struct_member, comp_literal_array_index }; + + struct component + { + const token* tok; + component_type type; + std::string member; // comp_struct_member + int64_t num_index; // comp_literal_array_index + + component(const token* t, const std::string& m): + tok(t), type(comp_struct_member), member(m), num_index(0) {} + component(const token* t, int64_t n): + tok(t), type(comp_literal_array_index), num_index(n) {} + void print (std::ostream& o) const; + }; + bool addressof; std::string base_name; - std::vector > components; + std::vector components; std::string probe_context_var; semantic_error* saved_conversion_error; target_symbol(): addressof(false), saved_conversion_error (0) {} @@ -239,6 +254,8 @@ struct target_symbol: public symbol void visit (visitor* u); }; +std::ostream& operator << (std::ostream& o, const target_symbol::component& c); + struct cast_op: public target_symbol { -- cgit