@@ -59,6 +59,39 @@ class codet:public exprt
59
59
codet &last_statement ();
60
60
const codet &last_statement () const ;
61
61
class code_blockt &make_block ();
62
+
63
+ protected:
64
+ typedef std::vector<codet> code_operandst;
65
+
66
+ code_operandst &code_operands ()
67
+ { return (code_operandst &)get_sub (); }
68
+
69
+ const code_operandst &code_operands () const
70
+ { return (const code_operandst &)get_sub (); }
71
+
72
+ codet &code_op0 ()
73
+ { return code_operands ().front (); }
74
+
75
+ codet &code_op1 ()
76
+ { return code_operands ()[1 ]; }
77
+
78
+ codet &code_op2 ()
79
+ { return code_operands ()[2 ]; }
80
+
81
+ codet &code_op3 ()
82
+ { return code_operands ()[3 ]; }
83
+
84
+ const codet &code_op0 () const
85
+ { return code_operands ().front (); }
86
+
87
+ const codet &code_op1 () const
88
+ { return code_operands ()[1 ]; }
89
+
90
+ const codet &code_op2 () const
91
+ { return code_operands ()[2 ]; }
92
+
93
+ const codet &code_op3 () const
94
+ { return code_operands ()[3 ]; }
62
95
};
63
96
64
97
namespace detail // NOLINT
@@ -598,12 +631,12 @@ class code_switcht:public codet
598
631
599
632
const codet &body () const
600
633
{
601
- return to_code ( op1 () );
634
+ return code_op1 ( );
602
635
}
603
636
604
637
codet &body ()
605
638
{
606
- return static_cast <codet &>( op1 () );
639
+ return code_op1 ( );
607
640
}
608
641
};
609
642
@@ -660,12 +693,12 @@ class code_whilet:public codet
660
693
661
694
const codet &body () const
662
695
{
663
- return to_code ( op1 () );
696
+ return code_op1 ( );
664
697
}
665
698
666
699
codet &body ()
667
700
{
668
- return static_cast <codet &>( op1 () );
701
+ return code_op1 ( );
669
702
}
670
703
};
671
704
@@ -722,12 +755,12 @@ class code_dowhilet:public codet
722
755
723
756
const codet &body () const
724
757
{
725
- return to_code ( op1 () );
758
+ return code_op1 ( );
726
759
}
727
760
728
761
codet &body ()
729
762
{
730
- return static_cast <codet &>( op1 () );
763
+ return code_op1 ( );
731
764
}
732
765
};
733
766
@@ -799,12 +832,12 @@ class code_fort:public codet
799
832
800
833
const codet &body () const
801
834
{
802
- return to_code ( op3 () );
835
+ return code_op3 ( );
803
836
}
804
837
805
838
codet &body ()
806
839
{
807
- return static_cast <codet &>( op3 () );
840
+ return code_op3 ( );
808
841
}
809
842
};
810
843
@@ -1079,12 +1112,12 @@ class code_labelt:public codet
1079
1112
1080
1113
codet &code ()
1081
1114
{
1082
- return static_cast <codet &>( op0 () );
1115
+ return code_op0 ( );
1083
1116
}
1084
1117
1085
1118
const codet &code () const
1086
1119
{
1087
- return static_cast < const codet &>( op0 () );
1120
+ return code_op0 ( );
1088
1121
}
1089
1122
};
1090
1123
@@ -1126,7 +1159,9 @@ class code_switch_caset:public codet
1126
1159
code_switch_caset (
1127
1160
const exprt &_case_op, const codet &_code):codet(ID_switch_case)
1128
1161
{
1129
- copy_to_operands (_case_op, _code);
1162
+ operands ().resize (2 );
1163
+ op0 ()=_case_op;
1164
+ code_op1 ()=_code;
1130
1165
}
1131
1166
1132
1167
bool is_default () const
@@ -1151,12 +1186,12 @@ class code_switch_caset:public codet
1151
1186
1152
1187
codet &code ()
1153
1188
{
1154
- return static_cast <codet &>( op1 () );
1189
+ return code_op1 ( );
1155
1190
}
1156
1191
1157
1192
const codet &code () const
1158
1193
{
1159
- return static_cast < const codet &>( op1 () );
1194
+ return code_op1 ( );
1160
1195
}
1161
1196
};
1162
1197
@@ -1791,12 +1826,12 @@ class code_try_catcht:public codet
1791
1826
1792
1827
codet &try_code ()
1793
1828
{
1794
- return static_cast <codet &>( op0 () );
1829
+ return code_op0 ( );
1795
1830
}
1796
1831
1797
1832
const codet &try_code () const
1798
1833
{
1799
- return static_cast < const codet &>( op0 () );
1834
+ return code_op0 ( );
1800
1835
}
1801
1836
1802
1837
code_declt &get_catch_decl (unsigned i)
0 commit comments