diff options
Diffstat (limited to 'bindings/ocaml/llvm/llvm.ml')
-rw-r--r-- | bindings/ocaml/llvm/llvm.ml | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/bindings/ocaml/llvm/llvm.ml b/bindings/ocaml/llvm/llvm.ml index 19ad672..168c21c 100644 --- a/bindings/ocaml/llvm/llvm.ml +++ b/bindings/ocaml/llvm/llvm.ml @@ -1137,7 +1137,14 @@ let rec string_of_lltype ty = (* FIXME: stop infinite recursion! :) *) match classify_type ty with TypeKind.Integer -> "i" ^ string_of_int (integer_bitwidth ty) - | TypeKind.Pointer -> (string_of_lltype (element_type ty)) ^ "*" + | TypeKind.Pointer -> + (let ety = element_type ty in + match classify_type ety with + | TypeKind.Struct -> + (match struct_name ety with + | None -> (string_of_lltype ety) + | Some s -> s) ^ "*" + | _ -> (string_of_lltype (element_type ty)) ^ "*") | TypeKind.Struct -> let s = "{ " ^ (concat2 ", " ( Array.map string_of_lltype (struct_element_types ty) |