@@ -433,18 +433,18 @@ class goto_programt
433
433
{
434
434
}
435
435
436
- // / Constructor that can set all members
436
+ // / Constructor that can set all members, passed by value
437
437
instructiont (
438
- codet && _code,
439
- const irep_idt & _function,
440
- source_locationt && _source_location,
438
+ codet _code,
439
+ irep_idt _function,
440
+ source_locationt _source_location,
441
441
goto_program_instruction_typet _type,
442
- exprt && _guard,
443
- targetst && _targets)
442
+ exprt _guard,
443
+ targetst _targets)
444
444
: code(std::move(_code)),
445
445
function (_function),
446
446
source_location(std::move(_source_location)),
447
- type(std::move( _type) ),
447
+ type(_type),
448
448
guard(std::move(_guard)),
449
449
targets(std::move(_targets))
450
450
{
@@ -807,6 +807,193 @@ class goto_programt
807
807
ins.validate (ns, vm);
808
808
}
809
809
}
810
+
811
+ static instructiont
812
+ make_return (const source_locationt &l = source_locationt::nil())
813
+ {
814
+ return instructiont (code_returnt (), irep_idt (), l, RETURN, nil_exprt (), {});
815
+ }
816
+
817
+ static instructiont
818
+ make_skip (const source_locationt &l = source_locationt::nil())
819
+ {
820
+ return instructiont (
821
+ static_cast <const codet &>(get_nil_irep ()),
822
+ irep_idt (),
823
+ l,
824
+ SKIP,
825
+ nil_exprt (),
826
+ {});
827
+ }
828
+
829
+ static instructiont make_location (const source_locationt &l)
830
+ {
831
+ return instructiont (
832
+ static_cast <const codet &>(get_nil_irep ()),
833
+ irep_idt (),
834
+ l,
835
+ LOCATION,
836
+ nil_exprt (),
837
+ {});
838
+ }
839
+
840
+ static instructiont
841
+ make_throw (const source_locationt &l = source_locationt::nil())
842
+ {
843
+ return instructiont (
844
+ static_cast <const codet &>(get_nil_irep ()),
845
+ irep_idt (),
846
+ l,
847
+ THROW,
848
+ nil_exprt (),
849
+ {});
850
+ }
851
+
852
+ static instructiont
853
+ make_catch (const source_locationt &l = source_locationt::nil())
854
+ {
855
+ return instructiont (
856
+ static_cast <const codet &>(get_nil_irep ()),
857
+ irep_idt (),
858
+ l,
859
+ CATCH,
860
+ nil_exprt (),
861
+ {});
862
+ }
863
+
864
+ static instructiont make_assertion (
865
+ const exprt &g,
866
+ const source_locationt &l = source_locationt::nil())
867
+ {
868
+ return instructiont (
869
+ static_cast <const codet &>(get_nil_irep ()),
870
+ irep_idt (),
871
+ l,
872
+ ASSERT,
873
+ exprt (g),
874
+ {});
875
+ }
876
+
877
+ static instructiont make_assumption (
878
+ const exprt &g,
879
+ const source_locationt &l = source_locationt::nil())
880
+ {
881
+ return instructiont (
882
+ static_cast <const codet &>(get_nil_irep ()), irep_idt (), l, ASSUME, g, {});
883
+ }
884
+
885
+ static instructiont make_other (const codet &_code)
886
+ {
887
+ return instructiont (
888
+ _code, irep_idt (), source_locationt::nil (), OTHER, nil_exprt (), {});
889
+ }
890
+
891
+ static instructiont make_decl (
892
+ const symbol_exprt &symbol,
893
+ const source_locationt &l = source_locationt::nil())
894
+ {
895
+ return instructiont (
896
+ code_declt (symbol), irep_idt (), l, DECL, nil_exprt (), {});
897
+ }
898
+
899
+ static instructiont make_dead (
900
+ const symbol_exprt &symbol,
901
+ const source_locationt &l = source_locationt::nil())
902
+ {
903
+ return instructiont (
904
+ code_deadt (symbol), irep_idt (), l, DEAD, nil_exprt (), {});
905
+ }
906
+
907
+ static instructiont
908
+ make_atomic_begin (const source_locationt &l = source_locationt::nil())
909
+ {
910
+ return instructiont (
911
+ static_cast <const codet &>(get_nil_irep ()),
912
+ irep_idt (),
913
+ l,
914
+ ATOMIC_BEGIN,
915
+ nil_exprt (),
916
+ {});
917
+ }
918
+
919
+ static instructiont
920
+ make_atomic_end (const source_locationt &l = source_locationt::nil())
921
+ {
922
+ return instructiont (
923
+ static_cast <const codet &>(get_nil_irep ()),
924
+ irep_idt (),
925
+ l,
926
+ ATOMIC_END,
927
+ nil_exprt (),
928
+ {});
929
+ }
930
+
931
+ static instructiont
932
+ make_end_function (const source_locationt &l = source_locationt::nil())
933
+ {
934
+ return instructiont (
935
+ static_cast <const codet &>(get_nil_irep ()),
936
+ irep_idt (),
937
+ l,
938
+ END_FUNCTION,
939
+ nil_exprt (),
940
+ {});
941
+ }
942
+
943
+ static instructiont make_incomplete_goto (
944
+ const code_gotot &_code,
945
+ const source_locationt &l = source_locationt::nil())
946
+ {
947
+ return instructiont (_code, irep_idt (), l, INCOMPLETE_GOTO, nil_exprt (), {});
948
+ }
949
+
950
+ static instructiont make_goto (
951
+ targett _target,
952
+ const source_locationt &l = source_locationt::nil())
953
+ {
954
+ return instructiont (
955
+ static_cast <const codet &>(get_nil_irep ()),
956
+ irep_idt (),
957
+ l,
958
+ GOTO,
959
+ true_exprt (),
960
+ {_target});
961
+ }
962
+
963
+ static instructiont make_goto (
964
+ targett _target,
965
+ const exprt &g,
966
+ const source_locationt &l = source_locationt::nil())
967
+ {
968
+ return instructiont (
969
+ static_cast <const codet &>(get_nil_irep ()),
970
+ irep_idt (),
971
+ l,
972
+ GOTO,
973
+ g,
974
+ {_target});
975
+ }
976
+
977
+ static instructiont make_assignment (
978
+ const code_assignt &_code,
979
+ const source_locationt &l = source_locationt::nil())
980
+ {
981
+ return instructiont (_code, irep_idt (), l, ASSIGN, nil_exprt (), {});
982
+ }
983
+
984
+ static instructiont make_decl (
985
+ const code_declt &_code,
986
+ const source_locationt &l = source_locationt::nil())
987
+ {
988
+ return instructiont (_code, irep_idt (), l, DECL, nil_exprt (), {});
989
+ }
990
+
991
+ static instructiont make_function_call (
992
+ const code_function_callt &_code,
993
+ const source_locationt &l = source_locationt::nil())
994
+ {
995
+ return instructiont (_code, irep_idt (), l, FUNCTION_CALL, nil_exprt (), {});
996
+ }
810
997
};
811
998
812
999
// / Get control-flow successors of a given instruction. The instruction is
0 commit comments