summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
authorwhitequark <whitequark@whitequark.org>2017-06-05 11:49:52 +0000
committerwhitequark <whitequark@whitequark.org>2017-06-05 11:49:52 +0000
commitf6059fdc547f1f07ef1c22b48da6514a581c3665 (patch)
treeb5754f0c702d23dd67eff0cc4e46695a46dac054 /llvm/test
parentb3398936ab26d7426bd5419da6c57334c3cfc043 (diff)
downloadbcm5719-llvm-f6059fdc547f1f07ef1c22b48da6514a581c3665.tar.gz
bcm5719-llvm-f6059fdc547f1f07ef1c22b48da6514a581c3665.zip
[LLVM-C] [OCaml] Expose Type::subtypes.
The C functions added are LLVMGetNumContainedTypes and LLVMGetSubtypes. The OCaml function added is Llvm.subtypes. Patch by Ekaterina Vaartis. Differential Revision: https://reviews.llvm.org/D33677 llvm-svn: 304709
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/Bindings/OCaml/core.ml11
1 files changed, 11 insertions, 0 deletions
diff --git a/llvm/test/Bindings/OCaml/core.ml b/llvm/test/Bindings/OCaml/core.ml
index 105f1bc4f73..802baa0b80b 100644
--- a/llvm/test/Bindings/OCaml/core.ml
+++ b/llvm/test/Bindings/OCaml/core.ml
@@ -66,6 +66,16 @@ let suite name f =
let filename = Sys.argv.(1)
let m = create_module context filename
+(*===-- Contained types --------------------------------------------------===*)
+
+let test_contained_types () =
+ let pointer_i32 = pointer_type i32_type in
+ insist (i32_type = (Array.get (subtypes pointer_i32) 0));
+
+ let ar = struct_type context [| i32_type; i8_type |] in
+ insist (i32_type = (Array.get (subtypes ar)) 0);
+ insist (i8_type = (Array.get (subtypes ar)) 1)
+
(*===-- Conversion --------------------------------------------------------===*)
@@ -1533,6 +1543,7 @@ let test_writer () =
(*===-- Driver ------------------------------------------------------------===*)
let _ =
+ suite "contained types" test_contained_types;
suite "conversion" test_conversion;
suite "target" test_target;
suite "constants" test_constants;
OpenPOWER on IntegriCloud