123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101(****************************************************************************)(* *)(* This file is part of MOPSA, a Modular Open Platform for Static Analysis. *)(* *)(* Copyright (C) 2017-2019 The MOPSA Project. *)(* *)(* This program is free software: you can redistribute it and/or modify *)(* it under the terms of the GNU Lesser General Public License as published *)(* by the Free Software Foundation, either version 3 of the License, or *)(* (at your option) any later version. *)(* *)(* This program is distributed in the hope that it will be useful, *)(* but WITHOUT ANY WARRANTY; without even the implied warranty of *)(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *)(* GNU Lesser General Public License for more details. *)(* *)(* You should have received a copy of the GNU Lesser General Public License *)(* along with this program. If not, see <http://www.gnu.org/licenses/>. *)(* *)(****************************************************************************)(** Standard signature of functor domains *)openCore.AllopenDomainopenMopsa_utilsmoduletypeDOMAIN_FUNCTOR=sigvalname:stringmoduleFunctor:functor(D:DOMAIN)->DOMAINend(*==========================================================================*)(** {2 Registration} *)(*==========================================================================*)(** Instrument transfer functions with some useful pre/post processing *)moduleInstrument(F:DOMAIN_FUNCTOR):DOMAIN_FUNCTOR=structletname=F.namemoduleFunctor(D:DOMAIN)=structmoduleI=F.Functor(D)includeI(* Add stmt to the effects of the domain *)letexecstmtmanflow=ifare_effects_enabled()thenI.execstmtmanflow|>OptionExt.lift@@funres->Cases.map_effects(funeffects->man.set_effects(man.get_effectseffects|>add_stmt_to_teffectstmt)effects)reselseI.execstmtmanflow(* Remove duplicate evaluations *)letevalexpmanflow=I.evalexpmanflow|>OptionExt.lift@@Eval.remove_duplicatesman.latticeendendletfunctors:(moduleDOMAIN_FUNCTOR)listref=ref[]letregister_domain_functorf=letmoduleF=(valf:DOMAIN_FUNCTOR)inletmoduleFF=Instrument(F)infunctors:=(moduleFF)::!functorsletfind_domain_functorname=List.find(fundom->letmoduleD=(valdom:DOMAIN_FUNCTOR)incompareD.namename=0)!functorsletmem_domain_functorname=List.exists(fundom->letmoduleD=(valdom:DOMAIN_FUNCTOR)incompareD.namename=0)!functorsletdomain_functor_names()=List.map(fundom->letmoduleD=(valdom:DOMAIN_FUNCTOR)inD.name)!functors