llvm.org GIT mirror llvm / 2c4ae18
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 Torok Edwin 7 years ago
2 changed file(s) with 18 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
11361136 (* FIXME: stop infinite recursion! :) *)
11371137 match classify_type ty with
11381138 TypeKind.Integer -> "i" ^ string_of_int (integer_bitwidth ty)
1139 | TypeKind.Pointer -> (string_of_lltype (element_type ty)) ^ "*"
1139 | TypeKind.Pointer ->
1140 (let ety = element_type ty in
1141 match classify_type ety with
1142 | TypeKind.Struct ->
1143 (match struct_name ety with
1144 | None -> (string_of_lltype ety)
1145 | Some s -> s) ^ "*"
1146 | _ -> (string_of_lltype (element_type ty)) ^ "*")
11401147 | TypeKind.Struct ->
11411148 let s = "{ " ^ (concat2 ", " (
11421149 Array.map string_of_lltype (struct_element_types ty)
336336 "{cx},{ax},{di},~{dirflag},~{fpsr},~{flags},~{edi},~{ecx}"
337337 true
338338 false)
339 end;
340
341 group "recursive struct"; begin
342 let nsty = named_struct_type context "rec" in
343 let pty = pointer_type nsty in
344 struct_set_body nsty [| i32_type; pty |] false;
345 let elts = [| const_int i32_type 4; const_pointer_null pty |] in
346 let grec_init = const_named_struct nsty elts in
347 ignore (define_global "grec" grec_init m);
348 ignore (string_of_lltype nsty);
339349 end
340350
341351