@ -14,9 +14,9 @@ module L = Logging
open CFrontend_utils
open CFrontend_utils
module rec CTransImpl : C Trans. CTrans =
module rec CTransImpl : C Module_type. CTranslation =
CTrans . CTrans_funct ( CFrontend_declImpl )
CTrans . CTrans_funct ( CFrontend_declImpl )
and CFrontend_declImpl : C Frontend_decl. CFrontend_decl =
and CFrontend_declImpl : C Module_type. CFrontend =
CFrontend_decl . CFrontend_decl_funct ( CTransImpl )
CFrontend_decl . CFrontend_decl_funct ( CTransImpl )
(* Translates a file by translating the ast into a cfg. *)
(* Translates a file by translating the ast into a cfg. *)
@ -24,7 +24,7 @@ let compute_icfg source tenv ast =
match ast with
match ast with
| Clang_ast_t . TranslationUnitDecl ( _ , decl_list , _ , _ ) ->
| Clang_ast_t . TranslationUnitDecl ( _ , decl_list , _ , _ ) ->
CFrontend_config . global_translation_unit_decls := decl_list ;
CFrontend_config . global_translation_unit_decls := decl_list ;
Logging . out_debug " \n Start creating icfg \n " ;
Logging . out_debug " @ \n Start creating icfg @ \n " ;
let cg = Cg . create ( Some source ) in
let cg = Cg . create ( Some source ) in
let cfg = Cfg . Node . create_cfg () in
let cfg = Cfg . Node . create_cfg () in
IList . iter ( CFrontend_declImpl . translate_one_declaration tenv cg cfg ` DeclTraversal )
IList . iter ( CFrontend_declImpl . translate_one_declaration tenv cg cfg ` DeclTraversal )
@ -43,10 +43,10 @@ let do_source_file source_file ast =
CTypes_decl . add_predefined_types tenv ;
CTypes_decl . add_predefined_types tenv ;
init_global_state_capture () ;
init_global_state_capture () ;
Config . nLOC := FileLOC . file_get_loc ( DB . source_file_to_string source_file ) ;
Config . nLOC := FileLOC . file_get_loc ( DB . source_file_to_string source_file ) ;
Logging . out_debug " \n Start building call/cfg graph for '%s'.... \n "
Logging . out_debug " @ \n Start building call/cfg graph for '%s'.... @ \n "
( DB . source_file_to_string source_file ) ;
( DB . source_file_to_string source_file ) ;
let call_graph , cfg = compute_icfg source_file tenv ast in
let call_graph , cfg = compute_icfg source_file tenv ast in
Logging . out_debug " \n End building call/cfg graph for '%s'. \n "
Logging . out_debug " @ \n End building call/cfg graph for '%s'. @ \n "
( DB . source_file_to_string source_file ) ;
( DB . source_file_to_string source_file ) ;
(* This part below is a boilerplate in every frontends. *)
(* This part below is a boilerplate in every frontends. *)
(* This could be moved in the cfg_infer module *)
(* This could be moved in the cfg_infer module *)