aboutsummaryrefslogtreecommitdiff
path: root/test/CodeGenCXX/microsoft-abi-structors.cpp
diff options
context:
space:
mode:
authorTimur Iskhodzhanov <timurrrr@google.com>2013-02-12 13:22:47 +0000
committerTimur Iskhodzhanov <timurrrr@google.com>2013-02-12 13:22:47 +0000
commit6c9dccd7c437d091a911b749eb0b96f7baea7715 (patch)
treed09964f9a44efb7a74fe10e75c2dccaa55fa0361 /test/CodeGenCXX/microsoft-abi-structors.cpp
parent9efe057ac090ed0d45a64b82e68c74e52c67ed91 (diff)
Rename -constructors test to just -structors as in fact it tests dtors too. Also, fix a minor typo in the test.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174966 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenCXX/microsoft-abi-structors.cpp')
-rw-r--r--test/CodeGenCXX/microsoft-abi-structors.cpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/test/CodeGenCXX/microsoft-abi-structors.cpp b/test/CodeGenCXX/microsoft-abi-structors.cpp
new file mode 100644
index 0000000000..12622f1089
--- /dev/null
+++ b/test/CodeGenCXX/microsoft-abi-structors.cpp
@@ -0,0 +1,35 @@
+// RUN: %clang_cc1 -emit-llvm %s -o - -cxx-abi microsoft -triple=i386-pc-win32 | FileCheck %s
+
+class A {
+ public:
+ A() { }
+ ~A() { }
+};
+
+void no_constructor_destructor_infinite_recursion() {
+ A a;
+
+// CHECK: define linkonce_odr x86_thiscallcc %class.A* @"\01??0A@@QAE@XZ"(%class.A* %this)
+// CHECK: [[THIS_ADDR:%[.0-9A-Z_a-z]+]] = alloca %class.A*, align 4
+// CHECK-NEXT: store %class.A* %this, %class.A** [[THIS_ADDR]], align 4
+// CHECK-NEXT: [[T1:%[.0-9A-Z_a-z]+]] = load %class.A** [[THIS_ADDR]]
+// CHECK-NEXT: ret %class.A* [[T1]]
+// CHECK-NEXT: }
+
+// Make sure that the destructor doesn't call itself:
+// CHECK: define {{.*}} @"\01??1A@@QAE@XZ"
+// CHECK-NOT: call void @"\01??1A@@QAE@XZ"
+// CHECK: ret
+}
+
+struct B {
+ virtual ~B();
+ virtual void foo();
+};
+
+void check_vftable_offset() {
+ B b;
+// The vftable pointer should point at the beginning of the vftable.
+// CHECK: [[THIS_PTR:%[0-9]+]] = bitcast %struct.B* {{.*}} to i8***
+// CHECK: store i8** getelementptr inbounds ([2 x i8*]* @"\01??_7B@@6B@", i64 0, i64 0), i8*** [[THIS_PTR]]
+}