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