Skip to content

Commit 4654abc

Browse files
committed
Remove shadowing parameter ns
At all call sites, ns referred to the class member of the same name, there is no need to pass it around.
1 parent 8d3c9aa commit 4654abc

File tree

2 files changed

+16
-23
lines changed

2 files changed

+16
-23
lines changed

src/linking/linking.cpp

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,13 @@ bool casting_replace_symbolt::replace_symbol_expr(symbol_exprt &s) const
4040
}
4141

4242
std::string linkingt::expr_to_string(
43-
const namespacet &ns,
4443
const irep_idt &identifier,
4544
const exprt &expr) const
4645
{
4746
return from_expr(ns, identifier, expr);
4847
}
4948

5049
std::string linkingt::type_to_string(
51-
const namespacet &ns,
5250
const irep_idt &identifier,
5351
const typet &type) const
5452
{
@@ -72,7 +70,6 @@ static const typet &follow_tags_symbols(
7270
}
7371

7472
std::string linkingt::type_to_string_verbose(
75-
const namespacet &ns,
7673
const symbolt &symbol,
7774
const typet &type) const
7875
{
@@ -91,7 +88,7 @@ std::string linkingt::type_to_string_verbose(
9188
{
9289
const typet &subtype = c.type();
9390
result+=" ";
94-
result+=type_to_string(ns, symbol.name, subtype);
91+
result+=type_to_string(symbol.name, subtype);
9592
result+=' ';
9693

9794
if(!c.get_base_name().empty())
@@ -108,15 +105,15 @@ std::string linkingt::type_to_string_verbose(
108105
}
109106
else if(followed.id()==ID_pointer)
110107
{
111-
return type_to_string_verbose(ns, symbol, followed.subtype())+" *";
108+
return type_to_string_verbose(symbol, followed.subtype())+" *";
112109
}
113110
else if(followed.id()==ID_incomplete_struct ||
114111
followed.id()==ID_incomplete_union)
115112
{
116-
return type_to_string(ns, symbol.name, type)+" (incomplete)";
113+
return type_to_string(symbol.name, type)+" (incomplete)";
117114
}
118115

119-
return type_to_string(ns, symbol.name, type);
116+
return type_to_string(symbol.name, type);
120117
}
121118

122119
void linkingt::detailed_conflict_report_rec(
@@ -256,8 +253,8 @@ void linkingt::detailed_conflict_report_rec(
256253
if(t1.subtype()!=t2.subtype())
257254
{
258255
msg="enum value types are different (";
259-
msg+=type_to_string(ns, old_symbol.name, t1.subtype())+'/';
260-
msg+=type_to_string(ns, new_symbol.name, t2.subtype())+')';
256+
msg+=type_to_string(old_symbol.name, t1.subtype())+'/';
257+
msg+=type_to_string(new_symbol.name, t2.subtype())+')';
261258
}
262259
else if(members1.size()!=members2.size())
263260
{
@@ -360,12 +357,12 @@ void linkingt::detailed_conflict_report_rec(
360357
{
361358
error() << '\n';
362359
error() << "reason for conflict at "
363-
<< expr_to_string(ns, "", conflict_path)
360+
<< expr_to_string("", conflict_path)
364361
<< ": " << msg << '\n';
365362

366363
error() << '\n';
367-
error() << type_to_string_verbose(ns, old_symbol, t1) << '\n';
368-
error() << type_to_string_verbose(ns, new_symbol, t2) << '\n';
364+
error() << type_to_string_verbose(old_symbol, t1) << '\n';
365+
error() << type_to_string_verbose(new_symbol, t2) << '\n';
369366
}
370367

371368
#ifdef DEBUG
@@ -385,10 +382,10 @@ void linkingt::link_error(
385382
<< "'" << '\n';
386383
error() << "old definition in module `" << old_symbol.module
387384
<< "' " << old_symbol.location << '\n'
388-
<< type_to_string_verbose(ns, old_symbol) << '\n';
385+
<< type_to_string_verbose(old_symbol) << '\n';
389386
error() << "new definition in module `" << new_symbol.module
390387
<< "' " << new_symbol.location << '\n'
391-
<< type_to_string_verbose(ns, new_symbol) << eom;
388+
<< type_to_string_verbose(new_symbol) << eom;
392389
}
393390

394391
void linkingt::link_warning(
@@ -403,10 +400,10 @@ void linkingt::link_warning(
403400
<< "\"" << '\n';
404401
warning() << "old definition in module " << old_symbol.module
405402
<< " " << old_symbol.location << '\n'
406-
<< type_to_string_verbose(ns, old_symbol) << '\n';
403+
<< type_to_string_verbose(old_symbol) << '\n';
407404
warning() << "new definition in module " << new_symbol.module
408405
<< " " << new_symbol.location << '\n'
409-
<< type_to_string_verbose(ns, new_symbol) << eom;
406+
<< type_to_string_verbose(new_symbol) << eom;
410407
}
411408

412409
irep_idt linkingt::rename(const irep_idt id)
@@ -1043,12 +1040,12 @@ void linkingt::duplicate_object_symbol(
10431040
warning() << "using old value in module "
10441041
<< old_symbol.module << " "
10451042
<< old_symbol.value.find_source_location() << '\n'
1046-
<< expr_to_string(ns, old_symbol.name, tmp_old)
1043+
<< expr_to_string(old_symbol.name, tmp_old)
10471044
<< '\n';
10481045
warning() << "ignoring new value in module "
10491046
<< new_symbol.module << " "
10501047
<< new_symbol.value.find_source_location() << '\n'
1051-
<< expr_to_string(ns, new_symbol.name, tmp_new)
1048+
<< expr_to_string(new_symbol.name, tmp_new)
10521049
<< eom;
10531050
}
10541051
}

src/linking/linking_class.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,25 +112,21 @@ class linkingt:public typecheckt
112112
const symbolt &new_symbol);
113113

114114
std::string expr_to_string(
115-
const namespacet &ns,
116115
const irep_idt &identifier,
117116
const exprt &expr) const;
118117

119118
std::string type_to_string(
120-
const namespacet &ns,
121119
const irep_idt &identifier,
122120
const typet &type) const;
123121

124122
std::string type_to_string_verbose(
125-
const namespacet &ns,
126123
const symbolt &symbol,
127124
const typet &type) const;
128125

129126
std::string type_to_string_verbose(
130-
const namespacet &ns,
131127
const symbolt &symbol) const
132128
{
133-
return type_to_string_verbose(ns, symbol, symbol.type);
129+
return type_to_string_verbose(symbol, symbol.type);
134130
}
135131

136132
void detailed_conflict_report_rec(

0 commit comments

Comments
 (0)