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 Checkers of IssueType.t * Localise.error_desc
exception Class_cast_exception of Localise.error_desc * 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 Eradicate of IssueType.t * Localise.error_desc
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 Checkers of IssueType.t * Localise.error_desc
exception Inherently_dangerous_function of Localise.error_desc
exception Internal_error of Localise.error_desc
@ -234,8 +232,6 @@ let recognize_exception exn =
; ocaml_pos= Some ocaml_pos
; visibility= Exn_user
; 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) ->
{ issue_type= IssueType.empty_vector_access
; 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 Checkers of IssueType.t * Localise.error_desc
exception Class_cast_exception of Localise.error_desc * 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 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 Inherently_dangerous_function of Localise.error_desc

@ -7,16 +7,13 @@
open! IStd
(** Module for Eradicate-based user-defined checkers. *)
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
description =
?(field_name = None) ~severity description =
let suppressed = Reporting.is_suppressed tenv proc_desc kind ~field_name in
if suppressed then Logging.debug Analysis Medium "Reporting is suppressed!@\n"
else
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 node = AnalysisState.get_node_exn () in
let session = AnalysisState.get_session () in

@ -7,16 +7,12 @@
open! IStd
(** Module for Eradicate-based user-defined checkers. *)
val report_error :
IntraproceduralAnalysis.t
-> Checker.t
-> IssueType.t
-> Location.t
-> ?field_name:Fieldname.t option
-> ?exception_kind:(IssueType.t -> Localise.error_desc -> exn)
-> severity:Exceptions.severity
-> string
-> 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))
Typ.Name.pp name_given Typ.Name.pp name_expected
in
EradicateCheckers.report_error analysis_data ImmutableCast
IssueType.checkers_immutable_cast loc description ~severity:Exceptions.Warning
EradicateReporting.report_error analysis_data ImmutableCast
IssueType.checkers_immutable_cast loc description ~severity:Warning
| _ ->
() )
| 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 ;
let field_name = get_field_name_for_error_suppressing err_instance in
let error_location = Option.value updated_location ~default:loc in
EradicateCheckers.report_error analysis_data Eradicate infer_issue_type error_location
~field_name
~exception_kind:(fun k d -> Exceptions.Eradicate (k, d))
~severity err_description )
EradicateReporting.report_error analysis_data Eradicate infer_issue_type error_location
~field_name ~severity err_description )
(** Register issue (unless exactly the same issue was already registered). If needed, report this

Loading…
Cancel
Save