From fa8ae3e5e9952cb0cc43bb75800299272fa003e5 Mon Sep 17 00:00:00 2001 From: Dulma Churchill Date: Wed, 27 Jul 2016 07:42:21 -0700 Subject: [PATCH] In the new framework where we go through every declaration we don't need a special case for properties anymore Reviewed By: jberdine Differential Revision: D3620115 fbshipit-source-id: bebbf10 --- infer/src/clang/cFrontend_errors.ml | 40 +++++------------------------ 1 file changed, 6 insertions(+), 34 deletions(-) diff --git a/infer/src/clang/cFrontend_errors.ml b/infer/src/clang/cFrontend_errors.ml index 0d2917865..254fdf428 100644 --- a/infer/src/clang/cFrontend_errors.ml +++ b/infer/src/clang/cFrontend_errors.ml @@ -90,26 +90,6 @@ let invoke_set_of_checkers f cfg cg method_decl_opt checkers = | Some issue_desc -> log_frontend_issue cfg cg method_decl_opt issue_desc | None -> ()) checkers -(* Call all checkers on properties of class c *) -let rec check_for_property_errors cfg cg decl_list = - let open Clang_ast_t in - let do_one_property decl_info pname_info pdi = - let call_property_checker = checkers_for_property decl_info pname_info pdi in - invoke_set_of_checkers call_property_checker cfg cg None property_checkers_list in - match decl_list with - | [] -> () - | ObjCPropertyDecl (decl_info, pname_info, pdi) :: rest -> - do_one_property decl_info pname_info pdi; - check_for_property_errors cfg cg rest - | _ :: rest -> - check_for_property_errors cfg cg rest - -let get_categories_decls decl_ref = - match Ast_utils.get_decl_opt_with_decl_ref decl_ref with - | Some ObjCCategoryDecl (_, _, decls, _, _) - | Some ObjCInterfaceDecl (_, _, decls, _, _) -> decls - | _ -> [] - let run_frontend_checkers_on_stmt cfg cg method_decl instr = let open Clang_ast_t in match instr with @@ -125,27 +105,19 @@ let run_frontend_checkers_on_stmt cfg cg method_decl instr = invoke_set_of_checkers call_captured_vars_checker cfg cg decl_opt captured_vars_checker_list | _ -> () -let rec run_frontend_checkers_on_decl cfg cg dec = +let run_frontend_checkers_on_decl cfg cg dec = let open Clang_ast_t in let decl_info = Clang_ast_proj.get_decl_tuple dec in if CLocation.should_do_frontend_check decl_info.Clang_ast_t.di_source_range then match dec with - | ObjCCategoryImplDecl(_, _, decl_list, _, ocidi) -> - let decls = (get_categories_decls ocidi.Clang_ast_t.ocidi_category_decl) @ decl_list in - check_for_property_errors cfg cg decls; - IList.iter (run_frontend_checkers_on_decl cfg cg) decl_list - | ObjCImplementationDecl(decl_info, _, decl_list, _, idi) -> - let decls = (get_categories_decls idi.Clang_ast_t.oidi_class_interface) @ decl_list in - check_for_property_errors cfg cg decls; - let call_ns_checker = checkers_for_ns decl_info decl_list in - invoke_set_of_checkers call_ns_checker cfg cg None ns_notification_checker_list; - IList.iter (run_frontend_checkers_on_decl cfg cg) decl_list + | ObjCImplementationDecl (decl_info, _, decl_list, _, _) | ObjCProtocolDecl (decl_info, _, decl_list, _, _) -> - check_for_property_errors cfg cg decl_list; let call_ns_checker = checkers_for_ns decl_info decl_list in - invoke_set_of_checkers call_ns_checker cfg cg None ns_notification_checker_list; - IList.iter (run_frontend_checkers_on_decl cfg cg) decl_list + invoke_set_of_checkers call_ns_checker cfg cg None ns_notification_checker_list | VarDecl _ -> let call_global_checker = checker_for_global_var dec in invoke_set_of_checkers call_global_checker cfg cg None global_var_checker_list + | ObjCPropertyDecl (decl_info, pname_info, pdi) -> + let call_property_checker = checkers_for_property decl_info pname_info pdi in + invoke_set_of_checkers call_property_checker cfg cg None property_checkers_list | _ -> ()