Skip to content

Commit 154b6cf

Browse files
authored
Merge pull request #3357 from tautschnig/vs-shadow-10
Remove shadowing parameter ns [blocks: #2310]
2 parents 33ec17e + e3da0f2 commit 154b6cf

File tree

2 files changed

+26
-38
lines changed

2 files changed

+26
-38
lines changed

src/linking/linking.cpp

Lines changed: 25 additions & 33 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
{
@@ -359,13 +356,12 @@ void linkingt::detailed_conflict_report_rec(
359356
if(!msg.empty())
360357
{
361358
error() << '\n';
362-
error() << "reason for conflict at "
363-
<< expr_to_string(ns, "", conflict_path)
359+
error() << "reason for conflict at " << expr_to_string("", conflict_path)
364360
<< ": " << msg << '\n';
365361

366362
error() << '\n';
367-
error() << type_to_string_verbose(ns, old_symbol, t1) << '\n';
368-
error() << type_to_string_verbose(ns, new_symbol, t2) << '\n';
363+
error() << type_to_string_verbose(old_symbol, t1) << '\n';
364+
error() << type_to_string_verbose(new_symbol, t2) << '\n';
369365
}
370366

371367
#ifdef DEBUG
@@ -383,12 +379,12 @@ void linkingt::link_error(
383379
error() << "error: " << msg << " `"
384380
<< old_symbol.display_name()
385381
<< "'" << '\n';
386-
error() << "old definition in module `" << old_symbol.module
387-
<< "' " << old_symbol.location << '\n'
388-
<< type_to_string_verbose(ns, old_symbol) << '\n';
389-
error() << "new definition in module `" << new_symbol.module
390-
<< "' " << new_symbol.location << '\n'
391-
<< type_to_string_verbose(ns, new_symbol) << eom;
382+
error() << "old definition in module `" << old_symbol.module << "' "
383+
<< old_symbol.location << '\n'
384+
<< type_to_string_verbose(old_symbol) << '\n';
385+
error() << "new definition in module `" << new_symbol.module << "' "
386+
<< new_symbol.location << '\n'
387+
<< type_to_string_verbose(new_symbol) << eom;
392388
}
393389

394390
void linkingt::link_warning(
@@ -401,12 +397,12 @@ void linkingt::link_warning(
401397
warning() << "warning: " << msg << " \""
402398
<< old_symbol.display_name()
403399
<< "\"" << '\n';
404-
warning() << "old definition in module " << old_symbol.module
405-
<< " " << old_symbol.location << '\n'
406-
<< type_to_string_verbose(ns, old_symbol) << '\n';
407-
warning() << "new definition in module " << new_symbol.module
408-
<< " " << new_symbol.location << '\n'
409-
<< type_to_string_verbose(ns, new_symbol) << eom;
400+
warning() << "old definition in module " << old_symbol.module << " "
401+
<< old_symbol.location << '\n'
402+
<< type_to_string_verbose(old_symbol) << '\n';
403+
warning() << "new definition in module " << new_symbol.module << " "
404+
<< new_symbol.location << '\n'
405+
<< type_to_string_verbose(new_symbol) << eom;
410406
}
411407

412408
irep_idt linkingt::rename(const irep_idt id)
@@ -1040,16 +1036,12 @@ void linkingt::duplicate_object_symbol(
10401036

10411037
warning() << "warning: conflicting initializers for"
10421038
<< " variable \"" << old_symbol.name << "\"\n";
1043-
warning() << "using old value in module "
1044-
<< old_symbol.module << " "
1039+
warning() << "using old value in module " << old_symbol.module << " "
10451040
<< old_symbol.value.find_source_location() << '\n'
1046-
<< expr_to_string(ns, old_symbol.name, tmp_old)
1047-
<< '\n';
1048-
warning() << "ignoring new value in module "
1049-
<< new_symbol.module << " "
1041+
<< expr_to_string(old_symbol.name, tmp_old) << '\n';
1042+
warning() << "ignoring new value in module " << new_symbol.module << " "
10501043
<< new_symbol.value.find_source_location() << '\n'
1051-
<< expr_to_string(ns, new_symbol.name, tmp_new)
1052-
<< eom;
1044+
<< expr_to_string(new_symbol.name, tmp_new) << eom;
10531045
}
10541046
}
10551047
}

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)