diff options
author | Gordon Henriksen <gordonhenriksen@mac.com> | 2007-10-08 03:45:09 +0000 |
---|---|---|
committer | Gordon Henriksen <gordonhenriksen@mac.com> | 2007-10-08 03:45:09 +0000 |
commit | a2ea75d0c826ffe712344055e874d65675953eb3 (patch) | |
tree | 01f0b3310d4b51e014b781cbf183bc225c00eee8 /test/Bindings | |
parent | 116ceb4f1833ca30cc453f22442f2b50ec0bbd97 (diff) | |
download | external_llvm-a2ea75d0c826ffe712344055e874d65675953eb3.zip external_llvm-a2ea75d0c826ffe712344055e874d65675953eb3.tar.gz external_llvm-a2ea75d0c826ffe712344055e874d65675953eb3.tar.bz2 |
C and Objective Caml bindings for getFunction and getNamedGlobal. Also enhanced
the Objective Caml 'declare_*' functions to behave more or less like
getOrInsertFunction.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42740 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Bindings')
-rw-r--r-- | test/Bindings/Ocaml/vmcore.ml | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/test/Bindings/Ocaml/vmcore.ml b/test/Bindings/Ocaml/vmcore.ml index 8aa6e43..4280b1c 100644 --- a/test/Bindings/Ocaml/vmcore.ml +++ b/test/Bindings/Ocaml/vmcore.ml @@ -393,8 +393,14 @@ let test_global_variables () = (* RUN: grep {GVar01.*external} < %t.ll *) group "declarations"; + insist (None == lookup_global "GVar01" m); let g = declare_global i32_type "GVar01" m in insist (is_declaration g); + insist (pointer_type float_type == + type_of (declare_global float_type "GVar01" m)); + insist (g == declare_global i32_type "GVar01" m); + insist (match lookup_global "GVar01" m with Some x -> x = g + | None -> false); (* RUN: grep {GVar02.*42} < %t.ll * RUN: grep {GVar03.*42} < %t.ll @@ -433,15 +439,21 @@ let test_global_variables () = let test_functions () = let ty = function_type i32_type [| i32_type; i64_type |] in - let pty = pointer_type ty in + let ty2 = function_type i8_type [| i8_type; i64_type |] in (* RUN: grep {declare i32 @Fn1\(i32, i64\)} < %t.ll *) group "declare"; + insist (None = lookup_function "Fn1" m); let fn = declare_function "Fn1" ty m in - insist (pty = type_of fn); + insist (pointer_type ty = type_of fn); insist (is_declaration fn); insist (0 = Array.length (basic_blocks fn)); + insist (pointer_type ty2 == type_of (declare_function "Fn1" ty2 m)); + insist (fn == declare_function "Fn1" ty m); + insist (None <> lookup_function "Fn1" m); + insist (match lookup_function "Fn1" m with Some x -> x = fn + | None -> false); (* RUN: grep -v {Fn2} < %t.ll *) |