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 std::atomic<S> s;
22 s.store(i: S());
23 std::atomic<int> i;
24 i.store(i: 5);
25
26 Parent p;
27 // Let the child node know what its parent is.
28 p.child.parent = &p;
29
30 return 0; // Set break point at this line.
31}
32

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