blob: c9701e8270de52e7edd60e3d382c56cafda91447 [file] [log] [blame]
Timur Iskhodzhanov85607912012-04-20 08:05:00 +00001// RUN: %clang_cc1 -emit-llvm %s -o - -cxx-abi microsoft -triple=i386-pc-win32 | FileCheck %s
2
3class A {
4 public:
5 A() { }
6 ~A() { }
7};
8
9void no_contstructor_destructor_infinite_recursion() {
10 A a;
11
John McCallbd315742012-09-25 08:00:39 +000012// CHECK: define linkonce_odr x86_thiscallcc %class.A* @"\01??0A@@QAE@XZ"(%class.A* %this)
NAKAMURA Takumi0e33dcd2012-09-25 09:53:18 +000013// CHECK: [[THIS_ADDR:%[.0-9A-Z_a-z]+]] = alloca %class.A*, align 4
14// CHECK-NEXT: store %class.A* %this, %class.A** [[THIS_ADDR]], align 4
15// CHECK-NEXT: [[T1:%[.0-9A-Z_a-z]+]] = load %class.A** [[THIS_ADDR]]
16// CHECK-NEXT: ret %class.A* [[T1]]
John McCallbd315742012-09-25 08:00:39 +000017// CHECK-NEXT: }
Timur Iskhodzhanov85607912012-04-20 08:05:00 +000018
19// Make sure that the destructor doesn't call itself:
20// CHECK: define {{.*}} @"\01??1A@@QAE@XZ"
21// CHECK-NOT: call void @"\01??1A@@QAE@XZ"
22// CHECK: ret
23}
John McCallbd315742012-09-25 08:00:39 +000024
Timur Iskhodzhanov649c7312013-01-21 13:02:41 +000025struct B {
26 virtual ~B();
27 virtual void foo();
28};
29
30void check_vftable_offset() {
31 B b;
32// The vftable pointer should point at the beginning of the vftable.
33// CHECK: [[THIS_PTR:%[0-9]+]] = bitcast %struct.B* {{.*}} to i8***
34// CHECK: store i8** getelementptr inbounds ([2 x i8*]* @"\01??_7B@@6B@", i64 0, i64 0), i8*** [[THIS_PTR]]
35}