From: Argyrios Kyrtzidis Date: Fri, 9 Dec 2011 00:17:47 +0000 (+0000) Subject: [arcmt] Un-XFAIL a test. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=48977874cb351f452102f8c15528eb1d8c7387e6;p=clang [arcmt] Un-XFAIL a test. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146210 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/test/ARCMT/checking.m b/test/ARCMT/checking.m index 86afdf0b23..7d1a8c7321 100644 --- a/test/ARCMT/checking.m +++ b/test/ARCMT/checking.m @@ -1,7 +1,33 @@ // RUN: %clang_cc1 -arcmt-check -verify -triple x86_64-apple-darwin10 %s -// XFAIL: * -#include "Common.h" +#if __has_feature(objc_arc) +#define NS_AUTOMATED_REFCOUNT_UNAVAILABLE __attribute__((unavailable("not available in automatic reference counting mode"))) +#else +#define NS_AUTOMATED_REFCOUNT_UNAVAILABLE +#endif + +typedef int BOOL; +typedef unsigned NSUInteger; + +@protocol NSObject +- (id)retain NS_AUTOMATED_REFCOUNT_UNAVAILABLE; // expected-note {{unavailable here}} +- (NSUInteger)retainCount NS_AUTOMATED_REFCOUNT_UNAVAILABLE; +- (oneway void)release NS_AUTOMATED_REFCOUNT_UNAVAILABLE; // expected-note 4 {{unavailable here}} +- (id)autorelease NS_AUTOMATED_REFCOUNT_UNAVAILABLE; +@end + +@interface NSObject {} +- (id)init; + ++ (id)new; ++ (id)alloc; +- (void)dealloc; + +- (void)finalize; + +- (id)copy; +- (id)mutableCopy; +@end typedef const struct __CFString * CFStringRef; extern const CFStringRef kUTTypePlainText; @@ -44,16 +70,20 @@ id global_foo; void test1(A *a, BOOL b, struct UnsafeS *unsafeS) { [[a delegate] release]; // expected-error {{it is not safe to remove 'retain' message on the result of a 'delegate' message; the object that was passed to 'setDelegate:' may not be properly retained}} \ - // expected-error {{ARC forbids explicit message send}} + // expected-error {{ARC forbids explicit message send}} \ + // expected-error {{unavailable}} [a.delegate release]; // expected-error {{it is not safe to remove 'retain' message on the result of a 'delegate' message; the object that was passed to 'setDelegate:' may not be properly retained}} \ - // expected-error {{ARC forbids explicit message send}} + // expected-error {{ARC forbids explicit message send}} \ + // expected-error {{unavailable}} [unsafeS->unsafeObj retain]; // expected-error {{it is not safe to remove 'retain' message on an __unsafe_unretained type}} \ // expected-error {{ARC forbids explicit message send}} id foo = [unsafeS->unsafeObj retain]; // no warning. [global_foo retain]; // expected-error {{it is not safe to remove 'retain' message on a global variable}} \ - // expected-error {{ARC forbids explicit message send}} + // expected-error {{ARC forbids explicit message send}} \ + // expected-error {{unavailable}} [global_foo release]; // expected-error {{it is not safe to remove 'release' message on a global variable}} \ - // expected-error {{ARC forbids explicit message send}} + // expected-error {{ARC forbids explicit message send}} \ + // expected-error {{unavailable}} [a dealloc]; [a retain]; [a retainCount]; // expected-error {{ARC forbids explicit message send of 'retainCount'}} @@ -267,7 +297,8 @@ void rdar9491791(int p) { // rdar://9504750 void rdar9504750(id p) { - RELEASE_MACRO(p); // expected-error {{ARC forbids explicit message send of 'release'}} + RELEASE_MACRO(p); // expected-error {{ARC forbids explicit message send of 'release'}} \ + // expected-error {{unavailable}} } // rdar://8939557