r210660 - Objective-C. Patch to handle bridge attribute warnings

Argyrios Kyrtzidis kyrtzidis at apple.com
Wed Jun 11 10:58:00 PDT 2014


 
> On Jun 11, 2014, at 9:52 AM, Fariborz Jahanian <fjahanian at apple.com> wrote:
> 
> Added: cfe/trunk/test/SemaObjC/objc-mixed-bridge-attribute.m
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/objc-mixed-bridge-attribute.m?rev=210660&view=auto
> ==============================================================================
> --- cfe/trunk/test/SemaObjC/objc-mixed-bridge-attribute.m (added)
> +++ cfe/trunk/test/SemaObjC/objc-mixed-bridge-attribute.m Wed Jun 11 11:52:44 2014
> @@ -0,0 +1,26 @@
> +// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
> +// expected-no-diagnostics
> +// rdar://17238954
> +
> +typedef const struct __attribute__((objc_bridge(NSAttributedString))) __CFAttributedString *CFAttributedStringRef;
> +
> +typedef struct __attribute__((objc_bridge_mutable(NSMutableAttributedString))) __CFAttributedString *CFMutableAttributedStringRef;
> +
> + at interface NSAttributedString
> + at end
> +
> + at interface NSMutableAttributedString
> + at end
> +
> +struct __CFAttributedString {
> +};
> +
> +void Test1(CFAttributedStringRef attrStr)
> +{
> +  id x = (NSAttributedString *) attrStr; // no warning
> +}
> +
> +void Test2(NSAttributedString *attrStr) {
> +  CFAttributedStringRef cfsr = (CFAttributedStringRef) attrStr;
> +}
> +
> 

Could you expand the test with all the different permutations ? Specifically test:

(NSAttributedString *) CFAttributedStringRef
(NSAttributedString *) CFMutableAttributedStringRef
(NSMutableAttributedString *) CFAttributedStringRef
(NSMutableAttributedString *) CFMutableAttributedStringRef

(CFAttributedStringRef) NSAttributedString *
(CFAttributedStringRef) NSMutableAttributedString *
(CFMutableAttributedStringRef) NSAttributedString *
(CFMutableAttributedStringRef) NSMutableAttributedString *

then also repeat the above with another set of types _without_ the presence of the internal struct definition (without the equivalent "struct __CFAttributedString {};”)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140611/a4c2ec0b/attachment.html>


More information about the cfe-commits mailing list