1#include <stdio.h>
2
3#if defined(__arm__) || defined(__aarch64__) || defined (__mips__) || defined(__powerpc64__)
4// Clang does not accept regparm attribute on these platforms.
5// Fortunately, the default calling convention passes arguments in registers
6// anyway.
7#define REGPARM(N)
8#else
9#define REGPARM(N) __attribute__((regparm(N)))
10#endif
11
12struct bar {
13 int m1;
14 int m2;
15};
16
17void f1(int a, struct bar *b) __attribute__((noinline)) REGPARM(2);
18void f1(int a, struct bar *b)
19{
20 b->m2 = b->m1 + a; // set breakpoint here
21}
22
23void f2(struct bar *b) __attribute__((noinline)) REGPARM(1);
24void f2(struct bar *b)
25{
26 int c = b->m2;
27 printf(format: "%d\n", c); // set breakpoint here
28}
29
30float f3() __attribute__((noinline));
31float f3() {
32 return 3.14f;
33}
34
35int main()
36{
37 struct bar myBar = { .m1: 3, .m2: 4 };
38 f1(a: 2, b: &myBar);
39 f2(b: &myBar);
40
41 float f = f3();
42 printf(format: "%f\n", f); // set breakpoint here
43 return 0;
44}
45

source code of lldb/test/API/lang/c/register_variables/test.c