[linters] Log assert failures in the linters framework

Reviewed By: ddino

Differential Revision: D3937986

fbshipit-source-id: 0926d72
master
Dulma Churchill 8 years ago committed by Facebook Github Bot
parent a44109b2b2
commit a1d7df6c07

@ -80,16 +80,21 @@ let store_issues source_file =
LintIssues.store_issues lint_issues_file !LintIssues.errLogMap LintIssues.store_issues lint_issues_file !LintIssues.errLogMap
let do_frontend_checks source_file ast = let do_frontend_checks source_file ast =
Logging.out "Start linting file %s\n" (DB.source_file_to_string source_file); try
match ast with Logging.out "Start linting file %s\n" (DB.source_file_to_string source_file);
| Clang_ast_t.TranslationUnitDecl(_, decl_list, _, _) -> match ast with
let context = context_with_ck_set CLintersContext.empty decl_list in | Clang_ast_t.TranslationUnitDecl(_, decl_list, _, _) ->
let is_decl_allowed decl = let context = context_with_ck_set CLintersContext.empty decl_list in
let decl_info = Clang_ast_proj.get_decl_tuple decl in let is_decl_allowed decl =
CLocation.should_do_frontend_check decl_info.Clang_ast_t.di_source_range in let decl_info = Clang_ast_proj.get_decl_tuple decl in
let allowed_decls = IList.filter is_decl_allowed decl_list in CLocation.should_do_frontend_check decl_info.Clang_ast_t.di_source_range in
IList.iter (do_frontend_checks_decl context) allowed_decls; let allowed_decls = IList.filter is_decl_allowed decl_list in
if (LintIssues.exists_issues ()) then IList.iter (do_frontend_checks_decl context) allowed_decls;
store_issues source_file; if (LintIssues.exists_issues ()) then
Logging.out "End linting file %s\n" (DB.source_file_to_string source_file) store_issues source_file;
| _ -> assert false (* NOTE: Assumes that an AST alsways starts with a TranslationUnitDecl *) Logging.out "End linting file %s\n" (DB.source_file_to_string source_file)
| _ -> assert false (* NOTE: Assumes that an AST alsways starts with a TranslationUnitDecl *)
with
| Assert_failure (file, line, column) ->
Logging.out "Fatal error: exception Assert_failure(%s, %d, %d)\n%!" file line column;
exit 1

Loading…
Cancel
Save