@@ -39,6 +39,7 @@ let no_crc = ref false
39
39
let shape = ref false
40
40
let index = ref false
41
41
let decls = ref false
42
+ let uid_deps = ref false
42
43
43
44
module Magic_number = Misc. Magic_number
44
45
module String = Misc.Stdlib. String
@@ -213,6 +214,27 @@ let print_cmt_infos cmt =
213
214
cmt.cmt_ident_occurrences;
214
215
Format. print_flush ()
215
216
end ;
217
+ if ! uid_deps then begin
218
+ printf " \n Uid dependencies:\n " ;
219
+ let arr = Array. of_list cmt.cmt_declaration_dependencies in
220
+ let () =
221
+ Array. sort (fun (_tr , u1 , u2 ) (_tr' , u1' , u2' ) ->
222
+ match Shape.Uid. compare u1 u1' with
223
+ | 0 -> Shape.Uid. compare u2 u2'
224
+ | n -> n) arr
225
+ in
226
+ Format. printf " @[<v>" ;
227
+ Array. iter (fun (rk , u1 , u2 ) ->
228
+ let rk = match rk with
229
+ | Definition_to_declaration -> " <-"
230
+ | Declaration_to_declaration -> " <->"
231
+ in
232
+ Format. printf " @[<h>%a %s %a@]@;"
233
+ Shape.Uid. print u1
234
+ rk
235
+ Shape.Uid. print u2) arr;
236
+ Format. printf " @]" ;
237
+ end ;
216
238
if ! decls then begin
217
239
printf " \n Uid of decls:\n " ;
218
240
let decls = Array. of_list (Shape.Uid.Tbl. to_list cmt.cmt_uid_to_decl) in
@@ -571,6 +593,8 @@ let arg_list = [
571
593
" Print a list of all usages of values, types, etc. in the module" ;
572
594
" -decls" , Arg. Set decls,
573
595
" Print a list of all declarations in the module" ;
596
+ " -uid-deps" , Arg. Set uid_deps,
597
+ " Print the declarations' uids dependencies of the module" ;
574
598
" -null-crc" , Arg. Set no_crc, " Print a null CRC for imported interfaces" ;
575
599
" -args" , Arg. Expand Arg. read_arg,
576
600
" <file> Read additional newline separated command line arguments \n \
0 commit comments