Skip to content

Commit b2c66d3

Browse files
Merge pull request #43 from goblint/stmt-fallthrough
Add CFG fallthrough field to stmt
2 parents 208d2a2 + 806794a commit b2c66d3

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/cil.ml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -736,6 +736,7 @@ and stmt = {
736736
and the context in which this
737737
statement appears *)
738738
mutable preds: stmt list; (** The inverse of the succs function*)
739+
mutable fallthrough: stmt option; (** The fallthrough successor statement computed from the context of this statement in {!Cil.computeCFGInto}. Useful for the syntactic successor of Goto and Loop. *)
739740
}
740741

741742
(** Labels *)
@@ -1323,7 +1324,7 @@ let isSigned = function
13231324
let mkStmt (sk: stmtkind) : stmt =
13241325
{ skind = sk;
13251326
labels = [];
1326-
sid = -1; succs = []; preds = [] }
1327+
sid = -1; succs = []; preds = []; fallthrough = None }
13271328

13281329
let mkBlock (slst: stmt list) : block =
13291330
{ battrs = []; bstmts = slst; }
@@ -6688,6 +6689,7 @@ let rec succpred_block b fallthrough rlabels =
66886689

66896690

66906691
and succpred_stmt s fallthrough rlabels =
6692+
s.fallthrough <- fallthrough;
66916693
match s.skind with
66926694
Instr _ -> trylink s fallthrough
66936695
| Return _ -> ()

src/cil.mli

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -925,6 +925,8 @@ and stmt = {
925925
* the CFG is computed. *)
926926
mutable preds: stmt list;
927927
(** The inverse of the succs function. *)
928+
mutable fallthrough: stmt option;
929+
(** The fallthrough successor statement computed from the context of this statement in {!Cil.computeCFGInto}. Useful for the syntactic successor of Goto and Loop. *)
928930
}
929931

930932
(** Labels *)

0 commit comments

Comments
 (0)