How about the other case? Can we avoid offering fixits for transferring globals in and out of ARC? I wouldn't stop a developer from writing it deliberately, but it seems very unlikely to be the correct solution in a case where they just forgot the cast.
On Aug 2, 2012, at 11:38 , Fariborz Jahanian <[email protected]> wrote: > Author: fjahanian > Date: Thu Aug 2 13:38:41 2012 > New Revision: 161194 > > URL: http://llvm.org/viewvc/llvm-project?rev=161194&view=rev > Log: > objc-arc: Modify test for more prcecise fixit. > // rdar://11913153 > > Modified: > cfe/trunk/test/SemaObjC/arc-dict-bridged-cast.m > > Modified: cfe/trunk/test/SemaObjC/arc-dict-bridged-cast.m > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/arc-dict-bridged-cast.m?rev=161194&r1=161193&r2=161194&view=diff > ============================================================================== > --- cfe/trunk/test/SemaObjC/arc-dict-bridged-cast.m (original) > +++ cfe/trunk/test/SemaObjC/arc-dict-bridged-cast.m Thu Aug 2 13:38:41 2012 > @@ -15,8 +15,10 @@ > - (id)objectForKeyedSubscript:(id<NSCopying>)key; > @end > > +#pragma clang arc_cf_code_audited begin > extern > CFMutableStringRef CFStringCreateMutable(CFAllocatorRef alloc, CFIndex > maxLength); > +#pragma clang arc_cf_code_audited end > > typedef const void * CFTypeRef; > > @@ -32,16 +34,13 @@ > // expected-note {{use > CFBridgingRelease call to transfer ownership of a +1 'CFStringRef' (aka > 'const struct __CFString *') into ARC}} > return infoDictionary[CFStringCreateMutable(((void*)0), 100)]; // > expected-error {{indexing expression is invalid because subscript type > 'CFMutableStringRef' (aka 'struct __CFString *') is not an integral or > Objective-C pointer type}} \ > // expected-error {{implicit > conversion of C pointer type 'CFMutableStringRef' (aka 'struct __CFString *') > to Objective-C pointer type '__strong id<NSCopying>' requires a bridged > cast}} \ > - // expected-note {{use __bridge to > convert directly (no change in ownership)}} \ > // expected-note {{use > CFBridgingRelease call to transfer ownership of a +1 'CFMutableStringRef' > (aka 'struct __CFString *') into ARC}} > > } > > -// CHECK: fix-it:"{{.*}}":{29:18-29:18}:"(__bridge __strong id<NSCopying>)(" > -// CHECK: fix-it:"{{.*}}":{29:34-29:34}:")" > -// CHECK: fix-it:"{{.*}}":{29:18-29:18}:"CFBridgingRelease(" > -// CHECK: fix-it:"{{.*}}":{29:34-29:34}:")" > -// CHECK: fix-it:"{{.*}}":{33:25-33:25}:"(__bridge __strong id<NSCopying>)(" > -// CHECK: fix-it:"{{.*}}":{33:63-33:63}:")" > -// CHECK: fix-it:"{{.*}}":{33:25-33:25}:"CFBridgingRelease(" > -// CHECK: fix-it:"{{.*}}":{33:63-33:63}:")" > +// CHECK: fix-it:"{{.*}}":{31:18-31:18}:"(__bridge __strong id<NSCopying>)(" > +// CHECK: fix-it:"{{.*}}":{31:34-31:34}:")" > +// CHECK: fix-it:"{{.*}}":{31:18-31:18}:"CFBridgingRelease(" > +// CHECK: fix-it:"{{.*}}":{31:34-31:34}:")" > +// CHECK: fix-it:"{{.*}}":{35:25-35:25}:"CFBridgingRelease(" > +// CHECK: fix-it:"{{.*}}":{35:63-35:63}:")" > > > _______________________________________________ > cfe-commits mailing list > [email protected] > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
