Skip to content

Deprecate get_unsigned_int #2453

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
Jun 25, 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
4 changes: 2 additions & 2 deletions jbmc/src/java_bytecode/java_bytecode_convert_method.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -974,11 +974,11 @@ codet java_bytecode_convert_methodt::get_clinit_call(
}
}

static unsigned get_bytecode_type_width(const typet &ty)
static std::size_t get_bytecode_type_width(const typet &ty)
{
if(ty.id()==ID_pointer)
return 32;
return ty.get_unsigned_int(ID_width);
return ty.get_size_t(ID_width);
}

codet java_bytecode_convert_methodt::convert_instructions(
Expand Down
4 changes: 1 addition & 3 deletions jbmc/src/java_bytecode/java_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@ unsigned java_local_variable_slots(const typet &t)
if(t.id()==ID_pointer)
return 1;

unsigned bitwidth;

bitwidth=t.get_unsigned_int(ID_width);
const std::size_t bitwidth = t.get_size_t(ID_width);
INVARIANT(
bitwidth==8 ||
bitwidth==16 ||
Expand Down
2 changes: 1 addition & 1 deletion src/ansi-c/c_typecast.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ typet c_typecastt::follow_with_qualifiers(const typet &src_type)
c_typecastt::c_typet c_typecastt::get_c_type(
const typet &type) const
{
unsigned width=type.get_int(ID_width);
const std::size_t width = type.get_size_t(ID_width);

if(type.id()==ID_signedbv)
{
Expand Down
2 changes: 1 addition & 1 deletion src/ansi-c/c_typecheck_type.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1368,7 +1368,7 @@ void c_typecheck_baset::typecheck_c_bit_field_type(c_bit_field_typet &type)
throw 0;
}

sub_width=c_enum_type.subtype().get_int(ID_width);
sub_width = c_enum_type.subtype().get_size_t(ID_width);
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion src/ansi-c/padding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ underlying_width(const c_bit_field_typet &type, const namespacet &ns)
const typet &c_enum_type = ns.follow_tag(to_c_enum_tag_type(subtype));

if(c_enum_type.id() == ID_c_enum)
return c_enum_type.subtype().get_int(ID_width);
return c_enum_type.subtype().get_size_t(ID_width);
else
return {};
}
Expand Down
4 changes: 2 additions & 2 deletions src/goto-instrument/accelerate/overflow_instrumenter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ void overflow_instrumentert::overflow_expr(
}

const typet &old_type=ns.follow(expr.op0().type());
std::size_t new_width=expr.type().get_int(ID_width);
std::size_t old_width=old_type.get_int(ID_width);
const std::size_t new_width = expr.type().get_size_t(ID_width);
const std::size_t old_width = old_type.get_size_t(ID_width);

if(type.id()==ID_signedbv)
{
Expand Down
2 changes: 1 addition & 1 deletion src/solvers/flattening/boolbv_not.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ bvt boolbvt::convert_not(const not_exprt &expr)
{
if((expr.type().id()==ID_verilog_signedbv ||
expr.type().id()==ID_verilog_unsignedbv) &&
expr.type().get_int(ID_width)==1)
expr.type().get_size_t(ID_width) == 1)
{
literalt has_x_or_z=bv_utils.verilog_bv_has_x_or_z(op_bv);
literalt normal_bits_zero=
Expand Down
2 changes: 1 addition & 1 deletion src/solvers/flattening/boolbv_reduction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ bvt boolbvt::convert_bv_reduction(const unary_exprt &expr)
{
if((expr.type().id()==ID_verilog_signedbv ||
expr.type().id()==ID_verilog_unsignedbv) &&
expr.type().get_int(ID_width)==1)
expr.type().get_size_t(ID_width) == 1)
{
bvt bv;
bv.resize(2);
Expand Down
4 changes: 2 additions & 2 deletions src/solvers/flattening/boolbv_width.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ const boolbv_widtht::entryt &boolbv_widtht::get_entry(const typet &type) const
type_id==ID_verilog_unsignedbv)
{
// we encode with two bits
entry.total_width=type.get_unsigned_int(ID_width)*2;
entry.total_width = type.get_size_t(ID_width) * 2;
assert(entry.total_width!=0);
}
else if(type_id==ID_range)
Expand Down Expand Up @@ -186,7 +186,7 @@ const boolbv_widtht::entryt &boolbv_widtht::get_entry(const typet &type) const
else if(type_id==ID_c_enum)
{
// these have a subtype
entry.total_width=type.subtype().get_unsigned_int(ID_width);
entry.total_width = type.subtype().get_size_t(ID_width);
assert(entry.total_width!=0);
}
else if(type_id==ID_incomplete_c_enum)
Expand Down
3 changes: 2 additions & 1 deletion src/util/arith_tools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,8 @@ constant_exprt from_integer(
}
else if(type_id==ID_c_enum)
{
std::size_t width=to_c_enum_type(type).subtype().get_unsigned_int(ID_width);
const std::size_t width =
to_c_enum_type(type).subtype().get_size_t(ID_width);
constant_exprt result(type);
result.set_value(integer2binary(int_value, width));
return result;
Expand Down
3 changes: 3 additions & 0 deletions src/util/irep.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Author: Daniel Kroening, [email protected]
#include <string>
#include <vector>

#include "deprecate.h"
#include "irep_ids.h"

#define SHARING
Expand Down Expand Up @@ -207,6 +208,8 @@ class irept
const irep_idt &get(const irep_namet &name) const;
bool get_bool(const irep_namet &name) const;
signed int get_int(const irep_namet &name) const;
/// \deprecated use get_size_t instead
DEPRECATED("Use get_size_t instead")
unsigned int get_unsigned_int(const irep_namet &name) const;
std::size_t get_size_t(const irep_namet &name) const;
long long get_long_long(const irep_namet &name) const;
Expand Down
2 changes: 0 additions & 2 deletions unit/util/irep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,6 @@ SCENARIO("irept_memory", "[core][utils][irept]")
// variants in the API
REQUIRE(!irep.get_bool("no_such_id"));
REQUIRE(irep.get_int("no_such_id") == 0);
REQUIRE(irep.get_unsigned_int("no_such_id") == 0u);
REQUIRE(irep.get_size_t("no_such_id") == 0u);
REQUIRE(irep.get_long_long("no_such_id") == 0);

Expand All @@ -199,7 +198,6 @@ SCENARIO("irept_memory", "[core][utils][irept]")
irep.set("numeric_id", 42);
REQUIRE(!irep.get_bool("numeric_id"));
REQUIRE(irep.get_int("numeric_id") == 42);
REQUIRE(irep.get_unsigned_int("numeric_id") == 42u);
REQUIRE(irep.get_size_t("numeric_id") == 42u);
REQUIRE(irep.get_long_long("numeric_id") == 42);

Expand Down