[inferbo] Report Unreachable_code_after with Checkers exception

Reviewed By: jeremydubreil

Differential Revision: D9798958

fbshipit-source-id: e1552c248
master
Mehdi Bouaziz 6 years ago committed by Facebook Github Bot
parent 0a9606b2b4
commit 051c9d5e1f

@ -130,8 +130,6 @@ exception Unary_minus_applied_to_unsigned_expression of Localise.error_desc * L.
exception Unknown_proc exception Unknown_proc
exception Unreachable_code_after of Localise.error_desc * L.ocaml_pos
exception Unsafe_guarded_by_access of Localise.error_desc * L.ocaml_pos exception Unsafe_guarded_by_access of Localise.error_desc * L.ocaml_pos
exception Use_after_free of Localise.error_desc * L.ocaml_pos exception Use_after_free of Localise.error_desc * L.ocaml_pos
@ -532,13 +530,6 @@ let recognize_exception exn =
; visibility= Exn_developer ; visibility= Exn_developer
; severity= None ; severity= None
; category= Nocat } ; category= Nocat }
| Unreachable_code_after (desc, ocaml_pos) ->
{ name= IssueType.unreachable_code_after
; description= desc
; ocaml_pos= Some ocaml_pos
; visibility= Exn_user
; severity= None
; category= Nocat }
| Unsafe_guarded_by_access (desc, ocaml_pos) -> | Unsafe_guarded_by_access (desc, ocaml_pos) ->
{ name= IssueType.unsafe_guarded_by_access { name= IssueType.unsafe_guarded_by_access
; description= desc ; description= desc

@ -134,8 +134,6 @@ exception Unary_minus_applied_to_unsigned_expression of Localise.error_desc * Lo
exception Unknown_proc exception Unknown_proc
exception Unreachable_code_after of Localise.error_desc * Logging.ocaml_pos
exception Unsafe_guarded_by_access of Localise.error_desc * Logging.ocaml_pos exception Unsafe_guarded_by_access of Localise.error_desc * Logging.ocaml_pos
exception Use_after_free of Localise.error_desc * Logging.ocaml_pos exception Use_after_free of Localise.error_desc * Logging.ocaml_pos

@ -543,12 +543,6 @@ let desc_condition_always_true_false i cond_str_opt loc =
{no_desc with descriptions= [description]; tags= !tags} {no_desc with descriptions= [description]; tags= !tags}
let desc_unreachable_code_after loc =
let tags = Tags.create () in
let description = "Unreachable code after statement " ^ at_line tags loc in
{no_desc with descriptions= [description]}
let desc_deallocate_stack_variable var_str proc_name loc = let desc_deallocate_stack_variable var_str proc_name loc =
let tags = Tags.create () in let tags = Tags.create () in
Tags.update tags Tags.value var_str ; Tags.update tags Tags.value var_str ;

@ -119,8 +119,6 @@ val desc_class_cast_exception :
val desc_condition_always_true_false : IntLit.t -> string option -> Location.t -> error_desc val desc_condition_always_true_false : IntLit.t -> string option -> Location.t -> error_desc
val desc_unreachable_code_after : Location.t -> error_desc
val desc_deallocate_stack_variable : string -> Typ.Procname.t -> Location.t -> error_desc val desc_deallocate_stack_variable : string -> Typ.Procname.t -> Location.t -> error_desc
val desc_deallocate_static_memory : string -> Typ.Procname.t -> Location.t -> error_desc val desc_deallocate_static_memory : string -> Typ.Procname.t -> Location.t -> error_desc

@ -1164,8 +1164,6 @@ let explain_condition_always_true_false tenv i cond node loc =
Localise.desc_condition_always_true_false i cond_str_opt loc Localise.desc_condition_always_true_false i cond_str_opt loc
let explain_unreachable_code_after loc = Localise.desc_unreachable_code_after loc
(** explain the escape of a stack variable address from its scope *) (** explain the escape of a stack variable address from its scope *)
let explain_stack_variable_address_escape loc pvar addr_dexp_opt = let explain_stack_variable_address_escape loc pvar addr_dexp_opt =
let addr_dexp_str = let addr_dexp_str =

@ -95,8 +95,6 @@ val explain_condition_always_true_false :
Tenv.t -> IntLit.t -> Exp.t -> Procdesc.Node.t -> Location.t -> Localise.error_desc Tenv.t -> IntLit.t -> Exp.t -> Procdesc.Node.t -> Location.t -> Localise.error_desc
(** explain a condition which is always true or false *) (** explain a condition which is always true or false *)
val explain_unreachable_code_after : Location.t -> Localise.error_desc
val explain_stack_variable_address_escape : val explain_stack_variable_address_escape :
Location.t -> Pvar.t -> DecompiledExp.t option -> Localise.error_desc Location.t -> Pvar.t -> DecompiledExp.t option -> Localise.error_desc
(** explain the escape of a stack variable address from its scope *) (** explain the escape of a stack variable address from its scope *)

@ -432,8 +432,11 @@ module Report = struct
() ()
| _ -> | _ ->
let location = Sil.instr_get_loc instr in let location = Sil.instr_get_loc instr in
let desc = Errdesc.explain_unreachable_code_after location in let exn =
let exn = Exceptions.Unreachable_code_after (desc, __POS__) in Exceptions.Checkers
( IssueType.unreachable_code_after
, Localise.verbatim_desc "Unreachable code after statement" )
in
Reporting.log_error summary ~loc:location exn Reporting.log_error summary ~loc:location exn

Loading…
Cancel
Save