@@ -942,12 +942,7 @@ void smt2_convt::convert_expr(const exprt &expr)
942
942
{
943
943
if (use_datatypes)
944
944
{
945
- INVARIANT (
946
- datatype_map.find (bitnot_expr.type ()) != datatype_map.end (),
947
- " type shall have been mapped to Z3 datatype" );
948
-
949
- const std::string &smt_typename =
950
- datatype_map.find (bitnot_expr.type ())->second ;
945
+ const std::string &smt_typename = datatype_map.at (bitnot_expr.type ());
951
946
952
947
// extract elements
953
948
const vector_typet &vector_type = to_vector_type (bitnot_expr.type ());
@@ -1010,12 +1005,8 @@ void smt2_convt::convert_expr(const exprt &expr)
1010
1005
{
1011
1006
if (use_datatypes)
1012
1007
{
1013
- INVARIANT (
1014
- datatype_map.find (unary_minus_expr.type ()) != datatype_map.end (),
1015
- " type shall have been mapped to Z3 datatype" );
1016
-
1017
1008
const std::string &smt_typename =
1018
- datatype_map.find (unary_minus_expr.type ())-> second ;
1009
+ datatype_map.at (unary_minus_expr.type ());
1019
1010
1020
1011
// extract elements
1021
1012
const vector_typet &vector_type =
@@ -1803,11 +1794,7 @@ void smt2_convt::convert_expr(const exprt &expr)
1803
1794
1804
1795
if (use_datatypes)
1805
1796
{
1806
- INVARIANT (
1807
- datatype_map.find (vector_type) != datatype_map.end (),
1808
- " type shall have been mapped to Z3 datatype" );
1809
-
1810
- const std::string &smt_typename = datatype_map.find (vector_type)->second ;
1797
+ const std::string &smt_typename = datatype_map.at (vector_type);
1811
1798
1812
1799
out << " (mk-" << smt_typename;
1813
1800
}
@@ -2592,10 +2579,7 @@ void smt2_convt::convert_struct(const struct_exprt &expr)
2592
2579
2593
2580
if (use_datatypes)
2594
2581
{
2595
- INVARIANT (
2596
- datatype_map.find (struct_type) != datatype_map.end (),
2597
- " type should have been mapped to Z3 datatype" );
2598
- const std::string &smt_typename = datatype_map.find (struct_type)->second ;
2582
+ const std::string &smt_typename = datatype_map.at (struct_type);
2599
2583
2600
2584
// use the constructor for the Z3 datatype
2601
2585
out << " (mk-" << smt_typename;
@@ -3079,11 +3063,7 @@ void smt2_convt::convert_plus(const plus_exprt &expr)
3079
3063
3080
3064
if (use_datatypes)
3081
3065
{
3082
- INVARIANT (
3083
- datatype_map.find (vector_type) != datatype_map.end (),
3084
- " type should have been mapped to Z3 datatype" );
3085
-
3086
- const std::string &smt_typename = datatype_map.find (vector_type)->second ;
3066
+ const std::string &smt_typename = datatype_map.at (vector_type);
3087
3067
3088
3068
out << " (mk-" << smt_typename;
3089
3069
}
@@ -3280,11 +3260,7 @@ void smt2_convt::convert_minus(const minus_exprt &expr)
3280
3260
3281
3261
if (use_datatypes)
3282
3262
{
3283
- INVARIANT (
3284
- datatype_map.find (vector_type) != datatype_map.end (),
3285
- " type should have been mapped to Z3 datatype" );
3286
-
3287
- const std::string &smt_typename = datatype_map.find (vector_type)->second ;
3263
+ const std::string &smt_typename = datatype_map.at (vector_type);
3288
3264
3289
3265
out << " (mk-" << smt_typename;
3290
3266
}
@@ -3589,10 +3565,7 @@ void smt2_convt::convert_with(const with_exprt &expr)
3589
3565
3590
3566
if (use_datatypes)
3591
3567
{
3592
- INVARIANT (
3593
- datatype_map.find (expr_type) != datatype_map.end (),
3594
- " type shall have been mapped to Z3 datatype" );
3595
- const std::string &smt_typename = datatype_map.find (expr_type)->second ;
3568
+ const std::string &smt_typename = datatype_map.at (expr_type);
3596
3569
3597
3570
out << " (update-" << smt_typename << " ." << component_name << " " ;
3598
3571
convert_expr (expr.op0 ());
@@ -3820,10 +3793,7 @@ void smt2_convt::convert_index(const index_exprt &expr)
3820
3793
3821
3794
if (use_datatypes)
3822
3795
{
3823
- INVARIANT (
3824
- datatype_map.find (vector_type) != datatype_map.end (),
3825
- " type should have been mapped to Z3 datatype" );
3826
- const std::string &smt_typename = datatype_map.find (vector_type)->second ;
3796
+ const std::string &smt_typename = datatype_map.at (vector_type);
3827
3797
3828
3798
// this is easy for constant indicies
3829
3799
@@ -3866,10 +3836,7 @@ void smt2_convt::convert_member(const member_exprt &expr)
3866
3836
3867
3837
if (use_datatypes)
3868
3838
{
3869
- INVARIANT (
3870
- datatype_map.find (struct_type) != datatype_map.end (),
3871
- " type should have been mapped to Z3 datatype" );
3872
- const std::string &smt_typename = datatype_map.find (struct_type)->second ;
3839
+ const std::string &smt_typename = datatype_map.at (struct_type);
3873
3840
3874
3841
out << " (" << smt_typename << " ."
3875
3842
<< struct_type.get_component (name).get_name ()
@@ -3926,11 +3893,7 @@ void smt2_convt::flatten2bv(const exprt &expr)
3926
3893
{
3927
3894
if (use_datatypes)
3928
3895
{
3929
- INVARIANT (
3930
- datatype_map.find (type) != datatype_map.end (),
3931
- " type should have been mapped to Z3 datatype" );
3932
-
3933
- const std::string &smt_typename = datatype_map.find (type)->second ;
3896
+ const std::string &smt_typename = datatype_map.at (type);
3934
3897
3935
3898
// concatenate elements
3936
3899
const vector_typet &vector_type=to_vector_type (type);
@@ -3961,11 +3924,7 @@ void smt2_convt::flatten2bv(const exprt &expr)
3961
3924
{
3962
3925
if (use_datatypes)
3963
3926
{
3964
- INVARIANT (
3965
- datatype_map.find (type) != datatype_map.end (),
3966
- " type should have been mapped to Z3 datatype" );
3967
-
3968
- const std::string &smt_typename = datatype_map.find (type)->second ;
3927
+ const std::string &smt_typename = datatype_map.at (type);
3969
3928
3970
3929
// concatenate elements
3971
3930
const struct_typet &struct_type=to_struct_type (type);
@@ -4028,11 +3987,7 @@ void smt2_convt::unflatten(
4028
3987
{
4029
3988
if (use_datatypes)
4030
3989
{
4031
- INVARIANT (
4032
- datatype_map.find (type) != datatype_map.end (),
4033
- " type should have been mapped to Z3 datatype" );
4034
-
4035
- const std::string &smt_typename = datatype_map.find (type)->second ;
3990
+ const std::string &smt_typename = datatype_map.at (type);
4036
3991
4037
3992
// extract elements
4038
3993
const vector_typet &vector_type=to_vector_type (type);
@@ -4079,11 +4034,7 @@ void smt2_convt::unflatten(
4079
4034
{
4080
4035
out << " )) " ;
4081
4036
4082
- INVARIANT (
4083
- datatype_map.find (type) != datatype_map.end (),
4084
- " type should have been mapped to Z3 datatype" );
4085
-
4086
- const std::string &smt_typename = datatype_map.find (type)->second ;
4037
+ const std::string &smt_typename = datatype_map.at (type);
4087
4038
4088
4039
out << " (mk-" << smt_typename;
4089
4040
@@ -4459,10 +4410,7 @@ void smt2_convt::convert_type(const typet &type)
4459
4410
{
4460
4411
if (use_datatypes)
4461
4412
{
4462
- INVARIANT (
4463
- datatype_map.find (type) != datatype_map.end (),
4464
- " type should have been converted to Z3 datatype" );
4465
- out << datatype_map.find (type)->second ;
4413
+ out << datatype_map.at (type);
4466
4414
}
4467
4415
else
4468
4416
{
@@ -4477,10 +4425,7 @@ void smt2_convt::convert_type(const typet &type)
4477
4425
{
4478
4426
if (use_datatypes)
4479
4427
{
4480
- INVARIANT (
4481
- datatype_map.find (type) != datatype_map.end (),
4482
- " type should have been converted to Z3 datatype" );
4483
- out << datatype_map.find (type)->second ;
4428
+ out << datatype_map.at (type);
4484
4429
}
4485
4430
else
4486
4431
{
@@ -4556,10 +4501,7 @@ void smt2_convt::convert_type(const typet &type)
4556
4501
{
4557
4502
if (use_datatypes)
4558
4503
{
4559
- INVARIANT (
4560
- datatype_map.find (type) != datatype_map.end (),
4561
- " type should have been converted to Z3 datatype" );
4562
- out << datatype_map.find (type)->second ;
4504
+ out << datatype_map.at (type);
4563
4505
}
4564
4506
else
4565
4507
{
@@ -4609,7 +4551,8 @@ void smt2_convt::find_symbols_rec(
4609
4551
if (use_datatypes &&
4610
4552
datatype_map.find (type)==datatype_map.end ())
4611
4553
{
4612
- std::string smt_typename = " complex." +std::to_string (datatype_map.size ());
4554
+ const std::string smt_typename =
4555
+ " complex." + std::to_string (datatype_map.size ());
4613
4556
datatype_map[type] = smt_typename;
4614
4557
4615
4558
out << " (declare-datatypes () ((" << smt_typename << " "
@@ -4637,7 +4580,8 @@ void smt2_convt::find_symbols_rec(
4637
4580
4638
4581
mp_integer size = numeric_cast_v<mp_integer>(vector_type.size ());
4639
4582
4640
- std::string smt_typename = " vector." +std::to_string (datatype_map.size ());
4583
+ const std::string smt_typename =
4584
+ " vector." + std::to_string (datatype_map.size ());
4641
4585
datatype_map[type] = smt_typename;
4642
4586
4643
4587
out << " (declare-datatypes () ((" << smt_typename << " "
@@ -4660,7 +4604,8 @@ void smt2_convt::find_symbols_rec(
4660
4604
if (use_datatypes &&
4661
4605
datatype_map.find (type)==datatype_map.end ())
4662
4606
{
4663
- std::string smt_typename = " struct." +std::to_string (datatype_map.size ());
4607
+ const std::string smt_typename =
4608
+ " struct." + std::to_string (datatype_map.size ());
4664
4609
datatype_map[type] = smt_typename;
4665
4610
need_decl=true ;
4666
4611
}
@@ -4674,7 +4619,7 @@ void smt2_convt::find_symbols_rec(
4674
4619
// Declare the corresponding SMT type if we haven't already.
4675
4620
if (need_decl)
4676
4621
{
4677
- std::string smt_typename = datatype_map[ type] ;
4622
+ const std::string & smt_typename = datatype_map. at ( type) ;
4678
4623
4679
4624
// We're going to create a datatype named something like `struct.0'.
4680
4625
// It's going to have a single constructor named `mk-struct.0' with an
0 commit comments