On Oct 1, 2014, at 5:09 PM, Argyrios Kyrtzidis <[email protected]> wrote:
>> On Oct 1, 2014, at 4:52 PM, John McCall <[email protected]> wrote:
>> 
>> On Oct 1, 2014, at 4:34 PM, Argyrios Kyrtzidis <[email protected]> wrote:
>>> + John
>>> 
>>> John, could you advice here ?
>>> 
>>>> On Oct 1, 2014, at 4:20 PM, Marshall Clow <[email protected]> wrote:
>>>> 
>>>> On Oct 1, 2014, at 3:36 PM, Marshall Clow <[email protected]> wrote:
>>>>> 
>>>>> Richard Smith pointed out that destroying a pointer to an objective-C 
>>>>> class might require an ARC call, and so the compiler needs to see the 
>>>>> type to figure out if it is_destructible.
>>>>> 
>>>>> Note that is_destructible<ObjCForwardClass**>::value is true, so it’s 
>>>>> just pointers to objective-C objects, not pointers in general.
>>>> 
>>>> Richard also pointed me to: 
>>>> http://clang.llvm.org/docs/AutomaticReferenceCounting.html#retainable-object-pointers
>>>> 
>>>> So, while I agree with Argyrios that this changed the behavior of 
>>>> is_trivially_destructible for forward-declared objective-C classes,
>>>> I am now convinced that the old behavior was incorrect, and the new 
>>>> behavior is “better”.
>>>> 
>>>> One could argue that a forward-declared objective-C class is not a 
>>>> complete type, since the compiler doesn’t know how to destroy it, and if 
>>>> so, then is_destructible is not required to give any answer at all ("T 
>>>> shall be a complete type”).
>> 
>> Pointers to forward-declared Objective-C classes are still complete types.  
>> They should be both destructible and (outside of ARC) non-trivially 
>> destructible.
>> 
>> I assume the problem here is ObjC property syntax, which usually looks like 
>> “foo.prop” where foo has ObjC pointer type.  Type-checking a property access 
>> really does require the type to be complete.  However, pseudo-destructor 
>> calls are not property accesses, and should not require the pointee type to 
>> be complete.
>> 
>> Does that answer your question?
> 
> Are you suggesting that we make compiler changes to accept the 
> pseudo-destructor call for ObjC pointers

Yes.  We already accept the pseudo-destructor call if the interface type is 
complete, presumably without actually looking anything up in the interface.  We 
just unnecessarily bail out early if the interface is incomplete, despite it 
being a pseudo-destructor call.

> , and if yes, what would the codegen behavior be for ARC ?

That doesn’t need to change.

John.
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to