[PATCH] OCaml bindings: implement Llvm.dump_type

Peter Zotov whitequark at whitequark.org
Sat Oct 12 09:58:07 PDT 2013


Hi sylvestre.ledru,

http://llvm-reviews.chandlerc.com/D1921

Files:
  bindings/ocaml/llvm/llvm.ml
  bindings/ocaml/llvm/llvm.mli
  bindings/ocaml/llvm/llvm_ocaml.c

Index: bindings/ocaml/llvm/llvm.ml
===================================================================
--- bindings/ocaml/llvm/llvm.ml
+++ bindings/ocaml/llvm/llvm.ml
@@ -313,6 +313,7 @@
 external classify_type : lltype -> TypeKind.t = "llvm_classify_type"
 external type_context : lltype -> llcontext = "llvm_type_context"
 external type_is_sized : lltype -> bool = "llvm_type_is_sized"
+external dump_type : lltype -> unit = "llvm_dump_type"
 
 (*--... Operations on integer types ........................................--*)
 external i1_type : llcontext -> lltype = "llvm_i1_type"
Index: bindings/ocaml/llvm/llvm.mli
===================================================================
--- bindings/ocaml/llvm/llvm.mli
+++ bindings/ocaml/llvm/llvm.mli
@@ -431,6 +431,10 @@
     See the method [llvm::Type::getContext]. *)
 val type_context : lltype -> llcontext
 
+(** [dump_type ty] prints the .ll representation of the type [ty] to standard
+    error. See the method [llvm::Type::dump]. *)
+val dump_type : lltype -> unit
+
 (** [string_of_lltype ty] returns a string describing the type [ty]. *)
 val string_of_lltype : lltype -> string
 
Index: bindings/ocaml/llvm/llvm_ocaml.c
===================================================================
--- bindings/ocaml/llvm/llvm_ocaml.c
+++ bindings/ocaml/llvm/llvm_ocaml.c
@@ -190,6 +190,12 @@
   return LLVMGetTypeContext(Ty);
 }
 
+/* lltype -> unit */
+CAMLprim value llvm_dump_type(LLVMTypeRef Val) {
+  LLVMDumpType(Val);
+  return Val_unit;
+}
+
 /*--... Operations on integer types ........................................--*/
 
 /* llcontext -> lltype */
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D1921.1.patch
Type: text/x-patch
Size: 1618 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20131012/0f64f01d/attachment.bin>


More information about the llvm-commits mailing list