Module Backend.Callbacks

Module to register and invoke checkers' callbacks.

type proc_callback_args = {
  1. summary : Summary.t;
  2. exe_env : Absint.Exe_env.t;
  3. proc_desc : IR.Procdesc.t;
}

Type of a procedure callback:

  • List of all the procedures the callback will be called on.
  • get_proc_desc to get a proc desc from a proc name
  • Type environment.
  • Procedure for the callback to act on.
type proc_callback_t = proc_callback_args -> Summary.t
type proc_callback_with_specialization_t = ?specialization:IR.Specialization.t -> proc_callback_t
type file_callback_args = {
  1. procedures : IR.Procname.t list;
  2. source_file : IBase.SourceFile.t;
  3. exe_env : Absint.Exe_env.t;
}
type file_callback_t = file_callback_args -> Absint.IssueLog.t

Result is a list of additional issues found at this stage (complementary to issues generated on per-procedure analysis stage)

val register_procedure_callback : IBase.Checker.t -> ?dynamic_dispatch:bool -> IBase.Language.t -> proc_callback_t -> unit

Register a procedure callback (see details above)

val register_procedure_callback_with_specialization : IBase.Checker.t -> ?dynamic_dispatch:bool -> IBase.Language.t -> proc_callback_with_specialization_t -> is_already_specialized:(IR.Specialization.t -> Summary.t -> bool) -> unit

Same as register_procedure_callback with specialization

val register_file_callback : IBase.Checker.t -> IBase.Language.t -> file_callback_t -> unit

Register a file callback (see details above). issues_dir must be unique for this type of checker.

val iterate_procedure_callbacks : Absint.Exe_env.t -> IBase.AnalysisRequest.t -> ?specialization:IR.Specialization.t -> Summary.t -> IR.Procdesc.t -> Summary.t

Invoke all registered procedure callbacks on the given procedure.

val is_specialized_for : IR.Specialization.t -> Summary.t -> bool

Check if all callbacks are specialized wrt the given specialization

val iterate_file_callbacks_and_store_issues : IR.Procname.t list -> Absint.Exe_env.t -> IBase.SourceFile.t -> unit

Invoke all registered file callbacks on a file, and store produced errors in a corresponding directory. Guaranteed to be called after all procedure-level callbacks are invoked