diff --git a/infer/src/clang/ClangLogging.ml b/infer/src/clang/ClangLogging.ml index 87b910617..2d2da98f4 100644 --- a/infer/src/clang/ClangLogging.ml +++ b/infer/src/clang/ClangLogging.ml @@ -8,9 +8,10 @@ *) open! IStd -let log_caught_exception (trans_unit_ctx: CFrontend_config.translation_unit_context) exception_type - exception_triggered_location (source_location_start, source_location_end) ast_node = - let caught_exception = +let log_frontend_exception (trans_unit_ctx: CFrontend_config.translation_unit_context) + exception_type exception_triggered_location (source_location_start, source_location_end) + ast_node = + let frontend_exception = EventLogger.FrontendException { exception_type ; source_location_start= @@ -21,7 +22,18 @@ let log_caught_exception (trans_unit_ctx: CFrontend_config.translation_unit_cont ; ast_node ; lang= CFrontend_config.string_of_clang_lang trans_unit_ctx.lang } in - EventLogger.log caught_exception + EventLogger.log frontend_exception + + +let log_caught_exception trans_unit_ctx exception_type exception_triggered_location source_range + ast_node = + log_frontend_exception trans_unit_ctx exception_type exception_triggered_location source_range + ast_node + + +let log_unexpected_decl trans_unit_ctx exception_triggered_location source_range ast_node = + log_frontend_exception trans_unit_ctx "Skipped declaration inside a class" + exception_triggered_location source_range ast_node let log_broken_cfg ~broken_node procdesc exception_triggered_location ~lang = diff --git a/infer/src/clang/ClangLogging.mli b/infer/src/clang/ClangLogging.mli index 6ab4387de..84b907c75 100644 --- a/infer/src/clang/ClangLogging.mli +++ b/infer/src/clang/ClangLogging.mli @@ -15,3 +15,7 @@ val log_caught_exception : val log_broken_cfg : broken_node:[`Join | `Other] -> Procdesc.t -> Logging.ocaml_pos -> lang:string -> unit + +val log_unexpected_decl : + CFrontend_config.translation_unit_context -> Logging.ocaml_pos + -> Clang_ast_t.source_location * Clang_ast_t.source_location -> string option -> unit diff --git a/infer/src/clang/cFrontend_decl.ml b/infer/src/clang/cFrontend_decl.ml index 8c5228eeb..9ee36b135 100644 --- a/infer/src/clang/cFrontend_decl.ml +++ b/infer/src/clang/cFrontend_decl.ml @@ -270,10 +270,9 @@ module CFrontend_decl_funct (T : CModule_type.CTranslation) : CModule_type.CFron | StaticAssertDecl _ | TranslationUnitDecl _ -> let decl_info = Clang_ast_proj.get_decl_tuple dec in - CFrontend_config.incorrect_assumption __POS__ decl_info.Clang_ast_t.di_source_range - "Skipped declaration inside a class '%s'." - (Clang_ast_proj.get_decl_kind_string dec) - dec + ClangLogging.log_unexpected_decl trans_unit_ctx __POS__ + decl_info.Clang_ast_t.di_source_range + (Some (Clang_ast_proj.get_decl_kind_string dec)) let process_methods trans_unit_ctx tenv cfg curr_class decl_list =