1// RUN: %clang_cc1 -emit-llvm -o %t %s 2// RUN: grep -e "global_ctors.*@A" %t 3// RUN: grep -e "global_dtors.*@B" %t 4// RUN: grep -e "global_ctors.*@C" %t 5// RUN: grep -e "global_dtors.*@D" %t 6 7int printf(const char *, ...); 8 9void A() __attribute__((constructor)); 10void B() __attribute__((destructor)); 11 12void A() { 13 printf("A\n"); 14} 15 16void B() { 17 printf("B\n"); 18} 19 20static void C() __attribute__((constructor)); 21 22static void D() __attribute__((destructor)); 23 24static int foo() { 25 return 10; 26} 27 28static void C() { 29 printf("A: %d\n", foo()); 30} 31 32static void D() { 33 printf("B\n"); 34} 35 36int main() { 37 return 0; 38} 39