@@ -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
@@ -576,12 +609,12 @@ class code_switcht:public codet
576
609
577
610
const codet &body () const
578
611
{
579
- return to_code ( op1 () );
612
+ return code_op1 ( );
580
613
}
581
614
582
615
codet &body ()
583
616
{
584
- return static_cast <codet &>( op1 () );
617
+ return code_op1 ( );
585
618
}
586
619
};
587
620
@@ -638,12 +671,12 @@ class code_whilet:public codet
638
671
639
672
const codet &body () const
640
673
{
641
- return to_code ( op1 () );
674
+ return code_op1 ( );
642
675
}
643
676
644
677
codet &body ()
645
678
{
646
- return static_cast <codet &>( op1 () );
679
+ return code_op1 ( );
647
680
}
648
681
};
649
682
@@ -700,12 +733,12 @@ class code_dowhilet:public codet
700
733
701
734
const codet &body () const
702
735
{
703
- return to_code ( op1 () );
736
+ return code_op1 ( );
704
737
}
705
738
706
739
codet &body ()
707
740
{
708
- return static_cast <codet &>( op1 () );
741
+ return code_op1 ( );
709
742
}
710
743
};
711
744
@@ -775,12 +808,12 @@ class code_fort:public codet
775
808
776
809
const codet &body () const
777
810
{
778
- return to_code ( op3 () );
811
+ return code_op3 ( );
779
812
}
780
813
781
814
codet &body ()
782
815
{
783
- return static_cast <codet &>( op3 () );
816
+ return code_op3 ( );
784
817
}
785
818
};
786
819
@@ -1014,12 +1047,12 @@ class code_labelt:public codet
1014
1047
1015
1048
codet &code ()
1016
1049
{
1017
- return static_cast <codet &>( op0 () );
1050
+ return code_op0 ( );
1018
1051
}
1019
1052
1020
1053
const codet &code () const
1021
1054
{
1022
- return static_cast < const codet &>( op0 () );
1055
+ return code_op0 ( );
1023
1056
}
1024
1057
};
1025
1058
@@ -1059,7 +1092,9 @@ class code_switch_caset:public codet
1059
1092
code_switch_caset (
1060
1093
const exprt &_case_op, const codet &_code):codet(ID_switch_case)
1061
1094
{
1062
- copy_to_operands (_case_op, _code);
1095
+ operands ().resize (2 );
1096
+ op0 ()=_case_op;
1097
+ code_op1 ()=_code;
1063
1098
}
1064
1099
1065
1100
bool is_default () const
@@ -1084,12 +1119,12 @@ class code_switch_caset:public codet
1084
1119
1085
1120
codet &code ()
1086
1121
{
1087
- return static_cast <codet &>( op1 () );
1122
+ return code_op1 ( );
1088
1123
}
1089
1124
1090
1125
const codet &code () const
1091
1126
{
1092
- return static_cast < const codet &>( op1 () );
1127
+ return code_op1 ( );
1093
1128
}
1094
1129
};
1095
1130
@@ -1718,12 +1753,12 @@ class code_try_catcht:public codet
1718
1753
1719
1754
codet &try_code ()
1720
1755
{
1721
- return static_cast <codet &>( op0 () );
1756
+ return code_op0 ( );
1722
1757
}
1723
1758
1724
1759
const codet &try_code () const
1725
1760
{
1726
- return static_cast < const codet &>( op0 () );
1761
+ return code_op0 ( );
1727
1762
}
1728
1763
1729
1764
code_declt &get_catch_decl (unsigned i)
0 commit comments