From 64406137e9dd128bed78ce40568234edf9cadd1e Mon Sep 17 00:00:00 2001 From: Sungkeun Cho Date: Fri, 7 May 2021 05:40:24 -0700 Subject: [PATCH] [ConfigImpact] Loosely compare ObjC method names Summary: This diff compares ObjC method names loosely when checking whether it is in the config impact data file or not. This is to cover the cases where method parameters changed. Reviewed By: jvillard Differential Revision: D28259169 fbshipit-source-id: e6070df9c --- infer/src/checkers/ExternalConfigImpactData.ml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/infer/src/checkers/ExternalConfigImpactData.ml b/infer/src/checkers/ExternalConfigImpactData.ml index b733fb4af..e45f5a44c 100644 --- a/infer/src/checkers/ExternalConfigImpactData.ml +++ b/infer/src/checkers/ExternalConfigImpactData.ml @@ -26,6 +26,11 @@ let read_file_config_data fname = ConfigProcnameSet.add itm acc ) +let is_similar_method_name = + let cut_objc_parameters name = List.hd_exn (String.split name ~on:':') in + fun name1 name2 -> String.equal (cut_objc_parameters name1) (cut_objc_parameters name2) + + let is_in_config_data_file = let config_data = Option.value_map Config.config_impact_data_file ~default:ConfigProcnameSet.empty @@ -34,7 +39,7 @@ let is_in_config_data_file = fun proc_name -> ConfigProcnameSet.exists (fun {method_name; class_name} -> - String.equal method_name (Procname.get_method proc_name) + is_similar_method_name method_name (Procname.get_method proc_name) && String.equal class_name (Procname.get_class_name proc_name |> Option.value ~default:"") ) config_data