summaryrefslogtreecommitdiff
path: root/clang/test/CodeGen/global-decls.c
diff options
context:
space:
mode:
authorZancanaro; Carlo <czan8762@plang3.cs.usyd.edu.au>2012-09-24 09:58:17 +1000
committerZancanaro; Carlo <czan8762@plang3.cs.usyd.edu.au>2012-09-24 09:58:17 +1000
commit222e2a7620e6520ffaf4fc4e69d79c18da31542e (patch)
tree7bfbc05bfa3b41c8f9d2e56d53a0bc3e310df239 /clang/test/CodeGen/global-decls.c
parent3d206f03985b50beacae843d880bccdc91a9f424 (diff)
Add the clang library to the repo (with some of my changes, too).
Diffstat (limited to 'clang/test/CodeGen/global-decls.c')
-rw-r--r--clang/test/CodeGen/global-decls.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/clang/test/CodeGen/global-decls.c b/clang/test/CodeGen/global-decls.c
new file mode 100644
index 0000000..89e899f
--- /dev/null
+++ b/clang/test/CodeGen/global-decls.c
@@ -0,0 +1,21 @@
+// RUN: %clang_cc1 -triple i386-pc-linux-gnu -emit-llvm -o %t %s
+
+// RUN: grep '@g0_ext = extern_weak global i32' %t
+extern int g0_ext __attribute__((weak));
+// RUN: grep 'declare extern_weak i32 @g1_ext()' %t
+extern int __attribute__((weak)) g1_ext (void);
+
+// RUN: grep '@g0_common = weak global i32' %t
+int g0_common __attribute__((weak));
+
+// RUN: grep '@g0_def = weak global i32' %t
+int g0_def __attribute__((weak)) = 52;
+// RUN: grep 'define weak i32 @g1_def()' %t
+int __attribute__((weak)) g1_def (void) { return 0; }
+
+// Force _ext references
+void f0() {
+ int a = g0_ext;
+ int b = g1_ext();
+}
+