kill Exceptions.Eradicate

Summary:
This is the same as Exceptions.Checkers. Eventual goal is to stop having
all issues going through the Exceptions layer.

Reviewed By: dulmarod

Differential Revision: D21686937

fbshipit-source-id: bd92fd0ff
master
Jules Villard 5 years ago committed by Facebook GitHub Bot
parent 4bb836b2c3
commit 0c9cc9f791

@ -42,6 +42,8 @@ exception Biabd_use_after_free of Localise.error_desc * L.ocaml_pos
exception Cannot_star of L.ocaml_pos exception Cannot_star of L.ocaml_pos
exception Checkers of IssueType.t * Localise.error_desc
exception Class_cast_exception of Localise.error_desc * L.ocaml_pos exception Class_cast_exception of Localise.error_desc * L.ocaml_pos
exception Condition_always_true_false of Localise.error_desc * bool * L.ocaml_pos exception Condition_always_true_false of Localise.error_desc * bool * L.ocaml_pos
@ -61,14 +63,10 @@ exception Divide_by_zero of Localise.error_desc * L.ocaml_pos
exception Empty_vector_access of Localise.error_desc * L.ocaml_pos exception Empty_vector_access of Localise.error_desc * L.ocaml_pos
exception Eradicate of IssueType.t * Localise.error_desc
exception Field_not_null_checked of Localise.error_desc * L.ocaml_pos exception Field_not_null_checked of Localise.error_desc * L.ocaml_pos
exception Frontend_warning of IssueType.t * Localise.error_desc * L.ocaml_pos exception Frontend_warning of IssueType.t * Localise.error_desc * L.ocaml_pos
exception Checkers of IssueType.t * Localise.error_desc
exception Inherently_dangerous_function of Localise.error_desc exception Inherently_dangerous_function of Localise.error_desc
exception Internal_error of Localise.error_desc exception Internal_error of Localise.error_desc
@ -234,8 +232,6 @@ let recognize_exception exn =
; ocaml_pos= Some ocaml_pos ; ocaml_pos= Some ocaml_pos
; visibility= Exn_user ; visibility= Exn_user
; severity= Some Error } ; severity= Some Error }
| Eradicate (kind, desc) ->
{issue_type= kind; description= desc; ocaml_pos= None; visibility= Exn_user; severity= None}
| Empty_vector_access (desc, ocaml_pos) -> | Empty_vector_access (desc, ocaml_pos) ->
{ issue_type= IssueType.empty_vector_access { issue_type= IssueType.empty_vector_access
; description= desc ; description= desc

@ -42,6 +42,8 @@ exception Biabd_use_after_free of Localise.error_desc * Logging.ocaml_pos
exception Cannot_star of Logging.ocaml_pos exception Cannot_star of Logging.ocaml_pos
exception Checkers of IssueType.t * Localise.error_desc
exception Class_cast_exception of Localise.error_desc * Logging.ocaml_pos exception Class_cast_exception of Localise.error_desc * Logging.ocaml_pos
exception Condition_always_true_false of Localise.error_desc * bool * Logging.ocaml_pos exception Condition_always_true_false of Localise.error_desc * bool * Logging.ocaml_pos
@ -64,10 +66,6 @@ exception Field_not_null_checked of Localise.error_desc * Logging.ocaml_pos
exception Empty_vector_access of Localise.error_desc * Logging.ocaml_pos exception Empty_vector_access of Localise.error_desc * Logging.ocaml_pos
exception Eradicate of IssueType.t * Localise.error_desc
exception Checkers of IssueType.t * Localise.error_desc
exception Frontend_warning of IssueType.t * Localise.error_desc * Logging.ocaml_pos exception Frontend_warning of IssueType.t * Localise.error_desc * Logging.ocaml_pos
exception Inherently_dangerous_function of Localise.error_desc exception Inherently_dangerous_function of Localise.error_desc

@ -7,16 +7,13 @@
open! IStd open! IStd
(** Module for Eradicate-based user-defined checkers. *)
let report_error {IntraproceduralAnalysis.proc_desc; tenv; err_log} checker kind loc let report_error {IntraproceduralAnalysis.proc_desc; tenv; err_log} checker kind loc
?(field_name = None) ?(exception_kind = fun k d -> Exceptions.Checkers (k, d)) ~severity ?(field_name = None) ~severity description =
description =
let suppressed = Reporting.is_suppressed tenv proc_desc kind ~field_name in let suppressed = Reporting.is_suppressed tenv proc_desc kind ~field_name in
if suppressed then Logging.debug Analysis Medium "Reporting is suppressed!@\n" if suppressed then Logging.debug Analysis Medium "Reporting is suppressed!@\n"
else else
let localized_description = Localise.verbatim_desc description in let localized_description = Localise.verbatim_desc description in
let exn = exception_kind kind localized_description in let exn = Exceptions.Checkers (kind, localized_description) in
let trace = [Errlog.make_trace_element 0 loc description []] in let trace = [Errlog.make_trace_element 0 loc description []] in
let node = AnalysisState.get_node_exn () in let node = AnalysisState.get_node_exn () in
let session = AnalysisState.get_session () in let session = AnalysisState.get_session () in

@ -7,16 +7,12 @@
open! IStd open! IStd
(** Module for Eradicate-based user-defined checkers. *)
val report_error : val report_error :
IntraproceduralAnalysis.t IntraproceduralAnalysis.t
-> Checker.t -> Checker.t
-> IssueType.t -> IssueType.t
-> Location.t -> Location.t
-> ?field_name:Fieldname.t option -> ?field_name:Fieldname.t option
-> ?exception_kind:(IssueType.t -> Localise.error_desc -> exn)
-> severity:Exceptions.severity -> severity:Exceptions.severity
-> string -> string
-> unit -> unit
(** Report an error. *)

@ -35,8 +35,8 @@ let check_immutable_cast analysis_data proc_desc typ_expected typ_found_opt loc
(Procname.to_simplified_string (Procdesc.get_proc_name proc_desc)) (Procname.to_simplified_string (Procdesc.get_proc_name proc_desc))
Typ.Name.pp name_given Typ.Name.pp name_expected Typ.Name.pp name_given Typ.Name.pp name_expected
in in
EradicateCheckers.report_error analysis_data ImmutableCast EradicateReporting.report_error analysis_data ImmutableCast
IssueType.checkers_immutable_cast loc description ~severity:Exceptions.Warning IssueType.checkers_immutable_cast loc description ~severity:Warning
| _ -> | _ ->
() ) () )
| None -> | None ->

@ -334,10 +334,8 @@ let report_now_if_reportable analysis_data err_instance ~nullsafe_mode loc =
Logging.debug Analysis Medium "About to report: %s" err_description ; Logging.debug Analysis Medium "About to report: %s" err_description ;
let field_name = get_field_name_for_error_suppressing err_instance in let field_name = get_field_name_for_error_suppressing err_instance in
let error_location = Option.value updated_location ~default:loc in let error_location = Option.value updated_location ~default:loc in
EradicateCheckers.report_error analysis_data Eradicate infer_issue_type error_location EradicateReporting.report_error analysis_data Eradicate infer_issue_type error_location
~field_name ~field_name ~severity err_description )
~exception_kind:(fun k d -> Exceptions.Eradicate (k, d))
~severity err_description )
(** Register issue (unless exactly the same issue was already registered). If needed, report this (** Register issue (unless exactly the same issue was already registered). If needed, report this

Loading…
Cancel
Save