summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGenCXX/microsoft-abi-byval-thunks.cpp
diff options
context:
space:
mode:
authorReid Kleckner <reid@kleckner.net>2014-07-25 21:39:46 +0000
committerReid Kleckner <reid@kleckner.net>2014-07-25 21:39:46 +0000
commit19819446eb29883725e579167243b30df4eb46c0 (patch)
tree2c8d59d799e30651da6b194e6c369eb32aa7bf37 /clang/test/CodeGenCXX/microsoft-abi-byval-thunks.cpp
parenta822d94f577ce495704a781999b5ce1d259f80dc (diff)
downloadbcm5719-llvm-19819446eb29883725e579167243b30df4eb46c0.tar.gz
bcm5719-llvm-19819446eb29883725e579167243b30df4eb46c0.zip
MS ABI: Don't push destructor cleanups for aggregate parameters in thunks
The target method of the thunk will perform the cleanup. This can't be tested in 32-bit x86 yet because passing something by value would create an inalloca, and we refuse to generate broken code for that. llvm-svn: 213976
Diffstat (limited to 'clang/test/CodeGenCXX/microsoft-abi-byval-thunks.cpp')
-rw-r--r--clang/test/CodeGenCXX/microsoft-abi-byval-thunks.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/clang/test/CodeGenCXX/microsoft-abi-byval-thunks.cpp b/clang/test/CodeGenCXX/microsoft-abi-byval-thunks.cpp
new file mode 100644
index 00000000000..a9ffc120142
--- /dev/null
+++ b/clang/test/CodeGenCXX/microsoft-abi-byval-thunks.cpp
@@ -0,0 +1,25 @@
+// RUN: not %clang_cc1 %s -fno-rtti -triple=i686-pc-win32 -emit-llvm -o /dev/null 2>&1 | FileCheck --check-prefix=CHECK32
+// RUN: %clang_cc1 %s -fno-rtti -triple=x86_64-pc-win32 -emit-llvm -o - | FileCheck --check-prefix=CHECK64
+
+namespace byval_thunk {
+struct Agg {
+ Agg();
+ Agg(const Agg &);
+ ~Agg();
+ int x;
+};
+
+struct A { virtual void foo(Agg x); };
+struct B { virtual void foo(Agg x); };
+struct C : A, B { virtual void foo(Agg x); };
+C c;
+
+// CHECK32: cannot compile this non-trivial argument copy for thunk yet
+
+// CHECK64-LABEL: define linkonce_odr void @"\01?foo@C@byval_thunk@@W7EAAXUAgg@2@@Z"
+// CHECK64: (%"struct.byval_thunk::C"* %this, %"struct.byval_thunk::Agg"* %x)
+// CHECK64: getelementptr i8* %{{.*}}, i32 -8
+// CHECK64: call void @"\01?foo@C@byval_thunk@@UEAAXUAgg@2@@Z"(%"struct.byval_thunk::C"* %2, %"struct.byval_thunk::Agg"* %x)
+// CHECK64-NOT: call
+// CHECK64: ret void
+}
OpenPOWER on IntegriCloud