diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2009-08-17 19:04:50 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2009-08-17 19:04:50 +0000 |
commit | d172e91f2ada3ad24f889a278d48bc36346ba972 (patch) | |
tree | a9162ba53665e0c71db32dca5c542f47b6cff5c8 /clang/test/CodeGenCXX/default-destructor-synthesis.cpp | |
parent | 436bd9f7708304dac6e7091765c2f6d2eb3c1fcc (diff) | |
download | bcm5719-llvm-d172e91f2ada3ad24f889a278d48bc36346ba972.tar.gz bcm5719-llvm-d172e91f2ada3ad24f889a278d48bc36346ba972.zip |
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.
llvm-svn: 79269
Diffstat (limited to 'clang/test/CodeGenCXX/default-destructor-synthesis.cpp')
-rw-r--r-- | clang/test/CodeGenCXX/default-destructor-synthesis.cpp | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/clang/test/CodeGenCXX/default-destructor-synthesis.cpp b/clang/test/CodeGenCXX/default-destructor-synthesis.cpp new file mode 100644 index 00000000000..0f6849cf549 --- /dev/null +++ b/clang/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: |