Skip to content

Remove shadowing parameter ns [blocks: #2310] #3357

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 11, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 25 additions & 33 deletions src/linking/linking.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,13 @@ bool casting_replace_symbolt::replace_symbol_expr(symbol_exprt &s) const
}

std::string linkingt::expr_to_string(
const namespacet &ns,
const irep_idt &identifier,
const exprt &expr) const
{
return from_expr(ns, identifier, expr);
}

std::string linkingt::type_to_string(
const namespacet &ns,
const irep_idt &identifier,
const typet &type) const
{
Expand All @@ -72,7 +70,6 @@ static const typet &follow_tags_symbols(
}

std::string linkingt::type_to_string_verbose(
const namespacet &ns,
const symbolt &symbol,
const typet &type) const
{
Expand All @@ -91,7 +88,7 @@ std::string linkingt::type_to_string_verbose(
{
const typet &subtype = c.type();
result+=" ";
result+=type_to_string(ns, symbol.name, subtype);
result += type_to_string(symbol.name, subtype);
result+=' ';

if(!c.get_base_name().empty())
Expand All @@ -108,15 +105,15 @@ std::string linkingt::type_to_string_verbose(
}
else if(followed.id()==ID_pointer)
{
return type_to_string_verbose(ns, symbol, followed.subtype())+" *";
return type_to_string_verbose(symbol, followed.subtype()) + " *";
}
else if(followed.id()==ID_incomplete_struct ||
followed.id()==ID_incomplete_union)
{
return type_to_string(ns, symbol.name, type)+" (incomplete)";
return type_to_string(symbol.name, type) + " (incomplete)";
}

return type_to_string(ns, symbol.name, type);
return type_to_string(symbol.name, type);
}

void linkingt::detailed_conflict_report_rec(
Expand Down Expand Up @@ -256,8 +253,8 @@ void linkingt::detailed_conflict_report_rec(
if(t1.subtype()!=t2.subtype())
{
msg="enum value types are different (";
msg+=type_to_string(ns, old_symbol.name, t1.subtype())+'/';
msg+=type_to_string(ns, new_symbol.name, t2.subtype())+')';
msg += type_to_string(old_symbol.name, t1.subtype()) + '/';
msg += type_to_string(new_symbol.name, t2.subtype()) + ')';
}
else if(members1.size()!=members2.size())
{
Expand Down Expand Up @@ -359,13 +356,12 @@ void linkingt::detailed_conflict_report_rec(
if(!msg.empty())
{
error() << '\n';
error() << "reason for conflict at "
<< expr_to_string(ns, "", conflict_path)
error() << "reason for conflict at " << expr_to_string("", conflict_path)
<< ": " << msg << '\n';

error() << '\n';
error() << type_to_string_verbose(ns, old_symbol, t1) << '\n';
error() << type_to_string_verbose(ns, new_symbol, t2) << '\n';
error() << type_to_string_verbose(old_symbol, t1) << '\n';
error() << type_to_string_verbose(new_symbol, t2) << '\n';
}

#ifdef DEBUG
Expand All @@ -383,12 +379,12 @@ void linkingt::link_error(
error() << "error: " << msg << " `"
<< old_symbol.display_name()
<< "'" << '\n';
error() << "old definition in module `" << old_symbol.module
<< "' " << old_symbol.location << '\n'
<< type_to_string_verbose(ns, old_symbol) << '\n';
error() << "new definition in module `" << new_symbol.module
<< "' " << new_symbol.location << '\n'
<< type_to_string_verbose(ns, new_symbol) << eom;
error() << "old definition in module `" << old_symbol.module << "' "
<< old_symbol.location << '\n'
<< type_to_string_verbose(old_symbol) << '\n';
error() << "new definition in module `" << new_symbol.module << "' "
<< new_symbol.location << '\n'
<< type_to_string_verbose(new_symbol) << eom;
}

void linkingt::link_warning(
Expand All @@ -401,12 +397,12 @@ void linkingt::link_warning(
warning() << "warning: " << msg << " \""
<< old_symbol.display_name()
<< "\"" << '\n';
warning() << "old definition in module " << old_symbol.module
<< " " << old_symbol.location << '\n'
<< type_to_string_verbose(ns, old_symbol) << '\n';
warning() << "new definition in module " << new_symbol.module
<< " " << new_symbol.location << '\n'
<< type_to_string_verbose(ns, new_symbol) << eom;
warning() << "old definition in module " << old_symbol.module << " "
<< old_symbol.location << '\n'
<< type_to_string_verbose(old_symbol) << '\n';
warning() << "new definition in module " << new_symbol.module << " "
<< new_symbol.location << '\n'
<< type_to_string_verbose(new_symbol) << eom;
}

irep_idt linkingt::rename(const irep_idt id)
Expand Down Expand Up @@ -1040,16 +1036,12 @@ void linkingt::duplicate_object_symbol(

warning() << "warning: conflicting initializers for"
<< " variable \"" << old_symbol.name << "\"\n";
warning() << "using old value in module "
<< old_symbol.module << " "
warning() << "using old value in module " << old_symbol.module << " "
<< old_symbol.value.find_source_location() << '\n'
<< expr_to_string(ns, old_symbol.name, tmp_old)
<< '\n';
warning() << "ignoring new value in module "
<< new_symbol.module << " "
<< expr_to_string(old_symbol.name, tmp_old) << '\n';
warning() << "ignoring new value in module " << new_symbol.module << " "
<< new_symbol.value.find_source_location() << '\n'
<< expr_to_string(ns, new_symbol.name, tmp_new)
<< eom;
<< expr_to_string(new_symbol.name, tmp_new) << eom;
}
}
}
Expand Down
6 changes: 1 addition & 5 deletions src/linking/linking_class.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,25 +112,21 @@ class linkingt:public typecheckt
const symbolt &new_symbol);

std::string expr_to_string(
const namespacet &ns,
const irep_idt &identifier,
const exprt &expr) const;

std::string type_to_string(
const namespacet &ns,
const irep_idt &identifier,
const typet &type) const;

std::string type_to_string_verbose(
const namespacet &ns,
const symbolt &symbol,
const typet &type) const;

std::string type_to_string_verbose(
const namespacet &ns,
const symbolt &symbol) const
{
return type_to_string_verbose(ns, symbol, symbol.type);
return type_to_string_verbose(symbol, symbol.type);
}

void detailed_conflict_report_rec(
Expand Down