[PATCH] D35899: [OCaml] Fix undefined reference to LLVMDumpType() with NDEBUG
Michał Górny via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 26 10:18:48 PDT 2017
mgorny updated this revision to Diff 108318.
https://reviews.llvm.org/D35899
Files:
bindings/ocaml/llvm/llvm.ml
bindings/ocaml/llvm/llvm.mli
bindings/ocaml/llvm/llvm_ocaml.c
Index: bindings/ocaml/llvm/llvm_ocaml.c
===================================================================
--- bindings/ocaml/llvm/llvm_ocaml.c
+++ bindings/ocaml/llvm/llvm_ocaml.c
@@ -336,7 +336,12 @@
/* lltype -> unit */
CAMLprim value llvm_dump_type(LLVMTypeRef Val) {
+#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
LLVMDumpType(Val);
+#else
+ caml_raise_with_arg(*caml_named_value("Llvm.FeatureDisabled"),
+ caml_copy_string("dump"));
+#endif
return Val_unit;
}
Index: bindings/ocaml/llvm/llvm.mli
===================================================================
--- bindings/ocaml/llvm/llvm.mli
+++ bindings/ocaml/llvm/llvm.mli
@@ -371,6 +371,8 @@
(** {6 Exceptions} *)
+exception FeatureDisabled of string
+
exception IoError of string
Index: bindings/ocaml/llvm/llvm.ml
===================================================================
--- bindings/ocaml/llvm/llvm.ml
+++ bindings/ocaml/llvm/llvm.ml
@@ -20,6 +20,10 @@
type llmemorybuffer
type llmdkind
+exception FeatureDisabled of string
+
+let () = Callback.register_exception "Llvm.FeatureDisabled" (FeatureDisabled "")
+
module TypeKind = struct
type t =
| Void
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D35899.108318.patch
Type: text/x-patch
Size: 1174 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170726/86c675c9/attachment.bin>
More information about the llvm-commits
mailing list