Skip to content

Commit 2c7a355

Browse files
Clean-up irep-id emptyness checks in ansi-c
1 parent 06638de commit 2c7a355

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

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';

0 commit comments

Comments
 (0)