1*1b191cb5SApple OSS Distributions // 2*1b191cb5SApple OSS Distributions // Declare a function as returning a raw pointer (in the header), but 3*1b191cb5SApple OSS Distributions // implement it by returning a shared pointer. This represents a TU that 4*1b191cb5SApple OSS Distributions // would have been translated to shared pointers. 5*1b191cb5SApple OSS Distributions // 6*1b191cb5SApple OSS Distributions // In this TU, SharedPtr<T> is intrusive_shared_ptr<T>, since USE_SHARED_PTR 7*1b191cb5SApple OSS Distributions // is defined. 8*1b191cb5SApple OSS Distributions // 9*1b191cb5SApple OSS Distributions 10*1b191cb5SApple OSS Distributions #define USE_SHARED_PTR 11*1b191cb5SApple OSS Distributions 12*1b191cb5SApple OSS Distributions #include "abi_helper.h" 13*1b191cb5SApple OSS Distributions 14*1b191cb5SApple OSS Distributions SharedPtr<T> return_shared_as_raw(T * ptr)15*1b191cb5SApple OSS Distributionsreturn_shared_as_raw(T* ptr) 16*1b191cb5SApple OSS Distributions { 17*1b191cb5SApple OSS Distributions return SharedPtr<T>(ptr, libkern::no_retain); 18*1b191cb5SApple OSS Distributions } 19