diff options
author | Torok Edwin <edwintorok@gmail.com> | 2011-10-14 20:38:14 +0000 |
---|---|---|
committer | Torok Edwin <edwintorok@gmail.com> | 2011-10-14 20:38:14 +0000 |
commit | 2c4ae181c4c3d93684bb5926cd73c6b3a8370c42 (patch) | |
tree | 1a7cb71a0339d342b0e4a5574702e6bca6fd2a65 /bindings | |
parent | 6b228e506f42972c003599f4873a24910f8a530a (diff) | |
download | external_llvm-2c4ae181c4c3d93684bb5926cd73c6b3a8370c42.zip external_llvm-2c4ae181c4c3d93684bb5926cd73c6b3a8370c42.tar.gz external_llvm-2c4ae181c4c3d93684bb5926cd73c6b3a8370c42.tar.bz2 |
OCaml bindings: fix infinite recursion on string_of_lltype
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141994 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'bindings')
-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) |