-
Notifications
You must be signed in to change notification settings - Fork 6
/
control_flow_c2.mli
109 lines (81 loc) · 2.9 KB
/
control_flow_c2.mli
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
open Ast_c
type node = node1 * string (* For debugging. Used by print_graph *)
and node1 = node2 * nodeinfo
and nodeinfo = {
labels: int list; (* Labels. Trick used for CTL engine *)
bclabels: int list; (* parent of a break or continue node *)
is_loop: bool;
is_fake: bool;
}
and node2 =
| TopNode
| EndNode
| FunHeader of definition (* but empty body *)
| Decl of declaration
| SeqStart of statement * int * info
| SeqEnd of int * info
| ExprStatement of statement * (expression option) wrap
| IfHeader of statement * expression wrap
| Else of info
| WhileHeader of statement * expression wrap
| DoHeader of statement * expression * info
| DoWhileTail of expression wrap
| ForHeader of statement *
(exprStatement wrap * exprStatement wrap * exprStatement wrap)
wrap
| SwitchHeader of statement * expression wrap
| MacroIterHeader of statement * (string * argument wrap2 list) wrap
| EndStatement of info option
| Return of statement * unit wrap
| ReturnExpr of statement * expression wrap
(* ------------------------ *)
| IfdefHeader of ifdef_directive
| IfdefElse of ifdef_directive
| IfdefEndif of ifdef_directive
(* ------------------------ *)
| DefineHeader of string wrap * define_kind
| DefineExpr of expression
| DefineType of fullType
| DefineDoWhileZeroHeader of unit wrap
| DefineTodo
| Include of includ
| MacroTop of string * argument wrap2 list * il
(* ------------------------ *)
| Case of statement * expression wrap
| Default of statement * unit wrap
| Continue of statement * unit wrap
| Break of statement * unit wrap
(* no counter part in cocci *)
| CaseRange of statement * (expression * expression) wrap
| Label of statement * string wrap
| Goto of statement * string wrap
| Asm of statement * asmbody wrap
| MacroStmt of statement * unit wrap
(* ------------------------ *)
| Enter
| Exit
| Fake
| CaseNode of int
(* ------------------------ *)
(* for ctl: *)
| TrueNode
| FalseNode
| InLoopNode
| AfterNode
| FallThroughNode
| ErrorExit
type edge = Direct
type cflow = (node, edge) Ograph_extended.ograph_mutable
val unwrap : node -> node2
val rewrap : node -> node2 -> node
val extract_labels : node -> int list
val extract_bclabels : node -> int list
val extract_fullstatement : node -> Ast_c.statement option
val extract_is_loop : node -> bool
val extract_is_fake : node -> bool
val mk_node: node2 -> int list -> int list -> string -> node
val mk_fake_node: node2 -> int list -> int list -> string -> node
val first_node : cflow -> Ograph_extended.nodei
val find_node : (node2 -> bool) -> cflow -> Ograph_extended.nodei
(* remove an intermediate node and redirect the connexion *)
val remove_one_node : Ograph_extended.nodei -> cflow -> unit