Home | History | Annotate | Download | only in CodeGenCXX
      1 // RUN: %clang_cc1 -triple x86_64 %s -fno-use-cxa-atexit -emit-llvm -o - | FileCheck %s
      2 
      3 // PR7097
      4 // RUN: %clang_cc1 -triple x86_64 %s -fno-use-cxa-atexit -mconstructor-aliases -emit-llvm -o - | FileCheck %s
      5 
      6 // CHECK:      call void @_ZN1AC1Ev([[A:%.*]]* @a)
      7 // CHECK-NEXT: call i32 @atexit(void ()* @__dtor_a)
      8 // CHECK:      define internal void @__dtor_a() [[NUW:#[0-9]+]]
      9 // CHECK:      call void @_ZN1AD1Ev([[A]]* @a)
     10 
     11 // CHECK:      call void @_ZN1AC1Ev([[A]]* @b)
     12 // CHECK-NEXT: call i32 @atexit(void ()* @__dtor_b)
     13 // CHECK:      define internal void @__dtor_b() [[NUW]]
     14 // CHECK:      call void @_ZN1AD1Ev([[A]]* @b)
     15 
     16 class A {
     17 public:
     18   A();
     19   ~A();
     20 };
     21 
     22 A a, b;
     23 
     24 // PR9593
     25 // CHECK:      define void @_Z4funcv()
     26 // CHECK:      call i32 @__cxa_guard_acquire(i64* @_ZGVZ4funcvE2a1)
     27 // CHECK:      call void @_ZN1AC1Ev([[A]]* @_ZZ4funcvE2a1)
     28 // CHECK-NEXT: call i32 @atexit(void ()* @__dtor__ZZ4funcvE2a1)
     29 // CHECK-NEXT: call void @__cxa_guard_release(i64* @_ZGVZ4funcvE2a1)
     30 
     31 // CHECK:      call i32 @__cxa_guard_acquire(i64* @_ZGVZ4funcvE2a2)
     32 // CHECK:      call void @_ZN1AC1Ev([[A]]* @_ZZ4funcvE2a2)
     33 // CHECK-NEXT: call i32 @atexit(void ()* @__dtor__ZZ4funcvE2a2)
     34 // CHECK-NEXT: call void @__cxa_guard_release(i64* @_ZGVZ4funcvE2a2)
     35 
     36 // CHECK:      define internal void @__dtor__ZZ4funcvE2a1() [[NUW]]
     37 // CHECK:      call void @_ZN1AD1Ev([[A]]* @_ZZ4funcvE2a1)
     38 
     39 // CHECK:      define internal void @__dtor__ZZ4funcvE2a2() [[NUW]]
     40 // CHECK:      call void @_ZN1AD1Ev([[A]]* @_ZZ4funcvE2a2)
     41 
     42 void func() {
     43   static A a1, a2;
     44 }
     45 
     46 // CHECK: attributes [[NUW]] = { nounwind }
     47