From 09b54e785818da59efcb5d46b96cc3d8930ba40f Mon Sep 17 00:00:00 2001 From: Qianyi Shu Date: Wed, 10 Jun 2020 00:44:08 -0700 Subject: [PATCH] [cost] suppress check is_on_ui_thread for ObjC method Summary: Cost analysis has an additional mode that checks whether the function occurs on a UI (main) thread. If so, it warns the user. This check is only supported for Java and C++ but not for ObjC, so the diff suppresses this check for ObjC, and set ```is_on_ui_thread``` to ```false``` by default. Reviewed By: ezgicicek Differential Revision: D21952470 fbshipit-source-id: 838dd5639 --- infer/src/cost/cost.ml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/infer/src/cost/cost.ml b/infer/src/cost/cost.ml index 58ac4d604..b1cc74e61 100644 --- a/infer/src/cost/cost.ml +++ b/infer/src/cost/cost.ml @@ -263,7 +263,9 @@ let checker ({InterproceduralAnalysis.proc_desc; exe_env; analyze_dependency} as let bound_map = compute_bound_map node_cfg inferbo_invariant_map control_dep_invariant_map loop_inv_map in - let is_on_ui_thread = ConcurrencyModels.runs_on_ui_thread tenv proc_name in + let is_on_ui_thread = + (not (Procname.is_objc_method proc_name)) && ConcurrencyModels.runs_on_ui_thread tenv proc_name + in let get_node_nb_exec = compute_get_node_nb_exec node_cfg bound_map in let astate = let open IOption.Let_syntax in