John McCall | d1e40d5 | 2011-10-02 01:16:38 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -triple x86_64-apple-darwin11 -emit-llvm -fobjc-arc -o - %s | FileCheck %s |
Fariborz Jahanian | af97517 | 2011-06-21 17:38:29 +0000 | [diff] [blame] | 2 | // rdar://9744349 |
| 3 | |
| 4 | typedef const struct __CFString * CFStringRef; |
| 5 | |
| 6 | @interface I |
| 7 | @property CFStringRef P; |
| 8 | - (CFStringRef) CFMeth __attribute__((cf_returns_retained)); |
| 9 | - (CFStringRef) newSomething; |
| 10 | - (CFStringRef) P __attribute__((cf_returns_retained)); |
| 11 | @end |
| 12 | |
| 13 | @implementation I |
| 14 | @synthesize P; |
| 15 | - (id) Meth { |
| 16 | I* p1 = (id)[p1 P]; |
| 17 | id p2 = (id)[p1 CFMeth]; |
| 18 | id p3 = (id)[p1 newSomething]; |
| 19 | return (id) p1.P; |
| 20 | } |
| 21 | - (CFStringRef) CFMeth { return 0; } |
| 22 | - (CFStringRef) newSomething { return 0; } |
| 23 | - (CFStringRef) P { return 0; } |
| 24 | - (void) setP : (CFStringRef)arg {} |
| 25 | @end |
| 26 | |
Fariborz Jahanian | c8505ad | 2011-06-21 19:42:38 +0000 | [diff] [blame] | 27 | // rdar://9544832 |
| 28 | CFStringRef SomeOtherFunc() __attribute__((cf_returns_retained)); |
| 29 | id MMM() |
| 30 | { |
| 31 | id obj = (id)((CFStringRef) __builtin___CFStringMakeConstantString ("" "Some CF String" "")); |
Fariborz Jahanian | c8505ad | 2011-06-21 19:42:38 +0000 | [diff] [blame] | 32 | return 0; |
| 33 | } |
| 34 | |
Fariborz Jahanian | af97517 | 2011-06-21 17:38:29 +0000 | [diff] [blame] | 35 | // CHECK-NOT: call i8* @objc_retainAutoreleasedReturnValue |