Skip to content

Commit c2c93d9

Browse files
committed
[lib] Include full file path as cache key in ParseModel
Before, the hashtbl used to only contain as a key the name of the file to be looked up. This causes issues when multiple libdirs with conflicting file names are used across the same run of herd. This eliminates this issues by adapting the keys of this hashtbl so that they contain the full path of the file, thus avoiding conflicts.
1 parent c74bb1a commit c2c93d9

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

lib/parseModel.ml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,11 @@ module Make(O:Config) = struct
7373
(opts,txt,set_text pp code)
7474

7575
let find_parse fname =
76-
try Hashtbl.find t fname
76+
let fname = O.libfind fname in
77+
try fname, Hashtbl.find t fname
7778
with Not_found ->
78-
let key = fname in
79-
let fname = O.libfind fname in
8079
let r = Misc.input_protect (do_parse fname) fname in
81-
Hashtbl.add t key (fname,r) ;
80+
Hashtbl.add t fname r ;
8281
fname,r
8382

8483
let parse fname = let _,r = find_parse fname in r

0 commit comments

Comments
 (0)