1 (* RUN: %ocamlc -warn-error A llvm.cma llvm_analysis.cma %s -o %t
8 (* Note that this takes a moment to link, so it's best to keep the number of
9 individual tests low. *)
11 let test x
= if not x
then exit
1 else ()
18 let fty = function_type void_type
[| |] in
19 let m = create_module
"valid_m" in
20 let fn = define_function
"valid_fn" fty m in
21 let at_entry = builder_at_end
(entry_block
fn) in
22 ignore
(build_ret_void
at_entry);
25 (* Test that valid constructs verify. *)
26 begin match verify_module
m with
27 Some msg
-> bomb "valid module failed verification!"
31 if not
(verify_function
fn) then bomb "valid function failed verification!";
34 (* Test that invalid constructs do not verify.
35 A basic block can contain only one terminator instruction. *)
36 ignore
(build_ret_void
at_entry);
38 begin match verify_module
m with
40 | None
-> bomb "invalid module passed verification!"
43 if verify_function
fn then bomb "invalid function passed verification!";
48 (* Don't bother to test assert_valid_{module,function}. *)