1 // RUN: clang-cc -emit-llvm -o %t %s && 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 && 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 && 14 // RUN: grep '@t13 =.*section "SECT"' %t && 15 // RUN: grep '@t14.x =.*section "SECT"' %t && 16 // RUN: grep 'declare extern_weak i32 @t15()' %t && 17 // RUN: grep '@t16 = extern_weak global i32' %t && 18 19 void t1() __attribute__((noreturn)); 20 void t1() { while (1) {} } 21 22 void t2() __attribute__((nothrow)); 23 void t2() {} 24 25 void t3() __attribute__((weak)); 26 void t3() {} 27 28 void t4() __attribute__((visibility("hidden"))); 29 void t4() {} 30 31 int t5 __attribute__((weak)) = 2; 32 33 int t6 __attribute__((visibility("protected"))); 34 35 void t7() __attribute__((noreturn, nothrow)); 36 void t7() { while (1) {} } 37 38 void __t8() {} 39 void t9() __attribute__((weak, alias("__t8"))); 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; }; 47 struct s0 t13 __attribute__((section("SECT"))) = { 0 }; 48 49 void t14(void) { 50 static int x __attribute__((section("SECT"))) = 0; 51 } 52 53 int __attribute__((weak_import)) t15(void); 54 extern int t16 __attribute__((weak_import)); 55 int t17() { 56 return t15() + t16; 57 } 58 59 // RUN: grep '@t18 = global i[0-9]* 1, align .*' %t && 60 extern int t18 __attribute__((weak_import)); 61 int t18 = 1; 62 63 // RUN: grep 'define i[0-9]* @t19()' %t && 64 extern int t19(void) __attribute__((weak_import)); 65 int t19(void) { 66 return 10; 67 } 68 69 // RUN: true 70