package frama-c-metacsl

  1. Overview
  2. Docs

Source file meta_utils.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
(**************************************************************************)
(*                                                                        *)
(*  SPDX-License-Identifier LGPL-2.1                                      *)
(*  Copyright (C)                                                         *)
(*  CEA (Commissariat à l'énergie atomique et aux énergies alternatives)  *)
(*                                                                        *)
(**************************************************************************)

module StrSet = Datatype.String.Set
module Str_Hashtbl = Datatype.String.Hashtbl
module Stmt_Hashtbl = Cil_datatype.Stmt.Hashtbl
module Fundec_Hashtbl = Cil_datatype.Fundec.Hashtbl
module Fundec_Set = Cil_datatype.Fundec.Set

let find_hash_list find_opt table key =
  match find_opt table key with
    | Some l -> l
    | None -> []

(* In a hashtable mapping key to lists of values, adds v to that list *)
let add_to_hash_list (find_opt, replace) table key v =
  let old_list = find_hash_list find_opt table key in
  replace table key (v :: old_list)