@@ -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
}
@@ -3284,11 +3264,7 @@ void smt2_convt::convert_minus(const minus_exprt &expr)
3284
3264
3285
3265
if (use_datatypes)
3286
3266
{
3287
- INVARIANT (
3288
- datatype_map.find (vector_type) != datatype_map.end (),
3289
- " type should have been mapped to Z3 datatype" );
3290
-
3291
- const std::string &smt_typename = datatype_map.find (vector_type)->second ;
3267
+ const std::string &smt_typename = datatype_map.at (vector_type);
3292
3268
3293
3269
out << " (mk-" << smt_typename;
3294
3270
}
@@ -3593,10 +3569,7 @@ void smt2_convt::convert_with(const with_exprt &expr)
3593
3569
3594
3570
if (use_datatypes)
3595
3571
{
3596
- INVARIANT (
3597
- datatype_map.find (expr_type) != datatype_map.end (),
3598
- " type shall have been mapped to Z3 datatype" );
3599
- const std::string &smt_typename = datatype_map.find (expr_type)->second ;
3572
+ const std::string &smt_typename = datatype_map.at (expr_type);
3600
3573
3601
3574
out << " (update-" << smt_typename << " ." << component_name << " " ;
3602
3575
convert_expr (expr.op0 ());
@@ -3824,10 +3797,7 @@ void smt2_convt::convert_index(const index_exprt &expr)
3824
3797
3825
3798
if (use_datatypes)
3826
3799
{
3827
- INVARIANT (
3828
- datatype_map.find (vector_type) != datatype_map.end (),
3829
- " type should have been mapped to Z3 datatype" );
3830
- const std::string &smt_typename = datatype_map.find (vector_type)->second ;
3800
+ const std::string &smt_typename = datatype_map.at (vector_type);
3831
3801
3832
3802
// this is easy for constant indicies
3833
3803
@@ -3870,10 +3840,7 @@ void smt2_convt::convert_member(const member_exprt &expr)
3870
3840
3871
3841
if (use_datatypes)
3872
3842
{
3873
- INVARIANT (
3874
- datatype_map.find (struct_type) != datatype_map.end (),
3875
- " type should have been mapped to Z3 datatype" );
3876
- const std::string &smt_typename = datatype_map.find (struct_type)->second ;
3843
+ const std::string &smt_typename = datatype_map.at (struct_type);
3877
3844
3878
3845
out << " (" << smt_typename << " ."
3879
3846
<< struct_type.get_component (name).get_name ()
@@ -3930,11 +3897,7 @@ void smt2_convt::flatten2bv(const exprt &expr)
3930
3897
{
3931
3898
if (use_datatypes)
3932
3899
{
3933
- INVARIANT (
3934
- datatype_map.find (type) != datatype_map.end (),
3935
- " type should have been mapped to Z3 datatype" );
3936
-
3937
- const std::string &smt_typename = datatype_map.find (type)->second ;
3900
+ const std::string &smt_typename = datatype_map.at (type);
3938
3901
3939
3902
// concatenate elements
3940
3903
const vector_typet &vector_type=to_vector_type (type);
@@ -3965,11 +3928,7 @@ void smt2_convt::flatten2bv(const exprt &expr)
3965
3928
{
3966
3929
if (use_datatypes)
3967
3930
{
3968
- INVARIANT (
3969
- datatype_map.find (type) != datatype_map.end (),
3970
- " type should have been mapped to Z3 datatype" );
3971
-
3972
- const std::string &smt_typename = datatype_map.find (type)->second ;
3931
+ const std::string &smt_typename = datatype_map.at (type);
3973
3932
3974
3933
// concatenate elements
3975
3934
const struct_typet &struct_type=to_struct_type (type);
@@ -4032,11 +3991,7 @@ void smt2_convt::unflatten(
4032
3991
{
4033
3992
if (use_datatypes)
4034
3993
{
4035
- INVARIANT (
4036
- datatype_map.find (type) != datatype_map.end (),
4037
- " type should have been mapped to Z3 datatype" );
4038
-
4039
- const std::string &smt_typename = datatype_map.find (type)->second ;
3994
+ const std::string &smt_typename = datatype_map.at (type);
4040
3995
4041
3996
// extract elements
4042
3997
const vector_typet &vector_type=to_vector_type (type);
@@ -4083,11 +4038,7 @@ void smt2_convt::unflatten(
4083
4038
{
4084
4039
out << " )) " ;
4085
4040
4086
- INVARIANT (
4087
- datatype_map.find (type) != datatype_map.end (),
4088
- " type should have been mapped to Z3 datatype" );
4089
-
4090
- const std::string &smt_typename = datatype_map.find (type)->second ;
4041
+ const std::string &smt_typename = datatype_map.at (type);
4091
4042
4092
4043
out << " (mk-" << smt_typename;
4093
4044
@@ -4466,10 +4417,7 @@ void smt2_convt::convert_type(const typet &type)
4466
4417
{
4467
4418
if (use_datatypes)
4468
4419
{
4469
- INVARIANT (
4470
- datatype_map.find (type) != datatype_map.end (),
4471
- " type should have been converted to Z3 datatype" );
4472
- out << datatype_map.find (type)->second ;
4420
+ out << datatype_map.at (type);
4473
4421
}
4474
4422
else
4475
4423
{
@@ -4484,10 +4432,7 @@ void smt2_convt::convert_type(const typet &type)
4484
4432
{
4485
4433
if (use_datatypes)
4486
4434
{
4487
- INVARIANT (
4488
- datatype_map.find (type) != datatype_map.end (),
4489
- " type should have been converted to Z3 datatype" );
4490
- out << datatype_map.find (type)->second ;
4435
+ out << datatype_map.at (type);
4491
4436
}
4492
4437
else
4493
4438
{
@@ -4563,10 +4508,7 @@ void smt2_convt::convert_type(const typet &type)
4563
4508
{
4564
4509
if (use_datatypes)
4565
4510
{
4566
- INVARIANT (
4567
- datatype_map.find (type) != datatype_map.end (),
4568
- " type should have been converted to Z3 datatype" );
4569
- out << datatype_map.find (type)->second ;
4511
+ out << datatype_map.at (type);
4570
4512
}
4571
4513
else
4572
4514
{
@@ -4616,7 +4558,8 @@ void smt2_convt::find_symbols_rec(
4616
4558
if (use_datatypes &&
4617
4559
datatype_map.find (type)==datatype_map.end ())
4618
4560
{
4619
- std::string smt_typename = " complex." +std::to_string (datatype_map.size ());
4561
+ const std::string smt_typename =
4562
+ " complex." + std::to_string (datatype_map.size ());
4620
4563
datatype_map[type] = smt_typename;
4621
4564
4622
4565
out << " (declare-datatypes () ((" << smt_typename << " "
@@ -4644,7 +4587,8 @@ void smt2_convt::find_symbols_rec(
4644
4587
4645
4588
mp_integer size = numeric_cast_v<mp_integer>(vector_type.size ());
4646
4589
4647
- std::string smt_typename = " vector." +std::to_string (datatype_map.size ());
4590
+ const std::string smt_typename =
4591
+ " vector." + std::to_string (datatype_map.size ());
4648
4592
datatype_map[type] = smt_typename;
4649
4593
4650
4594
out << " (declare-datatypes () ((" << smt_typename << " "
@@ -4667,7 +4611,8 @@ void smt2_convt::find_symbols_rec(
4667
4611
if (use_datatypes &&
4668
4612
datatype_map.find (type)==datatype_map.end ())
4669
4613
{
4670
- std::string smt_typename = " struct." +std::to_string (datatype_map.size ());
4614
+ const std::string smt_typename =
4615
+ " struct." + std::to_string (datatype_map.size ());
4671
4616
datatype_map[type] = smt_typename;
4672
4617
need_decl=true ;
4673
4618
}
@@ -4681,7 +4626,7 @@ void smt2_convt::find_symbols_rec(
4681
4626
// Declare the corresponding SMT type if we haven't already.
4682
4627
if (need_decl)
4683
4628
{
4684
- std::string smt_typename = datatype_map[ type] ;
4629
+ const std::string & smt_typename = datatype_map. at ( type) ;
4685
4630
4686
4631
// We're going to create a datatype named something like `struct.0'.
4687
4632
// It's going to have a single constructor named `mk-struct.0' with an
0 commit comments