blob: a5de4f4b42a2a1bf7f5225c815b8625fc54e5a8b [file] [log] [blame]
Daniel Dunbard7d5f022009-03-24 02:24:46 +00001// RUN: clang-cc -emit-llvm -o %t %s &&
Daniel Dunbard58139e2008-09-27 00:39:13 +00002// 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 Dunbar17f194f2009-02-12 17:28:23 +000010// 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 Dunbar30510ab2009-02-12 23:32:54 +000014// RUN: grep '@t13 =.*section "SECT"' %t &&
15// RUN: grep '@t14.x =.*section "SECT"' %t
Daniel Dunbar5e273142009-03-06 16:20:49 +000016// RUN: grep 'declare extern_weak i32 @t15()' %t &&
Daniel Dunbar2968b772009-06-05 22:58:34 +000017// RUN: grep '@t16 = extern_weak global i32' %t &&
Daniel Dunbard58139e2008-09-27 00:39:13 +000018
Chris Lattnerddee4232008-03-03 03:28:21 +000019void t1() __attribute__((noreturn));
20void t1() {}
21
Chris Lattnerddee4232008-03-03 03:28:21 +000022void t2() __attribute__((nothrow));
23void t2() {}
24
Chris Lattnerddee4232008-03-03 03:28:21 +000025void t3() __attribute__((weak));
26void t3() {}
27
Chris Lattner7b937ae2008-03-04 18:08:48 +000028void t4() __attribute__((visibility("hidden")));
Chris Lattnerddee4232008-03-03 03:28:21 +000029void t4() {}
30
Chris Lattnerddee4232008-03-03 03:28:21 +000031int t5 __attribute__((weak)) = 2;
32
Chris Lattner7b937ae2008-03-04 18:08:48 +000033int t6 __attribute__((visibility("protected")));
Chris Lattnerf89e88d2008-03-03 03:45:26 +000034
Chris Lattnerf89e88d2008-03-03 03:45:26 +000035void t7() __attribute__((noreturn, nothrow));
36void t7() {}
Nuno Lopesd4cbda62008-06-08 15:45:52 +000037
Nuno Lopesd4cbda62008-06-08 15:45:52 +000038void __t8() {}
39void t9() __attribute__((weak, alias("__t8")));
Daniel Dunbar17f194f2009-02-12 17:28:23 +000040
41void t10(void) __attribute__((section("SECT")));
42void t10(void) {}
43void __attribute__((section("SECT"))) t11(void) {}
44
45int t12 __attribute__((section("SECT")));
46struct s0 { int x; };
Daniel Dunbar30510ab2009-02-12 23:32:54 +000047struct s0 t13 __attribute__((section("SECT"))) = { 0 };
48
49void t14(void) {
50 static int x __attribute__((section("SECT"))) = 0;
51}
Daniel Dunbar5e273142009-03-06 16:20:49 +000052
53int __attribute__((weak_import)) t15(void);
54extern int t16 __attribute__((weak_import));
55int t17() {
56 return t15() + t16;
57}
58
Daniel Dunbar2968b772009-06-05 22:58:34 +000059// RUN: grep '@t18 = global i[0-9]* 1, align .*' %t &&
60extern int t18 __attribute__((weak_import));
61int t18 = 1;
Daniel Dunbar5e273142009-03-06 16:20:49 +000062
Daniel Dunbar2968b772009-06-05 22:58:34 +000063// RUN: grep 'define i[0-9]* @t19() nounwind {' %t &&
64extern int t19(void) __attribute__((weak_import));
65int t19(void) {
66 return 10;
67}
68
69// RUN: true