xref: /minix3/external/bsd/llvm/dist/clang/test/SemaObjC/objc-cf-audited-warning.m (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc// RUN: %clang_cc1  -fobjc-arc -verify %s
2*0a6a1f1dSLionel Sambuc// rdar://18222007
3*0a6a1f1dSLionel Sambuc
4*0a6a1f1dSLionel Sambuc#if __has_feature(arc_cf_code_audited)
5*0a6a1f1dSLionel Sambuc#define CF_IMPLICIT_BRIDGING_ENABLED _Pragma("clang arc_cf_code_audited begin")
6*0a6a1f1dSLionel Sambuc#define CF_IMPLICIT_BRIDGING_DISABLED _Pragma("clang arc_cf_code_audited end")
7*0a6a1f1dSLionel Sambuc#endif
8*0a6a1f1dSLionel Sambuc#define CF_BRIDGED_TYPE(T)              __attribute__((objc_bridge(T)))
9*0a6a1f1dSLionel Sambuc
10*0a6a1f1dSLionel Sambuctypedef const struct CF_BRIDGED_TYPE(NSURL) __CFURL * CFURLRef;
11*0a6a1f1dSLionel Sambuctypedef signed long long CFIndex;
12*0a6a1f1dSLionel Sambuctypedef unsigned char           Boolean;
13*0a6a1f1dSLionel Sambuctypedef unsigned char                   UInt8;
14*0a6a1f1dSLionel Sambuctypedef const struct __CFAllocator * CFAllocatorRef;
15*0a6a1f1dSLionel Sambucconst CFAllocatorRef kCFAllocatorDefault;
16*0a6a1f1dSLionel Sambuc
17*0a6a1f1dSLionel SambucCF_IMPLICIT_BRIDGING_ENABLED
18*0a6a1f1dSLionel SambucCFURLRef CFURLCreateFromFileSystemRepresentation(CFAllocatorRef allocator, const UInt8 *buffer, CFIndex bufLen, Boolean isDirectory); // expected-note {{passing argument to parameter 'buffer' here}}
19*0a6a1f1dSLionel SambucCF_IMPLICIT_BRIDGING_DISABLED
20*0a6a1f1dSLionel Sambuc
21*0a6a1f1dSLionel Sambucvoid saveImageToJPG(const char *filename)
22*0a6a1f1dSLionel Sambuc{
23*0a6a1f1dSLionel Sambuc    CFURLRef url = CFURLCreateFromFileSystemRepresentation(kCFAllocatorDefault, filename, 10, 0); // expected-warning {{passing 'const char *' to parameter of type 'const UInt8 *' (aka 'const unsigned char *') converts between pointers to integer types with different sign}}
24*0a6a1f1dSLionel Sambuc}
25