Improving the line number information in the string delegate warning check

Summary: public We are not assigning the location of the property rather than that of the class. It seems that it's no problem having the bugs reported in the .h files.

Reviewed By: ddino

Differential Revision: D2828005

fb-gh-sync-id: cf26549
master
Dulma Rodriguez 9 years ago committed by facebook-github-bot-5
parent f3964a05f7
commit 432dd28731

@ -14,7 +14,7 @@ open General_utils
(* === Warnings on properties === *) (* === Warnings on properties === *)
(* Strong Delegate Warning: a property with name delegate should not be declared strong *) (* Strong Delegate Warning: a property with name delegate should not be declared strong *)
let checker_strong_delegate_warning class_decl_info pname obj_c_property_decl_info = let checker_strong_delegate_warning decl_info pname obj_c_property_decl_info =
Printing.log_out "Checking for STRONG_DELEGATE property warning\n"; Printing.log_out "Checking for STRONG_DELEGATE property warning\n";
let delegate_regexp = Str.regexp_string_case_fold "delegate" in let delegate_regexp = Str.regexp_string_case_fold "delegate" in
let pname_contains_delegate = try let pname_contains_delegate = try
@ -26,7 +26,7 @@ let checker_strong_delegate_warning class_decl_info pname obj_c_property_decl_in
{ name = "STRONG_DELEGATE_WARNING"; { name = "STRONG_DELEGATE_WARNING";
description = "Property or ivar "^pname.Clang_ast_t.ni_name^" declared strong"; description = "Property or ivar "^pname.Clang_ast_t.ni_name^" declared strong";
suggestion = "In general delegates should be declared weak or assign"; suggestion = "In general delegates should be declared weak or assign";
loc = CLocation.get_sil_location_from_range class_decl_info.Clang_ast_t.di_source_range true; loc = CLocation.get_sil_location_from_range decl_info.Clang_ast_t.di_source_range true;
} in } in
(condition, warning_desc) (condition, warning_desc)

@ -40,7 +40,7 @@ let rec check_for_property_errors cfg cg tenv class_name class_decl_info decl_li
let open Clang_ast_t in let open Clang_ast_t in
let do_one_property decl_info pname_info pdi = let do_one_property decl_info pname_info pdi =
IList.iter (fun checker -> IList.iter (fun checker ->
let (condition, warning_desc) = checker class_decl_info pname_info pdi in let (condition, warning_desc) = checker decl_info pname_info pdi in
if condition then if condition then
let proc_desc = let proc_desc =
CMethod_trans.get_method_for_frontend_checks cfg cg tenv class_name decl_info in CMethod_trans.get_method_for_frontend_checks cfg cg tenv class_name decl_info in

Loading…
Cancel
Save