-
Notifications
You must be signed in to change notification settings - Fork 262
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Do not use nil_typet in c_bit_field_replacement_type
No caller handles that case, instead insert appropriate PRECONDITIONs.
- Loading branch information
1 parent
85d61b5
commit 83682da
Showing
1 changed file
with
11 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,9 +6,10 @@ Author: Daniel Kroening, [email protected] | |
\*******************************************************************/ | ||
|
||
|
||
#include "c_bit_field_replacement_type.h" | ||
|
||
#include <util/invariant.h> | ||
|
||
typet c_bit_field_replacement_type( | ||
const c_bit_field_typet &src, | ||
const namespacet &ns) | ||
|
@@ -23,21 +24,18 @@ typet c_bit_field_replacement_type( | |
result.set_width(src.get_width()); | ||
return std::move(result); | ||
} | ||
else if(subtype.id()==ID_c_enum_tag) | ||
else | ||
{ | ||
PRECONDITION(subtype.id() == ID_c_enum_tag); | ||
|
||
const typet &sub_subtype= | ||
ns.follow_tag(to_c_enum_tag_type(subtype)).subtype(); | ||
|
||
if(sub_subtype.id()==ID_signedbv || | ||
sub_subtype.id()==ID_unsignedbv) | ||
{ | ||
bitvector_typet result=to_bitvector_type(sub_subtype); | ||
result.set_width(src.get_width()); | ||
return std::move(result); | ||
} | ||
else | ||
return nil_typet(); | ||
PRECONDITION( | ||
sub_subtype.id() == ID_signedbv || sub_subtype.id() == ID_unsignedbv); | ||
|
||
bitvector_typet result = to_bitvector_type(sub_subtype); | ||
result.set_width(src.get_width()); | ||
return std::move(result); | ||
} | ||
else | ||
return nil_typet(); | ||
} |