[clang-cl] Ignore /Wv and /Wv:17 flags
[llvm-project.git] / clang / test / CodeGenCXX / microsoft-abi-cdecl-method-sret.cpp
blobad83c8967a8e51f67edeccd063b2b9be28baa788
1 // RUN: %clang_cc1 -triple i386-pc-win32 -emit-llvm %s -o - | FileCheck %s
3 // PR15768
5 // A trivial 20 byte struct is returned indirectly and taken as byval.
6 struct S {
7 S();
8 int a, b, c, d, e;
9 };
11 struct C {
12 S variadic_sret(const char *f, ...);
13 S __cdecl cdecl_sret();
14 S __cdecl byval_and_sret(S a);
15 int c;
18 S C::variadic_sret(const char *f, ...) { return S(); }
19 S C::cdecl_sret() { return S(); }
20 S C::byval_and_sret(S a) { return S(); }
22 // CHECK: define dso_local void @"?variadic_sret@C@@QAA?AUS@@PBDZZ"(%struct.C* {{[^,]*}} %this, %struct.S* noalias sret(%struct.S) align 4 %agg.result, i8* noundef %f, ...)
23 // CHECK: define dso_local void @"?cdecl_sret@C@@QAA?AUS@@XZ"(%struct.C* {{[^,]*}} %this, %struct.S* noalias sret(%struct.S) align 4 %agg.result)
24 // CHECK: define dso_local void @"?byval_and_sret@C@@QAA?AUS@@U2@@Z"(%struct.C* {{[^,]*}} %this, %struct.S* noalias sret(%struct.S) align 4 %agg.result, %struct.S* noundef byval(%struct.S) align 4 %a)
26 int main() {
27 C c;
28 c.variadic_sret("asdf");
29 c.cdecl_sret();
30 c.byval_and_sret(S());
32 // CHECK-LABEL: define dso_local noundef i32 @main()
33 // CHECK: call void {{.*}} @"?variadic_sret@C@@QAA?AUS@@PBDZZ"
34 // CHECK: call void @"?cdecl_sret@C@@QAA?AUS@@XZ"
35 // CHECK: call void @"?byval_and_sret@C@@QAA?AUS@@U2@@Z"
37 // __fastcall has similar issues.
38 struct A {
39 S __fastcall f(int x);
41 S A::f(int x) {
42 return S();
44 // CHECK-LABEL: define dso_local x86_fastcallcc void @"?f@A@@QAI?AUS@@H@Z"(%struct.A* inreg noundef nonnull align 1 dereferenceable(1) %this, %struct.S* inreg noalias sret(%struct.S) align 4 %agg.result, i32 noundef %x)