1. camlspotter
  2. ocaml-llvm-phantom

Commits

camlspotter  committed e34c228

cleanup

  • Participants
  • Parent commits ff052af
  • Branches default

Comments (0)

Files changed (1)

File type_ctxt.ml

View file
   let integer c ((_tag : 'itag), x) : 'itag integer typ = P.unsafe ^$ integer_type c x
   let float c : float typ = P.unsafe ^$ float_type c
   let double c : double typ = P.unsafe ^$ double_type c
-  let function_ : 'ret typ -> 'args typs -> ('args -> 'ret) typ = fun ret args -> P.unsafe ^$ function_type !<ret (P.List.to_array args)
-  let var_arg_function : 'ret typ -> 'args typs -> ('args -> dots -> 'ret) typ = fun ret args -> P.unsafe ^$ var_arg_function_type !<ret (P.List.to_array args)
+  let function_ : (ret : 'ret typ) (args : 'args typs) : ('args -> 'ret) typ =
+    P.unsafe ^$ function_type !<ret (P.List.to_array args)
+  let var_arg_function (ret : 'ret typ) (args : 'args typs) : ('args -> dots -> 'ret) typ = 
+    P.unsafe ^$ var_arg_function_type !<ret (P.List.to_array args)
 
   (* CR jfuruse: not for dots !*)
-  let function_params (t : ('args -> 'ret) typ) : 'args typs = P.List.unsafe_of_array (param_types !<t)
-  let function_return (ty : ('args -> 'ret) typ) : 'ret typ = P.unsafe ^$ return_type !<ty
+  let function_params (t : ('args -> 'ret) typ) : 'args typs = 
+    P.List.unsafe_of_array (param_types !<t)
 
-  let struct_ c (args : 'args typs) : 'args struct_ typ = P.unsafe ^$ struct_type c (P.List.to_array args)
-(*
-  let check_struct t = match classify t with
-    | TypeKind.Struct -> t
-    | _ -> assert false
-*)
+  let function_return (ty : ('args -> 'ret) typ) : 'ret typ = 
+    P.unsafe ^$ return_type !<ty
+
+  let struct_ c (args : 'args typs) : 'args struct_ typ = 
+    P.unsafe ^$ struct_type c (P.List.to_array args)
   
-  let struct_elements (t : 'typs struct_ typ) : 'typs typs = P.List.unsafe_of_array (struct_element_types !<t)
-  let array_ (t : 't typ) ((_tag : 'itag), size) : ('t, 'itag) array_ typ = P.unsafe ^$ array_type !<t size
+  let struct_elements (t : 'typs struct_ typ) : 'typs typs = 
+    P.List.unsafe_of_array (struct_element_types !<t)
+
+  let array_ (t : 't typ) ((_tag : 'itag), size) : ('t, 'itag) array_ typ = 
+    P.unsafe ^$ array_type !<t size
     
   let pointer (t : 't typ) : 't pointer typ = P.unsafe ^$ pointer_type !<t
-(*
-  let check_pointer t = match classify t with
-    | TypeKind.Pointer _ -> t
-    | _ -> assert false
-*)
+
   let element (t : [>`container of 't] typ) : 't typ = P.unsafe ^$ element_type !<t
 
   let define_name ~modname n t =
     Format.eprintf "Registered named type %s.%s@." modname n;
     defined_names := (!<t, (modname, n)) :: !defined_names
 
-  (** [string_of_lltype] of LLVM 2.8 has a bug: if it tries to print a recursive type, cabooom! *)        
+  (** [string_of_lltype] of LLVM 2.8 has a bug: if it tries to print a recursive type, 
+      Kabooom! *)        
   (* Here is a fix *)        
   let string_of_lltype ty =
     let create_name =
   let float = float context 
   let double = double context
   let struct_ x = struct_ context x
-(*
-  let check_pointer t = match classify t with
-    | TypeKind.Pointer _ -> Obj.magic t (* !! *)
-    | _ -> assert false
-*)
 
   (* void pointer is special in LLVM. It is illegal! *)
   let pointer_void = pointer i8