Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not allow to collect globals with duplicate identifiers in map #615

Merged
merged 1 commit into from
Mar 15, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/incremental/compareCIL.ml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,13 @@ let compareCilFiles ?(eq=eq_glob) (oldAST: file) (newAST: file) =

let addGlobal map global =
try
GlobalMap.add (identifier_of_global global) global map
let gid = identifier_of_global global in
let gid_to_string gid = match gid.global_t with
| Var -> "Var " ^ gid.name
| Decl -> "Decl " ^ gid.name
| Fun -> "Fun " ^ gid.name
| _ -> raise (NoGlobalIdentifier global) in
if GlobalMap.mem gid map then failwith ("Duplicate global identifier: " ^ gid_to_string gid) else GlobalMap.add gid global map
with
NoGlobalIdentifier _ -> map
in
Expand Down