123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133(**************************************************************************)(* *)(* SPDX-License-Identifier LGPL-2.1 *)(* Copyright (C) *)(* CEA (Commissariat à l'énergie atomique et aux énergies alternatives) *)(* *)(**************************************************************************)openCilopenCil_typesopenAst_constletaorOption:boolref=reffalseletrorOption:boolref=reffalseletcorOption:boolref=reffalseletabsOption:boolref=reffalseclassmutationVisitormk_label=object(self)inheritVisitor.frama_c_inplacevalmutableexprs=[]valmutablecurrloc=Fileloc.unknownmethodprivatemakeLabelcondcategory=letle=mk_label~extra:[category]cond[]currlocinexprs<-exprs@[le]methodprivatemk_op_labelseloplexprexpwmopt=ifopt=truethenList.iter(funop->letnewExp=Exp_builder.binopoplexprexpinletlabelExp=Exp_builder.binopNenewExpeinself#makeLabellabelExpwm)lop;self#traitExplexp;self#traitExprexpmethodprivatetraitExpe=matche.enodewith|BinOp(LAnd,lexp,rexp,_ty)->self#mk_op_labelse[LOr]lexprexp"COR"!corOption|BinOp(LOr,lexp,rexp,_ty)->self#mk_op_labelse[LAnd]lexprexp"COR"!corOption|BinOp(Div,lexp,rexp,_ty)->self#mk_op_labelse[Mult;PlusA;MinusA]lexprexp"AOR"!aorOption|BinOp(Mult,lexp,rexp,_ty)->self#mk_op_labelse[Div;PlusA;MinusA]lexprexp"AOR"!aorOption|BinOp(PlusA,lexp,rexp,_ty)->self#mk_op_labelse[Mult;Div;MinusA]lexprexp"AOR"!aorOption|BinOp(MinusA,lexp,rexp,_ty)->self#mk_op_labelse[Mult;Div;PlusA]lexprexp"AOR"!aorOption|BinOp(Lt,lexp,rexp,_ty)->self#mk_op_labelse[Le;Gt;Ge]lexprexp"ROR"!rorOption|BinOp(Gt,lexp,rexp,_ty)->self#mk_op_labelse[Lt;Le;Ge]lexprexp"ROR"!rorOption|BinOp(Le,lexp,rexp,_ty)->self#mk_op_labelse[Lt;Gt;Ge]lexprexp"ROR"!rorOption|BinOp(Ge,lexp,rexp,_ty)->self#mk_op_labelse[Lt;Le;Gt]lexprexp"ROR"!rorOption|BinOp(Eq,lexp,rexp,_ty)->self#mk_op_labelse[Ne]lexprexp"ROR"!rorOption|BinOp(Ne,lexp,rexp,_ty)->self#mk_op_labelse[Eq]lexprexp"ROR"!rorOption|BinOp(Shiftlt,lexp,rexp,_ty)->self#mk_op_labelse[Shiftrt]lexprexp"AOR"!aorOption|BinOp(Shiftrt,lexp,rexp,_ty)->self#mk_op_labelse[Shiftlt]lexprexp"AOR"!aorOption|BinOp(_op,lexp,rexp,_ty)->self#traitExplexp;self#traitExprexp|UnOp(Neg,exp,_ty)->if!aorOption=truethenbeginletlabelExp=Exp_builder.binopNeexpeinself#makeLabellabelExp"AOR"end;self#traitExpexp|UnOp(_op,exp,_ty)->self#traitExpexp|Lval(_l)->if!absOption=truethenbeginletzeroExp=Exp_builder.zero()inletlabelExp=Exp_builder.binopLtezeroExpinself#makeLabellabelExp"ABS"end|_->()method!vfuncf=ifAnnotators.shouldInstrumentFunf.svarthenDoChildrenelseSkipChildrenmethod!vstmt_auxstmt=beginmatchstmt.skindwith|Instr(Set(_l,e,loc))->currloc<-loc;self#traitExpe|If(e,_l,_ll,loc)->currloc<-loc;self#traitExpe|Return(e,loc)->beginmatchewith|Someexp->currloc<-loc;self#traitExpexp|_->()end|Switch(e,_l,_ll,loc)->currloc<-loc;self#traitExpe|_->()end;letstmtExprsLabels=exprsinexprs<-[];DoChildrenPost(funstmt->matchstmtExprsLabelswith|[]->stmt|_->stmt.skind<-Block(Cil.mkBlock(stmtExprsLabels@[Stmt_builder.mkstmt.skind]));stmt)endmoduleWM=Annotators.RegisterWithExtraTags(structletname="WM"lethelp="Weak Mutation"letapplymk_labelast=Visitor.visitFramacFileSameGlobals(newmutationVisitormk_label:>Visitor.frama_c_inplace)astend)