Check early whether the given decl has to be checked with linters or not

Reviewed By: dulmarod

Differential Revision: D3728836

fbshipit-source-id: a3fa865
master
Martino Luca 9 years ago committed by Facebook Github Bot 6
parent e1f19192c0
commit 7de52e7649

@ -76,7 +76,11 @@ let do_frontend_checks cfg cg source_file ast =
match ast with
| Clang_ast_t.TranslationUnitDecl(_, decl_list, _, _) ->
let context = context_with_ck_set CLintersContext.empty decl_list in
IList.iter (do_frontend_checks_decl context cfg cg) decl_list;
let is_decl_allowed decl =
let decl_info = Clang_ast_proj.get_decl_tuple decl in
CLocation.should_do_frontend_check decl_info.Clang_ast_t.di_source_range in
let allowed_decls = IList.filter is_decl_allowed decl_list in
IList.iter (do_frontend_checks_decl context cfg cg) allowed_decls;
(* TODO (t12740727): Remove condition once the transition to linters mode is finished *)
if Config.analyzer = Some Config.Linters then store_issues source_file
| _ -> assert false (* NOTE: Assumes that an AST alsways starts with a TranslationUnitDecl *)

@ -161,8 +161,6 @@ let run_frontend_checkers_on_stmt context cfg cg instr =
let run_frontend_checkers_on_decl context 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
| ObjCImplementationDecl (decl_info, _, decl_list, _, _)
| ObjCProtocolDecl (decl_info, _, decl_list, _, _) ->
@ -184,4 +182,3 @@ let run_frontend_checkers_on_decl context cfg cg dec =
invoke_set_of_checkers call_property_checker context cfg cg key property_checkers_list;
context
| _ -> context
else context

Loading…
Cancel
Save