[llvm-branch-commits] [llvm-branch] r309590 - Merging r309321:

Hans Wennborg via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon Jul 31 10:37:45 PDT 2017


Author: hans
Date: Mon Jul 31 10:37:45 2017
New Revision: 309590

URL: http://llvm.org/viewvc/llvm-project?rev=309590&view=rev
Log:
Merging r309321:
------------------------------------------------------------------------
r309321 | mgorny | 2017-07-27 14:13:25 -0700 (Thu, 27 Jul 2017) | 12 lines

[OCaml] Fix undefined reference to LLVMDumpType() with NDEBUG

Account for the possibility of LLVMDumpType() not being available with
NDEBUG in the OCaml bindings. If it is not built into LLVM, make
the dump function raise an exception.

Since rL293359, the dump functions are built only if either NDEBUG is
not defined, or LLVM_ENABLE_DUMP is defined. As a result, if the dump
functions are not built in LLVM, the dynamic OCaml libraries fail to
load due to undefined LLVMDumpType symbol.

Differential Revision: https://reviews.llvm.org/D35899
------------------------------------------------------------------------

Modified:
    llvm/branches/release_50/   (props changed)
    llvm/branches/release_50/bindings/ocaml/llvm/llvm.ml
    llvm/branches/release_50/bindings/ocaml/llvm/llvm.mli
    llvm/branches/release_50/bindings/ocaml/llvm/llvm_ocaml.c

Propchange: llvm/branches/release_50/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Jul 31 10:37:45 2017
@@ -1,3 +1,3 @@
 /llvm/branches/Apple/Pertwee:110850,110961
 /llvm/branches/type-system-rewrite:133420-134817
-/llvm/trunk:155241,308483-308484,308503,308808,308813,308891,308906,308950,308963,308978,308986,309113,309302,309323,309325,309343,309353,309355,309422
+/llvm/trunk:155241,308483-308484,308503,308808,308813,308891,308906,308950,308963,308978,308986,309113,309302,309321,309323,309325,309343,309353,309355,309422

Modified: llvm/branches/release_50/bindings/ocaml/llvm/llvm.ml
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_50/bindings/ocaml/llvm/llvm.ml?rev=309590&r1=309589&r2=309590&view=diff
==============================================================================
--- llvm/branches/release_50/bindings/ocaml/llvm/llvm.ml (original)
+++ llvm/branches/release_50/bindings/ocaml/llvm/llvm.ml Mon Jul 31 10:37:45 2017
@@ -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

Modified: llvm/branches/release_50/bindings/ocaml/llvm/llvm.mli
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_50/bindings/ocaml/llvm/llvm.mli?rev=309590&r1=309589&r2=309590&view=diff
==============================================================================
--- llvm/branches/release_50/bindings/ocaml/llvm/llvm.mli (original)
+++ llvm/branches/release_50/bindings/ocaml/llvm/llvm.mli Mon Jul 31 10:37:45 2017
@@ -371,6 +371,8 @@ type ('a, 'b) llrev_pos =
 
 (** {6 Exceptions} *)
 
+exception FeatureDisabled of string
+
 exception IoError of string
 
 

Modified: llvm/branches/release_50/bindings/ocaml/llvm/llvm_ocaml.c
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_50/bindings/ocaml/llvm/llvm_ocaml.c?rev=309590&r1=309589&r2=309590&view=diff
==============================================================================
--- llvm/branches/release_50/bindings/ocaml/llvm/llvm_ocaml.c (original)
+++ llvm/branches/release_50/bindings/ocaml/llvm/llvm_ocaml.c Mon Jul 31 10:37:45 2017
@@ -336,7 +336,12 @@ CAMLprim LLVMContextRef llvm_type_contex
 
 /* 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;
 }
 




More information about the llvm-branch-commits mailing list