summaryrefslogtreecommitdiff
path: root/clang/test/CodeGen/attr-weakref.c
diff options
context:
space:
mode:
authorCarlo Zancanaro <carlo@pc-4w14-0.cs.usyd.edu.au>2012-10-15 17:10:06 +1100
committerCarlo Zancanaro <carlo@pc-4w14-0.cs.usyd.edu.au>2012-10-15 17:10:06 +1100
commitbe1de4be954c80875ad4108e0a33e8e131b2f2c0 (patch)
tree1fbbecf276bf7c7bdcbb4dd446099d6d90eaa516 /clang/test/CodeGen/attr-weakref.c
parentc4626a62754862d20b41e8a46a3574264ea80e6d (diff)
parentf1bd2e48c5324d3f7cda4090c87f8a5b6f463ce2 (diff)
Merge branch 'master' of ssh://bitbucket.org/czan/honours
Diffstat (limited to 'clang/test/CodeGen/attr-weakref.c')
-rw-r--r--clang/test/CodeGen/attr-weakref.c62
1 files changed, 62 insertions, 0 deletions
diff --git a/clang/test/CodeGen/attr-weakref.c b/clang/test/CodeGen/attr-weakref.c
new file mode 100644
index 0000000..c1cc03b
--- /dev/null
+++ b/clang/test/CodeGen/attr-weakref.c
@@ -0,0 +1,62 @@
+// RUN: %clang_cc1 -emit-llvm -triple i386-linux-gnu -o %t %s
+// RUN: FileCheck --input-file=%t %s
+
+// CHECK: declare extern_weak void @test1_f()
+void test1_f(void);
+static void test1_g(void) __attribute__((weakref("test1_f")));
+void test1_h(void) {
+ test1_g();
+}
+
+// CHECK: define void @test2_f()
+void test2_f(void) {}
+static void test2_g(void) __attribute__((weakref("test2_f")));
+void test2_h(void) {
+ test2_g();
+}
+
+// CHECK: declare void @test3_f()
+void test3_f(void);
+static void test3_g(void) __attribute__((weakref("test3_f")));
+void test3_foo(void) {
+ test3_f();
+}
+void test3_h(void) {
+ test3_g();
+}
+
+// CHECK: define void @test4_f()
+void test4_f(void);
+static void test4_g(void) __attribute__((weakref("test4_f")));
+void test4_h(void) {
+ test4_g();
+}
+void test4_f(void) {}
+
+// CHECK: declare void @test5_f()
+void test5_f(void);
+static void test5_g(void) __attribute__((weakref("test5_f")));
+void test5_h(void) {
+ test5_g();
+}
+void test5_foo(void) {
+ test5_f();
+}
+
+// CHECK: declare extern_weak void @test6_f()
+void test6_f(void) __attribute__((weak));
+static void test6_g(void) __attribute__((weakref("test6_f")));
+void test6_h(void) {
+ test6_g();
+}
+void test6_foo(void) {
+ test6_f();
+}
+
+// CHECK: declare extern_weak void @test7_f()
+void test7_f(void);
+static void test7_g(void) __attribute__((weakref("test7_f")));
+static void *const test7_zed = (void *) &test7_g;
+void* test7_h(void) {
+ return test7_zed;
+}