[pulse][objc][nil] Improve error message for nil insertion into collection and nil block call issues

Reviewed By: skcho

Differential Revision: D29391031

fbshipit-source-id: 3113d7876
master
Daiva Naudziuniene 4 years ago committed by Facebook GitHub Bot
parent 724fbc4ad6
commit 9d877652d1

@ -68,13 +68,19 @@ let get_message diagnostic =
match invalidation with
| ConstantDereference i when IntLit.equal i IntLit.zero ->
(* Special error message for nullptr dereference *)
let issue_kind_str =
match must_be_valid_reason with
| Some (Invalidation.SelfOfNonPODReturnMethod non_pod_typ) ->
let nil_issue_kind = function
| Invalidation.SelfOfNonPODReturnMethod non_pod_typ ->
F.asprintf "undefined behaviour caused by nil messaging of non-pod return type (%a)"
(Typ.pp Pp.text) non_pod_typ
| _ ->
F.sprintf "null pointer dereference"
| Invalidation.InsertionIntoCollection ->
F.sprintf "nil insertion into collection"
| Invalidation.BlockCall ->
F.sprintf "nil block call"
in
let issue_kind_str =
Option.value_map must_be_valid_reason
~default:(F.sprintf "null pointer dereference")
~f:nil_issue_kind
in
let pp_access_trace fmt (trace : Trace.t) =
if same_trace then ()

Loading…
Cancel
Save