]> sourceware.org Git - systemtap.git/commitdiff
translate.cxx: fix counting in max_action_info
authorAbegail Jakop <ajakop@redhat.com>
Fri, 13 Jun 2014 18:35:07 +0000 (14:35 -0400)
committerAbegail Jakop <ajakop@redhat.com>
Tue, 17 Jun 2014 14:40:38 +0000 (10:40 -0400)
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

index 5d6821f390c3e741745b2e932dedd73699b59eaf..a19819fd0a6a903c0364ac6e21b6012007af7d3b 100644 (file)
@@ -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); }
This page took 0.038371 seconds and 5 git commands to generate.