Remove redundant class for get variable name.
--- a/stage3/constant_folding.cc Fri Dec 28 16:24:17 2012 +0100
+++ b/stage3/constant_folding.cc Mon Dec 31 11:02:38 2012 +0100
@@ -952,7 +952,7 @@
void *constant_folding_c::visit(symbolic_variable_c *symbol) {
std::string varName;
- varName = convert.toString(symbol->var_name);
+ varName = get_var_name_c::get_name(symbol->var_name)->value;
if (values.count(varName) > 0) {
symbol->const_value = values[varName];
}
@@ -969,7 +969,7 @@
search_var_instance_decl_c search_var_instance_decl(symbol);
function_param_iterator_c fpi(symbol);
while((var_name = fpi.next()) != NULL) {
- std::string varName = convert.toString(var_name);
+ std::string varName = get_var_name_c::get_name(var_name)->value;
symbol_c *varDecl = search_var_instance_decl.get_decl(var_name);
values[varName] = varDecl->const_value;
}
@@ -1258,7 +1258,7 @@
symbol->r_exp->accept(*this);
symbol->l_exp->const_value = symbol->r_exp->const_value;
- varName = convert.toString(symbol->l_exp);
+ varName = get_var_name_c::get_name(symbol->l_exp)->value;
values[varName] = symbol->l_exp->const_value;
return NULL;
@@ -1320,7 +1320,7 @@
values_incoming = values; /* save incoming status */
symbol->beg_expression->accept(*this);
symbol->end_expression->accept(*this);
- varName = convert.toString(symbol->control_variable);
+ varName = get_var_name_c::get_name(symbol->control_variable)->value;
values[varName] = symbol->beg_expression->const_value;
/* Optimize dead code */
--- a/stage3/constant_folding.hh Fri Dec 28 16:24:17 2012 +0100
+++ b/stage3/constant_folding.hh Mon Dec 31 11:02:38 2012 +0100
@@ -43,30 +43,6 @@
#include "../absyntax_utils/absyntax_utils.hh"
-class convert_c : public iterator_visitor_c {
- std::string text;
-
-public:
- convert_c(symbol_c *symbol = NULL) {
- text = "";
- }
-
- std::string toString(symbol_c *symbol) {
- symbol->accept(*this);
- return text;
- }
-
- void *visit(identifier_c *symbol) {
- text = symbol->value;
- return NULL;
- }
-
- void *visit(symbolic_variable_c *symbol) {
- symbol->var_name->accept(*this);
- return NULL;
- }
-};
-
class constant_folding_c : public iterator_visitor_c {
search_varfb_instance_type_c *search_varfb_instance_type;
int error_count;
@@ -76,7 +52,6 @@
symbol_c *prev_il_instruction;
/* the current IL operand being analyzed */
symbol_c *il_operand;
- convert_c convert;
public:
constant_folding_c(symbol_c *symbol = NULL);