From 450cc664d02ec242327e63a84534aacb1c998c6d Mon Sep 17 00:00:00 2001 From: Abegail Jakop Date: Fri, 13 Jun 2014 14:35:07 -0400 Subject: [PATCH] translate.cxx: fix counting in max_action_info translate.cxx: removed the creation of temporary visitors to visit the thenblock and elseblock in visit_if_statement in max_action_info because of errors with recursive calls. now uses only one visitor to visit blocks. --- translate.cxx | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/translate.cxx b/translate.cxx index 5d6821f39..a19819fd0 100644 --- a/translate.cxx +++ b/translate.cxx @@ -6698,15 +6698,22 @@ struct max_action_info: public functioncall_traversing_visitor { add_stmt_count(1); stmt->condition->visit(this); - max_action_info tmp_visitor_then (sess); - max_action_info tmp_visitor_else (sess); - stmt->thenblock->visit(& tmp_visitor_then); + + unsigned tmp_statement_count = statement_count; + unsigned then_count = 0; + unsigned else_count = 0; + + stmt->thenblock->visit(this); + then_count = statement_count - tmp_statement_count; + statement_count = tmp_statement_count; if (stmt->elseblock) { - stmt->elseblock->visit(& tmp_visitor_else); + stmt->elseblock->visit(this); + else_count = statement_count - tmp_statement_count; + statement_count = tmp_statement_count; } - add_stmt_count(max(tmp_visitor_then.statement_count, tmp_visitor_else.statement_count)); + add_stmt_count(max(then_count, else_count)); } void visit_null_statement (null_statement *stmt) { add_stmt_count(1); } -- 2.43.5