[clang-cl] Ignore /Wv and /Wv:17 flags
[llvm-project.git] / clang / test / CodeGenCXX / thiscall-struct-return.cpp
blob4d33418bb1d7b319fbf566936c2643c3953c17a4
1 // For MSVC ABI compatibility, all structures returned by value using the
2 // thiscall calling convention must use the hidden parameter.
3 //
4 // RUN: %clang_cc1 -triple i386-PC-Win32 %s -fms-compatibility -emit-llvm -o - | FileCheck %s
6 // This structure would normally be returned via EAX
7 struct S {
8 int i;
9 };
11 // This structure would normally be returned via EAX/EDX
12 struct M {
13 int i;
14 int j;
17 class C {
18 public:
19 C() {}
21 struct S __attribute__((thiscall)) Small() const {
22 struct S s = { 0 };
23 return s;
26 struct M __attribute__((thiscall)) Medium() const {
27 struct M m = { 0 };
28 return m;
32 // CHECK-LABEL: define{{.*}} void @_Z4testv()
33 void test( void ) {
34 // CHECK: call void @_ZN1CC1Ev(%class.C* {{[^,]*}} [[C:%.+]])
35 C c;
37 // CHECK: call x86_thiscallcc void @_ZNK1C5SmallEv(%struct.S* sret(%struct.S) align 4 %{{.+}}, %class.C* {{[^,]*}} [[C]])
38 (void)c.Small();
39 // CHECK: call x86_thiscallcc void @_ZNK1C6MediumEv(%struct.M* sret(%struct.M) align 4 %{{.+}}, %class.C* {{[^,]*}} [[C]])
40 (void)c.Medium();