1#include <functional>
2
3int foo(int x, int y) { return x + y - 1; }
4
5struct Bar {
6 int operator()() { return 66; }
7 int add_num(int i) const { return i + 3; }
8 int add_num2(int i) {
9 std::function<int(int)> add_num2_f = [](int x) { return x + 1; };
10
11 return add_num2_f(i); // Set break point at this line.
12 }
13};
14
15int foo2() {
16 auto f = [](int x) { return x + 1; };
17
18 std::function<int(int)> foo2_f = f;
19
20 return foo2_f(10); // Set break point at this line.
21}
22
23int main(int argc, char *argv[]) {
24 int acc = 42;
25 std::function<int(int, int)> f1 = foo;
26 std::function<int(int)> f2 = [acc, f1](int x) -> int {
27 return x + f1(acc, x);
28 };
29
30 auto f = [](int x, int y) { return x + y; };
31 auto g = [](int x, int y) { return x * y; };
32 std::function<int(int, int)> f3 = argc % 2 ? f : g;
33
34 Bar bar1;
35 std::function<int()> f4(bar1);
36 std::function<int(const Bar &, int)> f5 = &Bar::add_num;
37
38 int foo2_result = foo2();
39 int bar_add_num2_result = bar1.add_num2(i: 10);
40
41 return f1(acc, acc) + f2(acc) + f3(acc + 1, acc + 2) + f4() +
42 f5(bar1, 10); // Set break point at this line.
43}
44

source code of lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/function/main.cpp