From d5e178c1d6eb0e7c1a317b925687050aa1cb6c1b Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Tue, 13 Oct 2009 16:57:38 -0700 Subject: Consolidate print_format creation We almost had a factory in print_format::parse_print, so let's take that the rest of the way. This way we don't have so much duplication in initializing the print flags. * staptree.cxx (print_format::parse_print): Replaced with... (print_format::create): New factory to parse and create print_formats. * elaborate.cxx (add_global_var_display): Use this factory. * parse.cxx (parser::parse_symbol): Ditto. * tapset-mark.cxx (mark_var_expanding_visitor::visit_target_symbol_context): Ditto. * tapset-utrace.cxx (utrace_var_expanding_visitor::visit_target_symbol_arg): Ditto. * tapsets.cxx (dwarf_var_expanding_visitor::visit_target_symbol_context): Ditto. (tracepoint_var_expanding_visitor::visit_target_symbol_context) Ditto. --- staptree.h | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'staptree.h') diff --git a/staptree.h b/staptree.h index de148ce0..791b56f4 100644 --- a/staptree.h +++ b/staptree.h @@ -373,10 +373,6 @@ struct print_format: public expression } }; - print_format() - : hist(NULL) - {} - std::string raw_components; std::vector components; format_component delimiter; @@ -385,11 +381,17 @@ struct print_format: public expression static std::string components_to_string(std::vector const & components); static std::vector string_to_components(std::string const & str); - static bool parse_print(const std::string &name, bool &stream, - bool &format, bool &delim, bool &newline, bool &_char); + static print_format* create(const token *t); void print (std::ostream& o) const; void visit (visitor* u); + +private: + print_format(bool stream, bool format, bool delim, bool newline, bool _char): + print_to_stream(stream), print_with_format(format), + print_with_delim(delim), print_with_newline(newline), + print_char(_char), hist(NULL) + {} }; -- cgit