File: x64-microsoft-arguments.cpp

package info (click to toggle)
llvm-toolchain-19 1%3A19.1.7-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,998,520 kB
  • sloc: cpp: 6,951,680; ansic: 1,486,157; asm: 913,598; python: 232,024; f90: 80,126; objc: 75,281; lisp: 37,276; pascal: 16,990; sh: 10,009; ml: 5,058; perl: 4,724; awk: 3,523; makefile: 3,167; javascript: 2,504; xml: 892; fortran: 664; cs: 573
file content (92 lines) | stat: -rw-r--r-- 2,942 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
// RUN: %clang_cc1 -triple x86_64-windows-msvc -ffreestanding -emit-llvm -O0 \
// RUN: -x c++ -o - %s | FileCheck %s

int global_i = 0;

// Pass and return object with a reference type (pass directly, return indirectly).
// CHECK: define dso_local void @"?f1@@YA?AUS1@@XZ"(ptr dead_on_unwind noalias writable sret(%struct.S1) align 8 {{.*}})
// CHECK: call void @"?func1@@YA?AUS1@@U1@@Z"(ptr dead_on_unwind writable sret(%struct.S1) align 8 {{.*}}, i64 {{.*}})
struct S1 {
  int& r;
};

S1 func1(S1 x);
S1 f1() {
  S1 x{ global_i };
  return func1(x);
}

// Pass and return object with a reference type within an inner struct (pass directly, return indirectly).
// CHECK: define dso_local void @"?f2@@YA?AUS2@@XZ"(ptr dead_on_unwind noalias writable sret(%struct.S2) align 8 {{.*}})
// CHECK: call void @"?func2@@YA?AUS2@@U1@@Z"(ptr dead_on_unwind writable sret(%struct.S2) align 8 {{.*}}, i64 {{.*}})
struct Inner {
  int& r;
};

struct S2 {
  Inner i;
};

S2 func2(S2 x);
S2 f2() {
  S2 x{ { global_i } };
  return func2(x);
}

// Pass and return object with a reference type (pass directly, return indirectly).
// CHECK: define dso_local void @"?f3@@YA?AUS3@@XZ"(ptr dead_on_unwind noalias writable sret(%struct.S3) align 8 {{.*}})
// CHECK: call void @"?func3@@YA?AUS3@@U1@@Z"(ptr dead_on_unwind writable sret(%struct.S3) align 8 {{.*}}, i64 {{.*}})
struct S3 {
  const int& r;
};

S3 func3(S3 x);
S3 f3() {
  S3 x{ global_i };
  return func3(x);
}

// Pass and return object with a reference type within an inner struct (pass directly, return indirectly).
// CHECK: define dso_local void @"?f4@@YA?AUS4@@XZ"(ptr dead_on_unwind noalias writable sret(%struct.S4) align 8 {{.*}})
// CHECK: call void @"?func4@@YA?AUS4@@U1@@Z"(ptr dead_on_unwind writable sret(%struct.S4) align 8 {{.*}}, i64 {{.*}})
struct InnerConst {
  const int& r;
};

struct S4 {
  InnerConst i;
};

S4 func4(S4 x);
S4 f4() {
  S4 x{ { global_i } };
  return func4(x);
}

// Pass and return an object with an explicitly deleted copy assignment operator (pass directly, return indirectly).
// CHECK: define dso_local void @"?f5@@YA?AUS5@@XZ"(ptr dead_on_unwind noalias writable sret(%struct.S5) align 4 {{.*}})
// CHECK: call void @"?func5@@YA?AUS5@@U1@@Z"(ptr dead_on_unwind writable sret(%struct.S5) align 4 {{.*}}, i32 {{.*}})
struct S5 {
  S5& operator=(const S5&) = delete;
  int i;
};

S5 func5(S5 x);
S5 f5() {
  S5 x{ 1 };
  return func5(x);
}

// Pass and return an object with an explicitly defaulted copy assignment operator that is implicitly deleted (pass directly, return indirectly).
// CHECK: define dso_local void @"?f6@@YA?AUS6@@XZ"(ptr dead_on_unwind noalias writable sret(%struct.S6) align 8 {{.*}})
// CHECK: call void @"?func6@@YA?AUS6@@U1@@Z"(ptr dead_on_unwind writable sret(%struct.S6) align 8 {{.*}}, i64 {{.*}})
struct S6 {
  S6& operator=(const S6&) = default;
  int& i;
};

S6 func6(S6 x);
S6 f6() {
  S6 x{ global_i };
  return func6(x);
}