brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.8 KiB · ece776b Raw
39 lines · plain
1// RUN: %clang_cc1 -triple x86_64-apple-darwin11 -fsyntax-only -fobjc-arc -verify %s2// RUN: not %clang_cc1 -triple x86_64-apple-darwin11 -fsyntax-only -fobjc-arc -fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s3 4typedef const struct __CFString * CFStringRef;5typedef struct __CFString * CFMutableStringRef;6typedef signed long CFIndex;7typedef const struct __CFAllocator * CFAllocatorRef;8 9extern const CFStringRef kCFBundleNameKey;10 11@protocol NSCopying @end12 13@interface NSDictionary14- (id)objectForKeyedSubscript:(id<NSCopying>)key;15@end16 17#pragma clang arc_cf_code_audited begin18extern19CFMutableStringRef CFStringCreateMutable(CFAllocatorRef alloc, CFIndex maxLength);20#pragma clang arc_cf_code_audited end21 22typedef const void * CFTypeRef;23 24id CFBridgingRelease(CFTypeRef __attribute__((cf_consumed)) X);25 26@interface NSMutableString @end27 28NSMutableString *test(void) {29  NSDictionary *infoDictionary;30  infoDictionary[kCFBundleNameKey] = 0; // expected-error {{indexing expression is invalid because subscript type 'CFStringRef' (aka 'const struct __CFString *') is not an integral or Objective-C pointer type}}31  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}} \32                                       // expected-error {{implicit conversion of C pointer type 'CFMutableStringRef' (aka 'struct __CFString *') to Objective-C pointer type '__strong id<NSCopying>' requires a bridged cast}} \33                                        // expected-note {{use CFBridgingRelease call to transfer ownership of a +1 'CFMutableStringRef' (aka 'struct __CFString *') into ARC}}34					35}36 37// CHECK: fix-it:"{{.*}}":{31:25-31:25}:"CFBridgingRelease("38// CHECK: fix-it:"{{.*}}":{31:63-31:63}:")"39