Skip to content

Commit 9d8d81a

Browse files
authored
Merge pull request #997 from peterschrammel/clean-up-irep-id-empty
Clean up irep id emptyness checks
2 parents 74e21ce + 248eed6 commit 9d8d81a

33 files changed

+57
-57
lines changed

src/analyses/goto_check.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1689,21 +1689,21 @@ void goto_checkt::goto_check(
16891689
{
16901690
i_it->source_location.id(irep_idt());
16911691

1692-
if(it->source_location.get_file()!=irep_idt())
1692+
if(!it->source_location.get_file().empty())
16931693
i_it->source_location.set_file(it->source_location.get_file());
16941694

1695-
if(it->source_location.get_line()!=irep_idt())
1695+
if(!it->source_location.get_line().empty())
16961696
i_it->source_location.set_line(it->source_location.get_line());
16971697

1698-
if(it->source_location.get_function()!=irep_idt())
1698+
if(!it->source_location.get_function().empty())
16991699
i_it->source_location.set_function(
17001700
it->source_location.get_function());
17011701

1702-
if(it->source_location.get_column()!=irep_idt())
1702+
if(!it->source_location.get_column().empty())
17031703
i_it->source_location.set_column(it->source_location.get_column());
17041704
}
17051705

1706-
if(i_it->function==irep_idt())
1706+
if(i_it->function.empty())
17071707
i_it->function=it->function;
17081708
}
17091709

src/ansi-c/ansi_c_declaration.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ void ansi_c_declaratort::build(irept &src)
3333
t.make_nil();
3434
break;
3535
}
36-
else if(t.id()==irep_idt() ||
36+
else if(t.id().empty() ||
3737
t.is_nil())
3838
{
3939
assert(0);

src/ansi-c/c_typecheck_base.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,7 @@ void c_typecheck_baset::typecheck_function_body(symbolt &symbol)
539539
p_it++)
540540
{
541541
// may be anonymous
542-
if(p_it->get_base_name()==irep_idt())
542+
if(p_it->get_base_name().empty())
543543
{
544544
irep_idt base_name="#anon"+std::to_string(anon_counter++);
545545
p_it->set_base_name(base_name);

src/ansi-c/c_typecheck_expr.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1522,7 +1522,7 @@ void c_typecheck_baset::typecheck_expr_member(exprt &expr)
15221522
// copy method identifier
15231523
const irep_idt &identifier=component.get(ID_C_identifier);
15241524

1525-
if(identifier!=irep_idt())
1525+
if(!identifier.empty())
15261526
expr.set(ID_C_identifier, identifier);
15271527

15281528
const irep_idt &access=component.get_access();

src/ansi-c/c_typecheck_type.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ void c_typecheck_baset::typecheck_code_type(code_typet &type)
428428
irep_idt identifier=declaration.declarator().get_name();
429429

430430
// abstract or not?
431-
if(identifier==irep_idt())
431+
if(identifier.empty())
432432
{
433433
// abstract
434434
parameter.add_source_location()=declaration.type().source_location();
@@ -550,7 +550,7 @@ void c_typecheck_baset::typecheck_array_type(array_typet &type)
550550
{
551551
// not a constant and not infinity
552552

553-
assert(current_symbol_id!=irep_idt());
553+
assert(!current_symbol_id.empty());
554554

555555
const symbolt &base_symbol=lookup(current_symbol_id);
556556

@@ -862,7 +862,7 @@ void c_typecheck_baset::typecheck_compound_body(
862862
// scan for anonymous members, and name them
863863
for(auto &member : components)
864864
{
865-
if(member.get_name()!=irep_idt())
865+
if(!member.get_name().empty())
866866
continue;
867867

868868
member.set_name("$anon"+std::to_string(anon_member_counter++));

src/ansi-c/type2name.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ static std::string type2name(
110110
if(!type.source_location().get_function().empty())
111111
result+='l';
112112

113-
if(type.id()==irep_idt())
113+
if(type.id().empty())
114114
throw "empty type encountered";
115115
else if(type.id()==ID_empty)
116116
result+='V';

src/cpp/cpp_declarator.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ typet cpp_declaratort::merge_type(const typet &declaration_type) const
4949
}
5050
else
5151
{
52-
assert(t.id()!=irep_idt());
52+
assert(!t.id().empty());
5353
p=&t.subtype();
5454
}
5555
}

src/cpp/cpp_exception_id.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ void cpp_exception_list_rec(
5959
// grab C/C++ type
6060
irep_idt c_type=src.get(ID_C_c_type);
6161

62-
if(c_type!=irep_idt())
62+
if(!c_type.empty())
6363
{
6464
dest.push_back(id2string(c_type)+suffix);
6565
return;

src/cpp/cpp_instantiate_template.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@ const symbolt &cpp_typecheckt::instantiate_template(
485485
bool is_static=new_decl.storage_spec().is_static();
486486
irep_idt access = new_decl.get(ID_C_access);
487487

488-
assert(access != irep_idt());
488+
assert(!access.empty());
489489
assert(symb.type.id()==ID_struct);
490490

491491
typecheck_compound_declarator(

src/cpp/cpp_type2name.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ std::string cpp_type2name(const typet &type)
119119
// we try to use #c_type
120120
const irep_idt c_type=type.get(ID_C_c_type);
121121

122-
if(c_type!=irep_idt())
122+
if(!c_type.empty())
123123
result+=id2string(c_type);
124124
else if(type.id()==ID_unsignedbv)
125125
result+="unsigned_int";
@@ -131,7 +131,7 @@ std::string cpp_type2name(const typet &type)
131131
// we try to use #c_type
132132
const irep_idt c_type=type.get(ID_C_c_type);
133133

134-
if(c_type!=irep_idt())
134+
if(!c_type.empty())
135135
result+=id2string(c_type);
136136
else
137137
result+="double";

0 commit comments

Comments
 (0)