Reducing the scope of all frontend checks on declarations

Reviewed By: akotulski

Differential Revision: D3298032

fbshipit-source-id: 0a445fa
master
Dulma Churchill 9 years ago committed by Facebook Github Bot 6
parent bfce6bac47
commit 6d8d9f56c2

@ -122,25 +122,25 @@ let run_frontend_checkers_on_stmt trans_state instr =
let rec run_frontend_checkers_on_decl cfg cg dec = let rec run_frontend_checkers_on_decl cfg cg dec =
let open Clang_ast_t in let open Clang_ast_t in
match dec with let decl_info = Clang_ast_proj.get_decl_tuple dec in
| ObjCCategoryImplDecl(_, _, decl_list, _, ocidi) -> if CLocation.should_do_frontend_check decl_info.Clang_ast_t.di_source_range then
let decls = (get_categories_decls ocidi.Clang_ast_t.ocidi_category_decl) @ decl_list in match dec with
check_for_property_errors cfg cg decls; | ObjCCategoryImplDecl(_, _, decl_list, _, ocidi) ->
IList.iter (run_frontend_checkers_on_decl cfg cg) decl_list let decls = (get_categories_decls ocidi.Clang_ast_t.ocidi_category_decl) @ decl_list in
| ObjCImplementationDecl(decl_info, _, decl_list, _, idi) -> check_for_property_errors cfg cg decls;
let decls = (get_categories_decls idi.Clang_ast_t.oidi_class_interface) @ decl_list in IList.iter (run_frontend_checkers_on_decl cfg cg) decl_list
check_for_property_errors cfg cg decls; | ObjCImplementationDecl(decl_info, _, decl_list, _, idi) ->
let call_ns_checker = checkers_for_ns decl_info decl_list in let decls = (get_categories_decls idi.Clang_ast_t.oidi_class_interface) @ decl_list in
invoke_set_of_checkers call_ns_checker cfg cg None ns_notification_checker_list; check_for_property_errors cfg cg decls;
IList.iter (run_frontend_checkers_on_decl cfg cg) decl_list let call_ns_checker = checkers_for_ns decl_info decl_list in
| ObjCProtocolDecl (decl_info, _, decl_list, _, _) -> invoke_set_of_checkers call_ns_checker cfg cg None ns_notification_checker_list;
if CLocation.should_do_frontend_check decl_info.Clang_ast_t.di_source_range then IList.iter (run_frontend_checkers_on_decl cfg cg) decl_list
(check_for_property_errors cfg cg decl_list; | ObjCProtocolDecl (decl_info, _, decl_list, _, _) ->
let call_ns_checker = checkers_for_ns decl_info decl_list in check_for_property_errors cfg cg decl_list;
invoke_set_of_checkers call_ns_checker cfg cg None ns_notification_checker_list; let call_ns_checker = checkers_for_ns decl_info decl_list in
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;
else () IList.iter (run_frontend_checkers_on_decl cfg cg) decl_list
| VarDecl _ -> | VarDecl _ ->
let call_global_checker = checker_for_global_var dec in let call_global_checker = checker_for_global_var dec in
invoke_set_of_checkers call_global_checker cfg cg None global_var_checker_list invoke_set_of_checkers call_global_checker cfg cg None global_var_checker_list
| _ -> () | _ -> ()

@ -89,14 +89,13 @@ let file_in_project file =
| None -> false | None -> false
let should_do_frontend_check (loc_start, _) = let should_do_frontend_check (loc_start, _) =
let file = match loc_start.Clang_ast_t.sl_file with
match loc_start.Clang_ast_t.sl_file with | Some file ->
| Some f -> f let equal_current_source file =
| None -> assert false in DB.source_file_equal (source_file_from_path file) !DB.current_source in
let equal_current_source file = equal_current_source file ||
DB.source_file_equal (source_file_from_path file) !DB.current_source in (file_in_project file && not Config.testing_mode)
equal_current_source file || | None -> false
(file_in_project file && not Config.testing_mode)
(* We translate by default the instructions in the current file.*) (* We translate by default the instructions in the current file.*)
(* In C++ development, we also translate the headers that are part *) (* In C++ development, we also translate the headers that are part *)

Loading…
Cancel
Save