Call decl checkers on DeclStmt statements

Reviewed By: jvillard

Differential Revision: D3649322

fbshipit-source-id: 60b1b92
master
Ryan Rhee 8 years ago committed by Facebook Github Bot 5
parent 83ad776573
commit d2a4028881

@ -10,9 +10,14 @@
let rec do_frontend_checks_stmt (context:CLintersContext.context) cfg cg method_decl stmt = let rec do_frontend_checks_stmt (context:CLintersContext.context) cfg cg method_decl stmt =
let context' = CFrontend_errors.run_frontend_checkers_on_stmt context cfg cg method_decl stmt in let context' = CFrontend_errors.run_frontend_checkers_on_stmt context cfg cg method_decl stmt in
let stmts = CFrontend_utils.Ast_utils.get_stmts_from_stmt stmt in let stmts = CFrontend_utils.Ast_utils.get_stmts_from_stmt stmt in
IList.iter (do_frontend_checks_stmt context' cfg cg method_decl) stmts let do_all_checks_on_stmts stmt =
(match stmt with
let rec do_frontend_checks_decl context cfg cg decl = | Clang_ast_t.DeclStmt (_, _, decl_list) ->
IList.iter (do_frontend_checks_decl context' cfg cg) decl_list
| _ -> ());
do_frontend_checks_stmt context' cfg cg method_decl stmt in
IList.iter (do_all_checks_on_stmts) stmts
and do_frontend_checks_decl context cfg cg decl =
let open Clang_ast_t in let open Clang_ast_t in
let info = Clang_ast_proj.get_decl_tuple decl in let info = Clang_ast_proj.get_decl_tuple decl in
CLocation.update_curr_file info; CLocation.update_curr_file info;

@ -53,7 +53,7 @@ public class GlobalVarTest {
assertThat( assertThat(
"Results should contain " + GLOBAL_VARIABLE_INITIALIZED_WITH_FUNCTION_OR_METHOD_CALL, "Results should contain " + GLOBAL_VARIABLE_INITIALIZED_WITH_FUNCTION_OR_METHOD_CALL,
inferResults, inferResults,
containsOnlyLines(new int[]{30, 32, 34})); containsOnlyLines(new int[]{30, 32, 34, 52, 54, 56}));
} }
} }

Loading…
Cancel
Save