Skip to content

Commit 3a9ca83

Browse files
author
Daniel Kroening
committed
clarify typing in ansi_c_declaratort::build
1 parent 2855c2a commit 3a9ca83

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

src/ansi-c/ansi_c_declaration.cpp

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,38 +20,40 @@ Author: Daniel Kroening, [email protected]
2020

2121
void ansi_c_declaratort::build(irept &src)
2222
{
23-
typet *p=static_cast<typet *>(&src);
23+
irept *p = &src;
2424

2525
// walk down subtype until we hit symbol_type or "abstract"
2626
while(true)
2727
{
28-
typet &t=*p;
29-
30-
if(t.id() == ID_symbol_type || t.id() == ID_symbol)
28+
if(p->id() == ID_symbol_type || p->id() == ID_symbol)
3129
{
32-
set_base_name(t.get(ID_C_base_name));
33-
add_source_location()=t.source_location();
34-
t.make_nil();
30+
set_base_name(p->get(ID_C_base_name));
31+
add_source_location() =
32+
static_cast<const source_locationt &>(p->find(ID_C_source_location));
33+
p->make_nil();
3534
break;
3635
}
37-
else if(t.id().empty() ||
38-
t.is_nil())
36+
else if(p->id().empty() || p->is_nil())
3937
{
4038
UNREACHABLE;
4139
}
42-
else if(t.id()==ID_abstract)
40+
else if(p->id() == ID_abstract)
4341
{
44-
t.make_nil();
42+
p->make_nil();
4543
break;
4644
}
47-
else if(t.id()==ID_merged_type)
45+
else if(p->id() == ID_merged_type)
4846
{
4947
// we always walk down the _last_ member of a merged type
48+
typet &t = static_cast<typet &>(*p);
5049
assert(!t.subtypes().empty());
5150
p=&(t.subtypes().back());
5251
}
5352
else
53+
{
54+
typet &t = static_cast<typet &>(*p);
5455
p=&t.subtype();
56+
}
5557
}
5658

5759
type()=static_cast<const typet &>(src);

0 commit comments

Comments
 (0)