[linters] Do not lint implicit declarations

Reviewed By: ddino

Differential Revision: D6009056

fbshipit-source-id: e69f566
master
Dulma Churchill 7 years ago committed by Facebook Github Bot
parent 6f0c4cda4a
commit 21c7b7dda3

@ -254,5 +254,5 @@ DEFINE-CHECKER POINTER_TO_CONST_OBJC_CLASS = {
SET suggestion = "Consider using `%class_name% *const` instead, meaning SET suggestion = "Consider using `%class_name% *const` instead, meaning
the destination of the pointer cannot be changed."; the destination of the pointer cannot be changed.";
SET severity = "WARNING"; SET severity = "WARNING";
SET mode = "OFF"; SET mode = "ON";
}; };

@ -507,3 +507,7 @@ let has_block_attribute decl =
List.exists ~f:(fun attr -> match attr with BlocksAttr _ -> true | _ -> false) attributes List.exists ~f:(fun attr -> match attr with BlocksAttr _ -> true | _ -> false) attributes
| _ | _
-> false -> false
let is_implicit_decl decl =
let decl_info = Clang_ast_proj.get_decl_tuple decl in
decl_info.Clang_ast_t.di_is_implicit

@ -153,3 +153,5 @@ val get_cxx_virtual_base_classes : Clang_ast_t.decl -> Clang_ast_t.type_ptr list
val is_std_vector : Clang_ast_t.qual_type -> bool val is_std_vector : Clang_ast_t.qual_type -> bool
val has_block_attribute : Clang_ast_t.decl -> bool val has_block_attribute : Clang_ast_t.decl -> bool
val is_implicit_decl : Clang_ast_t.decl -> bool

@ -280,6 +280,8 @@ and do_frontend_checks_via_transition context map_active an trans =
and do_frontend_checks_decl (context: CLintersContext.context) and do_frontend_checks_decl (context: CLintersContext.context)
(map_act: Tableaux.context_linter_map) decl = (map_act: Tableaux.context_linter_map) decl =
let open Clang_ast_t in let open Clang_ast_t in
if CAst_utils.is_implicit_decl decl then () (* do not analyze implicit declarations *)
else
let an = Ctl_parser_types.Decl decl in let an = Ctl_parser_types.Decl decl in
(* The map should be visited when we enter the node before visiting children *) (* The map should be visited when we enter the node before visiting children *)
let map_active = Tableaux.update_linter_context_map an map_act in let map_active = Tableaux.update_linter_context_map an map_act in

@ -1,5 +1,3 @@
codetoanalyze/objc/linters/Pointer_to_const_objc_class.m, C_ptr_to_const_objc_bad, 13, POINTER_TO_CONST_OBJC_CLASS, []
codetoanalyze/objc/linters/Pointer_to_const_objc_class.m, C_setPtr_to_const_objc_bad, 13, POINTER_TO_CONST_OBJC_CLASS, []
codetoanalyze/objc/linters/Pointer_to_const_objc_class.m, Linters_dummy_method, 13, POINTER_TO_CONST_OBJC_CLASS, [] codetoanalyze/objc/linters/Pointer_to_const_objc_class.m, Linters_dummy_method, 13, POINTER_TO_CONST_OBJC_CLASS, []
codetoanalyze/objc/linters/assign_pointer.m, Linters_dummy_method, 18, ASSIGN_POINTER_WARNING, [] codetoanalyze/objc/linters/assign_pointer.m, Linters_dummy_method, 18, ASSIGN_POINTER_WARNING, []
codetoanalyze/objc/linters/assign_pointer.m, Linters_dummy_method, 20, ASSIGN_POINTER_WARNING, [] codetoanalyze/objc/linters/assign_pointer.m, Linters_dummy_method, 20, ASSIGN_POINTER_WARNING, []

Loading…
Cancel
Save