You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/analyses/assert.ml
+5-17Lines changed: 5 additions & 17 deletions
Original file line number
Diff line number
Diff line change
@@ -15,26 +15,14 @@ struct
15
15
16
16
letassert_fnmanecheckrefine=
17
17
let expr =CilType.Exp.show e in
18
-
letwarnwarn_fn?annotmsg=if check then
19
-
if get_bool "dbg.regression"then ( (* This only prints unexpected results (with the difference) as indicated by the comment behind the assert (same as used by the regression test script). *)
20
-
let loc =!M.current_loc in
21
-
let line =List.at (List.of_enum @@File.lines_of loc.file) (loc.line-1) in(* nosemgrep: batenum-of_enum *)
22
-
letopenStrin
23
-
let expected =if string_match (regexp ".+//.*\\(FAIL\\|UNKNOWN\\).*") line 0thenSome (matched_group 1 line) elseNonein
24
-
if expected <> annot then (
25
-
let result =if annot =None&& (expected =Some ("NOWARN") || (expected =Some ("UNKNOWN") &¬ (String.exists line "UNKNOWN!"))) then"improved"else"failed"in
26
-
(* Expressions with logical connectives like a && b are calculated in temporary variables by CIL. Instead of the original expression, we then see something like tmp___0. So we replace expr in msg by the original source if this is the case. *)
27
-
let assert_expr =if string_match (regexp ".*assert(\\(.+\\));.*") line 0then matched_group 1 line else expr in
28
-
let msg =if expr <> assert_expr thenString.nreplace ~str:msg ~sub:expr ~by:assert_expr else msg in
0 commit comments