diff options
author | graydon <graydon> | 2005-07-08 03:11:36 +0000 |
---|---|---|
committer | graydon <graydon> | 2005-07-08 03:11:36 +0000 |
commit | 85365d1b9cfd2d75cb847be4ced3de583f91865b (patch) | |
tree | 66ed4360c2114dd8ad4c316a14cde3d474f09976 /staptree.h | |
parent | 26a23e7acee698ac38349f19d1a9602ed0f6a4fd (diff) | |
download | systemtap-steved-85365d1b9cfd2d75cb847be4ced3de583f91865b.tar.gz systemtap-steved-85365d1b9cfd2d75cb847be4ced3de583f91865b.tar.xz systemtap-steved-85365d1b9cfd2d75cb847be4ced3de583f91865b.zip |
2005-07-07 Graydon Hoare <graydon@redhat.com>
* staptree.{h,cxx} (deep_copy_visitor): New visitor.
* elaborate.cxx
(derived_probe::derived_probe):
(alias_expansion_builder::build): Use it.
* testsuite/semok/fifteen.stp: New test which relies on deep copy.
Diffstat (limited to 'staptree.h')
-rw-r--r-- | staptree.h | 43 |
1 files changed, 43 insertions, 0 deletions
@@ -9,6 +9,7 @@ #ifndef STAPTREE_H #define STAPTREE_H +#include <stack> #include <string> #include <vector> #include <iostream> @@ -515,6 +516,48 @@ struct throwing_visitor: public visitor void visit_functioncall (functioncall* e); }; +// A visitor which performs a deep copy of the root node it's applied +// to. NB: It does not copy any of the variable or function +// declarations; those fields are set to NULL, assuming you want to +// re-infer the declarations in a new context (the one you're copying +// to). + +struct deep_copy_visitor: public visitor +{ + std::stack<void *> targets; + + static statement *deep_copy (statement *s); + static block *deep_copy (block *s); + + void visit_block (block *s); + void visit_null_statement (null_statement *s); + void visit_expr_statement (expr_statement *s); + void visit_if_statement (if_statement* s); + void visit_for_loop (for_loop* s); + void visit_foreach_loop (foreach_loop* s); + void visit_return_statement (return_statement* s); + void visit_delete_statement (delete_statement* s); + void visit_next_statement (next_statement* s); + void visit_break_statement (break_statement* s); + void visit_continue_statement (continue_statement* s); + void visit_literal_string (literal_string* e); + void visit_literal_number (literal_number* e); + void visit_binary_expression (binary_expression* e); + void visit_unary_expression (unary_expression* e); + void visit_pre_crement (pre_crement* e); + void visit_post_crement (post_crement* e); + void visit_logical_or_expr (logical_or_expr* e); + void visit_logical_and_expr (logical_and_expr* e); + void visit_array_in (array_in* e); + void visit_comparison (comparison* e); + void visit_concatenation (concatenation* e); + void visit_ternary_expression (ternary_expression* e); + void visit_assignment (assignment* e); + void visit_symbol (symbol* e); + void visit_arrayindex (arrayindex* e); + void visit_functioncall (functioncall* e); +}; + #endif // STAPTREE_H |