• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1(* RUN: cp %s %T/ext_exc.ml
2 * RUN: %ocamlc -g -w +A -package llvm.bitreader -linkpkg %T/ext_exc.ml -o %t
3 * RUN: %t
4 * RUN: %ocamlopt -g -w +A -package llvm.bitreader -linkpkg %T/ext_exc.ml -o %t
5 * RUN: %t
6 * XFAIL: vg_leak
7 *)
8
9let context = Llvm.global_context ()
10
11let diagnostic_handler _ = ()
12
13(* This used to crash, we must not use 'external' in .mli files, but 'val' if we
14 * want the let _ bindings executed, see http://caml.inria.fr/mantis/view.php?id=4166 *)
15let _ =
16    Llvm.set_diagnostic_handler context (Some diagnostic_handler);
17    try
18        ignore (Llvm_bitreader.get_module context (Llvm.MemoryBuffer.of_stdin ()))
19    with
20    Llvm_bitreader.Error _ -> ();;
21let _ =
22    try
23        ignore (Llvm.MemoryBuffer.of_file "/path/to/nonexistent/file")
24    with
25    Llvm.IoError _ -> ();;
26