@@ -119,6 +119,39 @@ class codet:public exprt
119
119
{
120
120
check_code (code, vm);
121
121
}
122
+
123
+ protected:
124
+ typedef std::vector<codet> code_operandst;
125
+
126
+ code_operandst &code_operands ()
127
+ { return (code_operandst &)get_sub (); }
128
+
129
+ const code_operandst &code_operands () const
130
+ { return (const code_operandst &)get_sub (); }
131
+
132
+ codet &code_op0 ()
133
+ { return code_operands ().front (); }
134
+
135
+ codet &code_op1 ()
136
+ { return code_operands ()[1 ]; }
137
+
138
+ codet &code_op2 ()
139
+ { return code_operands ()[2 ]; }
140
+
141
+ codet &code_op3 ()
142
+ { return code_operands ()[3 ]; }
143
+
144
+ const codet &code_op0 () const
145
+ { return code_operands ().front (); }
146
+
147
+ const codet &code_op1 () const
148
+ { return code_operands ()[1 ]; }
149
+
150
+ const codet &code_op2 () const
151
+ { return code_operands ()[2 ]; }
152
+
153
+ const codet &code_op3 () const
154
+ { return code_operands ()[3 ]; }
122
155
};
123
156
124
157
namespace detail // NOLINT
@@ -770,12 +803,12 @@ class code_switcht:public codet
770
803
771
804
const codet &body () const
772
805
{
773
- return to_code ( op1 () );
806
+ return code_op1 ( );
774
807
}
775
808
776
809
codet &body ()
777
810
{
778
- return static_cast <codet &>( op1 () );
811
+ return code_op1 ( );
779
812
}
780
813
781
814
protected:
@@ -836,12 +869,12 @@ class code_whilet:public codet
836
869
837
870
const codet &body () const
838
871
{
839
- return to_code ( op1 () );
872
+ return code_op1 ( );
840
873
}
841
874
842
875
codet &body ()
843
876
{
844
- return static_cast <codet &>( op1 () );
877
+ return code_op1 ( );
845
878
}
846
879
847
880
protected:
@@ -902,12 +935,12 @@ class code_dowhilet:public codet
902
935
903
936
const codet &body () const
904
937
{
905
- return to_code ( op1 () );
938
+ return code_op1 ( );
906
939
}
907
940
908
941
codet &body ()
909
942
{
910
- return static_cast <codet &>( op1 () );
943
+ return code_op1 ( );
911
944
}
912
945
913
946
protected:
@@ -997,12 +1030,12 @@ class code_fort:public codet
997
1030
998
1031
const codet &body () const
999
1032
{
1000
- return to_code ( op3 () );
1033
+ return code_op3 ( );
1001
1034
}
1002
1035
1003
1036
codet &body ()
1004
1037
{
1005
- return static_cast <codet &>( op3 () );
1038
+ return code_op3 ( );
1006
1039
}
1007
1040
1008
1041
protected:
@@ -1356,12 +1389,12 @@ class code_labelt:public codet
1356
1389
1357
1390
codet &code ()
1358
1391
{
1359
- return static_cast <codet &>( op0 () );
1392
+ return code_op0 ( );
1360
1393
}
1361
1394
1362
1395
const codet &code () const
1363
1396
{
1364
- return static_cast < const codet &>( op0 () );
1397
+ return code_op0 ( );
1365
1398
}
1366
1399
1367
1400
protected:
@@ -1433,12 +1466,12 @@ class code_switch_caset:public codet
1433
1466
1434
1467
codet &code ()
1435
1468
{
1436
- return static_cast <codet &>( op1 () );
1469
+ return code_op1 ( );
1437
1470
}
1438
1471
1439
1472
const codet &code () const
1440
1473
{
1441
- return static_cast < const codet &>( op1 () );
1474
+ return code_op1 ( );
1442
1475
}
1443
1476
1444
1477
protected:
@@ -2230,12 +2263,12 @@ class code_try_catcht:public codet
2230
2263
2231
2264
codet &try_code ()
2232
2265
{
2233
- return static_cast <codet &>( op0 () );
2266
+ return code_op0 ( );
2234
2267
}
2235
2268
2236
2269
const codet &try_code () const
2237
2270
{
2238
- return static_cast < const codet &>( op0 () );
2271
+ return code_op0 ( );
2239
2272
}
2240
2273
2241
2274
code_declt &get_catch_decl (unsigned i)
0 commit comments