Daniel Dunbar | d7d5f02 | 2009-03-24 02:24:46 +0000 | [diff] [blame] | 1 | // RUN: clang-cc -emit-llvm -o %t %s && |
Daniel Dunbar | d58139e | 2008-09-27 00:39:13 +0000 | [diff] [blame] | 2 | // RUN: grep 't1.*noreturn' %t && |
| 3 | // RUN: grep 't2.*nounwind' %t && |
| 4 | // RUN: grep 'weak.*t3' %t && |
| 5 | // RUN: grep 'hidden.*t4' %t && |
| 6 | // RUN: grep 't5.*weak' %t && |
| 7 | // RUN: grep 't6.*protected' %t && |
| 8 | // RUN: grep 't7.*noreturn' %t && |
| 9 | // RUN: grep 't7.*nounwind' %t && |
Daniel Dunbar | 17f194f | 2009-02-12 17:28:23 +0000 | [diff] [blame] | 10 | // RUN: grep 't9.*alias.*weak.*t8' %t && |
| 11 | // RUN: grep '@t10().*section "SECT"' %t && |
| 12 | // RUN: grep '@t11().*section "SECT"' %t && |
| 13 | // RUN: grep '@t12 =.*section "SECT"' %t && |
Daniel Dunbar | 30510ab | 2009-02-12 23:32:54 +0000 | [diff] [blame] | 14 | // RUN: grep '@t13 =.*section "SECT"' %t && |
| 15 | // RUN: grep '@t14.x =.*section "SECT"' %t |
Daniel Dunbar | 5e27314 | 2009-03-06 16:20:49 +0000 | [diff] [blame] | 16 | // RUN: grep 'declare extern_weak i32 @t15()' %t && |
Daniel Dunbar | 2968b77 | 2009-06-05 22:58:34 +0000 | [diff] [blame] | 17 | // RUN: grep '@t16 = extern_weak global i32' %t && |
Daniel Dunbar | d58139e | 2008-09-27 00:39:13 +0000 | [diff] [blame] | 18 | |
Chris Lattner | ddee423 | 2008-03-03 03:28:21 +0000 | [diff] [blame] | 19 | void t1() __attribute__((noreturn)); |
Mike Stump | 5f28a1e | 2009-07-24 02:49:01 +0000 | [diff] [blame^] | 20 | void t1() { while (1) {} } |
Chris Lattner | ddee423 | 2008-03-03 03:28:21 +0000 | [diff] [blame] | 21 | |
Chris Lattner | ddee423 | 2008-03-03 03:28:21 +0000 | [diff] [blame] | 22 | void t2() __attribute__((nothrow)); |
| 23 | void t2() {} |
| 24 | |
Chris Lattner | ddee423 | 2008-03-03 03:28:21 +0000 | [diff] [blame] | 25 | void t3() __attribute__((weak)); |
| 26 | void t3() {} |
| 27 | |
Chris Lattner | 7b937ae | 2008-03-04 18:08:48 +0000 | [diff] [blame] | 28 | void t4() __attribute__((visibility("hidden"))); |
Chris Lattner | ddee423 | 2008-03-03 03:28:21 +0000 | [diff] [blame] | 29 | void t4() {} |
| 30 | |
Chris Lattner | ddee423 | 2008-03-03 03:28:21 +0000 | [diff] [blame] | 31 | int t5 __attribute__((weak)) = 2; |
| 32 | |
Chris Lattner | 7b937ae | 2008-03-04 18:08:48 +0000 | [diff] [blame] | 33 | int t6 __attribute__((visibility("protected"))); |
Chris Lattner | f89e88d | 2008-03-03 03:45:26 +0000 | [diff] [blame] | 34 | |
Chris Lattner | f89e88d | 2008-03-03 03:45:26 +0000 | [diff] [blame] | 35 | void t7() __attribute__((noreturn, nothrow)); |
Mike Stump | 5f28a1e | 2009-07-24 02:49:01 +0000 | [diff] [blame^] | 36 | void t7() { while (1) {} } |
Nuno Lopes | d4cbda6 | 2008-06-08 15:45:52 +0000 | [diff] [blame] | 37 | |
Nuno Lopes | d4cbda6 | 2008-06-08 15:45:52 +0000 | [diff] [blame] | 38 | void __t8() {} |
| 39 | void t9() __attribute__((weak, alias("__t8"))); |
Daniel Dunbar | 17f194f | 2009-02-12 17:28:23 +0000 | [diff] [blame] | 40 | |
| 41 | void t10(void) __attribute__((section("SECT"))); |
| 42 | void t10(void) {} |
| 43 | void __attribute__((section("SECT"))) t11(void) {} |
| 44 | |
| 45 | int t12 __attribute__((section("SECT"))); |
| 46 | struct s0 { int x; }; |
Daniel Dunbar | 30510ab | 2009-02-12 23:32:54 +0000 | [diff] [blame] | 47 | struct s0 t13 __attribute__((section("SECT"))) = { 0 }; |
| 48 | |
| 49 | void t14(void) { |
| 50 | static int x __attribute__((section("SECT"))) = 0; |
| 51 | } |
Daniel Dunbar | 5e27314 | 2009-03-06 16:20:49 +0000 | [diff] [blame] | 52 | |
| 53 | int __attribute__((weak_import)) t15(void); |
| 54 | extern int t16 __attribute__((weak_import)); |
| 55 | int t17() { |
| 56 | return t15() + t16; |
| 57 | } |
| 58 | |
Daniel Dunbar | 2968b77 | 2009-06-05 22:58:34 +0000 | [diff] [blame] | 59 | // RUN: grep '@t18 = global i[0-9]* 1, align .*' %t && |
| 60 | extern int t18 __attribute__((weak_import)); |
| 61 | int t18 = 1; |
Daniel Dunbar | 5e27314 | 2009-03-06 16:20:49 +0000 | [diff] [blame] | 62 | |
Chris Lattner | ae0b243 | 2009-06-28 19:49:49 +0000 | [diff] [blame] | 63 | // RUN: grep 'define i[0-9]* @t19()' %t && |
Daniel Dunbar | 2968b77 | 2009-06-05 22:58:34 +0000 | [diff] [blame] | 64 | extern int t19(void) __attribute__((weak_import)); |
| 65 | int t19(void) { |
| 66 | return 10; |
| 67 | } |
| 68 | |
| 69 | // RUN: true |