summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGenCXX/pr20897.cpp
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2014-09-11 23:05:02 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2014-09-11 23:05:02 +0000
commit196ac334f32f81d9fe040d51de4117c86c7087bf (patch)
tree1ed72f0ee4a978653049c6ecf2be7dc0b266250d /clang/test/CodeGenCXX/pr20897.cpp
parent42fa4af8fe4e672d0b8bd4a5ebeec9b45730a0ff (diff)
downloadbcm5719-llvm-196ac334f32f81d9fe040d51de4117c86c7087bf.tar.gz
bcm5719-llvm-196ac334f32f81d9fe040d51de4117c86c7087bf.zip
MS ABI: Use the correct this arg when generating implict copy ctor
We assumed that the incoming this argument would be the last argument. However, this is not true under the MS ABI. This fixes PR20897. llvm-svn: 217642
Diffstat (limited to 'clang/test/CodeGenCXX/pr20897.cpp')
-rw-r--r--clang/test/CodeGenCXX/pr20897.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/clang/test/CodeGenCXX/pr20897.cpp b/clang/test/CodeGenCXX/pr20897.cpp
new file mode 100644
index 00000000000..06828c0ec07
--- /dev/null
+++ b/clang/test/CodeGenCXX/pr20897.cpp
@@ -0,0 +1,17 @@
+// RUN: %clang_cc1 -triple i686-windows-msvc -emit-llvm -std=c++1y -O0 -o - %s | FileCheck %s
+struct Base {};
+
+// __declspec(dllexport) causes us to export the implicit constructor.
+struct __declspec(dllexport) Derived : virtual Base {
+// CHECK-LABEL: define weak_odr dllexport x86_thiscallcc %struct.Derived* @"\01??0Derived@@QAE@ABU0@@Z"
+// CHECK: %[[this:.*]] = load %struct.Derived** {{.*}}
+// CHECK-NEXT: store %struct.Derived* %[[this]], %struct.Derived** %[[retval:.*]]
+// CHECK: %[[dest_a_gep:.*]] = getelementptr inbounds %struct.Derived* %[[this]], i32 0, i32 1
+// CHECK-NEXT: %[[src_load:.*]] = load %struct.Derived** {{.*}}
+// CHECK-NEXT: %[[src_a_gep:.*]] = getelementptr inbounds %struct.Derived* %[[src_load:.*]], i32 0, i32 1
+// CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* %[[dest_a_gep]], i8* %[[src_a_gep]], i64 1, i32 4, i1 false)
+// CHECK-NEXT: %[[dest_this:.*]] = load %struct.Derived** %[[retval]]
+// CHECK-NEXT: ret %struct.Derived* %[[dest_this]]
+ bool a : 1;
+ bool b : 1;
+};
OpenPOWER on IntegriCloud