Module InferModules.ConcurrencyModels

module F = Stdlib.Format
type lock_effect =
| Lock of InferIR.HilExp.t list

simultaneously acquire a list of locks

| Unlock of InferIR.HilExp.t list

simultaneously release a list of locks

| LockedIfTrue of InferIR.HilExp.t list

simultaneously attempt to acquire a list of locks

| GuardConstruct of {
guard : InferIR.HilExp.t;
lock : InferIR.HilExp.t;
acquire_now : bool;
}

mutex guard construction - clang only

| GuardLock of InferIR.HilExp.t

lock underlying mutex via guard - clang only

| GuardLockedIfTrue of InferIR.HilExp.t

lock underlying mutex if true via guard - clang only

| GuardUnlock of InferIR.HilExp.t

unlock underlying mutex via guard - clang only

| GuardDestroy of InferIR.HilExp.t

destroy guard and unlock underlying mutex - clang only

| NoEffect

function call has no lock-relevant effect

effect of call plus Hil expressions being un/locked, if known

type thread =
| BackgroundThread
| MainThread
| MainThreadIfTrue
| UnknownThread
val is_thread_utils_method : string -> InferIR.Typ.Procname.t -> bool

return true if the given method name is a utility class for checking what thread we're on TODO: clean this up so it takes only a procname

val get_lock_effect : InferIR.Typ.Procname.t -> InferIR.HilExp.t list -> lock_effect

describe how this procedure behaves with respect to locking

val get_thread : InferIR.Typ.Procname.t -> thread

describe how this procedure behaves with respect to thread access

val runs_on_ui_thread : attrs_of_pname:(InferIR.Typ.Procname.t -> InferIR.ProcAttributes.t option) -> InferIR.Tenv.t -> InferIR.Procdesc.t -> string option

We don't want to warn on methods that run on the UI thread because they should always be single-threaded. Assume that methods annotated with @UiThread, @OnEvent, @OnBind, @OnMount, @OnUnbind, @OnUnmount always run on the UI thread. Also assume that any superclass marked @UiThread implies all methods are on UI thread. Return Some string explaining why this method is on the UI thread, else return None.

val get_current_class_and_annotated_superclasses : (InferIR.Annot.Item.t -> bool) -> InferIR.Tenv.t -> InferIR.Typ.Procname.t -> (InferIR.Typ.name * InferIR.Typ.name list) option
val find_method_or_override_annotated : attrs_of_pname:(InferIR.Typ.Procname.t -> InferIR.ProcAttributes.t option) -> (InferIR.Annot.Item.t -> bool) -> InferIR.Typ.Procname.t -> InferIR.Tenv.t -> InferIR.Typ.Procname.t InferStdlib.IStd.sexp_option
val cpp_lock_types_matcher : InferIR.QualifiedCppName.Match.quals_matcher
val is_recursive_lock_type : InferIR.Typ.name -> bool