Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Source file libraryDesc.ml
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180(** Library function descriptor (specification). *)moduleCil=GoblintCilopenCil(** Pointer argument access specification. *)moduleAccess=structtypet={kind:AccessKind.t;(** Kind of access. *)deep:bool;(** Depth of access
- Shallow only accesses directly pointed values (may point to).
- Deep additionally follows all pointers in values (reachable). Rarely needed. *)}endtypemath=|Nanof(CilType.Fkind.t*Basetype.CilExp.t)|InfofCilType.Fkind.t|IsfiniteofBasetype.CilExp.t|IsinfofBasetype.CilExp.t|IsnanofBasetype.CilExp.t|IsnormalofBasetype.CilExp.t|SignbitofBasetype.CilExp.t|Isgreaterof(Basetype.CilExp.t*Basetype.CilExp.t)|Isgreaterequalof(Basetype.CilExp.t*Basetype.CilExp.t)|Islessof(Basetype.CilExp.t*Basetype.CilExp.t)|Islessequalof(Basetype.CilExp.t*Basetype.CilExp.t)|Islessgreaterof(Basetype.CilExp.t*Basetype.CilExp.t)|Isunorderedof(Basetype.CilExp.t*Basetype.CilExp.t)|Absof(CilType.Ikind.t*Basetype.CilExp.t)|Ceilof(CilType.Fkind.t*Basetype.CilExp.t)|Floorof(CilType.Fkind.t*Basetype.CilExp.t)|Fabsof(CilType.Fkind.t*Basetype.CilExp.t)|Fmaxof(CilType.Fkind.t*Basetype.CilExp.t*Basetype.CilExp.t)|Fminof(CilType.Fkind.t*Basetype.CilExp.t*Basetype.CilExp.t)|Acosof(CilType.Fkind.t*Basetype.CilExp.t)|Asinof(CilType.Fkind.t*Basetype.CilExp.t)|Atanof(CilType.Fkind.t*Basetype.CilExp.t)|Atan2of(CilType.Fkind.t*Basetype.CilExp.t*Basetype.CilExp.t)|Cosof(CilType.Fkind.t*Basetype.CilExp.t)|Sinof(CilType.Fkind.t*Basetype.CilExp.t)|Tanof(CilType.Fkind.t*Basetype.CilExp.t)|Sqrtof(CilType.Fkind.t*Basetype.CilExp.t)[@@derivingeq,ord,hash](** Type of special function, or {!Unknown}. *)(* Use inline record if not single {!Cil.exp} argument. *)typespecial=|AllocaofCil.exp|MallocofCil.exp|Callocof{count:Cil.exp;size:Cil.exp;}|Reallocof{ptr:Cil.exp;size:Cil.exp;}|FreeofCil.exp|Assertof{exp:Cil.exp;check:bool;refine:bool;}|Lockof{lock:Cil.exp;try_:bool;write:bool;return_on_success:bool;}|UnlockofCil.exp|ThreadCreateof{thread:Cil.exp;start_routine:Cil.exp;arg:Cil.exp;multiple:bool}|ThreadJoinof{thread:Cil.exp;ret_var:Cil.exp;}|ThreadExitof{ret_val:Cil.exp;}|ThreadSelf|GlobalizeofCil.exp|SignalofCil.exp|BroadcastofCil.exp|MutexAttrSetTypeof{attr:Cil.exp;typ:Cil.exp;}|MutexInitof{mutex:Cil.exp;attr:Cil.exp;}(* All Sem specials are not used yet. *)|SemInitof{sem:Cil.exp;pshared:Cil.exp;value:Cil.exp;}|SemWaitof{sem:Cil.exp;try_:bool;timeout:Cil.expoption;}|SemPostofCil.exp|SemDestroyofCil.exp|Waitof{cond:Cil.exp;mutex:Cil.exp;}|TimedWaitof{cond:Cil.exp;mutex:Cil.exp;abstime:Cil.exp;(** Unused *)}|BarrierWaitofCil.exp|BarrierInitof{barrier:Cil.exp;attr:Cil.exp;count:Cil.exp;}|Mathof{fun_args:math;}|Memsetof{dest:Cil.exp;ch:Cil.exp;count:Cil.exp;}|Bzeroof{dest:Cil.exp;count:Cil.exp;}|Memcpyof{dest:Cil.exp;src:Cil.exp;n:Cil.exp;}|Strcpyof{dest:Cil.exp;src:Cil.exp;n:Cil.expoption;}|Strcatof{dest:Cil.exp;src:Cil.exp;n:Cil.expoption;}|StrlenofCil.exp|Strstrof{haystack:Cil.exp;needle:Cil.exp;}|Strcmpof{s1:Cil.exp;s2:Cil.exp;n:Cil.expoption;}|Abort|IdentityofCil.exp(** Identity function. Some compiler optimization annotation functions map to this. *)|Setjmpof{env:Cil.exp;}|Longjmpof{env:Cil.exp;value:Cil.exp;}|Boundedof{exp:Cil.exp}(** Used to check for bounds for termination analysis. *)|Rand|Onceof{once_control:Cil.exp;init_routine:Cil.exp;}|Unknown(** Anything not belonging to other types. *)(* TODO: rename to Other? *)(** Pointer arguments access specification. *)moduleAccesses=structtypet=Cil.explist->(Access.t*Cil.explist)list(* TODO: remove/rename after migration? *)letfind(accs:t):Access.t->Cil.explist->Cil.explist=funaccargs->BatOption.(List.assoc_optacc(accsargs)|?[])letfind_kind(accs:t):AccessKind.t->Cil.explist->Cil.explist=funkindargs->letfa=findaccsaargsinf{kind;deep=true;}@f{kind;deep=false;}letiter(accs:t)(f:Access.t->Cil.exp->unit)args:unit=accsargs|>List.iter(fun(acc,exps)->List.iter(funexp->faccexp)exps)letfold(accs:t)(f:Access.t->Cil.exp->'a->'a)args(a:'a):'a=accsargs|>List.fold_left(funa(acc,exps)->List.fold_left(funaexp->faccexpa)aexps)aend(** Function attribute. *)typeattr=|ThreadUnsafe(** Function is not thread-safe to call, e.g. due to its own internal (global) state.
@see <https://man7.org/linux/man-pages/man7/pthreads.7.html> for list of thread-unsafe functions under POSIX.
@see <https://github.com/goblint/analyzer/issues/723> for Goblint issue about the (future) use of this attribute. *)|InvalidateGlobals(** Function invalidates all globals when called. *)(* TODO: AccessGlobals of Access.t list? *)(** Library function descriptor. *)typet={special:Cil.explist->special;(** Conversion to {!type-special} using arguments. *)accs:Accesses.t;(** Pointer arguments access specification. *)attrs:attrlist;(** Attributes of function. *)}moduleMathPrintable=structincludePrintable.StdLeaftypet=math[@@derivingeq,ord,hash]letname()="MathPrintable"letpretty()=function|Nan(fk,exp)->Pretty.dprintf"(%a )nan(%a)"d_fkindfkd_expexp|Inffk->Pretty.dprintf"(%a )inf()"d_fkindfk|Isfiniteexp->Pretty.dprintf"isFinite(%a)"d_expexp|Isinfexp->Pretty.dprintf"isInf(%a)"d_expexp|Isnanexp->Pretty.dprintf"isNan(%a)"d_expexp|Isnormalexp->Pretty.dprintf"isNormal(%a)"d_expexp|Signbitexp->Pretty.dprintf"signbit(%a)"d_expexp|Isgreater(exp1,exp2)->Pretty.dprintf"isGreater(%a, %a)"d_expexp1d_expexp2|Isgreaterequal(exp1,exp2)->Pretty.dprintf"isGreaterEqual(%a, %a)"d_expexp1d_expexp2|Isless(exp1,exp2)->Pretty.dprintf"isLess(%a, %a)"d_expexp1d_expexp2|Islessequal(exp1,exp2)->Pretty.dprintf"isLessEqual(%a, %a)"d_expexp1d_expexp2|Islessgreater(exp1,exp2)->Pretty.dprintf"isLessGreater(%a, %a)"d_expexp1d_expexp2|Isunordered(exp1,exp2)->Pretty.dprintf"isUnordered(%a, %a)"d_expexp1d_expexp2|Abs(ik,exp)->Pretty.dprintf"(%a )abs(%a)"d_ikindikd_expexp|Ceil(fk,exp)->Pretty.dprintf"(%a )ceil(%a)"d_fkindfkd_expexp|Floor(fk,exp)->Pretty.dprintf"(%a )floor(%a)"d_fkindfkd_expexp|Fabs(fk,exp)->Pretty.dprintf"(%a )fabs(%a)"d_fkindfkd_expexp|Fmax(fk,exp1,exp2)->Pretty.dprintf"(%a )fmax(%a, %a)"d_fkindfkd_expexp1d_expexp2|Fmin(fk,exp1,exp2)->Pretty.dprintf"(%a )fmin(%a, %a)"d_fkindfkd_expexp1d_expexp2|Acos(fk,exp)->Pretty.dprintf"(%a )acos(%a)"d_fkindfkd_expexp|Asin(fk,exp)->Pretty.dprintf"(%a )asin(%a)"d_fkindfkd_expexp|Atan(fk,exp)->Pretty.dprintf"(%a )atan(%a)"d_fkindfkd_expexp|Atan2(fk,exp1,exp2)->Pretty.dprintf"(%a )atan2(%a, %a)"d_fkindfkd_expexp1d_expexp2|Cos(fk,exp)->Pretty.dprintf"(%a )cos(%a)"d_fkindfkd_expexp|Sin(fk,exp)->Pretty.dprintf"(%a )sin(%a)"d_fkindfkd_expexp|Tan(fk,exp)->Pretty.dprintf"(%a )tan(%a)"d_fkindfkd_expexp|Sqrt(fk,exp)->Pretty.dprintf"(%a )sqrt(%a)"d_fkindfkd_expexpincludePrintable.SimplePretty(structtypenonrect=tletpretty=prettyend)endmoduleMathLifted=Lattice.FlatConf(structincludePrintable.DefaultConflettop_name="Unknown or no math desc"letbot_name="Nonexistent math desc"end)(MathPrintable)