Skip to content

Fix typet::check usage to work with latest API #4325

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
Mar 4, 2019
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
2 changes: 1 addition & 1 deletion src/util/expr_cast.h
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,8 @@ optionalt<T> type_try_dynamic_cast(TType &&base)
static_assert(!std::is_const<TType>::value, "Attempted to move from const.");
if(!can_cast_type<T>(base))
return {};
TType::check(base);
optionalt<T> ret{static_cast<T &&>(base)};
validate_type(*ret);
return ret;
}

Expand Down
13 changes: 7 additions & 6 deletions src/util/std_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -1130,7 +1130,8 @@ class bv_typet:public bitvector_typet
const typet &type,
const validation_modet vm = validation_modet::INVARIANT)
{
DATA_CHECK(!type.get(ID_width).empty(), "bitvector type must have width");
DATA_CHECK(
vm, !type.get(ID_width).empty(), "bitvector type must have width");
}
};

Expand Down Expand Up @@ -1241,7 +1242,7 @@ class signedbv_typet:public bitvector_typet
const validation_modet vm = validation_modet::INVARIANT)
{
DATA_CHECK(
!type.get(ID_width).empty(), "signed bitvector type must have width");
vm, !type.get(ID_width).empty(), "signed bitvector type must have width");
}
};

Expand Down Expand Up @@ -1305,7 +1306,7 @@ class fixedbv_typet:public bitvector_typet
const validation_modet vm = validation_modet::INVARIANT)
{
DATA_CHECK(
!type.get(ID_width).empty(), "fixed bitvector type must have width");
vm, !type.get(ID_width).empty(), "fixed bitvector type must have width");
}
};

Expand Down Expand Up @@ -1367,7 +1368,7 @@ class floatbv_typet:public bitvector_typet
const validation_modet vm = validation_modet::INVARIANT)
{
DATA_CHECK(
!type.get(ID_width).empty(), "float bitvector type must have width");
vm, !type.get(ID_width).empty(), "float bitvector type must have width");
}
};

Expand Down Expand Up @@ -1469,7 +1470,7 @@ class pointer_typet:public bitvector_typet
const typet &type,
const validation_modet vm = validation_modet::INVARIANT)
{
DATA_CHECK(!type.get(ID_width).empty(), "pointer must have width");
DATA_CHECK(vm, !type.get(ID_width).empty(), "pointer must have width");
}
};

Expand Down Expand Up @@ -1567,7 +1568,7 @@ class c_bool_typet:public bitvector_typet
const typet &type,
const validation_modet vm = validation_modet::INVARIANT)
{
DATA_CHECK(!type.get(ID_width).empty(), "C bool type must have width");
DATA_CHECK(vm, !type.get(ID_width).empty(), "C bool type must have width");
}
};

Expand Down
3 changes: 2 additions & 1 deletion src/util/type.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ class typet:public irept
///
/// The validation mode indicates whether well-formedness check failures are
/// reported via DATA_INVARIANT violations or exceptions.
static void check(const typet &, const validation_modet)
static void
check(const typet &, const validation_modet = validation_modet::INVARIANT)
{
}

Expand Down