llvm.org GIT mirror llvm / 876aa0d
[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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309321 91177308-0d34-0410-b5e6-96231b3b80d8 Michal Gorny 3 years ago
3 changed file(s) with 11 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
1818 type llattribute
1919 type llmemorybuffer
2020 type llmdkind
21
22 exception FeatureDisabled of string
23
24 let () = Callback.register_exception "Llvm.FeatureDisabled" (FeatureDisabled "")
2125
2226 module TypeKind = struct
2327 type t =
370370
371371 (** {6 Exceptions} *)
372372
373 exception FeatureDisabled of string
374
373375 exception IoError of string
374376
375377
335335
336336 /* lltype -> unit */
337337 CAMLprim value llvm_dump_type(LLVMTypeRef Val) {
338 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
338339 LLVMDumpType(Val);
340 #else
341 caml_raise_with_arg(*caml_named_value("Llvm.FeatureDisabled"),
342 caml_copy_string("dump"));
343 #endif
339344 return Val_unit;
340345 }
341346