r220727 - Objective-C ARC [qoi]. Issue diagnostic if __bridge casting

jahanian fjahanian at apple.com
Mon Oct 27 16:32:07 PDT 2014


> On Oct 27, 2014, at 4:22 PM, Jordan Rose <jordan_rose at apple.com> wrote:
> 
> 
>> On Oct 27, 2014, at 15:33, Fariborz Jahanian <fjahanian at apple.com> wrote:
>> 
>> Author: fjahanian
>> Date: Mon Oct 27 17:33:06 2014
>> New Revision: 220727
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=220727&view=rev
>> Log:
>> Objective-C ARC [qoi]. Issue diagnostic if __bridge casting
>> to C type a collection literal. rdar://18768214
>> 
>> Added:
>>   cfe/trunk/test/SemaObjC/arc-cfbridge-warning.m
>> Modified:
>>   cfe/trunk/include/clang/Basic/DiagnosticGroups.td
>>   cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
>>   cfe/trunk/lib/Sema/SemaExprObjC.cpp
>> 
>> Modified: cfe/trunk/include/clang/Basic/DiagnosticGroups.td
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticGroups.td?rev=220727&r1=220726&r2=220727&view=diff
>> ==============================================================================
>> --- cfe/trunk/include/clang/Basic/DiagnosticGroups.td (original)
>> +++ cfe/trunk/include/clang/Basic/DiagnosticGroups.td Mon Oct 27 17:33:06 2014
>> @@ -422,6 +422,7 @@ def : DiagGroup<"arc-abi">;
>> def ARCUnsafeRetainedAssign : DiagGroup<"arc-unsafe-retained-assign">;
>> def ARCRetainCycles : DiagGroup<"arc-retain-cycles">;
>> def ARCNonPodMemAccess : DiagGroup<"arc-non-pod-memaccess">;
>> +def ARCBridgeCastRelease : DiagGroup<"arc-bridge-cast-release">;
>> def AutomaticReferenceCounting : DiagGroup<"arc",
>>                                           [ARCUnsafeRetainedAssign,
>>                                            ARCRetainCycles,
>> 
>> Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=220727&r1=220726&r2=220727&view=diff
>> ==============================================================================
>> --- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
>> +++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Mon Oct 27 17:33:06 2014
>> @@ -4459,6 +4459,11 @@ def note_arc_retain_cycle_owner : Note<
>> def warn_arc_object_memaccess : Warning<
>>  "%select{destination for|source of}0 this %1 call is a pointer to "
>>  "ownership-qualified type %2">, InGroup<ARCNonPodMemAccess>;
>> +  
>> +def warn_arc_consumed_object_released : Warning<
>> +  "__bridge cast of collection literal of type %1 to \"bridgeable\" C "
>> +  "type %0 causes early release of the collection">,
>> +  InGroup<ARCBridgeCastRelease>;
> 
> Just my opinion, but I would drop the quotes from "bridgeable", and drop "C" entirely. Then you get "__bridge cast of collection literal of type 'NSArray *' to bridgeable type 'CFArrayRef' …".

OK.
> 
> What does maybeUndoReclaimObject do? Does that mean we previously treated this as a bridge at +1?

That is not I’m my patch. It shows up in the diff because of rearrangement. And there is comment on top of maybeUndoReclaimObject routine.
(You can ask John M. about it).

- Fariborz






More information about the cfe-commits mailing list