let select_annotations ~select_annot ~select_slice_pragma proj =
let visit_fun kf =
debug 1 "look for annotations in function %a@." Kernel_function.pretty kf;
let pdg = !Db.Pdg.get kf in
if PdgTypes.Pdg.is_top pdg then debug 1 "pdg top: skip annotations"
else if PdgTypes.Pdg.is_bottom pdg
then debug 1 "pdg bottom: skip annotations"
else begin
let filter annot = match annot.Cil_types.annot_content with
| Cil_types.APragma (Cil_types.Slice_pragma _) -> select_slice_pragma
| _ -> select_annot
in
try
let f = Kernel_function.get_definition kf in
let visit = new annot_visitor ~filter pdg in
let fc_visit = (visit:>Visitor.frama_c_visitor) in
let _ = Visitor.visitFramacFunction fc_visit f in
let to_select = visit#get_select in
if to_select <> [] then select_pdg_elements proj pdg to_select
with Kernel_function.No_Definition -> ()
end
in
Globals.Functions.iter visit_fun