Fixed line number in the reporting of strong delegate warning

Reviewed By: dulmarod

Differential Revision: D2626332

fb-gh-sync-id: 5e0e661
master
Dino Distefano 9 years ago committed by facebook-github-bot-7
parent d50a401cd0
commit 0f5aa343e7

@ -97,7 +97,7 @@ val explain_stack_variable_address_escape :
Location.t -> Sil.pvar -> Sil.dexp option -> Localise.error_desc
(** explain frontend warning *)
val explain_frontend_warning : string -> string -> string -> Localise.error_desc
val explain_frontend_warning : string -> string -> Location.t -> Localise.error_desc
(** explain a return statement missing *)
val explain_return_statement_missing : Location.t -> Localise.error_desc

@ -142,7 +142,7 @@ let recognize_exception exn =
| Field_not_null_checked (desc, mloc) ->
(Localise.field_not_null_checked, desc, Some mloc, Exn_user, Medium, Some Kwarning, Nocat)
| Frontend_warning (name, desc, mloc) ->
(Localise.from_string name, desc, Some mloc, Exn_user, Medium, None, Nocat)
(Localise.from_string name, desc, Some mloc, Exn_user, Medium, Some Kwarning, Nocat)
| Checkers (kind_s, desc) ->
(Localise.from_string kind_s, desc, None, Exn_user, High, None, Prover)
| Null_dereference (desc, mloc) ->

@ -575,7 +575,12 @@ let desc_divide_by_zero expr_str loc =
let desc_frontend_warning desc sugg loc =
let tags = Tags.create () in
[desc ^" at line "^ loc ^". "^ sugg], None, !tags
let description = Format.sprintf
"%s %s. %s"
desc
(at_line tags loc)
sugg in
[description], None, !tags
let desc_leak value_str_opt resource_opt resource_action_opt loc bucket_opt =
let tags = Tags.create () in

@ -187,7 +187,7 @@ val desc_deallocate_static_memory : string -> Procname.t -> Location.t -> error_
val desc_divide_by_zero : string -> Location.t -> error_desc
val desc_frontend_warning : string -> string -> string -> error_desc
val desc_frontend_warning : string -> string -> Location.t -> error_desc
val desc_leak :
string option -> Sil.resource option -> Sil.res_action option ->

@ -24,14 +24,19 @@ let property_checkers_list = [CFrontend_checkers.checker_strong_delegate_warning
(* Add a frontend warning with a description desc at location loc to the errlog of a proc desc *)
let log_frontend_warning pdesc warn_desc =
let loc = {
Location.line = int_of_string warn_desc.loc;
Location.col = -1;
Location.file = DB.source_file_empty;
Location.nLOC = -1;
} in
let errlog = Cfg.Procdesc.get_err_log pdesc in
let err_desc =
Errdesc.explain_frontend_warning warn_desc.description warn_desc.suggestion
warn_desc.loc in
let exn = (Exceptions.Frontend_warning
(warn_desc.name, err_desc,
try assert false with Assert_failure x -> x)) in
Reporting.log_error_from_errlog errlog exn
Errdesc.explain_frontend_warning warn_desc.description warn_desc.suggestion loc in
let exn = Exceptions.Frontend_warning
(warn_desc.name, err_desc,
try assert false with Assert_failure x -> x) in
Reporting.log_error_from_errlog errlog exn ~loc:(Some loc)
(* Call all checkers on properties of class c *)
let check_for_property_errors cfg c =

@ -58,6 +58,7 @@ public class InferResults {
String errorType = items[2].trim();
if (errorKind.equals("ERROR") ||
errorType.equals("RETURN_VALUE_IGNORED") ||
errorType.equals("STRONG_DELEGATE_WARNING") ||
errorType.equals("IMMUTABLE_CAST") ||
errorType.equals("PARAMETER_NOT_NULL_CHECKED") ||
errorType.equals("DANGLING_POINTER_DEREFERENCE") ||

Loading…
Cancel
Save