aboutsummaryrefslogtreecommitdiff
path: root/bindings
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2017-08-08 16:52:53 +0000
committerDimitry Andric <dim@FreeBSD.org>2017-08-08 16:52:53 +0000
commit4e20bb0468b8d0db13287e666b482eb93689be99 (patch)
tree852306cf8c98c56c9c7db1a0860802199b2b3253 /bindings
parent3ad6a4b447326bc16c17df65637ca02330b8d090 (diff)
Notes
Diffstat (limited to 'bindings')
-rw-r--r--bindings/ocaml/llvm/llvm.ml4
-rw-r--r--bindings/ocaml/llvm/llvm.mli2
-rw-r--r--bindings/ocaml/llvm/llvm_ocaml.c5
3 files changed, 11 insertions, 0 deletions
diff --git a/bindings/ocaml/llvm/llvm.ml b/bindings/ocaml/llvm/llvm.ml
index 6e8ca662ef67..59f0f178c288 100644
--- a/bindings/ocaml/llvm/llvm.ml
+++ b/bindings/ocaml/llvm/llvm.ml
@@ -20,6 +20,10 @@ type llattribute
type llmemorybuffer
type llmdkind
+exception FeatureDisabled of string
+
+let () = Callback.register_exception "Llvm.FeatureDisabled" (FeatureDisabled "")
+
module TypeKind = struct
type t =
| Void
diff --git a/bindings/ocaml/llvm/llvm.mli b/bindings/ocaml/llvm/llvm.mli
index c422e78f5d2d..3387c1ec52fe 100644
--- a/bindings/ocaml/llvm/llvm.mli
+++ b/bindings/ocaml/llvm/llvm.mli
@@ -371,6 +371,8 @@ type ('a, 'b) llrev_pos =
(** {6 Exceptions} *)
+exception FeatureDisabled of string
+
exception IoError of string
diff --git a/bindings/ocaml/llvm/llvm_ocaml.c b/bindings/ocaml/llvm/llvm_ocaml.c
index 4b6d1c5072bc..137b17f26bfb 100644
--- a/bindings/ocaml/llvm/llvm_ocaml.c
+++ b/bindings/ocaml/llvm/llvm_ocaml.c
@@ -336,7 +336,12 @@ CAMLprim LLVMContextRef llvm_type_context(LLVMTypeRef Ty) {
/* 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;
}