diff options
author | graydon <graydon> | 2005-08-10 03:15:21 +0000 |
---|---|---|
committer | graydon <graydon> | 2005-08-10 03:15:21 +0000 |
commit | d7f3e0c5d0b0af0dcb5f8168e1184f15a0554a4e (patch) | |
tree | 905bbe1cff9ae08a6cf9f314fd4d5bc8976215fa /elaborate.cxx | |
parent | 0110f903329ab531bcbe9d555d5b6f6dc77d8a54 (diff) | |
download | systemtap-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 'elaborate.cxx')
-rw-r--r-- | elaborate.cxx | 60 |
1 files changed, 11 insertions, 49 deletions
diff --git a/elaborate.cxx b/elaborate.cxx index c9f1fcd1..0cecab7e 100644 --- a/elaborate.cxx +++ b/elaborate.cxx @@ -396,53 +396,9 @@ symresolution_info::derive_probes (match_node * root, // Map usage checks // -class lvalue_aware_traversing_visitor - : public traversing_visitor -{ - unsigned lval_depth; -public: - - lvalue_aware_traversing_visitor() : lval_depth(0) {} - - bool is_in_lvalue() - { - return lval_depth > 0; - } - - virtual void visit_pre_crement (pre_crement* e) - { - ++lval_depth; - e->operand->visit (this); - --lval_depth; - } - - virtual void visit_post_crement (post_crement* e) - { - ++lval_depth; - e->operand->visit (this); - --lval_depth; - } - - virtual void visit_assignment (assignment* e) - { - ++lval_depth; - e->left->visit (this); - --lval_depth; - e->right->visit (this); - } - - virtual void visit_delete_statement (delete_statement* s) - { - ++lval_depth; - s->value->visit (this); - --lval_depth; - } - -}; - struct mutated_map_collector - : public lvalue_aware_traversing_visitor + : public traversing_visitor { set<vardecl *> * mutated_maps; @@ -452,14 +408,14 @@ struct mutated_map_collector void visit_arrayindex (arrayindex *e) { - if (is_in_lvalue()) + if (is_active_lvalue(e)) mutated_maps->insert(e->referent); } }; struct no_map_mutation_during_iteration_check - : public lvalue_aware_traversing_visitor + : public traversing_visitor { systemtap_session & session; map<functiondecl *,set<vardecl *> *> & function_mutates_maps; @@ -473,7 +429,7 @@ struct no_map_mutation_during_iteration_check void visit_arrayindex (arrayindex *e) { - if (is_in_lvalue()) + if (is_active_lvalue(e)) { for (unsigned i = 0; i < maps_being_iterated.size(); ++i) { @@ -1346,13 +1302,19 @@ typeresolution_info::visit_symbol (symbol* e) if (e->referent->arity > 0) unresolved (e->tok); // symbol resolution should not permit this - // XXX: but consider "delete <array>;" and similar constructs else resolve_2types (e, e->referent, this, t); } void +typeresolution_info::visit_target_symbol (target_symbol* e) +{ + throw semantic_error("unresolved target-symbol expression", e->tok); +} + + +void typeresolution_info::visit_arrayindex (arrayindex* e) { assert (e->referent != 0); |