Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Source file visibility.ml
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103(**************************************************************************)(* *)(* This file is part of the Frama-C's Lannotate plug-in. *)(* *)(* Copyright (C) 2012-2022 *)(* CEA (Commissariat à l'énergie atomique et aux énergies *)(* alternatives) *)(* *)(* 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, version 2.1. *)(* *)(* It 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. *)(* *)(* See the GNU Lesser General Public License version 2.1 *)(* for more details (enclosed in the file LICENSE) *)(* *)(**************************************************************************)openCil_typesopenAst_constclassto_visibilitypc_label=object(self)inheritVisitor.frama_c_inplacevalmutableto_add_vInfo=[]valmutableto_add_ret=None,[]valunk_loc=Cil_datatype.Location.unknownmethod!vvdecv=ifv.vname="__retres"thenv.vname<-"__retres_hidden_from_pc_view";SkipChildrenmethodprivatemk_init?(loc=unk_loc)vivalue=Local_init(vi,AssignInit(SingleInit(value)),loc)|>Stmt_builder.instrmethodprivatemk_comp?(loc=unk_loc)opvivalue=letnew_exp=Cil.new_exp~loc(Lval(Varvi,NoOffset))inExp_builder.binopopnew_expvaluemethod!vfunc_=Cil.DoChildrenPost(funf->letinits=List.map(fun(vi,_,_)->self#mk_initvi(Cil.zero~loc:unk_loc))to_add_vInfointo_add_vInfo<-[];to_add_ret<-None,[];f.sbody.bstmts<-inits@f.sbody.bstmts;f)method!vblock_=Cil.DoChildrenPost(funblock->matchto_add_retwith|None,_|Some_,[]->block|Somes,lbls->letrecauxlacc=matchlwith|[]->acc|s'::twhenCil_datatype.Stmt.equalss'->s'.skind<-Block(Cil.mkBlock(lbls@[Stmt_builder.mks'.skind]));auxt(acc@[s'])|s'::t->auxt(acc@[s'])inblock.bstmts<-auxblock.bstmts[];block)method!vstmt_auxs=matchs.skindwith|Instr(Call(_,{enode=Lval(Var{vname=name},NoOffset)},[cond;{enode=Const(CInt64(id,IInt,None))}asidExp;tagExp],loc))whenString.equalname"pc_label"->letvname="__SEQ_VISIBILITY_"^(string_of_int(Integer.to_int_exnid))inletpred_vInfo=Cil.makeVarinfofalsefalsevnameCil.intTypeinletexp_vInfo=Exp_builder.lval~loc(Varpred_vInfo,NoOffset)inletkeep_covered=Exp_builder.binop~locLOrexp_vInfocondinletset=Ast_info.mkassign(Varpred_vInfo,NoOffset)keep_coveredlocinto_add_vInfo<-to_add_vInfo@[(pred_vInfo,idExp,tagExp)];s.skind<-Instrset;Cil.SkipChildren|Return(_,loc)->letlbls=List.map(fun(vi,id,tag)->letcond=self#mk_comp~locNevi(Cil.zero~loc)inUtils.mk_callpc_label[cond;id;tag])to_add_vInfointo_add_ret<-(Somes,lbls);Cil.SkipChildren|_->Cil.DoChildrenendletto_visibilityastpc_label=Visitor.visitFramacFileSameGlobals(newto_visibilitypc_label:>Visitor.frama_c_visitor)ast