@@ -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
@@ -4462,10 +4413,7 @@ void smt2_convt::convert_type(const typet &type)
4462
4413
{
4463
4414
if (use_datatypes)
4464
4415
{
4465
- INVARIANT (
4466
- datatype_map.find (type) != datatype_map.end (),
4467
- " type should have been converted to Z3 datatype" );
4468
- out << datatype_map.find (type)->second ;
4416
+ out << datatype_map.at (type);
4469
4417
}
4470
4418
else
4471
4419
{
@@ -4480,10 +4428,7 @@ void smt2_convt::convert_type(const typet &type)
4480
4428
{
4481
4429
if (use_datatypes)
4482
4430
{
4483
- INVARIANT (
4484
- datatype_map.find (type) != datatype_map.end (),
4485
- " type should have been converted to Z3 datatype" );
4486
- out << datatype_map.find (type)->second ;
4431
+ out << datatype_map.at (type);
4487
4432
}
4488
4433
else
4489
4434
{
@@ -4559,10 +4504,7 @@ void smt2_convt::convert_type(const typet &type)
4559
4504
{
4560
4505
if (use_datatypes)
4561
4506
{
4562
- INVARIANT (
4563
- datatype_map.find (type) != datatype_map.end (),
4564
- " type should have been converted to Z3 datatype" );
4565
- out << datatype_map.find (type)->second ;
4507
+ out << datatype_map.at (type);
4566
4508
}
4567
4509
else
4568
4510
{
@@ -4612,7 +4554,8 @@ void smt2_convt::find_symbols_rec(
4612
4554
if (use_datatypes &&
4613
4555
datatype_map.find (type)==datatype_map.end ())
4614
4556
{
4615
- std::string smt_typename = " complex." +std::to_string (datatype_map.size ());
4557
+ const std::string smt_typename =
4558
+ " complex." + std::to_string (datatype_map.size ());
4616
4559
datatype_map[type] = smt_typename;
4617
4560
4618
4561
out << " (declare-datatypes () ((" << smt_typename << " "
@@ -4640,7 +4583,8 @@ void smt2_convt::find_symbols_rec(
4640
4583
4641
4584
mp_integer size = numeric_cast_v<mp_integer>(vector_type.size ());
4642
4585
4643
- std::string smt_typename = " vector." +std::to_string (datatype_map.size ());
4586
+ const std::string smt_typename =
4587
+ " vector." + std::to_string (datatype_map.size ());
4644
4588
datatype_map[type] = smt_typename;
4645
4589
4646
4590
out << " (declare-datatypes () ((" << smt_typename << " "
@@ -4663,7 +4607,8 @@ void smt2_convt::find_symbols_rec(
4663
4607
if (use_datatypes &&
4664
4608
datatype_map.find (type)==datatype_map.end ())
4665
4609
{
4666
- std::string smt_typename = " struct." +std::to_string (datatype_map.size ());
4610
+ const std::string smt_typename =
4611
+ " struct." + std::to_string (datatype_map.size ());
4667
4612
datatype_map[type] = smt_typename;
4668
4613
need_decl=true ;
4669
4614
}
@@ -4677,7 +4622,7 @@ void smt2_convt::find_symbols_rec(
4677
4622
// Declare the corresponding SMT type if we haven't already.
4678
4623
if (need_decl)
4679
4624
{
4680
- std::string smt_typename = datatype_map[ type] ;
4625
+ const std::string & smt_typename = datatype_map. at ( type) ;
4681
4626
4682
4627
// We're going to create a datatype named something like `struct.0'.
4683
4628
// It's going to have a single constructor named `mk-struct.0' with an
0 commit comments