Open Utils module to avoid prefixing common list functions.

master
Rohan Jacob-Rao 10 years ago
parent 96d5931744
commit f3afc6848b

@ -7,6 +7,7 @@
* of patent rights can be found in the PATENTS file in the same directory.
*)
%{
open Utils
open LAst
%}
@ -155,9 +156,9 @@
prog:
| targets defs = func_def* opt_mappings = metadata_def* EOF {
let mappings = Utils.list_flatten_options opt_mappings in
let mappings = list_flatten_options opt_mappings in
let add_mapping map (metadata_id, components) = MetadataMap.add metadata_id components map in
let metadata_map = Utils.list_fold_left add_mapping MetadataMap.empty mappings in
let metadata_map = list_fold_left add_mapping MetadataMap.empty mappings in
Prog (defs, metadata_map) }
targets:
@ -240,7 +241,7 @@ ptr_typ:
| tp = typ STAR { tp }
block:
| LBRACE annotated_instrs = annotated_instr* RBRACE { Utils.list_flatten_options annotated_instrs }
| LBRACE annotated_instrs = annotated_instr* RBRACE { list_flatten_options annotated_instrs }
annotated_instr:
| instruction = real_instr anno = annotation? { Some (instruction, anno) }

@ -7,6 +7,7 @@
* of patent rights can be found in the PATENTS file in the same directory.
*)
open Utils
open LAst
exception ImproperTypeError of string
@ -114,7 +115,7 @@ let trans_func_def (cfg : Cfg.cfg) (cg: Cg.t) (metadata : LAst.metadata_map)
ret_type = (match ret_tp_opt with
| None -> Sil.Tvoid
| Some ret_tp -> trans_typ ret_tp);
formals = Utils.list_map (fun (tp, name) -> (name, trans_typ tp)) params;
formals = list_map (fun (tp, name) -> (name, trans_typ tp)) params;
locals = []; (* TODO *)
captured = [];
loc = Sil.dummy_location
@ -133,7 +134,7 @@ let trans_func_def (cfg : Cfg.cfg) (cg: Cg.t) (metadata : LAst.metadata_map)
| [] -> Cfg.Node.set_succs_exn start_node [exit_node] [exit_node]
| nd :: nds -> Cfg.Node.set_succs_exn start_node [nd] [exit_node]; link_nodes nd nds in
let (sil_instrs, locals) = trans_annotated_instrs cfg procdesc metadata annotated_instrs in
let nodes = Utils.list_map (node_of_sil_instr cfg procdesc) sil_instrs in
let nodes = list_map (node_of_sil_instr cfg procdesc) sil_instrs in
Cfg.Procdesc.set_start_node procdesc start_node;
Cfg.Procdesc.set_exit_node procdesc exit_node;
link_nodes start_node nodes;
@ -145,5 +146,5 @@ let trans_prog : LAst.prog -> Cfg.cfg * Cg.t * Sil.tenv = function
let cfg = Cfg.Node.create_cfg () in
let cg = Cg.create () in
let tenv = Sil.create_tenv () in
Utils.list_iter (trans_func_def cfg cg metadata) func_defs;
list_iter (trans_func_def cfg cg metadata) func_defs;
(cfg, cg, tenv)

Loading…
Cancel
Save