[cfe-dev] objc++ enhancements for new c++ features

David Chisnall via cfe-dev cfe-dev at lists.llvm.org
Wed Mar 21 11:43:55 PDT 2018


On 21 Mar 2018, at 18:38, James Gregurich <bayoubengalml at mac.com> wrote:
> 
>> I agree it would be great to get ARC-managed pointers working well in std::shared_ptr and std::weak_ptr.  The usual subtlety with templates is that __strong doesn't show up in C++ mangling, so it's not straightforward to avoid ODR violations when ARC and MRR translation units are linked together.  I think this is solvable, but I doubt it's trivial.
> 
> 
> I've come to the conclusion that mixing ARC and non-ARC c++ modules is not viable because of the ODR limitation. Its probably not worth the effort to make it viable. However, all-arc and all-non-arc are both perfectly viable. the use case is the situation where you have a big legacy codebase that will never be made ARC-compatible in its entirety but pieces of it need to work in an ARC process.

I believe that you are conflating ARC-language and ARC-library features.  You should be able to use an __unsafe_unretained pointer and directly call the underlying runtime library ARC functions.  This is what I have done in smart pointers in the past to use ARC with non-ARC-aware ObjC++ compilers.

David




More information about the cfe-dev mailing list