1#include <atomic>
2
3// Define a Parent and Child struct that can point to each other.
4class Parent;
5struct Child {
6 // This should point to the parent which in turn owns this
7 // child instance. This cycle should not cause LLDB to infinite loop
8 // during printing.
9 std::atomic<Parent*> parent{nullptr};
10};
11struct Parent {
12 Child child;
13};
14
15struct S {
16 int x = 1;
17 int y = 2;
18};
19
20int main ()
21{
22 std::atomic<S> s;
23 s.store(i: S());
24 std::atomic<int> i;
25 i.store(i: 5);
26
27 Parent p;
28 // Let the child node know what its parent is.
29 p.child.parent = &p;
30
31 return 0; // Set break point at this line.
32}
33
34

source code of lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/atomic/main.cpp