1#include <libcxx-simulators-common/compressed_pair.h>
2
3#include <stdio.h>
4
5namespace std {
6namespace __lldb {
7template <class _Tp> struct default_delete {
8 default_delete() noexcept = default;
9
10 void operator()(_Tp *__ptr) const noexcept { delete __ptr; }
11};
12
13template <class _Tp, class _Dp = default_delete<_Tp>> class unique_ptr {
14public:
15 typedef _Tp element_type;
16 typedef _Dp deleter_type;
17 typedef _Tp *pointer;
18
19#if COMPRESSED_PAIR_REV == 0
20 std::__lldb::__compressed_pair<pointer, deleter_type> __ptr_;
21 explicit unique_ptr(pointer __p) noexcept
22 : __ptr_(__p, std::__lldb::__value_init_tag()) {}
23#elif COMPRESSED_PAIR_REV == 1 || COMPRESSED_PAIR_REV == 2
24 _LLDB_COMPRESSED_PAIR(pointer, __ptr_, deleter_type, __deleter_);
25 explicit unique_ptr(pointer __p) noexcept : __ptr_(__p), __deleter_() {}
26#endif
27};
28} // namespace __lldb
29} // namespace std
30
31struct StatefulDeleter {
32 StatefulDeleter() noexcept = default;
33
34 void operator()(int *__ptr) const noexcept { delete __ptr; }
35
36 int m_state = 50;
37};
38
39int main() {
40 std::__lldb::unique_ptr<int> var_up(new int(5));
41 std::__lldb::unique_ptr<int, StatefulDeleter> var_with_deleter_up(new int(5));
42 __builtin_printf("Break here\n");
43 return 0;
44}
45

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