xref: /xnu-12377.41.6/tests/intrusive_shared_ptr_src/abi_helper.h (revision bbb1b6f9e71b8cdde6e5cd6f4841f207dee3d828)
1*bbb1b6f9SApple OSS Distributions #ifndef TESTS_INTRUSIVE_SHARED_PTR_ABI_HELPER_H
2*bbb1b6f9SApple OSS Distributions #define TESTS_INTRUSIVE_SHARED_PTR_ABI_HELPER_H
3*bbb1b6f9SApple OSS Distributions 
4*bbb1b6f9SApple OSS Distributions #include <libkern/c++/intrusive_shared_ptr.h>
5*bbb1b6f9SApple OSS Distributions #include <darwintest.h>
6*bbb1b6f9SApple OSS Distributions #include "test_policy.h"
7*bbb1b6f9SApple OSS Distributions 
8*bbb1b6f9SApple OSS Distributions struct T { int i; };
9*bbb1b6f9SApple OSS Distributions 
10*bbb1b6f9SApple OSS Distributions #if defined USE_SHARED_PTR
11*bbb1b6f9SApple OSS Distributions template <typename T>
12*bbb1b6f9SApple OSS Distributions using SharedPtr = libkern::intrusive_shared_ptr<T, test_policy>;
13*bbb1b6f9SApple OSS Distributions #else
14*bbb1b6f9SApple OSS Distributions template <typename T>
15*bbb1b6f9SApple OSS Distributions using SharedPtr = T *;
16*bbb1b6f9SApple OSS Distributions #endif
17*bbb1b6f9SApple OSS Distributions 
18*bbb1b6f9SApple OSS Distributions extern SharedPtr<T> return_shared_as_raw(T*);
19*bbb1b6f9SApple OSS Distributions extern SharedPtr<T> return_raw_as_shared(T*);
20*bbb1b6f9SApple OSS Distributions 
21*bbb1b6f9SApple OSS Distributions #endif // !TESTS_INTRUSIVE_SHARED_PTR_ABI_HELPER_H
22