2014-05-01 11:07:18 +08:00
|
|
|
// RUN: %clang_cc1 -mconstructor-aliases -std=c++11 -fexceptions -emit-llvm %s -o - -triple=i386-pc-win32 | FileCheck %s -check-prefix=X86
|
|
|
|
// RUN: %clang_cc1 -mconstructor-aliases -std=c++11 -fexceptions -emit-llvm %s -o - -triple=x86_64-pc-win32 | FileCheck %s -check-prefix=X64
|
2013-12-05 03:23:12 +08:00
|
|
|
|
|
|
|
struct A {
|
|
|
|
A(int a);
|
2014-05-03 08:33:28 +08:00
|
|
|
A(const A &o);
|
2013-12-05 03:23:12 +08:00
|
|
|
~A();
|
|
|
|
int a;
|
|
|
|
};
|
|
|
|
|
|
|
|
void foo(A a, A b, A c) {
|
|
|
|
}
|
|
|
|
|
|
|
|
// Order of destruction should be left to right.
|
|
|
|
//
|
2018-03-17 04:36:49 +08:00
|
|
|
// X86-LABEL: define dso_local void @"?foo@@YAXUA@@00@Z"
|
2014-05-01 11:07:18 +08:00
|
|
|
// X86: ([[argmem_ty:<{ %struct.A, %struct.A, %struct.A }>]]* inalloca)
|
2015-02-28 03:18:17 +08:00
|
|
|
// X86: %[[a:[^ ]*]] = getelementptr inbounds [[argmem_ty]], [[argmem_ty]]* %0, i32 0, i32 0
|
|
|
|
// X86: %[[b:[^ ]*]] = getelementptr inbounds [[argmem_ty]], [[argmem_ty]]* %0, i32 0, i32 1
|
|
|
|
// X86: %[[c:[^ ]*]] = getelementptr inbounds [[argmem_ty]], [[argmem_ty]]* %0, i32 0, i32 2
|
2018-03-17 04:36:49 +08:00
|
|
|
// X86: call x86_thiscallcc void @"??1A@@QAE@XZ"(%struct.A* %[[a]])
|
|
|
|
// X86: call x86_thiscallcc void @"??1A@@QAE@XZ"(%struct.A* %[[b]])
|
|
|
|
// X86: call x86_thiscallcc void @"??1A@@QAE@XZ"(%struct.A* %[[c]])
|
2014-05-01 11:07:18 +08:00
|
|
|
// X86: ret void
|
|
|
|
|
2018-03-17 04:36:49 +08:00
|
|
|
// X64-LABEL: define dso_local void @"?foo@@YAXUA@@00@Z"
|
2014-05-01 11:07:18 +08:00
|
|
|
// X64: (%struct.A* %[[a:[^,]*]], %struct.A* %[[b:[^,]*]], %struct.A* %[[c:[^)]*]])
|
2018-03-17 04:36:49 +08:00
|
|
|
// X64: call void @"??1A@@QEAA@XZ"(%struct.A* %[[a]])
|
|
|
|
// X64: call void @"??1A@@QEAA@XZ"(%struct.A* %[[b]])
|
|
|
|
// X64: call void @"??1A@@QEAA@XZ"(%struct.A* %[[c]])
|
2014-05-01 11:07:18 +08:00
|
|
|
// X64: ret void
|
2013-12-05 03:23:12 +08:00
|
|
|
|
|
|
|
|
|
|
|
void call_foo() {
|
|
|
|
foo(A(1), A(2), A(3));
|
|
|
|
}
|
|
|
|
|
|
|
|
// Order of evaluation should be right to left, and we should clean up the right
|
|
|
|
// things as we unwind.
|
|
|
|
//
|
2018-03-17 04:36:49 +08:00
|
|
|
// X86-LABEL: define dso_local void @"?call_foo@@YAXXZ"()
|
2014-05-01 11:07:18 +08:00
|
|
|
// X86: call i8* @llvm.stacksave()
|
|
|
|
// X86: %[[argmem:[^ ]*]] = alloca inalloca [[argmem_ty]]
|
2015-02-28 03:18:17 +08:00
|
|
|
// X86: %[[arg3:[^ ]*]] = getelementptr inbounds [[argmem_ty]], [[argmem_ty]]* %[[argmem]], i32 0, i32 2
|
2018-10-15 23:43:00 +08:00
|
|
|
// X86: call x86_thiscallcc %struct.A* @"??0A@@QAE@H@Z"(%struct.A* %[[arg3]], i32 3)
|
2015-02-28 03:18:17 +08:00
|
|
|
// X86: %[[arg2:[^ ]*]] = getelementptr inbounds [[argmem_ty]], [[argmem_ty]]* %[[argmem]], i32 0, i32 1
|
2018-10-15 23:43:00 +08:00
|
|
|
// X86: invoke x86_thiscallcc %struct.A* @"??0A@@QAE@H@Z"(%struct.A* %[[arg2]], i32 2)
|
2015-02-28 03:18:17 +08:00
|
|
|
// X86: %[[arg1:[^ ]*]] = getelementptr inbounds [[argmem_ty]], [[argmem_ty]]* %[[argmem]], i32 0, i32 0
|
2018-10-15 23:43:00 +08:00
|
|
|
// X86: invoke x86_thiscallcc %struct.A* @"??0A@@QAE@H@Z"(%struct.A* %[[arg1]], i32 1)
|
2018-03-17 04:36:49 +08:00
|
|
|
// X86: call void @"?foo@@YAXUA@@00@Z"([[argmem_ty]]* inalloca %[[argmem]])
|
2014-05-01 11:07:18 +08:00
|
|
|
// X86: call void @llvm.stackrestore
|
|
|
|
// X86: ret void
|
|
|
|
//
|
|
|
|
// lpad2:
|
2015-12-12 13:39:21 +08:00
|
|
|
// X86: cleanuppad within none []
|
2018-03-17 04:36:49 +08:00
|
|
|
// X86: call x86_thiscallcc void @"??1A@@QAE@XZ"(%struct.A* %[[arg2]])
|
2015-10-08 09:13:52 +08:00
|
|
|
// X86: cleanupret
|
2014-05-01 11:07:18 +08:00
|
|
|
//
|
|
|
|
// ehcleanup:
|
2018-03-17 04:36:49 +08:00
|
|
|
// X86: call x86_thiscallcc void @"??1A@@QAE@XZ"(%struct.A* %[[arg3]])
|
2014-05-01 11:07:18 +08:00
|
|
|
|
2018-03-17 04:36:49 +08:00
|
|
|
// X64-LABEL: define dso_local void @"?call_foo@@YAXXZ"()
|
2018-10-15 23:43:00 +08:00
|
|
|
// X64: call %struct.A* @"??0A@@QEAA@H@Z"(%struct.A* %[[arg3:[^,]*]], i32 3)
|
|
|
|
// X64: invoke %struct.A* @"??0A@@QEAA@H@Z"(%struct.A* %[[arg2:[^,]*]], i32 2)
|
|
|
|
// X64: invoke %struct.A* @"??0A@@QEAA@H@Z"(%struct.A* %[[arg1:[^,]*]], i32 1)
|
2018-03-17 04:36:49 +08:00
|
|
|
// X64: call void @"?foo@@YAXUA@@00@Z"
|
2014-05-01 11:07:18 +08:00
|
|
|
// X64: (%struct.A* %[[arg1]], %struct.A* %[[arg2]], %struct.A* %[[arg3]])
|
|
|
|
// X64: ret void
|
2013-12-05 03:23:12 +08:00
|
|
|
//
|
|
|
|
// lpad2:
|
2015-12-12 13:39:21 +08:00
|
|
|
// X64: cleanuppad within none []
|
2018-03-17 04:36:49 +08:00
|
|
|
// X64: call void @"??1A@@QEAA@XZ"(%struct.A* %[[arg2]])
|
2015-10-08 09:13:52 +08:00
|
|
|
// X64: cleanupret
|
2013-12-05 03:23:12 +08:00
|
|
|
//
|
|
|
|
// ehcleanup:
|
2018-03-17 04:36:49 +08:00
|
|
|
// X64: call void @"??1A@@QEAA@XZ"(%struct.A* %[[arg3]])
|