1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
open Utils
open Location
open Format
(** Give a unique number to the given file name.
Second return value is true the first time this file name is seed. *)
let internFile =
let count = ref 0 in
let internedFiles = Hashtbl.create 17 in
fun s ->
match Hashtbl.find internedFiles s with
| v -> (v, false)
| exception Not_found ->
incr count;
let v = !count in
Hashtbl.add internedFiles s v;
(v, true)
let source_positions ii =
if (not !Glob_options.dwarf) || Location.isdummy ii then []
else
let n, isFresh = internFile ii.loc_fname in
let line, col = ii.loc_start in
let loc = [ asprintf ".loc %d %d %d" n line col ] in
if isFresh then asprintf ".file %d %S" n ii.loc_fname :: loc else loc