diff --git a/src/plugins/callgraph/Callgraph.mli b/src/plugins/callgraph/Callgraph.mli index 0d649136073dd5b2302303f3db77b9f2bae279aa..e7ba902325e6c84043bec088f00613e614853015 100644 --- a/src/plugins/callgraph/Callgraph.mli +++ b/src/plugins/callgraph/Callgraph.mli @@ -23,7 +23,7 @@ (** Callgraph plugin. *) module Options: sig - module Filename: Parameter_sig.String + module Filename: Parameter_sig.Filepath module Service_roots: Parameter_sig.Kernel_function_set module Uncalled: Parameter_sig.Bool module Uncalled_leaf: Parameter_sig.Bool diff --git a/src/plugins/callgraph/options.ml b/src/plugins/callgraph/options.ml index d42856664a9fe2f3e6bc2d0124c99ae90e729a68..04158a6a507d274ce7cedc76f220e6da4170279f 100644 --- a/src/plugins/callgraph/options.ml +++ b/src/plugins/callgraph/options.ml @@ -32,10 +32,12 @@ include end) module Filename = - Empty_string + Filepath (struct let option_name = "-cg" let arg_name = "filename" + let file_kind = "DOT" + let existence = Fc_Filepath.Indifferent let help = "dump the callgraph to the file \ <filename> in dot format" end) @@ -97,9 +99,10 @@ module Uncalled_leaf = let dump output g = let file = Filename.get () in - feedback ~level:2 "dumping the graph into file %s" file; + feedback ~level:2 "dumping the graph into file %a" + Fc_Filepath.Normalized.pretty file; try - let cout = open_out file in + let cout = open_out (file:>string) in output cout g; close_out cout with e -> diff --git a/src/plugins/callgraph/options.mli b/src/plugins/callgraph/options.mli index aa6fd2e5026a828c84f95be2cbca523154793c72..ab238a90b57d79c2387e9f5e9e688c2779d2d35c 100644 --- a/src/plugins/callgraph/options.mli +++ b/src/plugins/callgraph/options.mli @@ -23,7 +23,7 @@ include Plugin.S val name: string -module Filename: Parameter_sig.String +module Filename: Parameter_sig.Filepath module Roots: Parameter_sig.Kernel_function_set module Service_roots: Parameter_sig.Kernel_function_set module Function_pointers: Parameter_sig.Bool diff --git a/src/plugins/callgraph/register.ml b/src/plugins/callgraph/register.ml index d7da576b50f9ee45167f7e3404d27e0c179facd8..f7dba518b73c88a22fc56feaef7502c7821d59c3 100644 --- a/src/plugins/callgraph/register.ml +++ b/src/plugins/callgraph/register.ml @@ -21,7 +21,7 @@ (**************************************************************************) let main () = - if Options.Filename.get () <> "" then + if not (Filepath.Normalized.is_unknown (Options.Filename.get ())) then if Options.Services.get () then begin if not (Services.is_computed ()) then Services.dump () end else