Skip to content

Commit c42ec6b

Browse files
committed
Refactor Access.may_race with match
1 parent 417d5d3 commit c42ec6b

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

src/domains/access.ml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -438,16 +438,13 @@ struct
438438
end
439439

440440

441-
(* Check if two accesses may race and if yes with which confidence *)
441+
(** Check if two accesses may race. *)
442442
let may_race A.{kind; acc; _} A.{kind=kind2; acc=acc2; _} =
443-
if kind = Read && kind2 = Read then
444-
false (* two read/read accesses do not race *)
445-
else if not (get_bool "ana.race.free") && (kind = Free || kind2 = Free) then
446-
false
447-
else if not (MCPAccess.A.may_race acc acc2) then
448-
false (* analysis-specific information excludes race *)
449-
else
450-
true
443+
match kind, kind2 with
444+
| Read, Read -> false (* two read/read accesses do not race *)
445+
| Free, _
446+
| _, Free when not (get_bool "ana.race.free") -> false
447+
| _, _ -> MCPAccess.A.may_race acc acc2 (* analysis-specific information excludes race *)
451448

452449
(** Access sets for race detection and warnings. *)
453450
module WarnAccs =

0 commit comments

Comments
 (0)