Home | History | Annotate | Download | only in CodeGenCXX
      1 // RUN: %clang_cc1 %s -triple x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s
      2 // PR
      3 
      4 void foo(int);
      5 
      6 class A {
      7 public:
      8   A() { foo(1); }
      9 };
     10 
     11 class A1 {
     12 public:
     13   A1() { foo(2); }
     14 };
     15 
     16 class B {
     17 public:
     18   B() { foo(3); }
     19 };
     20 
     21 class C {
     22 public:
     23   static A a;
     24   C() { foo(4); }
     25 };
     26 
     27 
     28 A C::a = A();
     29 
     30 // CHECK: @llvm.global_ctors = appending global [3 x { i32, void ()* }] [{ i32, void ()* } { i32 200, void ()* @_GLOBAL__I_000200 }, { i32, void ()* } { i32 300, void ()* @_GLOBAL__I_000300 }, { i32, void ()* } { i32 65535, void ()* @_GLOBAL__I_a }]
     31 
     32 // CHECK: _GLOBAL__I_000200()
     33 // CHECK_NEXT: _Z3fooi(i32 3)
     34 
     35 // CHECK: _GLOBAL__I_000300()
     36 // CHECK_NEXT: _Z3fooi(i32 2)
     37 // CHECK_NEXT: _Z3fooi(i32 1)
     38 
     39 // CHECK: _GLOBAL__I_a()
     40 // CHECK_NEXT: _Z3fooi(i32 1)
     41 // CHECK_NEXT: _Z3fooi(i32 4)
     42 
     43 C c;
     44 A1 a1 __attribute__((init_priority (300)));
     45 A a __attribute__((init_priority (300)));
     46 B b __attribute__((init_priority (200)));
     47