diff options
Diffstat (limited to 'staptree.cxx')
-rw-r--r-- | staptree.cxx | 69 |
1 files changed, 68 insertions, 1 deletions
diff --git a/staptree.cxx b/staptree.cxx index 9276586b..cca79981 100644 --- a/staptree.cxx +++ b/staptree.cxx @@ -1,5 +1,5 @@ // parse tree functions -// Copyright (C) 2005-2009 Red Hat Inc. +// Copyright (C) 2005-2010 Red Hat Inc. // // This file is part of systemtap, and is free software. You can // redistribute it and/or modify it under the terms of the GNU General @@ -903,6 +903,18 @@ block::block (statement* car, statement* cdr) +void try_block::print (ostream& o) const +{ + o << "try {" << endl; + if (try_block) o << *try_block << endl; + o << "} catch "; + if (catch_error_var) o << "(" << *catch_error_var << ") "; + o << "{" << endl; + if (catch_block) o << *catch_block << endl; + o << "}" << endl; +} + + void for_loop::print (ostream& o) const { o << "for ("; @@ -1140,6 +1152,13 @@ block::visit (visitor* u) void +try_block::visit (visitor* u) +{ + u->visit_try_block (this); +} + + +void embeddedcode::visit (visitor* u) { u->visit_embeddedcode (this); @@ -1525,6 +1544,17 @@ traversing_visitor::visit_block (block* s) } void +traversing_visitor::visit_try_block (try_block* s) +{ + if (s->try_block) + s->try_block->visit (this); + if (s->catch_error_var) + s->catch_error_var->visit (this); + if (s->catch_block) + s->catch_block->visit (this); +} + +void traversing_visitor::visit_embeddedcode (embeddedcode*) { } @@ -1778,6 +1808,21 @@ functioncall_traversing_visitor::visit_functioncall (functioncall* e) void +varuse_collecting_visitor::visit_try_block (try_block *s) +{ + if (s->try_block) + s->try_block->visit (this); + if (s->catch_error_var) + written.insert (s->catch_error_var->referent); + if (s->catch_block) + s->catch_block->visit (this); + + // NB: don't functioncall_traversing_visitor::visit_try_block (s); + // since that would count s->catch_error_var as a read also. +} + + +void varuse_collecting_visitor::visit_embeddedcode (embeddedcode *s) { assert (current_function); // only they get embedded code @@ -2067,6 +2112,13 @@ throwing_visitor::visit_block (block* s) } void +throwing_visitor::visit_try_block (try_block* s) +{ + throwone (s->tok); +} + + +void throwing_visitor::visit_embeddedcode (embeddedcode* s) { throwone (s->tok); @@ -2279,6 +2331,15 @@ update_visitor::visit_block (block* s) } void +update_visitor::visit_try_block (try_block* s) +{ + replace (s->try_block); + replace (s->catch_error_var); + replace (s->catch_block); + provide (s); +} + +void update_visitor::visit_embeddedcode (embeddedcode* s) { provide (s); @@ -2556,6 +2617,12 @@ deep_copy_visitor::visit_block (block* s) } void +deep_copy_visitor::visit_try_block (try_block* s) +{ + update_visitor::visit_try_block(new try_block(*s)); +} + +void deep_copy_visitor::visit_embeddedcode (embeddedcode* s) { update_visitor::visit_embeddedcode(new embeddedcode(*s)); |