summaryrefslogtreecommitdiff
path: root/test/Bindings
diff options
context:
space:
mode:
authorErick Tryzelaar <idadesub@users.sourceforge.net>2010-02-28 09:46:13 +0000
committerErick Tryzelaar <idadesub@users.sourceforge.net>2010-02-28 09:46:13 +0000
commit8e130b1d0d53346e05d0a1161a52c6d62de163c4 (patch)
treed55f17ed5227c702a9c1097251769f9a03bb9ce8 /test/Bindings
parentc59286bff1cca8c4fa15f390c9002db94117614e (diff)
downloadllvm-8e130b1d0d53346e05d0a1161a52c6d62de163c4.tar.gz
llvm-8e130b1d0d53346e05d0a1161a52c6d62de163c4.tar.bz2
llvm-8e130b1d0d53346e05d0a1161a52c6d62de163c4.tar.xz
Add support for global variables in an address space for llvm-c and ocaml.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97377 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Bindings')
-rw-r--r--test/Bindings/Ocaml/vmcore.ml58
1 files changed, 38 insertions, 20 deletions
diff --git a/test/Bindings/Ocaml/vmcore.ml b/test/Bindings/Ocaml/vmcore.ml
index 9a2f547531..665c6f98b4 100644
--- a/test/Bindings/Ocaml/vmcore.ml
+++ b/test/Bindings/Ocaml/vmcore.ml
@@ -493,28 +493,46 @@ let test_global_variables () =
let (++) x f = f x; x in
let fourty_two32 = const_int i32_type 42 in
- (* 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);
+ group "declarations"; begin
+ (* RUN: grep {GVar01.*external} < %t.ll
+ *)
+ 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);
+
+ insist (None == lookup_global "QGVar01" m);
+ let g = declare_qualified_global i32_type "QGVar01" 3 m in
+ insist (is_declaration g);
+ insist (qualified_pointer_type float_type 3 ==
+ type_of (declare_qualified_global float_type "QGVar01" 3 m));
+ insist (g == declare_qualified_global i32_type "QGVar01" 3 m);
+ insist (match lookup_global "QGVar01" m with Some x -> x = g
+ | None -> false);
+ end;
- (* RUN: grep {GVar02.*42} < %t.ll
- * RUN: grep {GVar03.*42} < %t.ll
- *)
- group "definitions";
- let g = define_global "GVar02" fourty_two32 m in
- let g2 = declare_global i32_type "GVar03" m ++
+ group "definitions"; begin
+ (* RUN: grep {GVar02.*42} < %t.ll
+ * RUN: grep {GVar03.*42} < %t.ll
+ *)
+ let g = define_global "GVar02" fourty_two32 m in
+ let g2 = declare_global i32_type "GVar03" m ++
+ set_initializer fourty_two32 in
+ insist (not (is_declaration g));
+ insist (not (is_declaration g2));
+ insist ((global_initializer g) == (global_initializer g2));
+
+ let g = define_qualified_global "QGVar02" fourty_two32 3 m in
+ let g2 = declare_qualified_global i32_type "QGVar03" 3 m ++
set_initializer fourty_two32 in
- insist (not (is_declaration g));
- insist (not (is_declaration g2));
- insist ((global_initializer g) == (global_initializer g2));
+ insist (not (is_declaration g));
+ insist (not (is_declaration g2));
+ insist ((global_initializer g) == (global_initializer g2));
+ end;
(* RUN: grep {GVar04.*thread_local} < %t.ll
*)