summaryrefslogtreecommitdiff
path: root/test/SemaObjC
diff options
context:
space:
mode:
Diffstat (limited to 'test/SemaObjC')
-rw-r--r--test/SemaObjC/ClassPropertyNotObject.m1
-rw-r--r--test/SemaObjC/ContClassPropertyLookup.m1
-rw-r--r--test/SemaObjC/arc-decls.m2
-rw-r--r--test/SemaObjC/arc-objc-lifetime.m31
-rw-r--r--test/SemaObjC/arc-property-decl-attrs.m6
-rw-r--r--test/SemaObjC/arc-property-lifetime.m22
-rw-r--r--test/SemaObjC/arc-property.m12
-rw-r--r--test/SemaObjC/arc-readonly-property-ivar-1.m1
-rw-r--r--test/SemaObjC/arc-readonly-property-ivar.m1
-rw-r--r--test/SemaObjC/arc-repeated-weak.mm386
-rw-r--r--test/SemaObjC/arc-setter-property-match.m1
-rw-r--r--test/SemaObjC/arc-system-header.m2
-rw-r--r--test/SemaObjC/arc-unavailable-for-weakref.m2
-rw-r--r--test/SemaObjC/arc-unsafe_unretained.m1
-rw-r--r--test/SemaObjC/attr-availability.m8
-rw-r--r--test/SemaObjC/attr-cleanup.m1
-rw-r--r--test/SemaObjC/attr-deprecated.m3
-rw-r--r--test/SemaObjC/block-as-object.m1
-rw-r--r--test/SemaObjC/block-ivar.m1
-rw-r--r--test/SemaObjC/block-return.m1
-rw-r--r--test/SemaObjC/builtin_objc_assign_ivar.m1
-rw-r--r--test/SemaObjC/builtin_objc_msgSend.m1
-rw-r--r--test/SemaObjC/category-method-lookup-2.m1
-rw-r--r--test/SemaObjC/category-method-lookup.m1
-rw-r--r--test/SemaObjC/class-getter-using-dotsyntax.m1
-rw-r--r--test/SemaObjC/class-property-access.m1
-rw-r--r--test/SemaObjC/class-protocol.m1
-rw-r--r--test/SemaObjC/comptypes-2.m1
-rw-r--r--test/SemaObjC/comptypes-8.m1
-rw-r--r--test/SemaObjC/conditional-expr-5.m1
-rw-r--r--test/SemaObjC/conditional-expr-6.m1
-rw-r--r--test/SemaObjC/conditional-expr-7.m1
-rw-r--r--test/SemaObjC/conditional-expr-8.m1
-rw-r--r--test/SemaObjC/conflict-nonfragile-abi2.m1
-rw-r--r--test/SemaObjC/continuation-class-err.m4
-rw-r--r--test/SemaObjC/crash-on-objc-bool-literal.m12
-rw-r--r--test/SemaObjC/default-synthesize-2.m4
-rw-r--r--test/SemaObjC/delay-parsing-cfunctions.m1
-rw-r--r--test/SemaObjC/direct-synthesized-ivar-access.m1
-rw-r--r--test/SemaObjC/enhanced-proto-2.m1
-rw-r--r--test/SemaObjC/enum-fixed-type.m1
-rw-r--r--test/SemaObjC/error-property-gc-attr.m8
-rw-r--r--test/SemaObjC/getter-setter-defined-in-category-of-parent.m1
-rw-r--r--test/SemaObjC/iboutletcollection-attr.m4
-rw-r--r--test/SemaObjC/id_builtin.m1
-rw-r--r--test/SemaObjC/idiomatic-parentheses.m11
-rw-r--r--test/SemaObjC/ignore-qualifier-on-qualified-id.m1
-rw-r--r--test/SemaObjC/ignore-weakimport-method.m1
-rw-r--r--test/SemaObjC/interface-layout-2.m1
-rw-r--r--test/SemaObjC/interface-layout.m1
-rw-r--r--test/SemaObjC/interface-scope-2.m1
-rw-r--r--test/SemaObjC/interface-scope.m1
-rw-r--r--test/SemaObjC/ivar-access-package.m1
-rw-r--r--test/SemaObjC/ivar-in-class-extension-error.m4
-rw-r--r--test/SemaObjC/ivar-in-class-extension.m2
-rw-r--r--test/SemaObjC/ivar-sem-check-2.m4
-rw-r--r--test/SemaObjC/method-attributes.m29
-rw-r--r--test/SemaObjC/method-conflict-1.m1
-rw-r--r--test/SemaObjC/method-in-class-extension-impl.m1
-rw-r--r--test/SemaObjC/method-lookup-2.m1
-rw-r--r--test/SemaObjC/method-lookup-4.m1
-rw-r--r--test/SemaObjC/method-typecheck-1.m15
-rw-r--r--test/SemaObjC/nested-typedef-decl.m1
-rw-r--r--test/SemaObjC/no-gc-weak-test.m1
-rw-r--r--test/SemaObjC/no-ivar-access-control.m1
-rw-r--r--test/SemaObjC/no-ivar-in-interface-block.m6
-rw-r--r--test/SemaObjC/no-warn-qual-mismatch.m1
-rw-r--r--test/SemaObjC/no-warn-synth-protocol-meth.m1
-rw-r--r--test/SemaObjC/no-warn-unimpl-method.m1
-rw-r--r--test/SemaObjC/no-warning-unavail-unimp.m1
-rw-r--r--test/SemaObjC/nonarc-weak.m16
-rw-r--r--test/SemaObjC/nonnull.m1
-rw-r--r--test/SemaObjC/nowarn-superclass-method-mismatch.m1
-rw-r--r--test/SemaObjC/nsobject-attribute-1.m1
-rw-r--r--test/SemaObjC/nsobject-attribute.m11
-rw-r--r--test/SemaObjC/objc-buffered-methods.m1
-rw-r--r--test/SemaObjC/objc-literal-comparison.m4
-rw-r--r--test/SemaObjC/objc-qualified-property-lookup.m1
-rw-r--r--test/SemaObjC/overriding-property-in-class-extension.m27
-rw-r--r--test/SemaObjC/pedantic-dynamic-test.m1
-rw-r--r--test/SemaObjC/pragma-pack.m1
-rw-r--r--test/SemaObjC/property-11.m1
-rw-r--r--test/SemaObjC/property-13.m1
-rw-r--r--test/SemaObjC/property-2.m1
-rw-r--r--test/SemaObjC/property-6.m1
-rw-r--r--test/SemaObjC/property-7.m1
-rw-r--r--test/SemaObjC/property-8.m1
-rw-r--r--test/SemaObjC/property-9-impl-method.m1
-rw-r--r--test/SemaObjC/property-and-class-extension.m2
-rw-r--r--test/SemaObjC/property-and-ivar-use.m1
-rw-r--r--test/SemaObjC/property-deprecated-warning.m64
-rw-r--r--test/SemaObjC/property-dot-receiver.m1
-rw-r--r--test/SemaObjC/property-impl-misuse.m2
-rw-r--r--test/SemaObjC/property-in-class-extension-1.m59
-rw-r--r--test/SemaObjC/property-ivar-mismatch.m8
-rw-r--r--test/SemaObjC/property-method-lookup-impl.m1
-rw-r--r--test/SemaObjC/property-nonfragile-abi.m1
-rw-r--r--test/SemaObjC/property-noprotocol-warning.m1
-rw-r--r--test/SemaObjC/property-redundant-decl-accessor.m1
-rw-r--r--test/SemaObjC/property-weak.m1
-rw-r--r--test/SemaObjC/property.m4
-rw-r--r--test/SemaObjC/props-on-prots.m1
-rw-r--r--test/SemaObjC/protocol-expr-1.m1
-rw-r--r--test/SemaObjC/protocol-implementation-inherited.m1
-rw-r--r--test/SemaObjC/protocol-lookup-2.m1
-rw-r--r--test/SemaObjC/protocol-lookup.m1
-rw-r--r--test/SemaObjC/protocol-qualified-class-unsupported.m1
-rw-r--r--test/SemaObjC/rdar6248119.m1
-rw-r--r--test/SemaObjC/restrict-id-type.m1
-rw-r--r--test/SemaObjC/selector-1.m1
-rw-r--r--test/SemaObjC/selector-2.m1
-rw-r--r--test/SemaObjC/self-declared-in-block.m1
-rw-r--r--test/SemaObjC/self-in-function.m1
-rw-r--r--test/SemaObjC/setter-dotsyntax.m1
-rw-r--r--test/SemaObjC/super-cat-prot.m1
-rw-r--r--test/SemaObjC/super-dealloc-attribute.m87
-rw-r--r--test/SemaObjC/super-property-message-expr.m1
-rw-r--r--test/SemaObjC/super-property-notation.m1
-rw-r--r--test/SemaObjC/synth-provisional-ivars-1.m1
-rw-r--r--test/SemaObjC/synthesize-setter-contclass.m1
-rw-r--r--test/SemaObjC/transparent-union.m1
-rw-r--r--test/SemaObjC/ucn-objc-string.m1
-rw-r--r--test/SemaObjC/uninit-variables.m29
-rw-r--r--test/SemaObjC/unused.m27
-rw-r--r--test/SemaObjC/va-method-1.m1
-rw-r--r--test/SemaObjC/warn-direct-ivar-access.m2
-rw-r--r--test/SemaObjC/warn-implicit-self-in-block.m18
-rw-r--r--test/SemaObjC/warn-isa-ref.m2
-rw-r--r--test/SemaObjC/warn-retain-cycle.m63
-rw-r--r--test/SemaObjC/warning-missing-selector-name.m32
-rw-r--r--test/SemaObjC/weak-property.m2
-rw-r--r--test/SemaObjC/weak-receiver-warn.m48
-rw-r--r--test/SemaObjC/writable-property-in-superclass.m1
133 files changed, 1094 insertions, 81 deletions
diff --git a/test/SemaObjC/ClassPropertyNotObject.m b/test/SemaObjC/ClassPropertyNotObject.m
index 02ed40ae338b..67d76b85e7ab 100644
--- a/test/SemaObjC/ClassPropertyNotObject.m
+++ b/test/SemaObjC/ClassPropertyNotObject.m
@@ -1,5 +1,6 @@
// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
// RUN: %clang_cc1 -x objective-c++ -fsyntax-only -verify -Wno-objc-root-class %s
+// expected-no-diagnostics
// rdar://10565506
@protocol P @end
diff --git a/test/SemaObjC/ContClassPropertyLookup.m b/test/SemaObjC/ContClassPropertyLookup.m
index 06a0ffae588c..bf4f6430bae0 100644
--- a/test/SemaObjC/ContClassPropertyLookup.m
+++ b/test/SemaObjC/ContClassPropertyLookup.m
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
+// expected-no-diagnostics
@interface MyObject {
int _foo;
diff --git a/test/SemaObjC/arc-decls.m b/test/SemaObjC/arc-decls.m
index 8d5cca26a74c..a53b52acd862 100644
--- a/test/SemaObjC/arc-decls.m
+++ b/test/SemaObjC/arc-decls.m
@@ -85,6 +85,8 @@ void func()
- (id)ns_non __attribute((ns_returns_not_retained)); // expected-error {{overriding method has mismatched ns_returns_not_retained attributes}}
- (id)not_ret:(id) b __attribute((ns_returns_retained)); // expected-error {{overriding method has mismatched ns_returns_retained attributes}}
- (id)both__returns_not_retained:(id) b __attribute((ns_returns_not_retained));
+// rdar://12173491
+@property (copy, nonatomic) __attribute__((ns_returns_retained)) id (^fblock)(void);
@end
// Test that we give a good diagnostic here that mentions the missing
diff --git a/test/SemaObjC/arc-objc-lifetime.m b/test/SemaObjC/arc-objc-lifetime.m
index 03260e8cdd4a..08d2dbe16c87 100644
--- a/test/SemaObjC/arc-objc-lifetime.m
+++ b/test/SemaObjC/arc-objc-lifetime.m
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -triple x86_64-apple-darwin11 -fsyntax-only -fobjc-arc -verify -Wno-objc-root-class %s
-// RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin11 -fsyntax-only -fobjc-arc -verify -Wno-objc-root-class %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin11 -fsyntax-only -fobjc-arc -fblocks -Wexplicit-ownership-type -verify -Wno-objc-root-class %s
+// RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin11 -fsyntax-only -fobjc-arc -fblocks -Wexplicit-ownership-type -verify -Wno-objc-root-class %s
// rdar://10244607
typedef const struct __CFString * CFStringRef;
@@ -40,3 +40,30 @@ __strong I *(__strong (test3)); // expected-error {{the type 'I *__strong' is al
__unsafe_unretained __typeof__(test3) test4;
typedef __strong I *strong_I;
__unsafe_unretained strong_I test5;
+
+// rdar://10907090
+typedef void (^T) ();
+@interface NSObject @end
+@protocol P;
+@interface Radar10907090 @end
+
+@implementation Radar10907090
+- (void) MMM : (NSObject*) arg0 : (NSObject<P>**)arg : (id) arg1 : (id<P>*) arg2 {} // expected-warning {{method parameter of type 'NSObject<P> *__autoreleasing *' with no explicit ownership}} \
+ // expected-warning {{method parameter of type '__autoreleasing id<P> *' with no explicit ownership}}
+- (void) MM : (NSObject*) arg0 : (__strong NSObject**)arg : (id) arg1 : (__strong id*) arg2 {}
+- (void) M : (NSObject**)arg0 : (id*)arg {} // expected-warning {{method parameter of type 'NSObject *__autoreleasing *' with no explicit ownership}} \
+ // expected-warning {{method parameter of type '__autoreleasing id *' with no explicit ownership}}
+- (void) N : (__strong NSObject***) arg0 : (__strong NSObject<P>***)arg : (float**) arg1 : (double) arg2 {}
+- (void) BLOCK : (T*) arg0 : (T)arg : (__strong T*) arg1 {} // expected-warning {{method parameter of type '__autoreleasing T *' (aka 'void (^__autoreleasing *)()') with no explicit ownership}}
+@end
+
+// rdar://12280826
+@class NSMutableDictionary, NSError;
+@interface Radar12280826
+- (void)createInferiorTransportAndSetEnvironment:(NSMutableDictionary*)environment error:(__autoreleasing NSError**)error;
+@end
+
+@implementation Radar12280826
+- (void)createInferiorTransportAndSetEnvironment:(NSMutableDictionary*)environment error:(__autoreleasing NSError**)error {}
+@end
+
diff --git a/test/SemaObjC/arc-property-decl-attrs.m b/test/SemaObjC/arc-property-decl-attrs.m
index 1386241dd73c..283772c2279c 100644
--- a/test/SemaObjC/arc-property-decl-attrs.m
+++ b/test/SemaObjC/arc-property-decl-attrs.m
@@ -5,7 +5,7 @@
@public
id __unsafe_unretained x;
id __weak y;
- id __autoreleasing z; // expected-error {{ivars cannot have __autoreleasing ownership}}
+ id __autoreleasing z; // expected-error {{instance variables cannot have __autoreleasing ownership}}
}
@property(strong) id x;
@property(strong) id y;
@@ -16,7 +16,7 @@
@public
id __unsafe_unretained x;
id __weak y;
- id __autoreleasing z; // expected-error {{ivars cannot have __autoreleasing ownership}}
+ id __autoreleasing z; // expected-error {{instance variables cannot have __autoreleasing ownership}}
}
@property(retain) id x;
@property(retain) id y;
@@ -27,7 +27,7 @@
@public
id __unsafe_unretained x;
id __weak y;
- id __autoreleasing z; // expected-error {{ivars cannot have __autoreleasing ownership}}
+ id __autoreleasing z; // expected-error {{instance variables cannot have __autoreleasing ownership}}
}
@property(copy) id x;
@property(copy) id y;
diff --git a/test/SemaObjC/arc-property-lifetime.m b/test/SemaObjC/arc-property-lifetime.m
index bd393e0bf51f..19570815f611 100644
--- a/test/SemaObjC/arc-property-lifetime.m
+++ b/test/SemaObjC/arc-property-lifetime.m
@@ -5,7 +5,7 @@
@public
id __unsafe_unretained x;
id __weak y;
- id __autoreleasing z; // expected-error {{ivars cannot have __autoreleasing ownership}}
+ id __autoreleasing z; // expected-error {{instance variables cannot have __autoreleasing ownership}}
}
@property(strong) id x; // expected-note {{property declared here}}
@property(strong) id y; // expected-note {{property declared here}}
@@ -13,8 +13,8 @@
@end
@implementation Foo
-@synthesize x; // expected-error {{existing ivar 'x' for strong property 'x' may not be __unsafe_unretained}}
-@synthesize y; // expected-error {{existing ivar 'y' for strong property 'y' may not be __weak}}
+@synthesize x; // expected-error {{existing instance variable 'x' for strong property 'x' may not be __unsafe_unretained}}
+@synthesize y; // expected-error {{existing instance variable 'y' for strong property 'y' may not be __weak}}
@synthesize z; // suppressed
@end
@@ -22,7 +22,7 @@
@public
id __unsafe_unretained x;
id __weak y;
- id __autoreleasing z; // expected-error {{ivars cannot have __autoreleasing ownership}}
+ id __autoreleasing z; // expected-error {{instance variables cannot have __autoreleasing ownership}}
}
@property(retain) id x; // expected-note {{property declared here}}
@property(retain) id y; // expected-note {{property declared here}}
@@ -30,8 +30,8 @@
@end
@implementation Bar
-@synthesize x; // expected-error {{existing ivar 'x' for strong property 'x' may not be __unsafe_unretained}}
-@synthesize y; // expected-error {{existing ivar 'y' for strong property 'y' may not be __weak}}
+@synthesize x; // expected-error {{existing instance variable 'x' for strong property 'x' may not be __unsafe_unretained}}
+@synthesize y; // expected-error {{existing instance variable 'y' for strong property 'y' may not be __weak}}
@synthesize z; // suppressed
@end
@@ -39,7 +39,7 @@
@public
id __unsafe_unretained x;
id __weak y;
- id __autoreleasing z; // expected-error {{ivars cannot have __autoreleasing ownership}}
+ id __autoreleasing z; // expected-error {{instance variables cannot have __autoreleasing ownership}}
}
@property(copy) id x; // expected-note {{property declared here}}
@property(copy) id y; // expected-note {{property declared here}}
@@ -47,8 +47,8 @@
@end
@implementation Bas
-@synthesize x; // expected-error {{existing ivar 'x' for strong property 'x' may not be __unsafe_unretained}}
-@synthesize y; // expected-error {{existing ivar 'y' for strong property 'y' may not be __weak}}
+@synthesize x; // expected-error {{existing instance variable 'x' for strong property 'x' may not be __unsafe_unretained}}
+@synthesize y; // expected-error {{existing instance variable 'y' for strong property 'y' may not be __weak}}
@synthesize z; // suppressed
@end
@@ -79,7 +79,7 @@
@implementation Gorf
@synthesize x;
-@synthesize y; // expected-error {{existing ivar 'y' for property 'y' with assign attribute must be __unsafe_unretained}}
+@synthesize y; // expected-error {{existing instance variable 'y' for property 'y' with assign attribute must be __unsafe_unretained}}
@synthesize z;
@end
@@ -94,7 +94,7 @@
@implementation Gorf2
@synthesize x;
-@synthesize y; // expected-error {{existing ivar 'y' for property 'y' with unsafe_unretained attribute must be __unsafe_unretained}}
+@synthesize y; // expected-error {{existing instance variable 'y' for property 'y' with unsafe_unretained attribute must be __unsafe_unretained}}
@synthesize z;
@end
diff --git a/test/SemaObjC/arc-property.m b/test/SemaObjC/arc-property.m
index 41d8e8723961..2925459620eb 100644
--- a/test/SemaObjC/arc-property.m
+++ b/test/SemaObjC/arc-property.m
@@ -18,13 +18,13 @@
@end
@implementation MyClass
-@synthesize myString; // expected-error {{existing ivar 'myString' for strong property 'myString' may not be __weak}}
+@synthesize myString; // expected-error {{existing instance variable 'myString' for strong property 'myString' may not be __weak}}
@synthesize myString1 = StrongIvar; // OK
-@synthesize myString2 = myString2; // expected-error {{existing ivar 'myString2' for strong property 'myString2' may not be __weak}}
+@synthesize myString2 = myString2; // expected-error {{existing instance variable 'myString2' for strong property 'myString2' may not be __weak}}
//
@synthesize myString3; // OK
@synthesize myString4; // OK
-@synthesize myString5 = StrongIvar5; // expected-error {{existing ivar 'StrongIvar5' for __weak property 'myString5' must be __weak}}
+@synthesize myString5 = StrongIvar5; // expected-error {{existing instance variable 'StrongIvar5' for __weak property 'myString5' must be __weak}}
@end
@@ -33,7 +33,7 @@
@public
id __unsafe_unretained x; // should be __weak
id __strong y;
- id __autoreleasing z; // expected-error {{ivars cannot have __autoreleasing ownership}}
+ id __autoreleasing z; // expected-error {{instance variables cannot have __autoreleasing ownership}}
}
@property(weak) id x; // expected-note {{property declared here}}
@property(weak) id y; // expected-note {{property declared here}}
@@ -41,8 +41,8 @@
@end
@implementation Foo
-@synthesize x; // expected-error {{existing ivar 'x' for __weak property 'x' must be __weak}}
-@synthesize y; // expected-error {{existing ivar 'y' for __weak property 'y' must be __weak}}
+@synthesize x; // expected-error {{existing instance variable 'x' for __weak property 'x' must be __weak}}
+@synthesize y; // expected-error {{existing instance variable 'y' for __weak property 'y' must be __weak}}
@synthesize z; // suppressed
@end
diff --git a/test/SemaObjC/arc-readonly-property-ivar-1.m b/test/SemaObjC/arc-readonly-property-ivar-1.m
index c773f26cc113..418f90d38a8b 100644
--- a/test/SemaObjC/arc-readonly-property-ivar-1.m
+++ b/test/SemaObjC/arc-readonly-property-ivar-1.m
@@ -1,5 +1,6 @@
// RUN: %clang_cc1 -fobjc-default-synthesize-properties -triple x86_64-apple-darwin11 -fobjc-runtime-has-weak -fobjc-arc -fsyntax-only -verify -Wno-objc-root-class %s
// RUN: %clang_cc1 -x objective-c++ -fobjc-default-synthesize-properties -triple x86_64-apple-darwin11 -fobjc-runtime-has-weak -fobjc-arc -fsyntax-only -verify -Wno-objc-root-class %s
+// expected-no-diagnostics
// rdar:// 10558871
@interface PP
diff --git a/test/SemaObjC/arc-readonly-property-ivar.m b/test/SemaObjC/arc-readonly-property-ivar.m
index 635b9fec71d1..bcc1f4b45b23 100644
--- a/test/SemaObjC/arc-readonly-property-ivar.m
+++ b/test/SemaObjC/arc-readonly-property-ivar.m
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -triple x86_64-apple-darwin11 -fobjc-runtime-has-weak -fobjc-arc -fsyntax-only -verify -Wno-objc-root-class %s
+// expected-no-diagnostics
// rdar:// 10558871
@interface PP
diff --git a/test/SemaObjC/arc-repeated-weak.mm b/test/SemaObjC/arc-repeated-weak.mm
new file mode 100644
index 000000000000..e652bee82d53
--- /dev/null
+++ b/test/SemaObjC/arc-repeated-weak.mm
@@ -0,0 +1,386 @@
+// RUN: %clang_cc1 -fsyntax-only -fobjc-runtime-has-weak -fobjc-arc -fblocks -Wno-objc-root-class -std=c++11 -Warc-repeated-use-of-weak -verify %s
+
+@interface Test {
+@public
+ Test *ivar;
+ __weak id weakIvar;
+}
+@property(weak) Test *weakProp;
+@property(strong) Test *strongProp;
+
+- (__weak id)implicitProp;
+
++ (__weak id)weakProp;
+@end
+
+extern void use(id);
+extern id get();
+extern bool condition();
+#define nil ((id)0)
+
+void sanity(Test *a) {
+ use(a.weakProp); // expected-warning{{weak property 'weakProp' is accessed multiple times in this function but may be unpredictably set to nil; assign to a strong variable to keep the object alive}}
+ use(a.weakProp); // expected-note{{also accessed here}}
+
+ use(a.strongProp);
+ use(a.strongProp); // no-warning
+
+ use(a.weakProp); // expected-note{{also accessed here}}
+}
+
+void singleUse(Test *a) {
+ use(a.weakProp); // no-warning
+ use(a.strongProp); // no-warning
+}
+
+void assignsOnly(Test *a) {
+ a.weakProp = get(); // no-warning
+
+ id next = get();
+ if (next)
+ a.weakProp = next; // no-warning
+
+ a->weakIvar = get(); // no-warning
+ next = get();
+ if (next)
+ a->weakIvar = next; // no-warning
+
+ extern __weak id x;
+ x = get(); // no-warning
+ next = get();
+ if (next)
+ x = next; // no-warning
+}
+
+void assignThenRead(Test *a) {
+ a.weakProp = get(); // expected-note{{also accessed here}}
+ use(a.weakProp); // expected-warning{{weak property 'weakProp' is accessed multiple times}}
+}
+
+void twoVariables(Test *a, Test *b) {
+ use(a.weakProp); // no-warning
+ use(b.weakProp); // no-warning
+}
+
+void doubleLevelAccess(Test *a) {
+ use(a.strongProp.weakProp); // expected-warning{{weak property 'weakProp' may be accessed multiple times in this function and may be unpredictably set to nil; assign to a strong variable to keep the object alive}}
+ use(a.strongProp.weakProp); // expected-note{{also accessed here}}
+}
+
+void doubleLevelAccessIvar(Test *a) {
+ use(a.strongProp.weakProp); // expected-warning{{weak property 'weakProp' may be accessed multiple times}}
+ use(a.strongProp.weakProp); // expected-note{{also accessed here}}
+}
+
+void implicitProperties(Test *a) {
+ use(a.implicitProp); // expected-warning{{weak implicit property 'implicitProp' is accessed multiple times}}
+ use(a.implicitProp); // expected-note{{also accessed here}}
+}
+
+void classProperties() {
+ use(Test.weakProp); // expected-warning{{weak implicit property 'weakProp' is accessed multiple times}}
+ use(Test.weakProp); // expected-note{{also accessed here}}
+}
+
+void classPropertiesAreDifferent(Test *a) {
+ use(Test.weakProp); // no-warning
+ use(a.weakProp); // no-warning
+ use(a.strongProp.weakProp); // no-warning
+}
+
+void ivars(Test *a) {
+ use(a->weakIvar); // expected-warning{{weak instance variable 'weakIvar' is accessed multiple times}}
+ use(a->weakIvar); // expected-note{{also accessed here}}
+}
+
+void globals() {
+ extern __weak id a;
+ use(a); // expected-warning{{weak variable 'a' is accessed multiple times}}
+ use(a); // expected-note{{also accessed here}}
+}
+
+void messageGetter(Test *a) {
+ use([a weakProp]); // expected-warning{{weak property 'weakProp' is accessed multiple times}}
+ use([a weakProp]); // expected-note{{also accessed here}}
+}
+
+void messageSetter(Test *a) {
+ [a setWeakProp:get()]; // no-warning
+ [a setWeakProp:get()]; // no-warning
+}
+
+void messageSetterAndGetter(Test *a) {
+ [a setWeakProp:get()]; // expected-note{{also accessed here}}
+ use([a weakProp]); // expected-warning{{weak property 'weakProp' is accessed multiple times}}
+}
+
+void mixDotAndMessageSend(Test *a, Test *b) {
+ use(a.weakProp); // expected-warning{{weak property 'weakProp' is accessed multiple times}}
+ use([a weakProp]); // expected-note{{also accessed here}}
+
+ use([b weakProp]); // expected-warning{{weak property 'weakProp' is accessed multiple times}}
+ use(b.weakProp); // expected-note{{also accessed here}}
+}
+
+
+void assignToStrongWrongInit(Test *a) {
+ id val = a.weakProp; // expected-note{{also accessed here}}
+ use(a.weakProp); // expected-warning{{weak property 'weakProp' is accessed multiple times}}
+}
+
+void assignToStrongWrong(Test *a) {
+ id val;
+ val = a.weakProp; // expected-note{{also accessed here}}
+ use(a.weakProp); // expected-warning{{weak property 'weakProp' is accessed multiple times}}
+}
+
+void assignToIvarWrong(Test *a) {
+ a->weakIvar = get(); // expected-note{{also accessed here}}
+ use(a->weakIvar); // expected-warning{{weak instance variable 'weakIvar' is accessed multiple times}}
+}
+
+void assignToGlobalWrong() {
+ extern __weak id a;
+ a = get(); // expected-note{{also accessed here}}
+ use(a); // expected-warning{{weak variable 'a' is accessed multiple times}}
+}
+
+void assignToStrongOK(Test *a) {
+ if (condition()) {
+ id val = a.weakProp; // no-warning
+ (void)val;
+ } else {
+ id val;
+ val = a.weakProp; // no-warning
+ (void)val;
+ }
+}
+
+void assignToStrongConditional(Test *a) {
+ id val = (condition() ? a.weakProp : a.weakProp); // no-warning
+ id val2 = a.implicitProp ?: a.implicitProp; // no-warning
+}
+
+void testBlock(Test *a) {
+ use(a.weakProp); // no-warning
+
+ use(^{
+ use(a.weakProp); // expected-warning{{weak property 'weakProp' is accessed multiple times in this block}}
+ use(a.weakProp); // expected-note{{also accessed here}}
+ });
+}
+
+void assignToStrongWithCasts(Test *a) {
+ if (condition()) {
+ Test *val = (Test *)a.weakProp; // no-warning
+ (void)val;
+ } else {
+ id val;
+ val = (Test *)a.weakProp; // no-warning
+ (void)val;
+ }
+}
+
+void assignToStrongWithMessages(Test *a) {
+ if (condition()) {
+ id val = [a weakProp]; // no-warning
+ (void)val;
+ } else {
+ id val;
+ val = [a weakProp]; // no-warning
+ (void)val;
+ }
+}
+
+
+void assignAfterRead(Test *a) {
+ // Special exception for a single read before any writes.
+ if (!a.weakProp) // no-warning
+ a.weakProp = get(); // no-warning
+}
+
+void readOnceWriteMany(Test *a) {
+ if (!a.weakProp) { // no-warning
+ a.weakProp = get(); // no-warning
+ a.weakProp = get(); // no-warning
+ }
+}
+
+void readOnceAfterWrite(Test *a) {
+ a.weakProp = get(); // expected-note{{also accessed here}}
+ if (!a.weakProp) { // expected-warning{{weak property 'weakProp' is accessed multiple times in this function}}
+ a.weakProp = get(); // expected-note{{also accessed here}}
+ }
+}
+
+void readOnceWriteManyLoops(Test *a, Test *b, Test *c, Test *d, Test *e) {
+ while (condition()) {
+ if (!a.weakProp) { // expected-warning{{weak property 'weakProp' is accessed multiple times in this function}}
+ a.weakProp = get(); // expected-note{{also accessed here}}
+ a.weakProp = get(); // expected-note{{also accessed here}}
+ }
+ }
+
+ do {
+ if (!b.weakProp) { // expected-warning{{weak property 'weakProp' is accessed multiple times in this function}}
+ b.weakProp = get(); // expected-note{{also accessed here}}
+ b.weakProp = get(); // expected-note{{also accessed here}}
+ }
+ } while (condition());
+
+ for (id x = get(); x; x = get()) {
+ if (!c.weakProp) { // expected-warning{{weak property 'weakProp' is accessed multiple times in this function}}
+ c.weakProp = get(); // expected-note{{also accessed here}}
+ c.weakProp = get(); // expected-note{{also accessed here}}
+ }
+ }
+
+ for (id x in get()) {
+ if (!d.weakProp) { // expected-warning{{weak property 'weakProp' is accessed multiple times in this function}}
+ d.weakProp = get(); // expected-note{{also accessed here}}
+ d.weakProp = get(); // expected-note{{also accessed here}}
+ }
+ }
+
+ int array[] = { 1, 2, 3 };
+ for (int i : array) {
+ if (!e.weakProp) { // expected-warning{{weak property 'weakProp' is accessed multiple times in this function}}
+ e.weakProp = get(); // expected-note{{also accessed here}}
+ e.weakProp = get(); // expected-note{{also accessed here}}
+ }
+ }
+}
+
+void readOnlyLoop(Test *a) {
+ while (condition()) {
+ use(a.weakProp); // expected-warning{{weak property 'weakProp' is accessed multiple times in this function}}
+ }
+}
+
+void readInIterationLoop() {
+ for (Test *a in get())
+ use(a.weakProp); // no-warning
+}
+
+void readDoubleLevelAccessInLoop() {
+ for (Test *a in get()) {
+ use(a.strongProp.weakProp); // no-warning
+ }
+}
+
+void readParameterInLoop(Test *a) {
+ for (id unused in get()) {
+ use(a.weakProp); // expected-warning{{weak property 'weakProp' is accessed multiple times in this function}}
+ (void)unused;
+ }
+}
+
+void readGlobalInLoop() {
+ static __weak id a;
+ for (id unused in get()) {
+ use(a); // expected-warning{{weak variable 'a' is accessed multiple times in this function}}
+ (void)unused;
+ }
+}
+
+void doWhileLoop(Test *a) {
+ do {
+ use(a.weakProp); // no-warning
+ } while(0);
+}
+
+
+@interface Test (Methods)
+@end
+
+@implementation Test (Methods)
+- (void)sanity {
+ use(self.weakProp); // expected-warning{{weak property 'weakProp' is accessed multiple times in this method but may be unpredictably set to nil; assign to a strong variable to keep the object alive}}
+ use(self.weakProp); // expected-note{{also accessed here}}
+}
+
+- (void)ivars {
+ use(weakIvar); // expected-warning{{weak instance variable 'weakIvar' is accessed multiple times in this method but may be unpredictably set to nil; assign to a strong variable to keep the object alive}}
+ use(weakIvar); // expected-note{{also accessed here}}
+}
+
+- (void)doubleLevelAccessForSelf {
+ use(self.strongProp.weakProp); // expected-warning{{weak property 'weakProp' is accessed multiple times}}
+ use(self.strongProp.weakProp); // expected-note{{also accessed here}}
+
+ use(self->ivar.weakProp); // expected-warning{{weak property 'weakProp' is accessed multiple times}}
+ use(self->ivar.weakProp); // expected-note{{also accessed here}}
+
+ use(self->ivar->weakIvar); // expected-warning{{weak instance variable 'weakIvar' is accessed multiple times}}
+ use(self->ivar->weakIvar); // expected-note{{also accessed here}}
+}
+
+- (void)distinctFromOther:(Test *)other {
+ use(self.strongProp.weakProp); // no-warning
+ use(other.strongProp.weakProp); // no-warning
+
+ use(self->ivar.weakProp); // no-warning
+ use(other->ivar.weakProp); // no-warning
+
+ use(self.strongProp->weakIvar); // no-warning
+ use(other.strongProp->weakIvar); // no-warning
+}
+@end
+
+
+class Wrapper {
+ Test *a;
+
+public:
+ void fields() {
+ use(a.weakProp); // expected-warning{{weak property 'weakProp' is accessed multiple times in this function but may be unpredictably set to nil; assign to a strong variable to keep the object alive}}
+ use(a.weakProp); // expected-note{{also accessed here}}
+ }
+
+ void distinctFromOther(Test *b, const Wrapper &w) {
+ use(a.weakProp); // no-warning
+ use(b.weakProp); // no-warning
+ use(w.a.weakProp); // no-warning
+ }
+
+ static void doubleLevelAccessField(const Wrapper &x, const Wrapper &y) {
+ use(x.a.weakProp); // expected-warning{{weak property 'weakProp' may be accessed multiple times}}
+ use(y.a.weakProp); // expected-note{{also accessed here}}
+ }
+};
+
+
+// -----------------------
+// False positives
+// -----------------------
+
+// Most of these would require flow-sensitive analysis to silence correctly.
+
+void assignNil(Test *a) {
+ if (condition())
+ a.weakProp = nil; // expected-note{{also accessed here}}
+
+ use(a.weakProp); // expected-warning{{weak property 'weakProp' is accessed multiple times}}
+}
+
+void branch(Test *a) {
+ if (condition())
+ use(a.weakProp); // expected-warning{{weak property 'weakProp' is accessed multiple times}}
+ else
+ use(a.weakProp); // expected-note{{also accessed here}}
+}
+
+void doubleLevelAccess(Test *a, Test *b) {
+ use(a.strongProp.weakProp); // expected-warning{{weak property 'weakProp' may be accessed multiple times}}
+ use(b.strongProp.weakProp); // expected-note{{also accessed here}}
+
+ use(a.weakProp.weakProp); // no-warning
+}
+
+void doubleLevelAccessIvar(Test *a, Test *b) {
+ use(a->ivar.weakProp); // expected-warning{{weak property 'weakProp' may be accessed multiple times}}
+ use(b->ivar.weakProp); // expected-note{{also accessed here}}
+
+ use(a.strongProp.weakProp); // no-warning
+}
+
diff --git a/test/SemaObjC/arc-setter-property-match.m b/test/SemaObjC/arc-setter-property-match.m
index 9158b09a47e7..83a07e94f2b9 100644
--- a/test/SemaObjC/arc-setter-property-match.m
+++ b/test/SemaObjC/arc-setter-property-match.m
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -triple x86_64-apple-darwin11 -fsyntax-only -fobjc-arc -fblocks -verify -Wno-objc-root-class %s
+// expected-no-diagnostics
// rdar://10156674
@class NSArray;
diff --git a/test/SemaObjC/arc-system-header.m b/test/SemaObjC/arc-system-header.m
index 1a7c39d4e1cd..3443bda99bb3 100644
--- a/test/SemaObjC/arc-system-header.m
+++ b/test/SemaObjC/arc-system-header.m
@@ -38,7 +38,7 @@ id test6() {
x = (id) (test6_helper(), kMagicConstant);
}
-// workaround expected-note 4 {{marked unavailable here}}
+// workaround expected-note 4 {{marked unavailable here}} expected-note 2 {{property 'prop' is declared unavailable here}}
void test7(Test7 *p) {
*p.prop = 0; // expected-error {{'prop' is unavailable: this system declaration uses an unsupported type}}
p.prop = 0; // expected-error {{'prop' is unavailable: this system declaration uses an unsupported type}}
diff --git a/test/SemaObjC/arc-unavailable-for-weakref.m b/test/SemaObjC/arc-unavailable-for-weakref.m
index 8498de6d9a11..b140c64da71f 100644
--- a/test/SemaObjC/arc-unavailable-for-weakref.m
+++ b/test/SemaObjC/arc-unavailable-for-weakref.m
@@ -60,5 +60,5 @@ __attribute__((objc_arc_weak_reference_unavailable))
@end
@implementation I
-@synthesize font = _font; // expected-error {{synthesis of a weak-unavailable property is disallowed because it requires synthesis of an ivar of the __weak object}}
+@synthesize font = _font; // expected-error {{synthesis of a weak-unavailable property is disallowed because it requires synthesis of an instance variable of the __weak object}}
@end
diff --git a/test/SemaObjC/arc-unsafe_unretained.m b/test/SemaObjC/arc-unsafe_unretained.m
index a6c5f985df8f..99e870f643a8 100644
--- a/test/SemaObjC/arc-unsafe_unretained.m
+++ b/test/SemaObjC/arc-unsafe_unretained.m
@@ -1,5 +1,6 @@
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -verify -fblocks %s
// RUN: %clang_cc1 -fsyntax-only -verify -fblocks -fobjc-arc %s
+// expected-no-diagnostics
struct X {
__unsafe_unretained id object;
diff --git a/test/SemaObjC/attr-availability.m b/test/SemaObjC/attr-availability.m
index 7c9ff0f13d90..ed6b7608b9a4 100644
--- a/test/SemaObjC/attr-availability.m
+++ b/test/SemaObjC/attr-availability.m
@@ -14,8 +14,8 @@
@end
void f(A *a, B *b) {
- [a method]; // expected-warning{{'method' is deprecated: first deprecated in Mac OS X 10.2}}
- [b method]; // expected-warning {{'method' is deprecated: first deprecated in Mac OS X 10.2}}
- [a proto_method]; // expected-warning{{'proto_method' is deprecated: first deprecated in Mac OS X 10.2}}
- [b proto_method]; // expected-warning{{'proto_method' is deprecated: first deprecated in Mac OS X 10.2}}
+ [a method]; // expected-warning{{'method' is deprecated: first deprecated in OS X 10.2}}
+ [b method]; // expected-warning {{'method' is deprecated: first deprecated in OS X 10.2}}
+ [a proto_method]; // expected-warning{{'proto_method' is deprecated: first deprecated in OS X 10.2}}
+ [b proto_method]; // expected-warning{{'proto_method' is deprecated: first deprecated in OS X 10.2}}
}
diff --git a/test/SemaObjC/attr-cleanup.m b/test/SemaObjC/attr-cleanup.m
index 8415c698f348..978498ca64b5 100644
--- a/test/SemaObjC/attr-cleanup.m
+++ b/test/SemaObjC/attr-cleanup.m
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 %s -verify -fsyntax-only
+// expected-no-diagnostics
@class NSString;
diff --git a/test/SemaObjC/attr-deprecated.m b/test/SemaObjC/attr-deprecated.m
index 260462abc0b8..c0aa9fc07071 100644
--- a/test/SemaObjC/attr-deprecated.m
+++ b/test/SemaObjC/attr-deprecated.m
@@ -107,7 +107,8 @@ __attribute ((deprecated))
@interface Test2
-@property int test2 __attribute__((deprecated)); // expected-note 4 {{declared here}}
+@property int test2 __attribute__((deprecated)); // expected-note 4 {{declared here}} \
+ // expected-note 2 {{property 'test2' is declared deprecated here}}
@end
void test(Test2 *foo) {
diff --git a/test/SemaObjC/block-as-object.m b/test/SemaObjC/block-as-object.m
index a85b6067571e..945d6f68d6ea 100644
--- a/test/SemaObjC/block-as-object.m
+++ b/test/SemaObjC/block-as-object.m
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 %s -fsyntax-only -verify -fblocks
+// expected-no-diagnostics
@interface Whatever
- copy;
diff --git a/test/SemaObjC/block-ivar.m b/test/SemaObjC/block-ivar.m
index c7ea1d96a05b..5864b6350120 100644
--- a/test/SemaObjC/block-ivar.m
+++ b/test/SemaObjC/block-ivar.m
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s -fblocks
+// expected-no-diagnostics
@interface NSObject {
struct objc_object *isa;
diff --git a/test/SemaObjC/block-return.m b/test/SemaObjC/block-return.m
index 15c3fb64d778..e0bac996d80a 100644
--- a/test/SemaObjC/block-return.m
+++ b/test/SemaObjC/block-return.m
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -verify -fblocks -fobjc-gc-only %s
+// expected-no-diagnostics
// rdar://8979379
@interface NSString
diff --git a/test/SemaObjC/builtin_objc_assign_ivar.m b/test/SemaObjC/builtin_objc_assign_ivar.m
index 5839bf444419..6c28178de0ec 100644
--- a/test/SemaObjC/builtin_objc_assign_ivar.m
+++ b/test/SemaObjC/builtin_objc_assign_ivar.m
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -x objective-c %s -fsyntax-only -verify
+// expected-no-diagnostics
// rdar://9362887
typedef __typeof__(((int*)0)-((int*)0)) ptrdiff_t;
diff --git a/test/SemaObjC/builtin_objc_msgSend.m b/test/SemaObjC/builtin_objc_msgSend.m
index bf17225a0417..bfa09d9f6cfc 100644
--- a/test/SemaObjC/builtin_objc_msgSend.m
+++ b/test/SemaObjC/builtin_objc_msgSend.m
@@ -1,3 +1,4 @@
// RUN: %clang_cc1 %s -fsyntax-only -verify
+// expected-no-diagnostics
// rdar://8632525
extern id objc_msgSend(id self, SEL op, ...);
diff --git a/test/SemaObjC/category-method-lookup-2.m b/test/SemaObjC/category-method-lookup-2.m
index a31d824d1d45..ed347c7cde0c 100644
--- a/test/SemaObjC/category-method-lookup-2.m
+++ b/test/SemaObjC/category-method-lookup-2.m
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
+// expected-no-diagnostics
typedef struct objc_class *Class;
@interface NSObject
diff --git a/test/SemaObjC/category-method-lookup.m b/test/SemaObjC/category-method-lookup.m
index 4223a747947c..6239e948dce4 100644
--- a/test/SemaObjC/category-method-lookup.m
+++ b/test/SemaObjC/category-method-lookup.m
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
+// expected-no-diagnostics
@interface Foo
@end
diff --git a/test/SemaObjC/class-getter-using-dotsyntax.m b/test/SemaObjC/class-getter-using-dotsyntax.m
index 4ff9428e9637..dd384b510833 100644
--- a/test/SemaObjC/class-getter-using-dotsyntax.m
+++ b/test/SemaObjC/class-getter-using-dotsyntax.m
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
+// expected-no-diagnostics
typedef struct objc_class *Class;
diff --git a/test/SemaObjC/class-property-access.m b/test/SemaObjC/class-property-access.m
index c46d3fb397ce..735b51a3c432 100644
--- a/test/SemaObjC/class-property-access.m
+++ b/test/SemaObjC/class-property-access.m
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
+// expected-no-diagnostics
@interface Test {}
+ (Test*)one;
diff --git a/test/SemaObjC/class-protocol.m b/test/SemaObjC/class-protocol.m
index 91cd1389f1e6..021047e12052 100644
--- a/test/SemaObjC/class-protocol.m
+++ b/test/SemaObjC/class-protocol.m
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
+// expected-no-diagnostics
// pr5552
@interface Protocol
diff --git a/test/SemaObjC/comptypes-2.m b/test/SemaObjC/comptypes-2.m
index 74e42c96137d..8e90455de664 100644
--- a/test/SemaObjC/comptypes-2.m
+++ b/test/SemaObjC/comptypes-2.m
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
+// expected-no-diagnostics
#define nil (void *)0;
#define Nil (void *)0;
diff --git a/test/SemaObjC/comptypes-8.m b/test/SemaObjC/comptypes-8.m
index 750b0a6a5a97..e65103068911 100644
--- a/test/SemaObjC/comptypes-8.m
+++ b/test/SemaObjC/comptypes-8.m
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
+// expected-no-diagnostics
@protocol MyProtocol
@end
diff --git a/test/SemaObjC/conditional-expr-5.m b/test/SemaObjC/conditional-expr-5.m
index 47aed3e6a579..b1f7e5996947 100644
--- a/test/SemaObjC/conditional-expr-5.m
+++ b/test/SemaObjC/conditional-expr-5.m
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
+// expected-no-diagnostics
@interface PBXBuildSettingsDictionary
{
diff --git a/test/SemaObjC/conditional-expr-6.m b/test/SemaObjC/conditional-expr-6.m
index 098688a8a90a..e944e540b2fc 100644
--- a/test/SemaObjC/conditional-expr-6.m
+++ b/test/SemaObjC/conditional-expr-6.m
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
+// expected-no-diagnostics
@protocol MyProtocol @end
diff --git a/test/SemaObjC/conditional-expr-7.m b/test/SemaObjC/conditional-expr-7.m
index 3ddf3d73566a..5b4a8632b27f 100644
--- a/test/SemaObjC/conditional-expr-7.m
+++ b/test/SemaObjC/conditional-expr-7.m
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
+// expected-no-diagnostics
// radar 7682116
@interface Super @end
diff --git a/test/SemaObjC/conditional-expr-8.m b/test/SemaObjC/conditional-expr-8.m
index 6799983e3b16..beddd205a907 100644
--- a/test/SemaObjC/conditional-expr-8.m
+++ b/test/SemaObjC/conditional-expr-8.m
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
+// expected-no-diagnostics
// rdar://9296866
@interface NSResponder
diff --git a/test/SemaObjC/conflict-nonfragile-abi2.m b/test/SemaObjC/conflict-nonfragile-abi2.m
index 819732758d27..d0d6be84a65e 100644
--- a/test/SemaObjC/conflict-nonfragile-abi2.m
+++ b/test/SemaObjC/conflict-nonfragile-abi2.m
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -verify -fsyntax-only -Wno-objc-root-class %s
+// expected-no-diagnostics
// rdar://8225011
int glob;
diff --git a/test/SemaObjC/continuation-class-err.m b/test/SemaObjC/continuation-class-err.m
index ceb8ee90c9f5..8378c3f9f8bf 100644
--- a/test/SemaObjC/continuation-class-err.m
+++ b/test/SemaObjC/continuation-class-err.m
@@ -5,13 +5,13 @@
id _object;
id _object1;
}
-@property(readonly) id object; // expected-note {{property declared here}}
+@property(readonly) id object;
@property(readwrite, assign) id object1; // expected-note {{property declared here}}
@property (readonly) int indentLevel;
@end
@interface ReadOnly ()
-@property(readwrite, copy) id object; // expected-warning {{property attribute in class extension does not match the primary class}}
+@property(readwrite, copy) id object; // Ok. declaring memory model in class extension - primary has none.
@property(readonly) id object1; // expected-error {{illegal redeclaration of property in class extension 'ReadOnly' (attribute must be 'readwrite', while its primary must be 'readonly')}}
@property (readwrite, assign) int indentLevel; // OK. assign the default in any case.
@end
diff --git a/test/SemaObjC/crash-on-objc-bool-literal.m b/test/SemaObjC/crash-on-objc-bool-literal.m
new file mode 100644
index 000000000000..2c003a534b5a
--- /dev/null
+++ b/test/SemaObjC/crash-on-objc-bool-literal.m
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -x objective-c++ -fsyntax-only -verify %s
+// rdar://12456743
+
+typedef signed char BOOL; // expected-note 2 {{candidate found by name lookup is 'BOOL'}}
+
+EXPORT BOOL FUNC(BOOL enabled); // expected-error {{unknown type name 'EXPORT'}} // expected-error {{expected ';' after top level declarator}} \
+ // expected-note 2 {{candidate found by name lookup is 'BOOL'}}
+
+static inline BOOL MFIsPrivateVersion(void) { // expected-error {{reference to 'BOOL' is ambiguous}}
+ return __objc_yes; // expected-error {{reference to 'BOOL' is ambiguous}}
+}
diff --git a/test/SemaObjC/default-synthesize-2.m b/test/SemaObjC/default-synthesize-2.m
index 3756413bd83f..20c045e60e06 100644
--- a/test/SemaObjC/default-synthesize-2.m
+++ b/test/SemaObjC/default-synthesize-2.m
@@ -41,7 +41,7 @@
// Test3
@interface Test3
{
- id uid; // expected-note {{ivar is declared here}}
+ id uid; // expected-note {{instance variable is declared here}}
}
@property (readwrite, assign) id uid; // expected-note {{property declared here}}
@end
@@ -119,7 +119,7 @@ int* _object;
@interface Test8
{
id _y;
- id y; // expected-note {{ivar is declared here}}
+ id y; // expected-note {{instance variable is declared here}}
}
@property(copy) id y; // expected-note {{property declared here}}
@end
diff --git a/test/SemaObjC/delay-parsing-cfunctions.m b/test/SemaObjC/delay-parsing-cfunctions.m
index a6f66fe1bd38..c74b054f74d4 100644
--- a/test/SemaObjC/delay-parsing-cfunctions.m
+++ b/test/SemaObjC/delay-parsing-cfunctions.m
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -Werror -verify -Wno-objc-root-class %s
+// expected-no-diagnostics
// rdar://10387088
@interface MyClass
diff --git a/test/SemaObjC/direct-synthesized-ivar-access.m b/test/SemaObjC/direct-synthesized-ivar-access.m
index dc1491173aae..a276a64913b3 100644
--- a/test/SemaObjC/direct-synthesized-ivar-access.m
+++ b/test/SemaObjC/direct-synthesized-ivar-access.m
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -fobjc-default-synthesize-properties -verify -Wno-objc-root-class %s
+// expected-no-diagnostics
// rdar://8673791
// rdar://9943851
diff --git a/test/SemaObjC/enhanced-proto-2.m b/test/SemaObjC/enhanced-proto-2.m
index 28b03d93e2d2..352f29160e53 100644
--- a/test/SemaObjC/enhanced-proto-2.m
+++ b/test/SemaObjC/enhanced-proto-2.m
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -verify -Wno-objc-root-class %s
+// expected-no-diagnostics
@protocol MyProto1
@optional
diff --git a/test/SemaObjC/enum-fixed-type.m b/test/SemaObjC/enum-fixed-type.m
index 95153bedb3db..4fe643faef2f 100644
--- a/test/SemaObjC/enum-fixed-type.m
+++ b/test/SemaObjC/enum-fixed-type.m
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
+// expected-no-diagnostics
#if !__has_feature(objc_fixed_enum)
# error Enumerations with a fixed underlying type are not supported
diff --git a/test/SemaObjC/error-property-gc-attr.m b/test/SemaObjC/error-property-gc-attr.m
index 56802960c6b2..dfac0d4286ea 100644
--- a/test/SemaObjC/error-property-gc-attr.m
+++ b/test/SemaObjC/error-property-gc-attr.m
@@ -3,7 +3,7 @@
@interface INTF
{
- id IVAR; // expected-note {{ivar is declared here}}
+ id IVAR; // expected-note {{instance variable is declared here}}
__weak id II;
__weak id WID;
id ID;
@@ -19,10 +19,10 @@
@end
@implementation INTF
-@synthesize pweak=IVAR; // expected-error {{existing ivar 'IVAR' for __weak property 'pweak' must be __weak}}
-@synthesize NOT=II; // expected-error {{existing ivar 'II' for strong property 'NOT' may not be __weak}}
+@synthesize pweak=IVAR; // expected-error {{existing instance variable 'IVAR' for __weak property 'pweak' must be __weak}}
+@synthesize NOT=II; // expected-error {{existing instance variable 'II' for strong property 'NOT' may not be __weak}}
@synthesize WID;
@synthesize ID;
-@synthesize AWEAK; // expected-error {{existing ivar 'AWEAK' for strong property 'AWEAK' may not be __weak}}
+@synthesize AWEAK; // expected-error {{existing instance variable 'AWEAK' for strong property 'AWEAK' may not be __weak}}
@synthesize WI;
@end
diff --git a/test/SemaObjC/getter-setter-defined-in-category-of-parent.m b/test/SemaObjC/getter-setter-defined-in-category-of-parent.m
index 71c3237425bd..ff5c17446680 100644
--- a/test/SemaObjC/getter-setter-defined-in-category-of-parent.m
+++ b/test/SemaObjC/getter-setter-defined-in-category-of-parent.m
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
+// expected-no-diagnostics
@interface MyParent {
int X;
diff --git a/test/SemaObjC/iboutletcollection-attr.m b/test/SemaObjC/iboutletcollection-attr.m
index 22c21a764bdc..82cb96fbede7 100644
--- a/test/SemaObjC/iboutletcollection-attr.m
+++ b/test/SemaObjC/iboutletcollection-attr.m
@@ -21,9 +21,9 @@ typedef void *PV;
__attribute__((iboutletcollection(I, 1))) id ivar1; // expected-error {{attribute takes one argument}}
__attribute__((iboutletcollection(B))) id ivar2; // expected-error {{invalid type 'B' as argument of iboutletcollection attribute}}
__attribute__((iboutletcollection(PV))) id ivar3; // expected-error {{invalid type 'PV' as argument of iboutletcollection attribute}}
- __attribute__((iboutletcollection(PV))) void *ivar4; // expected-warning {{ivar with 'iboutletcollection' attribute must be an object type (invalid 'void *')}}
+ __attribute__((iboutletcollection(PV))) void *ivar4; // expected-warning {{instance variable with 'iboutletcollection' attribute must be an object type (invalid 'void *')}}
__attribute__((iboutletcollection(int))) id ivar5; // expected-error {{type argument of iboutletcollection attribute cannot be a builtin type}}
- __attribute__((iboutlet)) int ivar6; // expected-warning {{ivar with 'iboutlet' attribute must be an object type}}
+ __attribute__((iboutlet)) int ivar6; // expected-warning {{instance variable with 'iboutlet' attribute must be an object type}}
}
@property (nonatomic, retain) __attribute__((iboutletcollection(I,2,3))) id prop1; // expected-error {{attribute takes one argument}}
@property (nonatomic, retain) __attribute__((iboutletcollection(B))) id prop2; // expected-error {{invalid type 'B' as argument of iboutletcollection attribute}}
diff --git a/test/SemaObjC/id_builtin.m b/test/SemaObjC/id_builtin.m
index a1431d60abe3..be42e7d7c564 100644
--- a/test/SemaObjC/id_builtin.m
+++ b/test/SemaObjC/id_builtin.m
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 %s -fsyntax-only -verify
+// expected-no-diagnostics
// id is now builtin. There should be no errors.
id obj;
diff --git a/test/SemaObjC/idiomatic-parentheses.m b/test/SemaObjC/idiomatic-parentheses.m
index 417b948b8fab..801db5944f10 100644
--- a/test/SemaObjC/idiomatic-parentheses.m
+++ b/test/SemaObjC/idiomatic-parentheses.m
@@ -4,13 +4,18 @@
// <rdar://problem/7382435>
@interface Object
+{
+ unsigned uid;
+}
- (id) init;
- (id) initWithInt: (int) i;
- (void) iterate: (id) coll;
- (id) nextObject;
+@property unsigned uid;
@end
@implementation Object
+@synthesize uid;
- (id) init {
if (self = [self init]) {
}
@@ -20,6 +25,12 @@
- (id) initWithInt: (int) i {
if (self = [self initWithInt: i]) {
}
+ // rdar://11066598
+ if (self.uid = 100) { // expected-warning {{using the result of an assignment as a condition without parentheses}} \
+ // expected-note {{place parentheses around the assignment to silence this warning}} \
+ // expected-note {{use '==' to turn this assignment into an equality comparison}}
+ // ...
+ }
return self;
}
diff --git a/test/SemaObjC/ignore-qualifier-on-qualified-id.m b/test/SemaObjC/ignore-qualifier-on-qualified-id.m
index 36a2c1ad873d..996664f6a9e0 100644
--- a/test/SemaObjC/ignore-qualifier-on-qualified-id.m
+++ b/test/SemaObjC/ignore-qualifier-on-qualified-id.m
@@ -1,5 +1,6 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
// RUN: %clang_cc1 -x objective-c++ -fsyntax-only -verify %s
+// expected-no-diagnostics
// rdar://10667659
@protocol NSCopying @end
diff --git a/test/SemaObjC/ignore-weakimport-method.m b/test/SemaObjC/ignore-weakimport-method.m
index d71cebf2c79a..c68c57830a9a 100644
--- a/test/SemaObjC/ignore-weakimport-method.m
+++ b/test/SemaObjC/ignore-weakimport-method.m
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
+// expected-no-diagnostics
@interface foo
+ (void) cx __attribute__((weak_import));
- (void) x __attribute__((weak_import));
diff --git a/test/SemaObjC/interface-layout-2.m b/test/SemaObjC/interface-layout-2.m
index 02b14035a223..17e34d4681bd 100644
--- a/test/SemaObjC/interface-layout-2.m
+++ b/test/SemaObjC/interface-layout-2.m
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 %s -fsyntax-only -verify
+// expected-no-diagnostics
@interface A
{
int ivar;
diff --git a/test/SemaObjC/interface-layout.m b/test/SemaObjC/interface-layout.m
index 336605a7812e..9b083b0154e1 100644
--- a/test/SemaObjC/interface-layout.m
+++ b/test/SemaObjC/interface-layout.m
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 %s -fsyntax-only -verify -triple i386-apple-darwin9 -fobjc-runtime=macosx-fragile-10.5
+// expected-no-diagnostics
typedef struct objc_object {} *id;
typedef signed char BOOL;
typedef unsigned int NSUInteger;
diff --git a/test/SemaObjC/interface-scope-2.m b/test/SemaObjC/interface-scope-2.m
index 60fd900285d0..ffd740f7fc44 100644
--- a/test/SemaObjC/interface-scope-2.m
+++ b/test/SemaObjC/interface-scope-2.m
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify -triple i686-apple-darwin9 -Wno-objc-root-class %s
+// expected-no-diagnostics
// FIXME: must also compile as Objective-C++
// <rdar://problem/6487662>
diff --git a/test/SemaObjC/interface-scope.m b/test/SemaObjC/interface-scope.m
index 0671dae61e82..9875eca5bf16 100644
--- a/test/SemaObjC/interface-scope.m
+++ b/test/SemaObjC/interface-scope.m
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
+// expected-no-diagnostics
@interface I1 {
@private
diff --git a/test/SemaObjC/ivar-access-package.m b/test/SemaObjC/ivar-access-package.m
index abc3420f1bd2..ff5ff4e68aec 100644
--- a/test/SemaObjC/ivar-access-package.m
+++ b/test/SemaObjC/ivar-access-package.m
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
+// expected-no-diagnostics
typedef unsigned char BOOL;
diff --git a/test/SemaObjC/ivar-in-class-extension-error.m b/test/SemaObjC/ivar-in-class-extension-error.m
index b22b7984cc2d..c90e4780688d 100644
--- a/test/SemaObjC/ivar-in-class-extension-error.m
+++ b/test/SemaObjC/ivar-in-class-extension-error.m
@@ -4,12 +4,12 @@
@interface A @end
@interface A () {
- int _p0; // expected-error {{ivars may not be placed in class extension}}
+ int _p0; // expected-error {{instance variables may not be placed in class extension}}
}
@property int p0;
@end
@interface A(CAT) {
- int _p1; // expected-error {{ivars may not be placed in categories}}
+ int _p1; // expected-error {{instance variables may not be placed in categories}}
}
@end
diff --git a/test/SemaObjC/ivar-in-class-extension.m b/test/SemaObjC/ivar-in-class-extension.m
index cf02d26e7219..dc5cf6abf677 100644
--- a/test/SemaObjC/ivar-in-class-extension.m
+++ b/test/SemaObjC/ivar-in-class-extension.m
@@ -32,7 +32,7 @@ int fn3(SomeClass *obj) {
@interface SomeClass (Category)
{
- int categoryIvar; // expected-error {{ivars may not be placed in categories}}
+ int categoryIvar; // expected-error {{instance variables may not be placed in categories}}
}
@end
diff --git a/test/SemaObjC/ivar-sem-check-2.m b/test/SemaObjC/ivar-sem-check-2.m
index bf884b3d9d27..b1e1f2c2efad 100644
--- a/test/SemaObjC/ivar-sem-check-2.m
+++ b/test/SemaObjC/ivar-sem-check-2.m
@@ -16,8 +16,8 @@
@implementation Sub
@synthesize value; // expected-note {{previous use is here}}
-@synthesize value1=value; // expected-error {{synthesized properties 'value1' and 'value' both claim ivar 'value'}}
-@synthesize prop=value2; // expected-error {{property 'prop' attempting to use ivar 'value2' declared in super class 'Super'}}
+@synthesize value1=value; // expected-error {{synthesized properties 'value1' and 'value' both claim instance variable 'value'}}
+@synthesize prop=value2; // expected-error {{property 'prop' attempting to use instance variable 'value2' declared in super class 'Super'}}
@end
diff --git a/test/SemaObjC/method-attributes.m b/test/SemaObjC/method-attributes.m
index f7252af1f1b7..b402d52a42a1 100644
--- a/test/SemaObjC/method-attributes.m
+++ b/test/SemaObjC/method-attributes.m
@@ -55,3 +55,32 @@
- (IBAction)doSomething2:(id)sender {} // expected-warning {{attributes on method implementation and its declaration must match}}
- (IBAction)doSomething3:(id)sender {}
@end
+
+// rdar://11593375
+@interface NSObject @end
+
+@interface Test : NSObject
+-(id)method __attribute__((deprecated));
+-(id)method1;
+-(id)method2 __attribute__((aligned(16)));
+- (id) method3: (int)arg1 __attribute__((aligned(16))) __attribute__((deprecated)) __attribute__((unavailable)); // expected-note {{method 'method3:' declared here}}
+- (id) method4: (int)arg1 __attribute__((aligned(16))) __attribute__((deprecated)) __attribute__((unavailable));
+@end
+
+@implementation Test
+-(id)method __attribute__((aligned(16))) __attribute__((aligned(16))) __attribute__((deprecated)) {
+ return self;
+}
+-(id)method1 __attribute__((aligned(16))) {
+ return self;
+}
+-(id)method2 {
+ return self;
+}
+- (id) method3: (int)arg1 __attribute__((deprecated)) __attribute__((unavailable)) { // expected-warning {{attributes on method implementation and its declaration must match}}
+ return self;
+}
+- (id) method4: (int)arg1 __attribute__((aligned(16))) __attribute__((deprecated)) __attribute__((unavailable)) {
+ return self;
+}
+@end
diff --git a/test/SemaObjC/method-conflict-1.m b/test/SemaObjC/method-conflict-1.m
index ca91ebdef237..654cd0166fb5 100644
--- a/test/SemaObjC/method-conflict-1.m
+++ b/test/SemaObjC/method-conflict-1.m
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
+// expected-no-diagnostics
// This test case tests the default behavior.
diff --git a/test/SemaObjC/method-in-class-extension-impl.m b/test/SemaObjC/method-in-class-extension-impl.m
index c205322dec9d..d74ae8f154fd 100644
--- a/test/SemaObjC/method-in-class-extension-impl.m
+++ b/test/SemaObjC/method-in-class-extension-impl.m
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
+// expected-no-diagnostics
// rdar://8530080
@protocol ViewDelegate @end
diff --git a/test/SemaObjC/method-lookup-2.m b/test/SemaObjC/method-lookup-2.m
index 53cae8371252..25963048f749 100644
--- a/test/SemaObjC/method-lookup-2.m
+++ b/test/SemaObjC/method-lookup-2.m
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
+// expected-no-diagnostics
typedef signed char BOOL;
@protocol NSObject
diff --git a/test/SemaObjC/method-lookup-4.m b/test/SemaObjC/method-lookup-4.m
index 700565e78329..807d4dae36b5 100644
--- a/test/SemaObjC/method-lookup-4.m
+++ b/test/SemaObjC/method-lookup-4.m
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
+// expected-no-diagnostics
@interface NSObject {}
diff --git a/test/SemaObjC/method-typecheck-1.m b/test/SemaObjC/method-typecheck-1.m
index ee068d0bfccf..2d4e868cdf82 100644
--- a/test/SemaObjC/method-typecheck-1.m
+++ b/test/SemaObjC/method-typecheck-1.m
@@ -34,3 +34,18 @@
(float) x { return 0; } // expected-warning {{conflicting parameter types in implementation of 'setCat:': 'int' vs 'float'}}
+ (int) cCat: (int) x { return 0; } // expected-warning {{conflicting return type in implementation of 'cCat:': 'void' vs 'int'}}
@end
+
+// rdar://12519216
+// test that when implementation implements method in a category, types match.
+@interface testObject {}
+@end
+
+@interface testObject(Category)
+- (float)returnCGFloat; // expected-note {{previous definition is here}}
+@end
+
+@implementation testObject
+- (double)returnCGFloat { // expected-warning {{conflicting return type in implementation of 'returnCGFloat': 'float' vs 'double'}}
+ return 0.0;
+}
+@end
diff --git a/test/SemaObjC/nested-typedef-decl.m b/test/SemaObjC/nested-typedef-decl.m
index bb01eadba94b..7051ac689cc0 100644
--- a/test/SemaObjC/nested-typedef-decl.m
+++ b/test/SemaObjC/nested-typedef-decl.m
@@ -1,5 +1,6 @@
// RUN: %clang_cc1 -x objective-c -fsyntax-only -verify -Wno-objc-root-class %s
// RUN: %clang_cc1 -x objective-c++ -fsyntax-only -verify -Wno-objc-root-class %s
+// expected-no-diagnostics
// rdar://10041908
@interface Bar {
diff --git a/test/SemaObjC/no-gc-weak-test.m b/test/SemaObjC/no-gc-weak-test.m
index dd9b73cc0de3..6539a9b7f149 100644
--- a/test/SemaObjC/no-gc-weak-test.m
+++ b/test/SemaObjC/no-gc-weak-test.m
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -triple i386-apple-darwin9 -fsyntax-only -verify -Wno-objc-root-class %s
+// expected-no-diagnostics
@interface Subtask
{
diff --git a/test/SemaObjC/no-ivar-access-control.m b/test/SemaObjC/no-ivar-access-control.m
index 6f00b1a367c7..9bbff24be990 100644
--- a/test/SemaObjC/no-ivar-access-control.m
+++ b/test/SemaObjC/no-ivar-access-control.m
@@ -1,5 +1,6 @@
// RUN: %clang_cc1 -fsyntax-only -fdebugger-support -verify -Wno-objc-root-class %s
// RUN: %clang_cc1 -x objective-c++ -fdebugger-support -fsyntax-only -verify -Wno-objc-root-class %s
+// expected-no-diagnostics
// rdar://10997647
@interface I
diff --git a/test/SemaObjC/no-ivar-in-interface-block.m b/test/SemaObjC/no-ivar-in-interface-block.m
index 215db6150e53..af4797f1b64e 100644
--- a/test/SemaObjC/no-ivar-in-interface-block.m
+++ b/test/SemaObjC/no-ivar-in-interface-block.m
@@ -3,11 +3,11 @@
@interface I
{
- @protected int P_IVAR; // expected-warning {{declaration of ivars in the interface is deprecated}}
+ @protected int P_IVAR; // expected-warning {{declaration of instance variables in the interface is deprecated}}
- @public int PU_IVAR; // expected-warning {{declaration of ivars in the interface is deprecated}}
+ @public int PU_IVAR; // expected-warning {{declaration of instance variables in the interface is deprecated}}
- @private int PRV_IVAR; // expected-warning {{declaration of ivars in the interface is deprecated}}
+ @private int PRV_IVAR; // expected-warning {{declaration of instance variables in the interface is deprecated}}
}
@end
diff --git a/test/SemaObjC/no-warn-qual-mismatch.m b/test/SemaObjC/no-warn-qual-mismatch.m
index 1e3c18636674..9638da46c18f 100644
--- a/test/SemaObjC/no-warn-qual-mismatch.m
+++ b/test/SemaObjC/no-warn-qual-mismatch.m
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
+// expected-no-diagnostics
// radar 7211563
@interface X
diff --git a/test/SemaObjC/no-warn-synth-protocol-meth.m b/test/SemaObjC/no-warn-synth-protocol-meth.m
index 103f6bbd02ed..cdb855e15473 100644
--- a/test/SemaObjC/no-warn-synth-protocol-meth.m
+++ b/test/SemaObjC/no-warn-synth-protocol-meth.m
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
+// expected-no-diagnostics
@protocol CYCdef
- (int)name;
diff --git a/test/SemaObjC/no-warn-unimpl-method.m b/test/SemaObjC/no-warn-unimpl-method.m
index dd6e3ad4aa32..174f70a4ee5c 100644
--- a/test/SemaObjC/no-warn-unimpl-method.m
+++ b/test/SemaObjC/no-warn-unimpl-method.m
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -verify %s
+// expected-no-diagnostics
// This program tests that if class implements the forwardInvocation method, then
// every method possible is implemented in the class and should not issue
// warning of the "Method definition not found" kind. */
diff --git a/test/SemaObjC/no-warning-unavail-unimp.m b/test/SemaObjC/no-warning-unavail-unimp.m
index 88d519d115c4..d5a4eac99067 100644
--- a/test/SemaObjC/no-warning-unavail-unimp.m
+++ b/test/SemaObjC/no-warning-unavail-unimp.m
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
+// expected-no-diagnostics
// rdar://9651605
@interface Foo
diff --git a/test/SemaObjC/nonarc-weak.m b/test/SemaObjC/nonarc-weak.m
new file mode 100644
index 000000000000..ab51875de1cf
--- /dev/null
+++ b/test/SemaObjC/nonarc-weak.m
@@ -0,0 +1,16 @@
+// RUN: %clang_cc1 -triple x86_64-apple-macosx10.8.0 -fobjc-runtime=macosx-10.8.0 -fsyntax-only -Wunused-function %s > %t.nonarc 2>&1
+// RUN: %clang_cc1 -triple x86_64-apple-macosx10.8.0 -fobjc-runtime=macosx-10.8.0 -fsyntax-only -Wunused-function -fobjc-arc %s > %t.arc 2>&1
+// RUN: FileCheck -input-file=%t.nonarc %s
+// RUN: FileCheck -input-file=%t.arc -check-prefix=ARC %s
+
+static void bar() {} // Intentionally unused.
+
+void foo(id self) {
+ __weak id weakSelf = self;
+}
+
+// CHECK: 9:13: warning: __weak attribute cannot be specified on an automatic variable when ARC is not enabled
+// CHECK: 6:13: warning: unused function 'bar'
+// CHECK: 2 warnings generated
+// ARC: 6:13: warning: unused function 'bar'
+// ARC: 1 warning generated
diff --git a/test/SemaObjC/nonnull.m b/test/SemaObjC/nonnull.m
index a38c0acb84f1..902105b924dd 100644
--- a/test/SemaObjC/nonnull.m
+++ b/test/SemaObjC/nonnull.m
@@ -1,6 +1,7 @@
#include "nonnull.h"
// RUN: %clang_cc1 -fblocks -fsyntax-only -verify -Wno-objc-root-class %s
+// REQUIRES: LP64
@class NSObject;
diff --git a/test/SemaObjC/nowarn-superclass-method-mismatch.m b/test/SemaObjC/nowarn-superclass-method-mismatch.m
index b211cdea37b0..d522e899eb0b 100644
--- a/test/SemaObjC/nowarn-superclass-method-mismatch.m
+++ b/test/SemaObjC/nowarn-superclass-method-mismatch.m
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -fobjc-arc -fobjc-runtime-has-weak -Wsuper-class-method-mismatch -verify %s
+// expected-no-diagnostics
// rdar://11793793
@class NSString;
diff --git a/test/SemaObjC/nsobject-attribute-1.m b/test/SemaObjC/nsobject-attribute-1.m
index 72d8fa693a9b..4a75f5ce8efa 100644
--- a/test/SemaObjC/nsobject-attribute-1.m
+++ b/test/SemaObjC/nsobject-attribute-1.m
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fblocks -fsyntax-only -verify -Wno-objc-root-class %s
+// expected-no-diagnostics
@interface NSObject
- (id)self;
diff --git a/test/SemaObjC/nsobject-attribute.m b/test/SemaObjC/nsobject-attribute.m
index e3f28740dc8f..b794eafc9ed7 100644
--- a/test/SemaObjC/nsobject-attribute.m
+++ b/test/SemaObjC/nsobject-attribute.m
@@ -5,8 +5,8 @@ static int count;
static CGColorRef tmp = 0;
typedef struct S1 __attribute__ ((NSObject)) CGColorRef1; // expected-error {{__attribute ((NSObject)) is for pointer types only}}
-typedef void * __attribute__ ((NSObject)) CGColorRef2; // expected-error {{__attribute ((NSObject)) is for pointer types only}}
-
+typedef void * __attribute__ ((NSObject)) CGColorRef2; // no-warning
+typedef void * CFTypeRef;
@interface HandTested {
@public
@@ -14,9 +14,11 @@ typedef void * __attribute__ ((NSObject)) CGColorRef2; // expected-error {{__at
}
@property(copy) CGColorRef x;
-// rdar: // 7809460
-typedef struct CGColor * __attribute__((NSObject)) CGColorRefNoNSObject;
+// rdar://problem/7809460
+typedef struct CGColor * __attribute__((NSObject)) CGColorRefNoNSObject; // no-warning
@property (nonatomic, retain) CGColorRefNoNSObject color;
+// rdar://problem/12197822
+@property (strong) __attribute__((NSObject)) CFTypeRef myObj; // no-warning
@end
void setProperty(id self, id value) {
@@ -29,6 +31,7 @@ id getProperty(id self) {
@implementation HandTested
@synthesize x=x;
+@synthesize myObj;
@dynamic color;
@end
diff --git a/test/SemaObjC/objc-buffered-methods.m b/test/SemaObjC/objc-buffered-methods.m
index a4b83be0cd70..55e489798d77 100644
--- a/test/SemaObjC/objc-buffered-methods.m
+++ b/test/SemaObjC/objc-buffered-methods.m
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
+// expected-no-diagnostics
// rdar://8843851
int* global;
diff --git a/test/SemaObjC/objc-literal-comparison.m b/test/SemaObjC/objc-literal-comparison.m
index f1aa8ecd91e2..0a1058291e4e 100644
--- a/test/SemaObjC/objc-literal-comparison.m
+++ b/test/SemaObjC/objc-literal-comparison.m
@@ -2,6 +2,10 @@
// RUN: %clang_cc1 -fsyntax-only -Wno-everything -Wobjc-literal-compare "-Dnil=(id)0" -verify %s
// RUN: %clang_cc1 -fsyntax-only -Wno-everything -Wobjc-literal-compare "-Dnil=0" -verify %s
+// RUN: %clang_cc1 -fsyntax-only -Wno-everything -Wobjc-literal-compare -fobjc-arc "-Dnil=((id)0)" -verify %s
+// RUN: %clang_cc1 -fsyntax-only -Wno-everything -Wobjc-literal-compare -fobjc-arc "-Dnil=(id)0" -verify %s
+// RUN: %clang_cc1 -fsyntax-only -Wno-everything -Wobjc-literal-compare -fobjc-arc "-Dnil=0" -verify %s
+
// (test the warning flag as well)
typedef signed char BOOL;
diff --git a/test/SemaObjC/objc-qualified-property-lookup.m b/test/SemaObjC/objc-qualified-property-lookup.m
index 48b28cb05ca5..b5cadbd6037f 100644
--- a/test/SemaObjC/objc-qualified-property-lookup.m
+++ b/test/SemaObjC/objc-qualified-property-lookup.m
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
+// expected-no-diagnostics
// rdar://9078584
@interface NSObject @end
diff --git a/test/SemaObjC/overriding-property-in-class-extension.m b/test/SemaObjC/overriding-property-in-class-extension.m
new file mode 100644
index 000000000000..77efd556928c
--- /dev/null
+++ b/test/SemaObjC/overriding-property-in-class-extension.m
@@ -0,0 +1,27 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -Weverything %s
+// expected-no-diagnostics
+// rdar://12103434
+
+@class NSString;
+
+@interface NSObject @end
+
+@interface MyClass : NSObject
+
+@property (nonatomic, copy, readonly) NSString* name;
+
+@end
+
+@interface MyClass () {
+ NSString* _name;
+}
+
+@property (nonatomic, copy) NSString* name;
+
+@end
+
+@implementation MyClass
+
+@synthesize name = _name;
+
+@end
diff --git a/test/SemaObjC/pedantic-dynamic-test.m b/test/SemaObjC/pedantic-dynamic-test.m
index 61f36b333826..1fc5ef66b88a 100644
--- a/test/SemaObjC/pedantic-dynamic-test.m
+++ b/test/SemaObjC/pedantic-dynamic-test.m
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify -pedantic -Wno-objc-root-class %s
+// expected-no-diagnostics
// rdar: // 7860960
@interface I
diff --git a/test/SemaObjC/pragma-pack.m b/test/SemaObjC/pragma-pack.m
index ba39257fcd50..6869bca90d0a 100644
--- a/test/SemaObjC/pragma-pack.m
+++ b/test/SemaObjC/pragma-pack.m
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -triple i686-apple-darwin9 -fsyntax-only -verify -Wno-objc-root-class %s
+// expected-no-diagnostics
// Make sure pragma pack works inside ObjC methods. <rdar://problem/10893316>
@interface X
diff --git a/test/SemaObjC/property-11.m b/test/SemaObjC/property-11.m
index 297611574eae..e41a840c9224 100644
--- a/test/SemaObjC/property-11.m
+++ b/test/SemaObjC/property-11.m
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
+// expected-no-diagnostics
@interface NSSound
@end
diff --git a/test/SemaObjC/property-13.m b/test/SemaObjC/property-13.m
index 2ca341652686..362d6d3b15d1 100644
--- a/test/SemaObjC/property-13.m
+++ b/test/SemaObjC/property-13.m
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s -Wno-unreachable-code
+// expected-no-diagnostics
@interface NSObject
+ alloc;
diff --git a/test/SemaObjC/property-2.m b/test/SemaObjC/property-2.m
index f95af5990275..3298ee5766e2 100644
--- a/test/SemaObjC/property-2.m
+++ b/test/SemaObjC/property-2.m
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
+// expected-no-diagnostics
@interface Tester
@property char PropertyAtomic_char;
diff --git a/test/SemaObjC/property-6.m b/test/SemaObjC/property-6.m
index 933a4f0673f8..f2a293ec5ea4 100644
--- a/test/SemaObjC/property-6.m
+++ b/test/SemaObjC/property-6.m
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify -fobjc-exceptions %s
+// expected-no-diagnostics
# 1 "<command line>"
# 1 "/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h" 1 3
typedef signed char BOOL;
diff --git a/test/SemaObjC/property-7.m b/test/SemaObjC/property-7.m
index e6cba50f7a61..3d03b8f680d3 100644
--- a/test/SemaObjC/property-7.m
+++ b/test/SemaObjC/property-7.m
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
+// expected-no-diagnostics
typedef signed char BOOL;
typedef struct _NSZone NSZone;
diff --git a/test/SemaObjC/property-8.m b/test/SemaObjC/property-8.m
index 8647aba8c3e7..da97ffcb7ed0 100644
--- a/test/SemaObjC/property-8.m
+++ b/test/SemaObjC/property-8.m
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
+// expected-no-diagnostics
typedef signed char BOOL;
typedef unsigned int NSUInteger;
typedef struct _NSZone NSZone;
diff --git a/test/SemaObjC/property-9-impl-method.m b/test/SemaObjC/property-9-impl-method.m
index 84eb3635e2ac..d6220f66fa9a 100644
--- a/test/SemaObjC/property-9-impl-method.m
+++ b/test/SemaObjC/property-9-impl-method.m
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 %s -fsyntax-only -verify
+// expected-no-diagnostics
// rdar://5967199
typedef signed char BOOL;
diff --git a/test/SemaObjC/property-and-class-extension.m b/test/SemaObjC/property-and-class-extension.m
index 7040078416cd..80cedc372dd2 100644
--- a/test/SemaObjC/property-and-class-extension.m
+++ b/test/SemaObjC/property-and-class-extension.m
@@ -31,6 +31,6 @@ extension but ignore any ivars in superclass class extensions.
@end
@implementation SomeClass
-@synthesize Property; // expected-error {{property 'Property' attempting to use ivar 'Property' declared in super class 'Super'}}
+@synthesize Property; // expected-error {{property 'Property' attempting to use instance variable 'Property' declared in super class 'Super'}}
@synthesize Property1; // OK
@end
diff --git a/test/SemaObjC/property-and-ivar-use.m b/test/SemaObjC/property-and-ivar-use.m
index 5b40d854898e..a9974945b2c0 100644
--- a/test/SemaObjC/property-and-ivar-use.m
+++ b/test/SemaObjC/property-and-ivar-use.m
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
+// expected-no-diagnostics
// Do not issue error if 'ivar' used previously belongs to the inherited class
// and has same name as @dynalic property in current class.
diff --git a/test/SemaObjC/property-deprecated-warning.m b/test/SemaObjC/property-deprecated-warning.m
new file mode 100644
index 000000000000..aa7b764fab19
--- /dev/null
+++ b/test/SemaObjC/property-deprecated-warning.m
@@ -0,0 +1,64 @@
+// RUN: %clang_cc1 -fsyntax-only -triple thumbv6-apple-ios3.0 -verify -Wno-objc-root-class %s
+// RUN: %clang_cc1 -x objective-c++ -fsyntax-only -triple thumbv6-apple-ios3.0 -verify -Wno-objc-root-class %s
+// rdar://12324295
+
+typedef signed char BOOL;
+
+@protocol P
+@property(nonatomic,assign) id ptarget __attribute__((availability(ios,introduced=2.0,deprecated=3.0))); // expected-note 2 {{property 'ptarget' is declared deprecated here}}
+@end
+
+@protocol P1<P>
+- (void)setPtarget:(id)arg; // expected-note {{method 'setPtarget:' declared here}}
+@end
+
+
+@interface UITableViewCell<P1>
+@property(nonatomic,assign) id target __attribute__((availability(ios,introduced=2.0,deprecated=3.0))); // expected-note {{property 'target' is declared deprecated here}}
+@end
+
+@interface PSTableCell : UITableViewCell
+ - (void)setTarget:(id)target; // expected-note {{method 'setTarget:' declared here}}
+@end
+
+@interface UITableViewCell(UIDeprecated)
+@property(nonatomic,assign) id dep_target __attribute__((availability(ios,introduced=2.0,deprecated=3.0))); // expected-note {{method 'dep_target' declared here}} \
+ // expected-note 2 {{property 'dep_target' is declared deprecated here}} \
+ // expected-note {{method 'setDep_target:' declared here}}
+@end
+
+@implementation PSTableCell
+- (void)setTarget:(id)target {};
+- (void)setPtarget:(id)val {};
+- (void) Meth {
+ [self setTarget: (id)0]; // expected-warning {{'setTarget:' is deprecated: first deprecated in iOS 3.0}}
+ [self setDep_target: [self dep_target]]; // expected-warning {{'dep_target' is deprecated: first deprecated in iOS 3.0}} \
+ // expected-warning {{'setDep_target:' is deprecated: first deprecated in iOS 3.0}}
+
+ [self setPtarget: (id)0]; // expected-warning {{setPtarget:' is deprecated: first deprecated in iOS 3.0}}
+}
+@end
+
+
+@interface CustomAccessorNames
+@property(getter=isEnabled,assign) BOOL enabled __attribute__((availability(ios,introduced=2.0,deprecated=3.0))); // expected-note {{method 'isEnabled' declared here}} expected-note {{property 'enabled' is declared deprecated here}}
+
+@property(setter=setNewDelegate:,assign) id delegate __attribute__((availability(ios,introduced=2.0,deprecated=3.0))); // expected-note {{method 'setNewDelegate:' declared here}} expected-note {{property 'delegate' is declared deprecated here}}
+@end
+
+void testCustomAccessorNames(CustomAccessorNames *obj) {
+ if ([obj isEnabled]) // expected-warning {{'isEnabled' is deprecated: first deprecated in iOS 3.0}}
+ [obj setNewDelegate:0]; // expected-warning {{'setNewDelegate:' is deprecated: first deprecated in iOS 3.0}}
+}
+
+
+@interface ProtocolInCategory
+@end
+
+@interface ProtocolInCategory (TheCategory) <P1>
+- (id)ptarget; // expected-note {{method 'ptarget' declared here}}
+@end
+
+id useDeprecatedProperty(ProtocolInCategory *obj) {
+ return [obj ptarget]; // expected-warning {{'ptarget' is deprecated: first deprecated in iOS 3.0}}
+}
diff --git a/test/SemaObjC/property-dot-receiver.m b/test/SemaObjC/property-dot-receiver.m
index c5a928b4e892..4a5f1959dc0e 100644
--- a/test/SemaObjC/property-dot-receiver.m
+++ b/test/SemaObjC/property-dot-receiver.m
@@ -1,5 +1,6 @@
// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
// RUN: %clang_cc1 -x objective-c++ -fsyntax-only -verify -Wno-objc-root-class %s
+// expected-no-diagnostics
// rdar://8962253
@interface Singleton {
diff --git a/test/SemaObjC/property-impl-misuse.m b/test/SemaObjC/property-impl-misuse.m
index 939909e9b279..c49916e10d90 100644
--- a/test/SemaObjC/property-impl-misuse.m
+++ b/test/SemaObjC/property-impl-misuse.m
@@ -12,7 +12,7 @@
@dynamic X; // expected-note {{previous declaration is here}}
@dynamic X; // expected-error {{property 'X' is already implemented}}
@synthesize Y; // expected-note {{previous use is here}}
-@synthesize Z=Y; // expected-error {{synthesized properties 'Z' and 'Y' both claim ivar 'Y'}}
+@synthesize Z=Y; // expected-error {{synthesized properties 'Z' and 'Y' both claim instance variable 'Y'}}
@end
// rdar://8703553
diff --git a/test/SemaObjC/property-in-class-extension-1.m b/test/SemaObjC/property-in-class-extension-1.m
new file mode 100644
index 000000000000..ab461ef6c191
--- /dev/null
+++ b/test/SemaObjC/property-in-class-extension-1.m
@@ -0,0 +1,59 @@
+// RUN: %clang_cc1 -fsyntax-only -triple x86_64-apple-darwin11 -fobjc-runtime-has-weak -verify -Weverything %s
+// RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin11 -fobjc-runtime-has-weak -fsyntax-only -verify -Weverything %s
+// rdar://12103400
+
+@class NSString;
+
+@interface MyClass
+
+@property (nonatomic, readonly) NSString* addingMemoryModel;
+
+@property (nonatomic, copy, readonly) NSString* matchingMemoryModel;
+
+@property (nonatomic, retain, readonly) NSString* addingNoNewMemoryModel;
+
+@property (readonly) NSString* none;
+@property (readonly) NSString* none1;
+
+@property (assign, readonly) NSString* changeMemoryModel; // expected-note {{property declared here}}
+
+@property (readonly) __weak id weak_prop;
+@property (readonly) __weak id weak_prop1;
+
+@property (assign, readonly) NSString* assignProperty;
+
+@property (readonly) NSString* readonlyProp;
+
+
+
+@end
+
+@interface MyClass ()
+{
+ NSString* _name;
+}
+
+@property (nonatomic, copy) NSString* addingMemoryModel;
+@property (nonatomic, copy) NSString* matchingMemoryModel;
+@property () NSString* addingNoNewMemoryModel;
+@property () NSString* none;
+@property (readwrite, retain) NSString* none1;
+
+@property (retain) NSString* changeMemoryModel; // expected-warning {{property attribute in class extension does not match the primary class}}
+@property () __weak id weak_prop;
+@property (readwrite) __weak id weak_prop1;
+
+@property (assign, readwrite) NSString* assignProperty;
+@property (assign) NSString* readonlyProp;
+@end
+
+// rdar://12214070
+@interface radar12214070
+@property (nonatomic, atomic, readonly) float propertyName; // expected-error {{property attributes 'atomic' and 'nonatomic' are mutually exclusive}}
+@end
+
+@interface radar12214070 ()
+@property (atomic, nonatomic, readonly, readwrite) float propertyName; // expected-error {{property attributes 'readonly' and 'readwrite' are mutually exclusive}} \
+ // expected-error {{property attributes 'atomic' and 'nonatomic' are mutually exclusive}}
+@end
+
diff --git a/test/SemaObjC/property-ivar-mismatch.m b/test/SemaObjC/property-ivar-mismatch.m
index a0d1c9da7b80..148fa8ebb27f 100644
--- a/test/SemaObjC/property-ivar-mismatch.m
+++ b/test/SemaObjC/property-ivar-mismatch.m
@@ -3,24 +3,24 @@
@interface Test4
{
- char ivar; // expected-note{{ivar is declared here}}
+ char ivar; // expected-note{{instance variable is declared here}}
}
@property int prop;
@end
@implementation Test4
-@synthesize prop = ivar; // expected-error {{type of property 'prop' ('int') does not match type of ivar 'ivar' ('char')}}
+@synthesize prop = ivar; // expected-error {{type of property 'prop' ('int') does not match type of instance variable 'ivar' ('char')}}
@end
@interface Test5
{
- void * _P; // expected-note {{ivar is declared here}}
+ void * _P; // expected-note {{instance variable is declared here}}
}
@property int P;
@end
@implementation Test5
-@synthesize P=_P; // expected-error {{ype of property 'P' ('int') does not match type of ivar '_P' ('void *')}}
+@synthesize P=_P; // expected-error {{ype of property 'P' ('int') does not match type of instance variable '_P' ('void *')}}
@end
diff --git a/test/SemaObjC/property-method-lookup-impl.m b/test/SemaObjC/property-method-lookup-impl.m
index 19d4e684944a..dc490edb1fdc 100644
--- a/test/SemaObjC/property-method-lookup-impl.m
+++ b/test/SemaObjC/property-method-lookup-impl.m
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
+// expected-no-diagnostics
@interface SSyncCEList
{
diff --git a/test/SemaObjC/property-nonfragile-abi.m b/test/SemaObjC/property-nonfragile-abi.m
index 55bf91f383d4..3684cb00ebb4 100644
--- a/test/SemaObjC/property-nonfragile-abi.m
+++ b/test/SemaObjC/property-nonfragile-abi.m
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
+// expected-no-diagnostics
typedef signed char BOOL;
diff --git a/test/SemaObjC/property-noprotocol-warning.m b/test/SemaObjC/property-noprotocol-warning.m
index 71bb86a301ef..e4752c52bc99 100644
--- a/test/SemaObjC/property-noprotocol-warning.m
+++ b/test/SemaObjC/property-noprotocol-warning.m
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
+// expected-no-diagnostics
@interface Object
diff --git a/test/SemaObjC/property-redundant-decl-accessor.m b/test/SemaObjC/property-redundant-decl-accessor.m
index 3b0e825b9d8c..6ff2ceab7ea2 100644
--- a/test/SemaObjC/property-redundant-decl-accessor.m
+++ b/test/SemaObjC/property-redundant-decl-accessor.m
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -Werror -verify -Wno-objc-root-class %s
+// expected-no-diagnostics
@interface MyClass {
const char *_myName;
diff --git a/test/SemaObjC/property-weak.m b/test/SemaObjC/property-weak.m
index a4397a684fc0..d57774bf0fec 100644
--- a/test/SemaObjC/property-weak.m
+++ b/test/SemaObjC/property-weak.m
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -triple i386-apple-darwin9 -fsyntax-only -verify %s
+// expected-no-diagnostics
@interface foo
@property(nonatomic) int foo __attribute__((weak_import));
diff --git a/test/SemaObjC/property.m b/test/SemaObjC/property.m
index d6495b42308d..76fdf5b242a2 100644
--- a/test/SemaObjC/property.m
+++ b/test/SemaObjC/property.m
@@ -2,7 +2,7 @@
@interface I
{
- int IVAR; // expected-note{{ivar is declared here}}
+ int IVAR; // expected-note{{instance variable is declared here}}
int name;
}
@property int d1;
@@ -18,7 +18,7 @@
@synthesize d1; // expected-error {{synthesized property 'd1' must either be named the same as}}
@dynamic bad; // expected-error {{property implementation must have its declaration in interface 'I'}}
@synthesize prop_id; // expected-error {{synthesized property 'prop_id' must either be named the same}} // expected-note {{previous declaration is here}}
-@synthesize prop_id = IVAR; // expected-error {{type of property 'prop_id' ('id') does not match type of ivar 'IVAR' ('int')}} // expected-error {{property 'prop_id' is already implemented}}
+@synthesize prop_id = IVAR; // expected-error {{type of property 'prop_id' ('id') does not match type of instance variable 'IVAR' ('int')}} // expected-error {{property 'prop_id' is already implemented}}
@synthesize name; // OK! property with same name as an accessible ivar of same name
@end
diff --git a/test/SemaObjC/props-on-prots.m b/test/SemaObjC/props-on-prots.m
index c01e8338628e..6962d6f895c9 100644
--- a/test/SemaObjC/props-on-prots.m
+++ b/test/SemaObjC/props-on-prots.m
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
+// expected-no-diagnostics
typedef signed char BOOL;
@class NSInvocation, NSMethodSignature, NSCoder, NSString, NSEnumerator;
diff --git a/test/SemaObjC/protocol-expr-1.m b/test/SemaObjC/protocol-expr-1.m
index fe01d1d47a8d..94a0d9e3e8b5 100644
--- a/test/SemaObjC/protocol-expr-1.m
+++ b/test/SemaObjC/protocol-expr-1.m
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
+// expected-no-diagnostics
@protocol fproto;
diff --git a/test/SemaObjC/protocol-implementation-inherited.m b/test/SemaObjC/protocol-implementation-inherited.m
index c333bb5042d2..45010d5e2e75 100644
--- a/test/SemaObjC/protocol-implementation-inherited.m
+++ b/test/SemaObjC/protocol-implementation-inherited.m
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
+// expected-no-diagnostics
@protocol P0
-bar;
diff --git a/test/SemaObjC/protocol-lookup-2.m b/test/SemaObjC/protocol-lookup-2.m
index bf0752312e44..9e8ed8a627b9 100644
--- a/test/SemaObjC/protocol-lookup-2.m
+++ b/test/SemaObjC/protocol-lookup-2.m
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
+// expected-no-diagnostics
@interface NSObject @end
@protocol ProtocolA
diff --git a/test/SemaObjC/protocol-lookup.m b/test/SemaObjC/protocol-lookup.m
index ed3fbe0f72bf..26718ae2eaa1 100644
--- a/test/SemaObjC/protocol-lookup.m
+++ b/test/SemaObjC/protocol-lookup.m
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
+// expected-no-diagnostics
@protocol NSObject
- retain;
- release;
diff --git a/test/SemaObjC/protocol-qualified-class-unsupported.m b/test/SemaObjC/protocol-qualified-class-unsupported.m
index 4bf6b289e7b7..777084d8554b 100644
--- a/test/SemaObjC/protocol-qualified-class-unsupported.m
+++ b/test/SemaObjC/protocol-qualified-class-unsupported.m
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
+// expected-no-diagnostics
#include <stddef.h>
diff --git a/test/SemaObjC/rdar6248119.m b/test/SemaObjC/rdar6248119.m
index 046992c52fe5..a49597839129 100644
--- a/test/SemaObjC/rdar6248119.m
+++ b/test/SemaObjC/rdar6248119.m
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only %s -verify -fobjc-exceptions
+// expected-no-diagnostics
// Test case for:
// <rdar://problem/6248119> @finally doesn't introduce a new scope
diff --git a/test/SemaObjC/restrict-id-type.m b/test/SemaObjC/restrict-id-type.m
index b24fcb0185e4..24f74c93a027 100644
--- a/test/SemaObjC/restrict-id-type.m
+++ b/test/SemaObjC/restrict-id-type.m
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -std=gnu99 -fsyntax-only -verify %s
+// expected-no-diagnostics
void f0(restrict id a0) {}
diff --git a/test/SemaObjC/selector-1.m b/test/SemaObjC/selector-1.m
index 16d44cbb5515..186e19fead83 100644
--- a/test/SemaObjC/selector-1.m
+++ b/test/SemaObjC/selector-1.m
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -verify %s
+// expected-no-diagnostics
@interface I
- (id) compare: (char) arg1;
diff --git a/test/SemaObjC/selector-2.m b/test/SemaObjC/selector-2.m
index fb75369a9a10..17d1872cc7ea 100644
--- a/test/SemaObjC/selector-2.m
+++ b/test/SemaObjC/selector-2.m
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -Wselector -verify %s
+// expected-no-diagnostics
// rdar://8851684
@interface I
- length;
diff --git a/test/SemaObjC/self-declared-in-block.m b/test/SemaObjC/self-declared-in-block.m
index 40a03313b693..36a9ef571d5a 100644
--- a/test/SemaObjC/self-declared-in-block.m
+++ b/test/SemaObjC/self-declared-in-block.m
@@ -1,5 +1,6 @@
// RUN: %clang_cc1 -fsyntax-only -triple x86_64-apple-darwin10 -fblocks -verify -Wno-objc-root-class %s
// RUN: %clang_cc1 -x objective-c++ -fsyntax-only -triple x86_64-apple-darwin10 -fblocks -verify -Wno-objc-root-class %s
+// expected-no-diagnostics
// rdar://9154582
@interface Blocky @end
diff --git a/test/SemaObjC/self-in-function.m b/test/SemaObjC/self-in-function.m
index 9027a947a03c..a14ad909dde3 100644
--- a/test/SemaObjC/self-in-function.m
+++ b/test/SemaObjC/self-in-function.m
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -fblocks -verify %s
+// expected-no-diagnostics
// rdar://9181463
typedef struct objc_class *Class;
diff --git a/test/SemaObjC/setter-dotsyntax.m b/test/SemaObjC/setter-dotsyntax.m
index e0b51e8b51c6..ec47ee2a8e9f 100644
--- a/test/SemaObjC/setter-dotsyntax.m
+++ b/test/SemaObjC/setter-dotsyntax.m
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
+// expected-no-diagnostics
// rdar://8528170
@interface NSObject @end
diff --git a/test/SemaObjC/super-cat-prot.m b/test/SemaObjC/super-cat-prot.m
index 3e289860c06e..fd9399499ec7 100644
--- a/test/SemaObjC/super-cat-prot.m
+++ b/test/SemaObjC/super-cat-prot.m
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
+// expected-no-diagnostics
typedef signed char BOOL;
typedef unsigned int NSUInteger;
@class NSInvocation, NSMethodSignature, NSCoder, NSString, NSEnumerator;
diff --git a/test/SemaObjC/super-dealloc-attribute.m b/test/SemaObjC/super-dealloc-attribute.m
new file mode 100644
index 000000000000..35f6dac9bf42
--- /dev/null
+++ b/test/SemaObjC/super-dealloc-attribute.m
@@ -0,0 +1,87 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
+// RUN: %clang_cc1 -x objective-c++ -fsyntax-only -verify -Wno-objc-root-class %s
+// RUN: %clang_cc1 -fsyntax-only -fobjc-arc -verify -Wno-objc-root-class %s
+// RUN: %clang_cc1 -x objective-c++ -fobjc-arc -fsyntax-only -verify -Wno-objc-root-class %s
+// rdar://6386358
+
+#if __has_attribute(objc_requires_super)
+#define NS_REQUIRES_SUPER __attribute((objc_requires_super))
+#endif
+
+@protocol NSObject // expected-note {{protocol is declared here}}
+- MyDealloc NS_REQUIRES_SUPER; // expected-warning {{'objc_requires_super' attribute cannot be applied to methods in protocols}}
+@end
+
+@interface Root
+- MyDealloc __attribute((objc_requires_super));
+- (void)XXX __attribute((objc_requires_super));
+- (void) dealloc __attribute((objc_requires_super)); // expected-warning {{'objc_requires_super' attribute cannot be applied to dealloc}}
+- (void) MyDeallocMeth; // Method in root is not annotated.
+- (void) AnnotMyDeallocMeth __attribute((objc_requires_super));
+- (void) AnnotMyDeallocMethCAT NS_REQUIRES_SUPER;
+
++ (void)registerClass:(id)name __attribute((objc_requires_super));
+@end
+
+@interface Baz : Root<NSObject>
+- MyDealloc;
+- (void) MyDeallocMeth __attribute((objc_requires_super)); // 'Baz' author has annotated method
+- (void) AnnotMyDeallocMeth; // Annotated in root but not here. Annotation is inherited though
+- (void) AnnotMeth __attribute((objc_requires_super)); // 'Baz' author has annotated method
+@end
+
+@implementation Baz
+- MyDealloc {
+ [super MyDealloc];
+ return 0;
+}
+
+- (void)XXX {
+ [super MyDealloc];
+} // expected-warning {{method possibly missing a [super XXX] call}}
+
+- (void) MyDeallocMeth {} // No warning here.
+- (void) AnnotMyDeallocMeth{} // expected-warning {{method possibly missing a [super AnnotMyDeallocMeth] call}}
+- (void) AnnotMeth{}; // No warning here. Annotation is in its class.
+
++ (void)registerClass:(id)name {} // expected-warning {{method possibly missing a [super registerClass:] call}}
+@end
+
+@interface Bar : Baz
+@end
+
+@implementation Bar
+- (void) MyDeallocMeth {} // expected-warning {{method possibly missing a [super MyDeallocMeth] call}}
+- (void) AnnotMyDeallocMeth{} // expected-warning {{method possibly missing a [super AnnotMyDeallocMeth] call}}
+- (void) AnnotMeth{}; // expected-warning {{method possibly missing a [super AnnotMeth] call}}
+@end
+
+@interface Bar(CAT)
+- (void) AnnotMyDeallocMethCAT; // Annotated in root but not here. Annotation is inherited though
+- (void) AnnotMethCAT __attribute((objc_requires_super));
+@end
+
+@implementation Bar(CAT)
+- (void) MyDeallocMeth {} // expected-warning {{method possibly missing a [super MyDeallocMeth] call}}
+- (void) AnnotMyDeallocMeth{} // expected-warning {{method possibly missing a [super AnnotMyDeallocMeth] call}}
+- (void) AnnotMeth{}; // expected-warning {{method possibly missing a [super AnnotMeth] call}}
+- (void) AnnotMyDeallocMethCAT{}; // expected-warning {{method possibly missing a [super AnnotMyDeallocMethCAT] call}}
+- (void) AnnotMethCAT {};
+@end
+
+
+@interface Valid : Baz
+@end
+
+@implementation Valid
+
+- (void)MyDeallocMeth {
+ [super MyDeallocMeth]; // no-warning
+}
+
+
++ (void)registerClass:(id)name {
+ [super registerClass:name]; // no-warning
+}
+
+@end
diff --git a/test/SemaObjC/super-property-message-expr.m b/test/SemaObjC/super-property-message-expr.m
index c25164e15973..81b8f8fa1d6c 100644
--- a/test/SemaObjC/super-property-message-expr.m
+++ b/test/SemaObjC/super-property-message-expr.m
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
+// expected-no-diagnostics
@interface SStoreNodeInfo
diff --git a/test/SemaObjC/super-property-notation.m b/test/SemaObjC/super-property-notation.m
index 7d3f7c70bb52..0c17bb9392ec 100644
--- a/test/SemaObjC/super-property-notation.m
+++ b/test/SemaObjC/super-property-notation.m
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
+// expected-no-diagnostics
@interface B
+(int) classGetter;
diff --git a/test/SemaObjC/synth-provisional-ivars-1.m b/test/SemaObjC/synth-provisional-ivars-1.m
index 0e155f4840f0..92a9d7165f13 100644
--- a/test/SemaObjC/synth-provisional-ivars-1.m
+++ b/test/SemaObjC/synth-provisional-ivars-1.m
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -fobjc-default-synthesize-properties -verify -Wno-objc-root-class %s
+// expected-no-diagnostics
// rdar://8913053
typedef unsigned char BOOL;
diff --git a/test/SemaObjC/synthesize-setter-contclass.m b/test/SemaObjC/synthesize-setter-contclass.m
index d75441518725..df954db2dbb5 100644
--- a/test/SemaObjC/synthesize-setter-contclass.m
+++ b/test/SemaObjC/synthesize-setter-contclass.m
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
+// expected-no-diagnostics
@interface TestClass
{
diff --git a/test/SemaObjC/transparent-union.m b/test/SemaObjC/transparent-union.m
index 6f2dbf915ac0..bda0a54bb63f 100644
--- a/test/SemaObjC/transparent-union.m
+++ b/test/SemaObjC/transparent-union.m
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
+// expected-no-diagnostics
typedef union {
struct xx_object_s *_do;
diff --git a/test/SemaObjC/ucn-objc-string.m b/test/SemaObjC/ucn-objc-string.m
index 6070278bb134..f80d1ffb9156 100644
--- a/test/SemaObjC/ucn-objc-string.m
+++ b/test/SemaObjC/ucn-objc-string.m
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 %s -verify -fsyntax-only
+// expected-no-diagnostics
@class NSString;
extern void NSLog(NSString *format, ...) __attribute__((format(__NSString__, 1, 2)));
diff --git a/test/SemaObjC/uninit-variables.m b/test/SemaObjC/uninit-variables.m
index cad0f54b2dd3..a3312264f0c2 100644
--- a/test/SemaObjC/uninit-variables.m
+++ b/test/SemaObjC/uninit-variables.m
@@ -1,5 +1,16 @@
// RUN: %clang_cc1 -fsyntax-only -Wuninitialized -fsyntax-only -fblocks %s -verify
+#include <stdarg.h>
+
+@interface NSObject {} @end
+@class NSString;
+
+@interface NSException
++ (void)raise:(NSString *)name format:(NSString *)format, ...;
++ (void)raise:(NSString *)name format:(NSString *)format arguments:(va_list)argList;
+- (void)raise;
+@end
+
// Duplicated from uninit-variables.c.
// Test just to ensure the analysis is working.
int test1() {
@@ -25,3 +36,21 @@ void test3() {
}
}
+int test_abort_on_exceptions(int y, NSException *e, NSString *s, int *z, ...) {
+ int x; // expected-note {{initialize the variable 'x' to silence this warning}}
+ if (y == 1) {
+ va_list alist;
+ va_start(alist, z);
+ [NSException raise:@"Blah" format:@"Blah %@" arguments:alist];
+ return x;
+ }
+ else if (y == 2) {
+ [NSException raise:@"Blah" format:s];
+ return x;
+ }
+ else if (y == 3) {
+ [e raise];
+ return x;
+ }
+ return x; // expected-warning {{variable 'x' is uninitialized when used here}}
+}
diff --git a/test/SemaObjC/unused.m b/test/SemaObjC/unused.m
index 5c7542bf4738..3fd1cf04673f 100644
--- a/test/SemaObjC/unused.m
+++ b/test/SemaObjC/unused.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -verify -Wunused -Wunused-parameter -fsyntax-only -Wno-objc-root-class %s
+// RUN: %clang_cc1 -verify -Wused-but-marked-unused -Wno-objc-protocol-method-implementation -Wunused -Wunused-parameter -fsyntax-only -Wno-objc-root-class %s
int printf(const char *, ...);
@@ -25,12 +25,17 @@ void test2() {
}
@interface foo
-- (int)meth: (int)x: (int)y: (int)z ;
+- (int)meth: (int)x : (int)y : (int)z ;
@end
@implementation foo
-- (int) meth: (int)x:
-(int)y: // expected-warning{{unused}}
+- (int) meth: (int)x: // expected-warning {{'x' used as the name of the previous parameter rather than as part of the selector}} \
+ // expected-note {{introduce a parameter name to make 'x' part of the selector}} \
+ // expected-note {{or insert whitespace before ':' to use 'x' as parameter name and have an empty entry in the selector}}
+
+(int)y: // expected-warning {{unused}} expected-warning {{'y' used as the name of the previous parameter rather than as part of the selector}} \
+ // expected-note {{introduce a parameter name to make 'y' part of the selector}} \
+ // expected-note {{or insert whitespace before ':' to use 'y' as parameter name and have an empty entry in the selector}}
(int) __attribute__((unused))z { return x; }
@end
@@ -53,3 +58,17 @@ void test2() {
// rdar://10777111
static NSString *x = @"hi"; // expected-warning {{unused variable 'x'}}
+
+// rdar://12233989
+@interface TestTransitiveUnused
+- (void) a __attribute__((unused));
+- (void) b __attribute__((unused));
+@end
+
+@interface TestTransitiveUnused(CAT)
+@end
+
+@implementation TestTransitiveUnused(CAT)
+- (void) b {}
+- (void) a { [self b]; }
+@end
diff --git a/test/SemaObjC/va-method-1.m b/test/SemaObjC/va-method-1.m
index fe7ccd7632cd..4959df31990f 100644
--- a/test/SemaObjC/va-method-1.m
+++ b/test/SemaObjC/va-method-1.m
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
+// expected-no-diagnostics
#include <stdarg.h>
diff --git a/test/SemaObjC/warn-direct-ivar-access.m b/test/SemaObjC/warn-direct-ivar-access.m
index d2295f47655e..088fe0fa264f 100644
--- a/test/SemaObjC/warn-direct-ivar-access.m
+++ b/test/SemaObjC/warn-direct-ivar-access.m
@@ -15,7 +15,7 @@ __attribute__((objc_root_class)) @interface MyObject {
@implementation MyObject
@synthesize myMaster = _myMaster;
-@synthesize isTickledPink = _isTickledPink; // expected-error {{existing ivar '_isTickledPink' for property 'isTickledPink'}}
+@synthesize isTickledPink = _isTickledPink; // expected-error {{existing instance variable '_isTickledPink' for property 'isTickledPink'}}
@synthesize myIntProp = _myIntProp;
- (void) doSomething {
diff --git a/test/SemaObjC/warn-implicit-self-in-block.m b/test/SemaObjC/warn-implicit-self-in-block.m
new file mode 100644
index 000000000000..a7ee16ec700d
--- /dev/null
+++ b/test/SemaObjC/warn-implicit-self-in-block.m
@@ -0,0 +1,18 @@
+// RUN: %clang_cc1 -x objective-c -fobjc-arc -fblocks -Wimplicit-retain-self -verify %s
+// rdar://11194874
+
+@interface Root @end
+
+@interface I : Root
+{
+ int _bar;
+}
+@end
+
+@implementation I
+ - (void)foo{
+ ^{
+ _bar = 3; // expected-warning {{block implicitly retains 'self'; explicitly mention 'self' to indicate this is intended behavior}}
+ }();
+ }
+@end
diff --git a/test/SemaObjC/warn-isa-ref.m b/test/SemaObjC/warn-isa-ref.m
index 1932a029b0c7..9d7abd48adff 100644
--- a/test/SemaObjC/warn-isa-ref.m
+++ b/test/SemaObjC/warn-isa-ref.m
@@ -41,7 +41,7 @@ static void func() {
@interface BaseClass {
@public
- Class isa; // expected-note 3 {{ivar is declared here}}
+ Class isa; // expected-note 3 {{instance variable is declared here}}
}
@end
diff --git a/test/SemaObjC/warn-retain-cycle.m b/test/SemaObjC/warn-retain-cycle.m
index 00fd234a0c09..eb4e966c7726 100644
--- a/test/SemaObjC/warn-retain-cycle.m
+++ b/test/SemaObjC/warn-retain-cycle.m
@@ -1,4 +1,6 @@
-// RUN: %clang_cc1 -fsyntax-only -fobjc-runtime-has-weak -fobjc-arc -fblocks -verify -Wno-objc-root-class %s
+// RUN: %clang_cc1 -fsyntax-only -fobjc-runtime-has-weak -fobjc-arc -fblocks -verify -Wno-objc-root-class -Wno-implicit-retain-self %s
+
+void *_Block_copy(const void *block);
@interface Test0
- (void) setBlock: (void(^)(void)) block;
@@ -24,6 +26,10 @@ void test0(Test0 *x) {
[weakx addBlock: ^{ [x actNow]; }];
[weakx setBlock: ^{ [x actNow]; }];
weakx.block = ^{ [x actNow]; };
+
+ // rdar://11702054
+ x.block = ^{ (void)x.actNow; }; // expected-warning {{capturing 'x' strongly in this block is likely to lead to a retain cycle}} \
+ // expected-note {{block will be retained by the captured object}}
}
@interface BlockOwner
@@ -123,3 +129,58 @@ void doSomething(unsigned v);
}
@end
+
+void testBlockVariable() {
+ typedef void (^block_t)(void);
+
+ // This case will be caught by -Wuninitialized, and does not create a
+ // retain cycle.
+ block_t a1 = ^{
+ a1(); // no-warning
+ };
+
+ // This case will also be caught by -Wuninitialized.
+ block_t a2;
+ a2 = ^{
+ a2(); // no-warning
+ };
+
+ __block block_t b1 = ^{ // expected-note{{block will be retained by the captured object}}
+ b1(); // expected-warning{{capturing 'b1' strongly in this block is likely to lead to a retain cycle}}
+ };
+
+ __block block_t b2;
+ b2 = ^{ // expected-note{{block will be retained by the captured object}}
+ b2(); // expected-warning{{capturing 'b2' strongly in this block is likely to lead to a retain cycle}}
+ };
+}
+
+
+@interface NSObject
+- (id)copy;
+
+- (void (^)(void))someRandomMethodReturningABlock;
+@end
+
+
+void testCopying(Test0 *obj) {
+ typedef void (^block_t)(void);
+
+ [obj setBlock:[^{ // expected-note{{block will be retained by the captured object}}
+ [obj actNow]; // expected-warning{{capturing 'obj' strongly in this block is likely to lead to a retain cycle}}
+ } copy]];
+
+ [obj addBlock:(__bridge_transfer block_t)_Block_copy((__bridge void *)^{ // expected-note{{block will be retained by the captured object}}
+ [obj actNow]; // expected-warning{{capturing 'obj' strongly in this block is likely to lead to a retain cycle}}
+ })];
+
+ [obj addBlock:[^{
+ [obj actNow]; // no-warning
+ } someRandomMethodReturningABlock]];
+
+ extern block_t someRandomFunctionReturningABlock(block_t);
+ [obj setBlock:someRandomFunctionReturningABlock(^{
+ [obj actNow]; // no-warning
+ })];
+}
+
diff --git a/test/SemaObjC/warning-missing-selector-name.m b/test/SemaObjC/warning-missing-selector-name.m
new file mode 100644
index 000000000000..d43031eee0b5
--- /dev/null
+++ b/test/SemaObjC/warning-missing-selector-name.m
@@ -0,0 +1,32 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
+// RUN: %clang_cc1 -x objective-c++ -fsyntax-only -verify -Wno-objc-root-class -Wmissing-selector-name %s
+// rdar://12263549
+
+@interface Super @end
+@interface INTF : Super
+-(void) Name1:(id)Arg1 Name2:(id)Arg2; // Name1:Name2:
+-(void) Name1:(id) Name2:(id)Arg2; // expected-warning {{'Name2' used as the name of the previous parameter rather than as part of the selector}} \
+ // expected-note {{introduce a parameter name to make 'Name2' part of the selector}} \
+ // expected-note {{or insert whitespace before ':' to use 'Name2' as parameter name and have an empty entry in the selector}}
+-(void) Name1:(id)Arg1 Name2:(id)Arg2 Name3:(id)Arg3; // Name1:Name2:Name3:
+-(void) Name1:(id)Arg1 Name2:(id) Name3:(id)Arg3; // expected-warning {{'Name3' used as the name of the previous parameter rather than as part of the selector}} \
+ // expected-note {{introduce a parameter name to make 'Name3' part of the selector}} \
+ // expected-note {{or insert whitespace before ':' to use 'Name3' as parameter name and have an empty entry in the selector}}
+- method:(id) second:(id)second; // expected-warning {{'second' used as the name of the previous parameter rather than as part of the selector}} \
+ // expected-note {{introduce a parameter name to make 'second' part of the selector}} \
+ // expected-note {{or insert whitespace before ':' to use 'second' as parameter name and have an empty entry in the selector}} \
+ // expected-note {{method definition for 'method::' not found}}
+
+@end
+
+@implementation INTF // expected-warning {{incomplete implementation}}
+-(void) Name1:(id)Arg1 Name2:(id)Arg2{}
+-(void) Name1:(id) Name2:(id)Arg2 {} // expected-warning {{'Name2' used as the name of the previous parameter rather than as part of the selector}} \
+ // expected-note {{introduce a parameter name to make 'Name2' part of the selector}} \
+ // expected-note {{or insert whitespace before ':' to use 'Name2' as parameter name and have an empty entry in the selector}}
+-(void) Name1:(id)Arg1 Name2:(id)Arg2 Name3:(id)Arg3 {}
+-(void) Name1:(id)Arg1 Name2:(id) Name3:(id)Arg3 {} // expected-warning {{'Name3' used as the name of the previous parameter rather than as part of the selector}} \
+ // expected-note {{introduce a parameter name to make 'Name3' part of the selector}} \
+ // expected-note {{or insert whitespace before ':' to use 'Name3' as parameter name and have an empty entry in the selector}}
+- method:(id)first second:(id)second {return 0; }
+@end
diff --git a/test/SemaObjC/weak-property.m b/test/SemaObjC/weak-property.m
index 8a2adf99b7e4..141c35b9acea 100644
--- a/test/SemaObjC/weak-property.m
+++ b/test/SemaObjC/weak-property.m
@@ -19,6 +19,6 @@
@end
@implementation WeakPropertyTest
-@synthesize x; // expected-error {{existing ivar 'x' for __weak property 'x' must be __weak}}
+@synthesize x; // expected-error {{existing instance variable 'x' for __weak property 'x' must be __weak}}
@dynamic value1, value, value2, v1,v2,v3,v4;
@end
diff --git a/test/SemaObjC/weak-receiver-warn.m b/test/SemaObjC/weak-receiver-warn.m
index 547f0087bc40..88b867ed0d04 100644
--- a/test/SemaObjC/weak-receiver-warn.m
+++ b/test/SemaObjC/weak-receiver-warn.m
@@ -9,13 +9,13 @@
void test0(Test0 *x) {
__weak Test0 *weakx = x;
- [x addBlock: ^{ [weakx actNow]; }]; // expected-warning {{weak receiver may be unpredictably null in ARC mode}}
- [x setBlock: ^{ [weakx actNow]; }]; // expected-warning {{weak receiver may be unpredictably null in ARC mode}}
- x.block = ^{ [weakx actNow]; }; // expected-warning {{weak receiver may be unpredictably null in ARC mode}}
+ [x addBlock: ^{ [weakx actNow]; }]; // expected-warning {{weak receiver may be unpredictably set to nil}} expected-note {{assign the value to a strong variable to keep the object alive during use}}
+ [x setBlock: ^{ [weakx actNow]; }]; // expected-warning {{weak receiver may be unpredictably set to nil}} expected-note {{assign the value to a strong variable to keep the object alive during use}}
+ x.block = ^{ [weakx actNow]; }; // expected-warning {{weak receiver may be unpredictably set to nil}} expected-note {{assign the value to a strong variable to keep the object alive during use}}
- [weakx addBlock: ^{ [x actNow]; }]; // expected-warning {{weak receiver may be unpredictably null in ARC mode}}
- [weakx setBlock: ^{ [x actNow]; }]; // expected-warning {{weak receiver may be unpredictably null in ARC mode}}
- weakx.block = ^{ [x actNow]; }; // expected-warning {{weak receiver may be unpredictably null in ARC mode}}
+ [weakx addBlock: ^{ [x actNow]; }]; // expected-warning {{weak receiver may be unpredictably set to nil}} expected-note {{assign the value to a strong variable to keep the object alive during use}}
+ [weakx setBlock: ^{ [x actNow]; }]; // expected-warning {{weak receiver may be unpredictably set to nil}} expected-note {{assign the value to a strong variable to keep the object alive during use}}
+ weakx.block = ^{ [x actNow]; }; // expected-warning {{weak receiver may be unpredictably set to nil}} expected-note {{assign the value to a strong variable to keep the object alive during use}}
}
@interface Test
@@ -36,12 +36,12 @@ void test0(Test0 *x) {
if (self.weak_atomic_prop) {
self.weak_atomic_prop = 0;
}
- [self.weak_prop Meth]; // expected-warning {{weak property may be unpredictably null in ARC mode}}
+ [self.weak_prop Meth]; // expected-warning {{weak property may be unpredictably set to nil}} expected-note {{assign the value to a strong variable to keep the object alive during use}}
id pi = self.P;
- [self.weak_atomic_prop Meth]; // expected-warning {{weak property may be unpredictably null in ARC mode}}
+ [self.weak_atomic_prop Meth]; // expected-warning {{weak property may be unpredictably set to nil}} expected-note {{assign the value to a strong variable to keep the object alive during use}}
- [self.P Meth]; // expected-warning {{weak implicit property may be unpredictably null in ARC mode}}
+ [self.P Meth]; // expected-warning {{weak implicit property may be unpredictably set to nil}} expected-note {{assign the value to a strong variable to keep the object alive during use}}
}
- (__weak id) P { return 0; }
@@ -52,7 +52,7 @@ void test0(Test0 *x) {
@interface MyClass {
__weak MyClass *_parent;
}
-@property (weak) MyClass *parent; // expected-note 2 {{property declared here}}
+@property (weak) MyClass *parent; // expected-note 4 {{property declared here}}
@end
@implementation MyClass
@@ -60,9 +60,9 @@ void test0(Test0 *x) {
- (void)doSomething
{
- [[self parent] doSomething]; // expected-warning {{weak property may be unpredictably null in ARC mode}}
+ [[self parent] doSomething]; // expected-warning {{weak property may be unpredictably set to nil}} expected-note {{assign the value to a strong variable to keep the object alive during use}}
- (void)self.parent.doSomething; // expected-warning {{weak property may be unpredictably null in ARC mode}}
+ (void)self.parent.doSomething; // expected-warning {{weak property may be unpredictably set to nil}} expected-note {{assign the value to a strong variable to keep the object alive during use}}
}
@end
@@ -74,7 +74,27 @@ void test0(Test0 *x) {
@end
void testProtocol(id <MyProtocol> input) {
- [[input object] Meth]; // expected-warning {{weak property may be unpredictably null in ARC mode}}
- [input.object Meth]; // expected-warning {{weak property may be unpredictably null in ARC mode}}
+ [[input object] Meth]; // expected-warning {{weak property may be unpredictably set to nil}} expected-note {{assign the value to a strong variable to keep the object alive during use}}
+ [input.object Meth]; // expected-warning {{weak property may be unpredictably set to nil}} expected-note {{assign the value to a strong variable to keep the object alive during use}}
}
+
+@interface Subclass : MyClass
+// Unnecessarily redeclare -parent.
+- (id)parent;
+@end
+
+@implementation Subclass
+
+- (id)parent {
+ return [super parent];
+}
+
+- (void)doSomethingElse {
+ [[self parent] doSomething]; // expected-warning {{weak property may be unpredictably set to nil}} expected-note {{assign the value to a strong variable to keep the object alive during use}}
+
+ (void)self.parent.doSomething; // expected-warning {{weak property may be unpredictably set to nil}} expected-note {{assign the value to a strong variable to keep the object alive during use}}
+}
+
+@end
+
diff --git a/test/SemaObjC/writable-property-in-superclass.m b/test/SemaObjC/writable-property-in-superclass.m
index bbd1f16cffc0..99be5413d7ae 100644
--- a/test/SemaObjC/writable-property-in-superclass.m
+++ b/test/SemaObjC/writable-property-in-superclass.m
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
+// expected-no-diagnostics
@interface MessageStore
@property (assign, readonly) int P;