[sledge] Change args of Loc.mk from optional to explicit options

Reviewed By: jvillard

Differential Revision: D27262513

fbshipit-source-id: 8f97bdd43
master
Josh Berdine 4 years ago committed by Facebook GitHub Bot
parent 9ee705bb88
commit eb4a01ce8d

@ -100,24 +100,24 @@ open struct
open struct
let loc_of_global g =
Loc.mk
?dir:(get_debug_loc_directory g)
?file:(Llvm.get_debug_loc_filename g)
~line:(Llvm.get_debug_loc_line g)
?col:None
~dir:(get_debug_loc_directory g)
~file:(Llvm.get_debug_loc_filename g)
~line:(Some (Llvm.get_debug_loc_line g))
~col:None
let loc_of_function f =
Loc.mk
?dir:(get_debug_loc_directory f)
?file:(Llvm.get_debug_loc_filename f)
~line:(Llvm.get_debug_loc_line f)
?col:None
~dir:(get_debug_loc_directory f)
~file:(Llvm.get_debug_loc_filename f)
~line:(Some (Llvm.get_debug_loc_line f))
~col:None
let loc_of_instr i =
Loc.mk
?dir:(get_debug_loc_directory i)
?file:(Llvm.get_debug_loc_filename i)
~line:(Llvm.get_debug_loc_line i)
~col:(Llvm.get_debug_loc_column i)
~dir:(get_debug_loc_directory i)
~file:(Llvm.get_debug_loc_filename i)
~line:(Some (Llvm.get_debug_loc_line i))
~col:(Some (Llvm.get_debug_loc_column i))
let find_scope scope =
ScopeTbl.find_or_add scope_tbl scope ~default:(fun () ->

@ -12,7 +12,11 @@ type t = {dir: string; file: string; line: int; col: int}
let none = {dir= ""; file= ""; line= 0; col= 0}
let mk ?(dir = none.dir) ?(file = none.file) ?(col = none.col) ~line =
let mk ~dir ~file ~line ~col =
let dir = Option.get_or dir ~default:none.dir in
let file = Option.get_or file ~default:none.file in
let line = Option.get_or line ~default:none.line in
let col = Option.get_or col ~default:none.col in
{dir; file; line; col}
let root = ref None

@ -12,7 +12,13 @@ type t = {dir: string; file: string; line: int; col: int}
val pp : t pp
val none : t
val mk : ?dir:string -> ?file:string -> ?col:int -> line:int -> t
val mk :
dir:string option
-> file:string option
-> line:int option
-> col:int option
-> t
val root : string option ref
(** Pathnames are printed relative to [root] if set. *)

Loading…
Cancel
Save