blob: 7cbd55940b43991d6e8cf1030d2bac78adb55494 [file] [log] [blame]
Daniel Dunbara5728872009-12-15 20:14:24 +00001// RUN: %clang_cc1 -triple=x86_64-apple-darwin10 -emit-llvm %s -o - |FileCheck %s
Anders Carlsson89ed31d2009-08-08 23:24:23 +00002
3struct A {
4 A();
5 ~A();
6};
7
Anders Carlsson74d644a2009-10-08 17:28:59 +00008struct B { B(); ~B(); };
9
John McCallfb8b69a2010-02-02 08:02:49 +000010struct C { void *field; };
11
Anders Carlsson2ca4f632010-02-05 18:38:45 +000012struct D { ~D(); };
13
John McCallfb8b69a2010-02-02 08:02:49 +000014// CHECK: @c = global %struct.C zeroinitializer, align 8
15
Anders Carlsson74d644a2009-10-08 17:28:59 +000016// CHECK: call void @_ZN1AC1Ev(%struct.A* @a)
Anders Carlssona3f36ab2009-10-08 17:22:47 +000017// CHECK: call i32 @__cxa_atexit(void (i8*)* bitcast (void (%struct.A*)* @_ZN1AD1Ev to void (i8*)*), i8* getelementptr inbounds (%struct.A* @a, i32 0, i32 0), i8* bitcast (i8** @__dso_handle to i8*))
Anders Carlsson89ed31d2009-08-08 23:24:23 +000018A a;
Anders Carlsson74d644a2009-10-08 17:28:59 +000019
20// CHECK: call void @_ZN1BC1Ev(%struct.A* @b)
21// CHECK: call i32 @__cxa_atexit(void (i8*)* bitcast (void (%struct.A*)* @_ZN1BD1Ev to void (i8*)*), i8* getelementptr inbounds (%struct.A* @b, i32 0, i32 0), i8* bitcast (i8** @__dso_handle to i8*))
22B b;
John McCallfb8b69a2010-02-02 08:02:49 +000023
24// PR6205: this should not require a global initializer
25// CHECK-NOT: call void @_ZN1CC1Ev(%struct.C* @c)
26C c;
27
Anders Carlsson2ca4f632010-02-05 18:38:45 +000028// CHECK: call i32 @__cxa_atexit(void (i8*)* bitcast (void (%struct.A*)* @_ZN1DD1Ev to void (i8*)*), i8* getelementptr inbounds (%struct.A* @d, i32 0, i32 0), i8* bitcast (i8** @__dso_handle to i8*))
29D d;
30
Daniel Dunbarefb0fa92010-03-20 04:15:41 +000031// CHECK: define internal void @_GLOBAL__I_a() {