summaryrefslogtreecommitdiffstats
path: root/staptree.h
diff options
context:
space:
mode:
authorgraydon <graydon>2005-08-10 03:15:21 +0000
committergraydon <graydon>2005-08-10 03:15:21 +0000
commitd7f3e0c5d0b0af0dcb5f8168e1184f15a0554a4e (patch)
tree905bbe1cff9ae08a6cf9f314fd4d5bc8976215fa /staptree.h
parent0110f903329ab531bcbe9d555d5b6f6dc77d8a54 (diff)
downloadsystemtap-steved-d7f3e0c5d0b0af0dcb5f8168e1184f15a0554a4e.tar.gz
systemtap-steved-d7f3e0c5d0b0af0dcb5f8168e1184f15a0554a4e.tar.xz
systemtap-steved-d7f3e0c5d0b0af0dcb5f8168e1184f15a0554a4e.zip
2005-08-09 Graydon Hoare <graydon@redhat.com>
* staptree.{cxx,h} (target_symbol): New struct. (*_visitor::visit_target_symbol): Support it. (visitor::active_lvalues) (visitor::is_active_lvalue) (visitor::push_active_lvalue) (visitor::pop_active_lvalue): Support lvalue-detection. (delete_statement::visit) (pre_crement::visit) (post_crement::visit) (assignment::visit): Push and pop lvalue expressions. * elaborate.{cxx,h} (lvalule_aware_traversing_visitor): Remove class. (no_map_mutation_during_iteration_check) (mutated_map_collector): Update lvalue logic. (typeresolution_info::visit_target_symbol): Add, throw error. * parse.{cxx,h} (tt2str) (tok_is) (parser::expect_*) (parser::peek_*): New helpers. (parser::parse_symbol): Rewrite, support target_symbols. * translate.cxx (c_unparser::visit_target_symbol): Implement. * tapsets.cxx (var_expanding_copy_visitor): Update lvalue logic, change visit_symbol to visit_target_symbol.
Diffstat (limited to 'staptree.h')
-rw-r--r--staptree.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/staptree.h b/staptree.h
index 34e04ec7..93537921 100644
--- a/staptree.h
+++ b/staptree.h
@@ -177,6 +177,21 @@ struct symbol: public expression
};
+struct target_symbol : public expression
+{
+ enum component_type
+ {
+ comp_struct_member,
+ comp_struct_pointer_member,
+ comp_literal_array_index
+ };
+ std::string base_name;
+ std::vector<std::pair<component_type, std::string> > components;
+ void print (std::ostream& o);
+ void visit (visitor* u);
+};
+
+
struct arrayindex: public expression
{
std::string base;
@@ -426,6 +441,12 @@ struct probe_alias: public probe
// statement/expression tree.
struct visitor
{
+ // Machinery for differentiating lvalue visits from non-lvalue.
+ std::vector<expression *> active_lvalues;
+ bool is_active_lvalue(expression *e);
+ void push_active_lvalue(expression *e);
+ void pop_active_lvalue();
+
virtual ~visitor () {}
virtual void visit_block (block *s) = 0;
virtual void visit_embeddedcode (embeddedcode *s) = 0;
@@ -453,6 +474,7 @@ struct visitor
virtual void visit_ternary_expression (ternary_expression* e) = 0;
virtual void visit_assignment (assignment* e) = 0;
virtual void visit_symbol (symbol* e) = 0;
+ virtual void visit_target_symbol (target_symbol* e) = 0;
virtual void visit_arrayindex (arrayindex* e) = 0;
virtual void visit_functioncall (functioncall* e) = 0;
};
@@ -489,6 +511,7 @@ struct traversing_visitor: public visitor
void visit_ternary_expression (ternary_expression* e);
void visit_assignment (assignment* e);
void visit_symbol (symbol* e);
+ void visit_target_symbol (target_symbol* e);
void visit_arrayindex (arrayindex* e);
void visit_functioncall (functioncall* e);
};
@@ -530,6 +553,7 @@ struct throwing_visitor: public visitor
void visit_ternary_expression (ternary_expression* e);
void visit_assignment (assignment* e);
void visit_symbol (symbol* e);
+ void visit_target_symbol (target_symbol* e);
void visit_arrayindex (arrayindex* e);
void visit_functioncall (functioncall* e);
};
@@ -573,6 +597,7 @@ struct deep_copy_visitor: public visitor
virtual void visit_ternary_expression (ternary_expression* e);
virtual void visit_assignment (assignment* e);
virtual void visit_symbol (symbol* e);
+ virtual void visit_target_symbol (target_symbol* e);
virtual void visit_arrayindex (arrayindex* e);
virtual void visit_functioncall (functioncall* e);
};