diff options
Diffstat (limited to 'clang/test/CodeGenCXX/microsoft-abi-byval-sret.cpp')
-rw-r--r-- | clang/test/CodeGenCXX/microsoft-abi-byval-sret.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/clang/test/CodeGenCXX/microsoft-abi-byval-sret.cpp b/clang/test/CodeGenCXX/microsoft-abi-byval-sret.cpp new file mode 100644 index 00000000000..00d36b7d492 --- /dev/null +++ b/clang/test/CodeGenCXX/microsoft-abi-byval-sret.cpp @@ -0,0 +1,26 @@ +// RUN: %clang_cc1 -emit-llvm %s -o - -triple=i686-pc-win32 -mconstructor-aliases -fno-rtti | FileCheck %s + +struct A { + A() : a(42) {} + A(const A &o) : a(o.a) {} + ~A() {} + int a; + A foo(A o); +}; + +A A::foo(A x) { + A y(*this); + y.a += x.a; + return y; +} + +// CHECK: define x86_thiscallcc void @"\01?foo@A@@QAE?AU1@U1@@Z" +// CHECK: (%struct.A* %this, <{ %struct.A*, %struct.A }>* inalloca) + +int main() { + A x; + A y = x.foo(x); +} + +// CHECK: call x86_thiscallcc void @"\01?foo@A@@QAE?AU1@U1@@Z" +// CHECK: (%struct.A* %{{[^,]*}}, <{ %struct.A*, %struct.A }>* inalloca %{{[^,]*}}) |