From 1cd151d5b9e1fd46590d5e4c3473a86ea9bbe043 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Tue, 10 Feb 2009 18:29:55 -0800 Subject: Simplify dead_stmtexpr_remover * staptree.h (update_visitor::require): Add a clearok parameter for optimizing traversers to signal that they're ready for NULL back. * elaborate.cxx (dead_stmtexpr_remover): Convert to an update_visitor. --- staptree.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'staptree.h') diff --git a/staptree.h b/staptree.h index 00809ed0..0cd0ee0d 100644 --- a/staptree.h +++ b/staptree.h @@ -815,7 +815,7 @@ struct throwing_visitor: public visitor struct update_visitor: public visitor { - template T require (T src) + template T require (T src, bool clearok=false) { T dst = NULL; if (src != NULL) @@ -824,7 +824,7 @@ struct update_visitor: public visitor assert(!targets.empty()); dst = static_cast(targets.top()); targets.pop(); - assert(dst); + assert(clearok || dst); } return dst; } @@ -874,7 +874,7 @@ private: }; template <> indexable* -update_visitor::require (indexable* src); +update_visitor::require (indexable* src, bool clearok); // 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 -- cgit