[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / CodeGenCXX / windows-x86-swiftcall.cpp
blob9927d0b24799ef0f6fc7fd8fd6c7c2c56eeb88ab
1 // RUN: %clang_cc1 -triple x86_64-unknown-windows -emit-llvm -target-cpu core2 -o - %s | FileCheck %s
3 #define SWIFTCALL __attribute__((swiftcall))
4 #define OUT __attribute__((swift_indirect_result))
5 #define ERROR __attribute__((swift_error_result))
6 #define CONTEXT __attribute__((swift_context))
8 /*****************************************************************************/
9 /****************************** PARAMETER ABIS *******************************/
10 /*****************************************************************************/
12 // Swift doesn't use inalloca like windows x86 normally does.
13 struct NonTrivial {
14 NonTrivial();
15 NonTrivial(const NonTrivial &);
16 int o;
19 SWIFTCALL int receiveNonTrivial(NonTrivial o) { return o.o; }
21 // CHECK-LABEL: define dso_local swiftcc noundef i32 @"?receiveNonTrivial@@YSHUNonTrivial@@@Z"(ptr noundef %o)
23 int passNonTrivial() {
24 return receiveNonTrivial({});
27 // CHECK-LABEL: define dso_local noundef i32 @"?passNonTrivial@@YAHXZ"()
28 // CHECK-NOT: stacksave
29 // CHECK: call swiftcc noundef i32 @"?receiveNonTrivial@@YSHUNonTrivial@@@Z"(ptr noundef %{{.*}})