Skip to content
Snippets Groups Projects
Commit c9107d65 authored by Andre Maroneze's avatar Andre Maroneze
Browse files

[Callgraph] use Filepath parameters for relevant options

parent 9cbe7c82
No related branches found
No related tags found
No related merge requests found
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
(** Callgraph plugin. *) (** Callgraph plugin. *)
module Options: sig module Options: sig
module Filename: Parameter_sig.String module Filename: Parameter_sig.Filepath
module Service_roots: Parameter_sig.Kernel_function_set module Service_roots: Parameter_sig.Kernel_function_set
module Uncalled: Parameter_sig.Bool module Uncalled: Parameter_sig.Bool
module Uncalled_leaf: Parameter_sig.Bool module Uncalled_leaf: Parameter_sig.Bool
......
...@@ -32,10 +32,12 @@ include ...@@ -32,10 +32,12 @@ include
end) end)
module Filename = module Filename =
Empty_string Filepath
(struct (struct
let option_name = "-cg" let option_name = "-cg"
let arg_name = "filename" let arg_name = "filename"
let file_kind = "DOT"
let existence = Fc_Filepath.Indifferent
let help = "dump the callgraph to the file \ let help = "dump the callgraph to the file \
<filename> in dot format" <filename> in dot format"
end) end)
...@@ -97,9 +99,10 @@ module Uncalled_leaf = ...@@ -97,9 +99,10 @@ module Uncalled_leaf =
let dump output g = let dump output g =
let file = Filename.get () in 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 try
let cout = open_out file in let cout = open_out (file:>string) in
output cout g; output cout g;
close_out cout close_out cout
with e -> with e ->
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
include Plugin.S include Plugin.S
val name: string val name: string
module Filename: Parameter_sig.String module Filename: Parameter_sig.Filepath
module Roots: Parameter_sig.Kernel_function_set module Roots: Parameter_sig.Kernel_function_set
module Service_roots: Parameter_sig.Kernel_function_set module Service_roots: Parameter_sig.Kernel_function_set
module Function_pointers: Parameter_sig.Bool module Function_pointers: Parameter_sig.Bool
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
(**************************************************************************) (**************************************************************************)
let main () = let main () =
if Options.Filename.get () <> "" then if not (Filepath.Normalized.is_unknown (Options.Filename.get ())) then
if Options.Services.get () then begin if Options.Services.get () then begin
if not (Services.is_computed ()) then Services.dump () if not (Services.is_computed ()) then Services.dump ()
end else end else
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment