@@ -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 =
@@ -1807,11 +1798,7 @@ void smt2_convt::convert_expr(const exprt &expr)
1807
1798
1808
1799
if (use_datatypes)
1809
1800
{
1810
- INVARIANT (
1811
- datatype_map.find (vector_type) != datatype_map.end (),
1812
- " type shall have been mapped to Z3 datatype" );
1813
-
1814
- const std::string &smt_typename = datatype_map.find (vector_type)->second ;
1801
+ const std::string &smt_typename = datatype_map.at (vector_type);
1815
1802
1816
1803
out << " (mk-" << smt_typename;
1817
1804
}
@@ -2596,10 +2583,7 @@ void smt2_convt::convert_struct(const struct_exprt &expr)
2596
2583
2597
2584
if (use_datatypes)
2598
2585
{
2599
- INVARIANT (
2600
- datatype_map.find (struct_type) != datatype_map.end (),
2601
- " type should have been mapped to Z3 datatype" );
2602
- const std::string &smt_typename = datatype_map.find (struct_type)->second ;
2586
+ const std::string &smt_typename = datatype_map.at (struct_type);
2603
2587
2604
2588
// use the constructor for the Z3 datatype
2605
2589
out << " (mk-" << smt_typename;
@@ -3083,11 +3067,7 @@ void smt2_convt::convert_plus(const plus_exprt &expr)
3083
3067
3084
3068
if (use_datatypes)
3085
3069
{
3086
- INVARIANT (
3087
- datatype_map.find (vector_type) != datatype_map.end (),
3088
- " type should have been mapped to Z3 datatype" );
3089
-
3090
- const std::string &smt_typename = datatype_map.find (vector_type)->second ;
3070
+ const std::string &smt_typename = datatype_map.at (vector_type);
3091
3071
3092
3072
out << " (mk-" << smt_typename;
3093
3073
}
@@ -3285,11 +3265,7 @@ void smt2_convt::convert_minus(const minus_exprt &expr)
3285
3265
3286
3266
if (use_datatypes)
3287
3267
{
3288
- INVARIANT (
3289
- datatype_map.find (vector_type) != datatype_map.end (),
3290
- " type should have been mapped to Z3 datatype" );
3291
-
3292
- const std::string &smt_typename = datatype_map.find (vector_type)->second ;
3268
+ const std::string &smt_typename = datatype_map.at (vector_type);
3293
3269
3294
3270
out << " (mk-" << smt_typename;
3295
3271
}
@@ -3594,10 +3570,7 @@ void smt2_convt::convert_with(const with_exprt &expr)
3594
3570
3595
3571
if (use_datatypes)
3596
3572
{
3597
- INVARIANT (
3598
- datatype_map.find (expr_type) != datatype_map.end (),
3599
- " type shall have been mapped to Z3 datatype" );
3600
- const std::string &smt_typename = datatype_map.find (expr_type)->second ;
3573
+ const std::string &smt_typename = datatype_map.at (expr_type);
3601
3574
3602
3575
out << " (update-" << smt_typename << " ." << component_name << " " ;
3603
3576
convert_expr (expr.op0 ());
@@ -3825,10 +3798,7 @@ void smt2_convt::convert_index(const index_exprt &expr)
3825
3798
3826
3799
if (use_datatypes)
3827
3800
{
3828
- INVARIANT (
3829
- datatype_map.find (vector_type) != datatype_map.end (),
3830
- " type should have been mapped to Z3 datatype" );
3831
- const std::string &smt_typename = datatype_map.find (vector_type)->second ;
3801
+ const std::string &smt_typename = datatype_map.at (vector_type);
3832
3802
3833
3803
// this is easy for constant indicies
3834
3804
@@ -3871,10 +3841,7 @@ void smt2_convt::convert_member(const member_exprt &expr)
3871
3841
3872
3842
if (use_datatypes)
3873
3843
{
3874
- INVARIANT (
3875
- datatype_map.find (struct_type) != datatype_map.end (),
3876
- " type should have been mapped to Z3 datatype" );
3877
- const std::string &smt_typename = datatype_map.find (struct_type)->second ;
3844
+ const std::string &smt_typename = datatype_map.at (struct_type);
3878
3845
3879
3846
out << " (" << smt_typename << " ."
3880
3847
<< struct_type.get_component (name).get_name ()
@@ -3931,11 +3898,7 @@ void smt2_convt::flatten2bv(const exprt &expr)
3931
3898
{
3932
3899
if (use_datatypes)
3933
3900
{
3934
- INVARIANT (
3935
- datatype_map.find (type) != datatype_map.end (),
3936
- " type should have been mapped to Z3 datatype" );
3937
-
3938
- const std::string &smt_typename = datatype_map.find (type)->second ;
3901
+ const std::string &smt_typename = datatype_map.at (type);
3939
3902
3940
3903
// concatenate elements
3941
3904
const vector_typet &vector_type=to_vector_type (type);
@@ -3966,11 +3929,7 @@ void smt2_convt::flatten2bv(const exprt &expr)
3966
3929
{
3967
3930
if (use_datatypes)
3968
3931
{
3969
- INVARIANT (
3970
- datatype_map.find (type) != datatype_map.end (),
3971
- " type should have been mapped to Z3 datatype" );
3972
-
3973
- const std::string &smt_typename = datatype_map.find (type)->second ;
3932
+ const std::string &smt_typename = datatype_map.at (type);
3974
3933
3975
3934
// concatenate elements
3976
3935
const struct_typet &struct_type=to_struct_type (type);
@@ -4033,11 +3992,7 @@ void smt2_convt::unflatten(
4033
3992
{
4034
3993
if (use_datatypes)
4035
3994
{
4036
- INVARIANT (
4037
- datatype_map.find (type) != datatype_map.end (),
4038
- " type should have been mapped to Z3 datatype" );
4039
-
4040
- const std::string &smt_typename = datatype_map.find (type)->second ;
3995
+ const std::string &smt_typename = datatype_map.at (type);
4041
3996
4042
3997
// extract elements
4043
3998
const vector_typet &vector_type=to_vector_type (type);
@@ -4084,11 +4039,7 @@ void smt2_convt::unflatten(
4084
4039
{
4085
4040
out << " )) " ;
4086
4041
4087
- INVARIANT (
4088
- datatype_map.find (type) != datatype_map.end (),
4089
- " type should have been mapped to Z3 datatype" );
4090
-
4091
- const std::string &smt_typename = datatype_map.find (type)->second ;
4042
+ const std::string &smt_typename = datatype_map.at (type);
4092
4043
4093
4044
out << " (mk-" << smt_typename;
4094
4045
@@ -4467,10 +4418,7 @@ void smt2_convt::convert_type(const typet &type)
4467
4418
{
4468
4419
if (use_datatypes)
4469
4420
{
4470
- INVARIANT (
4471
- datatype_map.find (type) != datatype_map.end (),
4472
- " type should have been converted to Z3 datatype" );
4473
- out << datatype_map.find (type)->second ;
4421
+ out << datatype_map.at (type);
4474
4422
}
4475
4423
else
4476
4424
{
@@ -4485,10 +4433,7 @@ void smt2_convt::convert_type(const typet &type)
4485
4433
{
4486
4434
if (use_datatypes)
4487
4435
{
4488
- INVARIANT (
4489
- datatype_map.find (type) != datatype_map.end (),
4490
- " type should have been converted to Z3 datatype" );
4491
- out << datatype_map.find (type)->second ;
4436
+ out << datatype_map.at (type);
4492
4437
}
4493
4438
else
4494
4439
{
@@ -4564,10 +4509,7 @@ void smt2_convt::convert_type(const typet &type)
4564
4509
{
4565
4510
if (use_datatypes)
4566
4511
{
4567
- INVARIANT (
4568
- datatype_map.find (type) != datatype_map.end (),
4569
- " type should have been converted to Z3 datatype" );
4570
- out << datatype_map.find (type)->second ;
4512
+ out << datatype_map.at (type);
4571
4513
}
4572
4514
else
4573
4515
{
@@ -4617,7 +4559,8 @@ void smt2_convt::find_symbols_rec(
4617
4559
if (use_datatypes &&
4618
4560
datatype_map.find (type)==datatype_map.end ())
4619
4561
{
4620
- std::string smt_typename = " complex." +std::to_string (datatype_map.size ());
4562
+ const std::string smt_typename =
4563
+ " complex." + std::to_string (datatype_map.size ());
4621
4564
datatype_map[type] = smt_typename;
4622
4565
4623
4566
out << " (declare-datatypes () ((" << smt_typename << " "
@@ -4645,7 +4588,8 @@ void smt2_convt::find_symbols_rec(
4645
4588
4646
4589
mp_integer size = numeric_cast_v<mp_integer>(vector_type.size ());
4647
4590
4648
- std::string smt_typename = " vector." +std::to_string (datatype_map.size ());
4591
+ const std::string smt_typename =
4592
+ " vector." + std::to_string (datatype_map.size ());
4649
4593
datatype_map[type] = smt_typename;
4650
4594
4651
4595
out << " (declare-datatypes () ((" << smt_typename << " "
@@ -4668,7 +4612,8 @@ void smt2_convt::find_symbols_rec(
4668
4612
if (use_datatypes &&
4669
4613
datatype_map.find (type)==datatype_map.end ())
4670
4614
{
4671
- std::string smt_typename = " struct." +std::to_string (datatype_map.size ());
4615
+ const std::string smt_typename =
4616
+ " struct." + std::to_string (datatype_map.size ());
4672
4617
datatype_map[type] = smt_typename;
4673
4618
need_decl=true ;
4674
4619
}
@@ -4682,7 +4627,7 @@ void smt2_convt::find_symbols_rec(
4682
4627
// Declare the corresponding SMT type if we haven't already.
4683
4628
if (need_decl)
4684
4629
{
4685
- std::string smt_typename = datatype_map[ type] ;
4630
+ const std::string & smt_typename = datatype_map. at ( type) ;
4686
4631
4687
4632
// We're going to create a datatype named something like `struct.0'.
4688
4633
// It's going to have a single constructor named `mk-struct.0' with an
0 commit comments