diff options
| author | Fariborz Jahanian <fjahanian@apple.com> | 2014-06-18 22:50:40 +0000 |
|---|---|---|
| committer | Fariborz Jahanian <fjahanian@apple.com> | 2014-06-18 22:50:40 +0000 |
| commit | 62aeb8b653eadc8c9f4dda2d437bff18b43b6f29 (patch) | |
| tree | b067feb45fe38b89487a007ad816dadafdce3305 /clang/test/SemaObjC | |
| parent | 3d19f1388f185a6e0f8775428a5cc5a15af0c695 (diff) | |
| download | bcm5719-llvm-62aeb8b653eadc8c9f4dda2d437bff18b43b6f29.tar.gz bcm5719-llvm-62aeb8b653eadc8c9f4dda2d437bff18b43b6f29.zip | |
Objective-C ARC. Allow conversion of (void*) pointers to
retainable ObjC pointers without requiring a bridge-cast
by recognizing this as a +0 context. // rdar://16627903
llvm-svn: 211234
Diffstat (limited to 'clang/test/SemaObjC')
| -rw-r--r-- | clang/test/SemaObjC/arc-type-conversion.m | 4 | ||||
| -rw-r--r-- | clang/test/SemaObjC/arc.m | 18 |
2 files changed, 18 insertions, 4 deletions
diff --git a/clang/test/SemaObjC/arc-type-conversion.m b/clang/test/SemaObjC/arc-type-conversion.m index 5cf2cf4b745..ce21a7f18b6 100644 --- a/clang/test/SemaObjC/arc-type-conversion.m +++ b/clang/test/SemaObjC/arc-type-conversion.m @@ -16,10 +16,8 @@ void * cvt(id arg) (void)(void*)voidp_val; (void)(void**)arg; // expected-error {{cast of an Objective-C pointer to 'void **' is disallowed with ARC}} cvt((void*)arg); // expected-error {{cast of Objective-C pointer type 'id' to C pointer type 'void *' requires a bridged cast}} \ - // expected-error {{implicit conversion of C pointer type 'void *' to Objective-C pointer type 'id' requires a bridged cast}} \ - // expected-note 2 {{use __bridge to convert directly (no change in ownership)}} \ + // expected-note 1 {{use __bridge to convert directly (no change in ownership)}} \ // expected-note {{use CFBridgingRetain call to make an ARC object available as a +1 'void *'}} \ - // expected-note {{use CFBridgingRelease call to transfer ownership of a +1 'void *' into ARC}} cvt(0); (void)(__strong id**)(0); return arg; // expected-error {{implicit conversion of Objective-C pointer type 'id' to C pointer type 'void *' requires a bridged cast}} \ diff --git a/clang/test/SemaObjC/arc.m b/clang/test/SemaObjC/arc.m index 060af24fa0d..31b47105d52 100644 --- a/clang/test/SemaObjC/arc.m +++ b/clang/test/SemaObjC/arc.m @@ -285,7 +285,7 @@ void test11(id op, void *vp) { b = (nil == vp); b = (vp == op); // expected-error {{implicit conversion of Objective-C pointer type 'id' to C pointer type 'void *' requires a bridged cast}} expected-note {{use __bridge}} expected-note {{use CFBridgingRetain call}} - b = (op == vp); // expected-error {{implicit conversion of C pointer type 'void *' to Objective-C pointer type 'id' requires a bridged cast}} expected-note {{use __bridge}} expected-note {{use CFBridgingRelease call}} + b = (op == vp); } void test12(id collection) { @@ -782,3 +782,19 @@ void foo(NSArray *array) { } } } + +// rdar://16627903 +extern void abort(); +#define TKAssertEqual(a, b) do{\ + __typeof(a) a_res = (a);\ + __typeof(b) b_res = (b);\ + if ((a_res) != (b_res)) {\ + abort();\ + }\ +}while(0) + +int main() { + id object; + TKAssertEqual(object, nil); + TKAssertEqual(object, (id)nil); +} |

