@@ -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:
@@ -1352,12 +1385,12 @@ class code_labelt:public codet
1352
1385
1353
1386
codet &code ()
1354
1387
{
1355
- return static_cast <codet &>( op0 () );
1388
+ return code_op0 ( );
1356
1389
}
1357
1390
1358
1391
const codet &code () const
1359
1392
{
1360
- return static_cast < const codet &>( op0 () );
1393
+ return code_op0 ( );
1361
1394
}
1362
1395
1363
1396
protected:
@@ -1429,12 +1462,12 @@ class code_switch_caset:public codet
1429
1462
1430
1463
codet &code ()
1431
1464
{
1432
- return static_cast <codet &>( op1 () );
1465
+ return code_op1 ( );
1433
1466
}
1434
1467
1435
1468
const codet &code () const
1436
1469
{
1437
- return static_cast < const codet &>( op1 () );
1470
+ return code_op1 ( );
1438
1471
}
1439
1472
1440
1473
protected:
@@ -2407,12 +2440,12 @@ class code_try_catcht:public codet
2407
2440
2408
2441
codet &try_code ()
2409
2442
{
2410
- return static_cast <codet &>( op0 () );
2443
+ return code_op0 ( );
2411
2444
}
2412
2445
2413
2446
const codet &try_code () const
2414
2447
{
2415
- return static_cast < const codet &>( op0 () );
2448
+ return code_op0 ( );
2416
2449
}
2417
2450
2418
2451
code_declt &get_catch_decl (unsigned i)
0 commit comments