2014-10-30 16:29:45 +08:00
|
|
|
(* RUN: cp %s %T/ext_exc.ml
|
2015-07-18 01:33:23 +08:00
|
|
|
* RUN: %ocamlc -g -w +A -package llvm.bitreader -linkpkg %T/ext_exc.ml -o %t
|
2014-11-03 17:50:53 +08:00
|
|
|
* RUN: %t
|
2015-07-18 01:33:23 +08:00
|
|
|
* RUN: %ocamlopt -g -w +A -package llvm.bitreader -linkpkg %T/ext_exc.ml -o %t
|
2014-10-30 16:29:45 +08:00
|
|
|
* RUN: %t
|
2010-12-24 05:22:09 +08:00
|
|
|
* XFAIL: vg_leak
|
2010-12-23 23:49:26 +08:00
|
|
|
*)
|
2014-10-30 16:29:45 +08:00
|
|
|
|
2010-12-23 23:49:26 +08:00
|
|
|
let context = Llvm.global_context ()
|
2014-10-30 16:29:45 +08:00
|
|
|
|
2016-04-10 21:55:53 +08:00
|
|
|
let diagnostic_handler _ = ()
|
|
|
|
|
|
|
|
(* This used to crash, we must not use 'external' in .mli files, but 'val' if we
|
2010-12-23 23:49:26 +08:00
|
|
|
* want the let _ bindings executed, see http://caml.inria.fr/mantis/view.php?id=4166 *)
|
|
|
|
let _ =
|
2016-04-10 21:55:53 +08:00
|
|
|
Llvm.set_diagnostic_handler context (Some diagnostic_handler);
|
2010-12-23 23:49:26 +08:00
|
|
|
try
|
|
|
|
ignore (Llvm_bitreader.get_module context (Llvm.MemoryBuffer.of_stdin ()))
|
|
|
|
with
|
|
|
|
Llvm_bitreader.Error _ -> ();;
|
|
|
|
let _ =
|
|
|
|
try
|
|
|
|
ignore (Llvm.MemoryBuffer.of_file "/path/to/nonexistent/file")
|
|
|
|
with
|
|
|
|
Llvm.IoError _ -> ();;
|