aboutsummaryrefslogtreecommitdiff
path: root/test/CodeGenCXX/default-destructor-synthesis.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2009-08-17 19:04:50 +0000
committerFariborz Jahanian <fjahanian@apple.com>2009-08-17 19:04:50 +0000
commit0880bacf8fdb7de9d9c5b53b81ea0e53afccafb5 (patch)
tree53c2515821b23f598d2d000a436f2e1c9eced0b2 /test/CodeGenCXX/default-destructor-synthesis.cpp
parent622f9dc76bdc4f4d6920907f4fb64a3222aa6566 (diff)
Patch to 1) synthesizing non-trivial default destructor when
one is not provided by user. 2) More complete emission of ctor prologue when it has no initializer list or when it is synthesized. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79269 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenCXX/default-destructor-synthesis.cpp')
-rw-r--r--test/CodeGenCXX/default-destructor-synthesis.cpp54
1 files changed, 54 insertions, 0 deletions
diff --git a/test/CodeGenCXX/default-destructor-synthesis.cpp b/test/CodeGenCXX/default-destructor-synthesis.cpp
new file mode 100644
index 0000000000..0f6849cf54
--- /dev/null
+++ b/test/CodeGenCXX/default-destructor-synthesis.cpp
@@ -0,0 +1,54 @@
+// RUN: clang-cc -triple x86_64-apple-darwin -std=c++0x -O0 -S %s -o %t-64.s &&
+// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s &&
+// RUN: clang-cc -triple i386-apple-darwin -std=c++0x -O0 -S %s -o %t-32.s &&
+// RUN: FileCheck -check-prefix LP32 -input-file=%t-32.s %s &&
+// RUN: true
+
+extern "C" int printf(...);
+
+struct S {
+ S() : iS(1), fS(1.23) {};
+ ~S(){printf("S::~S(%d, %f)\n", iS, fS); };
+ int iS;
+ float fS;
+};
+
+struct Q {
+ Q() : iQ(2), dQ(2.34) {};
+ ~Q(){printf("Q::~Q(%d, %f)\n", iQ, dQ); };
+ int iQ;
+ double dQ;
+};
+
+struct P {
+ P() : fP(3.45) , iP(3) {};
+ ~P(){printf("P::~P(%d, %f)\n", iP, fP); };
+ float fP;
+ int iP;
+};
+
+struct M : Q, P {
+ S s;
+
+ Q q;
+
+ P p;
+
+};
+
+M gm;
+
+int main() {M m1;}
+
+// CHECK-LP64: call __ZN1MC1Ev
+// CHECK-LP64: call __ZN1MD1Ev
+// CHECK-LP64: .globl __ZN1MD1Ev
+// CHECK-LP64-NEXT: .weak_definition __ZN1MD1Ev
+// CHECK-LP64-NEXT: __ZN1MD1Ev:
+
+
+// CHECK-LP32: call L__ZN1MC1Ev
+// CHECK-LP32: call L__ZN1MD1Ev
+// CHECK-LP32: .globl __ZN1MD1Ev
+// CHECK-LP32-NEXT: .weak_definition __ZN1MD1Ev
+// CHECK-LP32-NEXT: __ZN1MD1Ev: