[ConfigImpact] Address unknown ObjC init methods as cheap

Summary: We have some FPs due to unknown init methods that are added dynamically.

Reviewed By: ezgicicek

Differential Revision: D27856371

fbshipit-source-id: b6fb46df3
master
Sungkeun Cho 4 years ago committed by Facebook GitHub Bot
parent 6e3b02eaee
commit c264fc20c1

@ -357,9 +357,9 @@ module ObjC_Cpp = struct
if is_instance then ObjCInstanceMethod else ObjCClassMethod if is_instance then ObjCInstanceMethod else ObjCClassMethod
let is_objc_constructor method_name = let is_prefix_init s = String.is_prefix ~prefix:"init" s
String.equal method_name "new" || String.is_prefix ~prefix:"init" method_name
let is_objc_constructor method_name = String.equal method_name "new" || is_prefix_init method_name
let is_objc_kind = function let is_objc_kind = function
| ObjCClassMethod | ObjCInstanceMethod | ObjCInternalMethod -> | ObjCClassMethod | ObjCInstanceMethod | ObjCInternalMethod ->
@ -605,6 +605,12 @@ let is_objc_dealloc procname =
match procname with ObjC_Cpp {method_name} -> ObjC_Cpp.is_objc_dealloc method_name | _ -> false match procname with ObjC_Cpp {method_name} -> ObjC_Cpp.is_objc_dealloc method_name | _ -> false
let is_objc_init procname =
is_objc_method procname
&&
match procname with ObjC_Cpp {method_name} -> ObjC_Cpp.is_prefix_init method_name | _ -> false
let block_of_procname procname = let block_of_procname procname =
match procname with match procname with
| Block block -> | Block block ->

@ -326,6 +326,9 @@ val is_cpp_lambda : t -> bool
val is_objc_dealloc : t -> bool val is_objc_dealloc : t -> bool
(** Return whether the dealloc method of an Objective-C class. *) (** Return whether the dealloc method of an Objective-C class. *)
val is_objc_init : t -> bool
(** Return whether the init method of an Objective-C class. *)
val is_c_method : t -> bool val is_c_method : t -> bool
(** Return true this is an Objective-C/C++ method name. *) (** Return true this is an Objective-C/C++ method name. *)

@ -447,6 +447,9 @@ module Dom = struct
join_unchecked_callees join_unchecked_callees
(UncheckedCallees.replace_location_by_call location callee_summary) (UncheckedCallees.replace_location_by_call location callee_summary)
(UncheckedCalleesCond.replace_location_by_call location callee_summary_cond) (UncheckedCalleesCond.replace_location_by_call location callee_summary_cond)
| None when Procname.is_objc_init callee ->
(* If callee is unknown ObjC initializer, ignore it. *)
astate
| _ -> | _ ->
(* Otherwise, add callee's name. *) (* Otherwise, add callee's name. *)
join_unchecked_callees join_unchecked_callees

Loading…
Cancel
Save