Skip to content

Commit 20d2445

Browse files
committed
Remove unused rename(expr, old_id, new_id)
There is rename_symbolt providing the same functionality, and it is actually used and optimised. cr https://code.amazon.com/reviews/CR-1629519
1 parent 430d402 commit 20d2445

File tree

2 files changed

+1
-39
lines changed

2 files changed

+1
-39
lines changed

src/util/rename.cpp

+1-33
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,9 @@ Author: Daniel Kroening, [email protected]
88

99
#include "rename.h"
1010

11-
#include <algorithm>
11+
#include <string>
1212

1313
#include "symbol.h"
14-
#include "expr.h"
1514
#include "namespace.h"
1615

1716
/// automated variable renaming
@@ -35,34 +34,3 @@ void get_new_name(irep_idt &new_name, const namespacet &ns)
3534

3635
new_name=prefix+std::to_string(ns.get_max(prefix)+1);
3736
}
38-
39-
/// automated variable renaming
40-
/// \par parameters: expression, old name, new name
41-
/// \return modifies the expression returns false iff something was renamed
42-
bool rename(exprt &expr, const irep_idt &old_name,
43-
const irep_idt &new_name)
44-
{
45-
bool result=true;
46-
47-
if(expr.id()==ID_symbol)
48-
{
49-
if(expr.get(ID_identifier)==old_name)
50-
{
51-
expr.set(ID_identifier, new_name);
52-
result=false;
53-
}
54-
}
55-
else
56-
{
57-
if(expr.id()==ID_address_of)
58-
{
59-
// TODO
60-
}
61-
else
62-
Forall_operands(it, expr)
63-
if(!rename(*it, old_name, new_name))
64-
result=false;
65-
}
66-
67-
return result;
68-
}

src/util/rename.h

-6
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,4 @@ void get_new_name(symbolt &symbol,
2626
void get_new_name(irep_idt &new_name,
2727
const namespacet &ns);
2828

29-
// true: did nothing
30-
// false: renamed something in the expression
31-
32-
bool rename(exprt &expr, const irep_idt &old_name,
33-
const irep_idt &new_name);
34-
3529
#endif // CPROVER_UTIL_RENAME_H

0 commit comments

Comments
 (0)