summaryrefslogtreecommitdiffstats
path: root/test/SemaObjC
diff options
context:
space:
mode:
Diffstat (limited to 'test/SemaObjC')
-rw-r--r--test/SemaObjC/arc-bridged-cast.m2
-rw-r--r--test/SemaObjC/arc-cf.m12
-rw-r--r--test/SemaObjC/arc-decls.m24
-rw-r--r--test/SemaObjC/arc-dict-bridged-cast.m2
-rw-r--r--test/SemaObjC/arc-property-lifetime.m32
-rw-r--r--test/SemaObjC/arc-readonly-property-ivar-1.m4
-rw-r--r--test/SemaObjC/arc-repeated-weak.mm15
-rw-r--r--test/SemaObjC/arc-unavailable-for-weakref.m4
-rw-r--r--test/SemaObjC/arc.m19
-rw-r--r--test/SemaObjC/attr-objc-exception.m4
-rw-r--r--test/SemaObjC/attr-objc-gc.m6
-rw-r--r--test/SemaObjC/attr-print.m9
-rw-r--r--test/SemaObjC/attr-root-class.m6
-rw-r--r--test/SemaObjC/bad-property-synthesis-crash.m2
-rw-r--r--test/SemaObjC/blocks.m15
-rw-r--r--test/SemaObjC/call-super-2.m6
-rw-r--r--test/SemaObjC/class-def-test-1.m5
-rw-r--r--test/SemaObjC/compare-qualified-id.m2
-rw-r--r--test/SemaObjC/conditional-expr.m3
-rw-r--r--test/SemaObjC/conversion.m17
-rw-r--r--test/SemaObjC/dealloc.m2
-rw-r--r--test/SemaObjC/default-synthesize-1.m2
-rw-r--r--test/SemaObjC/default-synthesize-2.m4
-rw-r--r--test/SemaObjC/default-synthesize-3.m74
-rw-r--r--test/SemaObjC/default-synthesize.m2
-rw-r--r--test/SemaObjC/deprecated-objc-introspection.m7
-rw-r--r--test/SemaObjC/direct-synthesized-ivar-access.m2
-rw-r--r--test/SemaObjC/error-outof-scope-property-use.m8
-rw-r--r--test/SemaObjC/foreach.m6
-rw-r--r--test/SemaObjC/format-arg-attribute.m34
-rw-r--r--test/SemaObjC/format-strings-objc.m7
-rw-r--r--test/SemaObjC/forward-protocol-incomplete-impl-warn.m2
-rw-r--r--test/SemaObjC/iboutlet.m4
-rw-r--r--test/SemaObjC/iboutletcollection-attr.m17
-rw-r--r--test/SemaObjC/idiomatic-parentheses.m7
-rw-r--r--test/SemaObjC/instancetype.m2
-rw-r--r--test/SemaObjC/ivar-lookup.m74
-rw-r--r--test/SemaObjC/ivar-ref-misuse.m5
-rw-r--r--test/SemaObjC/message.m2
-rw-r--r--test/SemaObjC/method-bad-param.m14
-rw-r--r--test/SemaObjC/method-conflict-2.m49
-rw-r--r--test/SemaObjC/method-not-defined.m2
-rw-r--r--test/SemaObjC/method-sentinel-attr.m2
-rw-r--r--test/SemaObjC/missing-atend-metadata.m2
-rw-r--r--test/SemaObjC/nsobject-attribute.m2
-rw-r--r--test/SemaObjC/objc-array-literal.m16
-rw-r--r--test/SemaObjC/objc-dictionary-literal.m2
-rw-r--r--test/SemaObjC/objcbridge-attribute.m66
-rw-r--r--test/SemaObjC/overriding-property-in-class-extension.m3
-rw-r--r--test/SemaObjC/property-5.m2
-rw-r--r--test/SemaObjC/property-ambiguous-synthesis.m48
-rw-r--r--test/SemaObjC/property-category-1.m2
-rw-r--r--test/SemaObjC/property-choose-expr.m14
-rw-r--r--test/SemaObjC/property-in-class-extension-1.m9
-rw-r--r--test/SemaObjC/property-ownership-attr.m19
-rw-r--r--test/SemaObjC/protocol-id-test-1.m4
-rw-r--r--test/SemaObjC/protocol-id-test-2.m2
-rw-r--r--test/SemaObjC/provisional-ivar-lookup.m2
-rw-r--r--test/SemaObjC/related-result-type-inference.m18
-rw-r--r--test/SemaObjC/selector-3.m35
-rw-r--r--test/SemaObjC/self-comparison.m12
-rw-r--r--test/SemaObjC/sign-conversion.m39
-rw-r--r--test/SemaObjC/super-class-protocol-conformance.m2
-rw-r--r--test/SemaObjC/super-dealloc-attribute.m49
-rw-r--r--test/SemaObjC/super-property-notation.m2
-rw-r--r--test/SemaObjC/synth-provisional-ivars-1.m2
-rw-r--r--test/SemaObjC/synth-provisional-ivars.m2
-rw-r--r--test/SemaObjC/synthesized-ivar.m2
-rw-r--r--test/SemaObjC/tentative-property-decl.m4
-rw-r--r--test/SemaObjC/unimplemented-protocol-prop.m2
-rw-r--r--test/SemaObjC/unsued-backing-ivar-warning.m76
-rw-r--r--test/SemaObjC/warn-direct-ivar-access.m2
-rw-r--r--test/SemaObjC/warn-implicit-atomic-property.m2
-rw-r--r--test/SemaObjC/warn-missing-super.m2
-rw-r--r--test/SemaObjC/warn-retain-block-property.m4
75 files changed, 874 insertions, 91 deletions
diff --git a/test/SemaObjC/arc-bridged-cast.m b/test/SemaObjC/arc-bridged-cast.m
index b5ec36a..439d382 100644
--- a/test/SemaObjC/arc-bridged-cast.m
+++ b/test/SemaObjC/arc-bridged-cast.m
@@ -1,5 +1,5 @@
// RUN: %clang_cc1 -triple x86_64-apple-darwin11 -fsyntax-only -fobjc-arc -fblocks -verify %s
-// RUN: %clang_cc1 -triple x86_64-apple-darwin11 -fsyntax-only -fobjc-arc -fblocks -fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s
+// RUN: not %clang_cc1 -triple x86_64-apple-darwin11 -fsyntax-only -fobjc-arc -fblocks -fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s
typedef const void *CFTypeRef;
CFTypeRef CFBridgingRetain(id X);
diff --git a/test/SemaObjC/arc-cf.m b/test/SemaObjC/arc-cf.m
index 5754720..d71d274 100644
--- a/test/SemaObjC/arc-cf.m
+++ b/test/SemaObjC/arc-cf.m
@@ -45,3 +45,15 @@ void test2() {
x = (id) CFMakeString3(); // expected-error {{requires a bridged cast}} expected-note {{CFBridgingRelease call to transfer}}
x = (id) CFCreateString3(); // expected-error {{requires a bridged cast}} expected-note {{CFBridgingRelease call to transfer}}
}
+
+// rdar://14569171
+@interface NSString @end
+typedef signed int SInt32;
+#pragma clang arc_cf_code_audited begin
+extern SInt32 CFStringGetIntValue(CFStringRef str); // expected-note {{passing argument to parameter 'str' here}}
+#pragma clang arc_cf_code_audited end
+
+void test3() {
+ NSString* answer = @"42";
+ int ans = CFStringGetIntValue(answer); // expected-error {{incompatible pointer types passing retainable parameter of type 'NSString *__strong'to a CF function expecting 'CFStringRef'}}
+}
diff --git a/test/SemaObjC/arc-decls.m b/test/SemaObjC/arc-decls.m
index cdf6cc6..903cea2 100644
--- a/test/SemaObjC/arc-decls.m
+++ b/test/SemaObjC/arc-decls.m
@@ -99,3 +99,27 @@ void test7(void) {
I *y;
J **py = &y; // expected-error {{pointer to non-const type 'J *' with no explicit ownership}} expected-warning {{incompatible pointer types initializing}}
}
+
+void func(void) __attribute__((objc_ownership(none))); // expected-warning {{'objc_ownership' only applies to Objective-C object or block pointer types; type here is 'void (void)'}}
+struct __attribute__((objc_ownership(none))) S2 {}; // expected-error {{'objc_ownership' attribute only applies to variables}}
+@interface I2
+ @property __attribute__((objc_ownership(frob))) id i; // expected-warning {{'objc_ownership' attribute argument not supported: 'frob'}}
+@end
+
+// rdar://15304886
+@interface NSObject @end
+
+@interface ControllerClass : NSObject @end
+
+@interface SomeClassOwnedByController
+@property (readonly) ControllerClass *controller; // expected-note {{property declared here}}
+
+// rdar://15465916
+@property (readonly, weak) ControllerClass *weak_controller;
+@end
+
+@interface SomeClassOwnedByController ()
+@property (readwrite, weak) ControllerClass *controller; // expected-warning {{primary property declaration is implicitly strong while redeclaration in class extension is weak}}
+
+@property (readwrite, weak) ControllerClass *weak_controller;
+@end
diff --git a/test/SemaObjC/arc-dict-bridged-cast.m b/test/SemaObjC/arc-dict-bridged-cast.m
index ea64840..e00c47f 100644
--- a/test/SemaObjC/arc-dict-bridged-cast.m
+++ b/test/SemaObjC/arc-dict-bridged-cast.m
@@ -1,5 +1,5 @@
// RUN: %clang_cc1 -triple x86_64-apple-darwin11 -fsyntax-only -fobjc-arc -verify %s
-// RUN: %clang_cc1 -triple x86_64-apple-darwin11 -fsyntax-only -fobjc-arc -fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s
+// RUN: not %clang_cc1 -triple x86_64-apple-darwin11 -fsyntax-only -fobjc-arc -fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s
// rdar://11913153
typedef const struct __CFString * CFStringRef;
diff --git a/test/SemaObjC/arc-property-lifetime.m b/test/SemaObjC/arc-property-lifetime.m
index b824b2a..ed72e8c 100644
--- a/test/SemaObjC/arc-property-lifetime.m
+++ b/test/SemaObjC/arc-property-lifetime.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple x86_64-apple-darwin11 -fobjc-default-synthesize-properties -fobjc-runtime-has-weak -fsyntax-only -fobjc-arc -verify -Wno-objc-root-class %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin11 -fobjc-runtime-has-weak -fsyntax-only -fobjc-arc -verify -Wno-objc-root-class %s
// rdar://9340606
@interface Foo {
@@ -171,7 +171,12 @@ void foo(Baz *f) {
// rdar://11253688
@interface Boom
-@property (readonly) const void * innerPointer __attribute__((objc_returns_inner_pointer)); // expected-error {{'objc_returns_inner_pointer' attribute only applies to methods}}
+{
+ const void * innerPointerIvar __attribute__((objc_returns_inner_pointer)); // expected-error {{'objc_returns_inner_pointer' attribute only applies to methods and properties}}
+}
+@property (readonly) Boom * NotInnerPointer __attribute__((objc_returns_inner_pointer)); // expected-warning {{'objc_returns_inner_pointer' attribute only applies to properties that return a non-retainable pointer}}
+- (Boom *) NotInnerPointerMethod __attribute__((objc_returns_inner_pointer)); // expected-warning {{'objc_returns_inner_pointer' attribute only applies to methods that return a non-retainable pointer}}
+@property (readonly) const void * innerPointer __attribute__((objc_returns_inner_pointer));
@end
@interface Foo2 {
@@ -182,3 +187,26 @@ void foo(Baz *f) {
@implementation Foo2
@end
+
+// rdar://13885083
+@interface NSObject
+-(id)init;
+@end
+
+typedef char BOOL;
+@interface Test13885083 : NSObject
+
+@property (nonatomic, assign) BOOL retain; // expected-error {{ARC forbids synthesis of 'retain'}}
+
+-(id)init;
+
+@end
+
+@implementation Test13885083
+-(id) init
+{
+ self = [super init];
+ return self;
+}
+@end
+
diff --git a/test/SemaObjC/arc-readonly-property-ivar-1.m b/test/SemaObjC/arc-readonly-property-ivar-1.m
index 418f90d..2b98f01 100644
--- a/test/SemaObjC/arc-readonly-property-ivar-1.m
+++ b/test/SemaObjC/arc-readonly-property-ivar-1.m
@@ -1,5 +1,5 @@
-// 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
+// RUN: %clang_cc1 -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++ -triple x86_64-apple-darwin11 -fobjc-runtime-has-weak -fobjc-arc -fsyntax-only -verify -Wno-objc-root-class %s
// expected-no-diagnostics
// rdar:// 10558871
diff --git a/test/SemaObjC/arc-repeated-weak.mm b/test/SemaObjC/arc-repeated-weak.mm
index b5d9002..64df92a 100644
--- a/test/SemaObjC/arc-repeated-weak.mm
+++ b/test/SemaObjC/arc-repeated-weak.mm
@@ -410,3 +410,18 @@ void doubleLevelAccessIvar(Test *a, Test *b) {
use(a.strongProp.weakProp); // no-warning
}
+// rdar://13942025
+@interface X
+@end
+
+@implementation X
+- (int) warningAboutWeakVariableInsideTypeof {
+ __typeof__(self) __weak weakSelf = self;
+ ^(){
+ __typeof__(weakSelf) blockSelf = weakSelf;
+ use(blockSelf);
+ }();
+ return sizeof(weakSelf);
+}
+@end
+
diff --git a/test/SemaObjC/arc-unavailable-for-weakref.m b/test/SemaObjC/arc-unavailable-for-weakref.m
index b9b5cc5..eab5f2c 100644
--- a/test/SemaObjC/arc-unavailable-for-weakref.m
+++ b/test/SemaObjC/arc-unavailable-for-weakref.m
@@ -86,3 +86,7 @@ __attribute__((objc_arc_weak_reference_unavailable))
@implementation I2 // expected-note {{when implemented by class I2}}
@synthesize font = _font;
@end
+
+__attribute__((objc_arc_weak_reference_unavailable(1))) // expected-error {{'objc_arc_weak_reference_unavailable' attribute takes no arguments}}
+@interface I3
+@end
diff --git a/test/SemaObjC/arc.m b/test/SemaObjC/arc.m
index 1d4e42d..060af24 100644
--- a/test/SemaObjC/arc.m
+++ b/test/SemaObjC/arc.m
@@ -84,14 +84,19 @@ void test1(A *a) {
// rdar://8861761
@interface B
--(id)alloc;
++ (id)alloc;
- (id)initWithInt: (int) i;
+- (id)myInit __attribute__((objc_method_family(init)));
+- (id)myBadInit __attribute__((objc_method_family(12))); // expected-error {{'objc_method_family' attribute requires parameter 1 to be an identifier}}
+
@end
void rdar8861761() {
B *o1 = [[B alloc] initWithInt:0];
B *o2 = [B alloc];
[o2 initWithInt:0]; // expected-warning {{expression result unused}}
+ B *o3 = [[B alloc] myInit];
+ [[B alloc] myInit]; // expected-warning {{expression result unused}}
}
// rdar://8925835
@@ -411,7 +416,7 @@ void test17(void) {
void test18(void) {
id x;
- [x test18]; // expected-error {{no known instance method for selector 'test18'}}
+ [x test18]; // expected-error {{instance method 'test18' not found ; did you mean 'test17'?}}
}
extern struct Test19 *test19a;
@@ -767,3 +772,13 @@ void test(NSArray *x) {
__strong NSMutableArray *y1 = x; // expected-warning {{incompatible pointer types initializing 'NSMutableArray *' with an expression of type 'NSArray *'}}
PSNS y2 = x; // expected-warning {{incompatible pointer types initializing 'NSMutableArray *' with an expression of type 'NSArray *'}}
}
+
+// rdar://15123684
+@class NSString;
+
+void foo(NSArray *array) {
+ for (NSString *string in array) {
+ for (string in @[@"blah", @"more blah", string]) { // expected-error {{selector element of type 'NSString *const __strong' cannot be a constant l-value}}
+ }
+ }
+}
diff --git a/test/SemaObjC/attr-objc-exception.m b/test/SemaObjC/attr-objc-exception.m
index b497271..dd8ac57 100644
--- a/test/SemaObjC/attr-objc-exception.m
+++ b/test/SemaObjC/attr-objc-exception.m
@@ -8,9 +8,9 @@ __attribute__((__objc_exception__))
@end
-__attribute__((__objc_exception__)) // expected-error {{attribute may only be applied to an Objective-C interface}}
+__attribute__((__objc_exception__)) // expected-error {{'__objc_exception__' attribute only applies to Objective-C interfaces}}
int X;
-__attribute__((__objc_exception__)) // expected-error {{attribute may only be applied to an Objective-C interface}}
+__attribute__((__objc_exception__)) // expected-error {{'__objc_exception__' attribute only applies to Objective-C interfaces}}
void foo();
diff --git a/test/SemaObjC/attr-objc-gc.m b/test/SemaObjC/attr-objc-gc.m
index 9ca12c9..827945c 100644
--- a/test/SemaObjC/attr-objc-gc.m
+++ b/test/SemaObjC/attr-objc-gc.m
@@ -2,9 +2,9 @@
static id __attribute((objc_gc(weak))) a;
static id __attribute((objc_gc(strong))) b;
-static id __attribute((objc_gc())) c; // expected-error{{'objc_gc' attribute requires parameter 1 to be a string}}
-static id __attribute((objc_gc(123))) d; // expected-error{{'objc_gc' attribute requires parameter 1 to be a string}}
-static id __attribute((objc_gc(foo, 456))) e; // expected-error{{attribute takes one argument}}
+static id __attribute((objc_gc())) c; // expected-error{{'objc_gc' attribute requires a string}}
+static id __attribute((objc_gc(123))) d; // expected-error{{'objc_gc' attribute requires a string}}
+static id __attribute((objc_gc(foo, 456))) e; // expected-error{{'objc_gc' attribute takes one argument}}
static id __attribute((objc_gc(hello))) f; // expected-warning{{'objc_gc' attribute argument not supported: 'hello'}}
static int __attribute__((objc_gc(weak))) g; // expected-warning {{'objc_gc' only applies to pointer types; type here is 'int'}}
diff --git a/test/SemaObjC/attr-print.m b/test/SemaObjC/attr-print.m
new file mode 100644
index 0000000..e3405d2
--- /dev/null
+++ b/test/SemaObjC/attr-print.m
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1 %s -fobjc-arc -ast-print | FileCheck %s
+
+__strong id x;
+id y;
+__strong id z;
+
+// CHECK: __strong id x;
+// CHECK-NOT: __strong id y;
+// CHECK: __strong id z;
diff --git a/test/SemaObjC/attr-root-class.m b/test/SemaObjC/attr-root-class.m
index 195cd66..6be1c09 100644
--- a/test/SemaObjC/attr-root-class.m
+++ b/test/SemaObjC/attr-root-class.m
@@ -11,6 +11,10 @@ __attribute__((objc_root_class))
@implementation NonRootClass
@end
-__attribute__((objc_root_class)) static void nonClassDeclaration() // expected-error {{attribute may only be applied to an Objective-C interface}}
+__attribute__((objc_root_class)) static void nonClassDeclaration() // expected-error {{'objc_root_class' attribute only applies to Objective-C interfaces}}
{
}
+
+__attribute__((objc_root_class(1))) // expected-error {{'objc_root_class' attribute takes no arguments}}
+@interface I1
+@end
diff --git a/test/SemaObjC/bad-property-synthesis-crash.m b/test/SemaObjC/bad-property-synthesis-crash.m
index ea4e004..94c6804 100644
--- a/test/SemaObjC/bad-property-synthesis-crash.m
+++ b/test/SemaObjC/bad-property-synthesis-crash.m
@@ -13,7 +13,7 @@
__what; // expected-error {{use of undeclared identifier}} \
// expected-warning {{expression result unused}}
}
-@synthesize what; // expected-note 2 {{'what' declared here}}
+@synthesize what; // expected-note {{'what' declared here}}
@end
@implementation Bar // expected-warning {{cannot find interface declaration for}}
diff --git a/test/SemaObjC/blocks.m b/test/SemaObjC/blocks.m
index b523e4c..d6681d0 100644
--- a/test/SemaObjC/blocks.m
+++ b/test/SemaObjC/blocks.m
@@ -86,9 +86,11 @@ typedef enum CStyleEnum (^cse_block_t)();
void testCStyleEnumInference(bool arg) {
cse_block_t a;
+ enum CStyleEnum value;
// No warnings here.
a = ^{ return getCSE(); };
+ a = ^{ return value; };
a = ^{ // expected-error {{incompatible block pointer types assigning to 'cse_block_t' (aka 'enum CStyleEnum (^)()') from 'int (^)(void)'}}
return 1;
@@ -102,6 +104,7 @@ void testCStyleEnumInference(bool arg) {
// No warnings here.
a = ^{ if (arg) return CSE_Value; else return getCSE(); };
a = ^{ if (arg) return getCSE(); else return CSE_Value; };
+ a = ^{ if (arg) return value; else return CSE_Value; };
// These two blocks actually return 'int'
a = ^{ // expected-error {{incompatible block pointer types assigning to 'cse_block_t' (aka 'enum CStyleEnum (^)()') from 'int (^)(void)'}}
@@ -118,6 +121,13 @@ void testCStyleEnumInference(bool arg) {
return 1;
};
+ a = ^{ // expected-error {{incompatible block pointer types assigning to 'cse_block_t' (aka 'enum CStyleEnum (^)()') from 'int (^)(void)'}}
+ if (arg)
+ return 1;
+ else
+ return value; // expected-error {{return type 'enum CStyleEnum' must match previous return type 'int'}}
+ };
+
// rdar://13200889
extern void check_enum(void);
a = ^{
@@ -206,3 +216,8 @@ void testAnonymousEnumTypes(int arg) {
SB = ^{ if (arg) return TDFTE_Value; else return getTDFTE(); };
SB = ^{ if (arg) return getTDFTE(); else return TDFTE_Value; };
}
+
+static inline void inlinefunc() {
+ ^{}();
+}
+void inlinefunccaller() { inlinefunc(); }
diff --git a/test/SemaObjC/call-super-2.m b/test/SemaObjC/call-super-2.m
index 3c45a2c..8927f3b 100644
--- a/test/SemaObjC/call-super-2.m
+++ b/test/SemaObjC/call-super-2.m
@@ -14,7 +14,7 @@ id objc_getClass(const char *s);
- (int) instance_func0;
@end
-@interface Derived: Object
+@interface Derived: Object // expected-note {{receiver is instance of class declared here}}
+ (int) class_func1;
+ (int) class_func2;
+ (int) class_func3;
@@ -35,7 +35,7 @@ id objc_getClass(const char *s);
@implementation Derived
+ (int) class_func1
{
- int i = (size_t)[self class_func0]; // expected-warning {{class method '+class_func0' not found (return type defaults to 'id')}}
+ int i = (size_t)[self class_func0]; // expected-warning {{class method '+class_func0' not found (return type defaults to 'id'); did you mean '+class_func}}
return i + (size_t)[super class_func0]; // expected-warning {{class method '+class_func0' not found (return type defaults to 'id')}}
}
+ (int) class_func2
@@ -68,7 +68,7 @@ id objc_getClass(const char *s);
}
- (int) instance_func1
{
- int i = (size_t)[self instance_func0]; // expected-warning {{instance method '-instance_func0' not found (return type defaults to 'id')}}
+ int i = (size_t)[self instance_func0]; // expected-warning {{instance method '-instance_func0' not found (return type defaults to 'id'); did you mean}}
return i + (size_t)[super instance_func0]; // expected-warning {{'Object' may not respond to 'instance_func0'}}
}
- (int) instance_func2
diff --git a/test/SemaObjC/class-def-test-1.m b/test/SemaObjC/class-def-test-1.m
index 0d114b9..7931cc3 100644
--- a/test/SemaObjC/class-def-test-1.m
+++ b/test/SemaObjC/class-def-test-1.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
@protocol SUPER;
@@ -16,9 +16,10 @@ typedef int INTF; // expected-note {{previous definition is here}}
typedef int OBJECT; // expected-error {{redefinition of 'OBJECT' as different kind of symbol}}
-typedef int OBJECT2; // expected-note {{previous definition is here}}
+typedef int OBJECT2; // expected-note 2 {{previous definition is here}}
@interface INTF2 : OBJECT2 @end // expected-error {{redefinition of 'OBJECT2' as different kind of symbol}}
+@implementation INTF2 : OBJECT2 @end // expected-error {{redefinition of 'OBJECT2' as different kind of symbol}}
@protocol PROTO;
diff --git a/test/SemaObjC/compare-qualified-id.m b/test/SemaObjC/compare-qualified-id.m
index 82868f8a..02fa86e 100644
--- a/test/SemaObjC/compare-qualified-id.m
+++ b/test/SemaObjC/compare-qualified-id.m
@@ -12,7 +12,7 @@ typedef struct _NSZone NSZone;
typedef struct {} NSFastEnumerationState;
@protocol NSFastEnumeration - (NSUInteger)countByEnumeratingWithState:(NSFastEnumerationState *)state objects:(id *)stackbuf count:(NSUInteger)len; @end
@interface NSDictionary : NSObject <NSCopying, NSMutableCopying, NSCoding, NSFastEnumeration> - (NSUInteger)count; @end
-@interface NSMutableDictionary : NSDictionary - (void)removeObjectForKey:(id)aKey; @end
+@interface NSMutableDictionary : NSDictionary - (void)removeObjectForKey:(id)aKey; @end // expected-note {{receiver is instance of class declared here}}
extern NSString * const NSTaskDidTerminateNotification;
@interface XCPropertyExpansionContext : NSObject <NSCopying> { // expected-note {{required for direct or indirect protocol 'NSCopying'}}
diff --git a/test/SemaObjC/conditional-expr.m b/test/SemaObjC/conditional-expr.m
index ec1305d..049a095 100644
--- a/test/SemaObjC/conditional-expr.m
+++ b/test/SemaObjC/conditional-expr.m
@@ -33,7 +33,8 @@
@end
// No @interface declaration for DTFilterOutputStream3
-@implementation DTFilterOutputStream3 // expected-warning {{cannot find interface declaration for 'DTFilterOutputStream3'}}
+@implementation DTFilterOutputStream3 // expected-warning {{cannot find interface declaration for 'DTFilterOutputStream3'}} \
+ // expected-note {{receiver is instance of class declared here}}
- (id)initWithNextOutputStream:(id <DTOutputStreams>) outputStream {
id <DTOutputStreams> nextOutputStream = [self nextOutputStream]; // expected-warning {{method '-nextOutputStream' not found (return type defaults to 'id')}}
self = nextOutputStream; // expected-warning {{assigning to 'DTFilterOutputStream3 *' from incompatible type 'id<DTOutputStreams>'}}
diff --git a/test/SemaObjC/conversion.m b/test/SemaObjC/conversion.m
new file mode 100644
index 0000000..88a1a44
--- /dev/null
+++ b/test/SemaObjC/conversion.m
@@ -0,0 +1,17 @@
+// RUN: %clang_cc1 -Wconversion -fsyntax-only %s -verify
+
+typedef signed char BOOL;
+__attribute__((objc_root_class)) @interface RDar14415662
+@property (readonly) BOOL stuff;
+@property (readwrite) BOOL otherStuff;
+@end
+
+void radar14415662(RDar14415662 *f, char x, int y) {
+ f.otherStuff = !f.stuff; // no-warning
+ BOOL b = !f.stuff; // no-warning
+
+ // True positive to sanity check warning is working.
+ x = y; // expected-warning {{implicit conversion loses integer precision: 'int' to 'char'}}
+}
+
+
diff --git a/test/SemaObjC/dealloc.m b/test/SemaObjC/dealloc.m
index feafafd..59218d2 100644
--- a/test/SemaObjC/dealloc.m
+++ b/test/SemaObjC/dealloc.m
@@ -1,5 +1,5 @@
// RUN: %clang_cc1 -triple x86_64-apple-darwin11 -fsyntax-only -fobjc-arc -fblocks -verify %s
-// RUN: %clang_cc1 -triple x86_64-apple-darwin11 -fsyntax-only -fobjc-arc -fblocks -fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s
+// RUN: not %clang_cc1 -triple x86_64-apple-darwin11 -fsyntax-only -fobjc-arc -fblocks -fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s
// rdar://11987838
@protocol NSObject
diff --git a/test/SemaObjC/default-synthesize-1.m b/test/SemaObjC/default-synthesize-1.m
index 5aaca9a..f9f2e72 100644
--- a/test/SemaObjC/default-synthesize-1.m
+++ b/test/SemaObjC/default-synthesize-1.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -fobjc-default-synthesize-properties -Wobjc-missing-property-synthesis -verify -Wno-objc-root-class %s
+// RUN: %clang_cc1 -fsyntax-only -Wobjc-missing-property-synthesis -verify -Wno-objc-root-class %s
// rdar://11295716
@interface NSObject
diff --git a/test/SemaObjC/default-synthesize-2.m b/test/SemaObjC/default-synthesize-2.m
index 20c045e..1980b91 100644
--- a/test/SemaObjC/default-synthesize-2.m
+++ b/test/SemaObjC/default-synthesize-2.m
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -x objective-c -fsyntax-only -fobjc-default-synthesize-properties -verify -Wno-objc-root-class %s
-// RUN: %clang_cc1 -x objective-c++ -fsyntax-only -fobjc-default-synthesize-properties -verify -Wno-objc-root-class %s
+// 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
// rdar://8843851
@interface StopAccessingIvarsDirectlyExample
diff --git a/test/SemaObjC/default-synthesize-3.m b/test/SemaObjC/default-synthesize-3.m
index 82f968d..1c32665 100644
--- a/test/SemaObjC/default-synthesize-3.m
+++ b/test/SemaObjC/default-synthesize-3.m
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -x objective-c -fsyntax-only -fobjc-default-synthesize-properties -verify -Wno-objc-root-class %s
-// RUN: %clang_cc1 -x objective-c++ -fsyntax-only -fobjc-default-synthesize-properties -verify -Wno-objc-root-class %s
+// 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
#if __has_attribute(objc_requires_property_definitions)
__attribute ((objc_requires_property_definitions))
@@ -111,3 +111,73 @@ __attribute ((objc_requires_property_definitions)) // expected-error {{objc_requ
@implementation S
@end
+
+// rdar://14085456
+// No warning must be issued in this test.
+@interface ParentObject
+@end
+
+@protocol TestObject
+@property (readonly) int six;
+@end
+
+@interface TestObject : ParentObject <TestObject>
+@property int six;
+@end
+
+@implementation TestObject
+@synthesize six;
+@end
+
+// rdar://14094682
+// no warning in this test
+@interface ISAChallenge : NSObject {
+}
+
+@property (assign, readonly) int failureCount;
+@end
+
+@interface ISSAChallenge : ISAChallenge {
+ int _failureCount;
+}
+@property (assign, readwrite) int failureCount;
+@end
+
+@implementation ISAChallenge
+- (int)failureCount {
+ return 0;
+}
+@end
+
+@implementation ISSAChallenge
+
+@synthesize failureCount = _failureCount;
+@end
+
+__attribute ((objc_requires_property_definitions(1))) // expected-error {{'objc_requires_property_definitions' attribute takes no arguments}}
+@interface I1
+@end
+
+// rdar://15051465
+@protocol SubFooling
+ @property(nonatomic, readonly) id hoho; // expected-note 2 {{property declared here}}
+@end
+
+@protocol Fooing<SubFooling>
+ @property(nonatomic, readonly) id muahahaha; // expected-note 2 {{property declared here}}
+@end
+
+typedef NSObject<Fooing> FooObject;
+
+@interface Okay : NSObject<Fooing>
+@end
+
+@implementation Okay // expected-warning 2 {{auto property synthesis will not synthesize property declared in a protocol}}
+@end
+
+@interface Fail : FooObject
+@end
+
+@implementation Fail // expected-warning 2 {{auto property synthesis will not synthesize property declared in a protocol}}
+@end
+
diff --git a/test/SemaObjC/default-synthesize.m b/test/SemaObjC/default-synthesize.m
index e6ea0a5..dd16c13 100644
--- a/test/SemaObjC/default-synthesize.m
+++ b/test/SemaObjC/default-synthesize.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -fobjc-default-synthesize-properties -verify -Wno-objc-root-class %s
+// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
@interface NSString @end
diff --git a/test/SemaObjC/deprecated-objc-introspection.m b/test/SemaObjC/deprecated-objc-introspection.m
index faaef25..4f74841 100644
--- a/test/SemaObjC/deprecated-objc-introspection.m
+++ b/test/SemaObjC/deprecated-objc-introspection.m
@@ -14,9 +14,11 @@ typedef struct objc_object {
id firstobj;
struct objc_class *isa;
}
+- (id)performSelector:(SEL)aSelector;;
@end
@interface Whatever : NSObject
+self;
+-(id)foo;
@end
static void func() {
@@ -94,4 +96,9 @@ void testBitmasking(NSObject *p) {
(void) (0x1 & ((NSUInteger) p)); // expected-warning {{bitmasking for introspection of Objective-C object pointers is strongly discouraged}}
(void) (((NSUInteger) p) ^ 0x1); // no-warning
(void) (0x1 ^ ((NSUInteger) p)); // no-warning
+ (void) (0x1 & ((NSUInteger) [p performSelector:@selector(foo)])); // expected-warning {{bitmasking for introspection of Objective-C object pointers is strongly discouraged}}
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-objc-pointer-introspection-performSelector"
+ (void) (0x1 & ((NSUInteger) [p performSelector:@selector(foo)])); // no-warning
+#pragma clang diagnostic pop
} \ No newline at end of file
diff --git a/test/SemaObjC/direct-synthesized-ivar-access.m b/test/SemaObjC/direct-synthesized-ivar-access.m
index a276a64..7ec3337 100644
--- a/test/SemaObjC/direct-synthesized-ivar-access.m
+++ b/test/SemaObjC/direct-synthesized-ivar-access.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -fobjc-default-synthesize-properties -verify -Wno-objc-root-class %s
+// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
// expected-no-diagnostics
// rdar://8673791
// rdar://9943851
diff --git a/test/SemaObjC/error-outof-scope-property-use.m b/test/SemaObjC/error-outof-scope-property-use.m
index c69a405..c480e2d 100644
--- a/test/SemaObjC/error-outof-scope-property-use.m
+++ b/test/SemaObjC/error-outof-scope-property-use.m
@@ -1,12 +1,12 @@
-// RUN: %clang_cc1 -fsyntax-only -fobjc-default-synthesize-properties -verify -Wno-objc-root-class %s
-// RUN: %clang_cc1 -x objective-c++ -fsyntax-only -fobjc-default-synthesize-properties -verify -Wno-objc-root-class %s
+// 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
// rdar://13178483
-@class NSMutableDictionary;
+@class NSMutableDictionary; // expected-note {{receiver is instance of class declared here}}
@interface LaunchdJobs
-@property (nonatomic,retain) NSMutableDictionary *uuids_jobs; // expected-note 2 {{'_uuids_jobs' declared here}}
+@property (nonatomic,retain) NSMutableDictionary *uuids_jobs; // expected-note {{'_uuids_jobs' declared here}}
@end
diff --git a/test/SemaObjC/foreach.m b/test/SemaObjC/foreach.m
index d0e0f7b..91ea2ec 100644
--- a/test/SemaObjC/foreach.m
+++ b/test/SemaObjC/foreach.m
@@ -13,8 +13,8 @@ void f(NSArray *a) {
* and no diagnostics even in pedantic mode should happen.
* rdar://6814674
*/
- for (id thisKey in keys);
- for (id thisKey in keys);
+ for (id thisKey in keys); /* expected-warning {{unused variable 'thisKey'}} */
+ for (id thisKey in keys); /* expected-warning {{unused variable 'thisKey'}} */
}
/* // rdar://9072298 */
@@ -41,7 +41,7 @@ typedef struct {
int main ()
{
NSObject<NSFastEnumeration>* collection = ((void*)0);
- for (id thing in collection) { }
+ for (id thing in collection) { } /* expected-warning {{unused variable 'thing'}} */
return 0;
}
diff --git a/test/SemaObjC/format-arg-attribute.m b/test/SemaObjC/format-arg-attribute.m
index dede433..e770373 100644
--- a/test/SemaObjC/format-arg-attribute.m
+++ b/test/SemaObjC/format-arg-attribute.m
@@ -1,17 +1,17 @@
-// RUN: %clang_cc1 -verify -fsyntax-only %s
+// RUN: %clang_cc1 -Werror -Wformat-nonliteral -verify -fsyntax-only %s
@class NSString;
extern NSString *fa2 (const NSString *) __attribute__((format_arg(1)));
extern NSString *fa3 (NSString *) __attribute__((format_arg(1)));
-extern void fc1 (const NSString *) __attribute__((format_arg)); // expected-error {{attribute takes one argument}}
-extern void fc2 (const NSString *) __attribute__((format_arg())); // expected-error {{attribute takes one argument}}
-extern void fc3 (const NSString *) __attribute__((format_arg(1, 2))); // expected-error {{attribute takes one argument}}
+extern void fc1 (const NSString *) __attribute__((format_arg)); // expected-error {{'format_arg' attribute takes one argument}}
+extern void fc2 (const NSString *) __attribute__((format_arg())); // expected-error {{'format_arg' attribute takes one argument}}
+extern void fc3 (const NSString *) __attribute__((format_arg(1, 2))); // expected-error {{'format_arg' attribute takes one argument}}
-struct s1 { int i; } __attribute__((format_arg(1))); // expected-warning {{'format_arg' attribute only applies to functions}}
-union u1 { int i; } __attribute__((format_arg(1))); // expected-warning {{'format_arg' attribute only applies to functions}}
-enum e1 { E1V0 } __attribute__((format_arg(1))); // expected-warning {{'format_arg' attribute only applies to functions}}
+struct s1 { int i; } __attribute__((format_arg(1))); // expected-error {{'format_arg' attribute only applies to functions}}
+union u1 { int i; } __attribute__((format_arg(1))); // expected-error {{'format_arg' attribute only applies to functions}}
+enum e1 { E1V0 } __attribute__((format_arg(1))); // expected-error {{'format_arg' attribute only applies to functions}}
extern NSString *ff3 (const NSString *) __attribute__((format_arg(3-2)));
extern NSString *ff4 (const NSString *) __attribute__((format_arg(foo))); // expected-error {{use of undeclared identifier 'foo'}}
@@ -25,3 +25,23 @@ extern NSString *fi2 (NSString *) __attribute__((format_arg(1)));
extern int fi3 (const NSString *) __attribute__((format_arg(1))); // expected-error {{function does not return NSString}}
extern NSString *fi4 (const NSString *) __attribute__((format_arg(1)));
extern NSString *fi5 (const NSString *) __attribute__((format_arg(1)));
+
+// rdar://15242010
+@interface NSString
++ (id)stringWithFormat:(NSString *)format, ... __attribute__((format(__NSString__, 1, 2)));
+@end
+
+@interface NSBundle
+- (NSString *)localizedStringForKey:(NSString *)key value:(NSString *)value table:(NSString *)tableName __attribute__ ((format_arg(1)));
++ (NSBundle *)mainBundle;
+@end
+
+
+NSString* localizedFormat(NSString* string) __attribute__ ((format_arg(1)));
+
+int main()
+{
+ [NSString stringWithFormat:[[NSBundle mainBundle] localizedStringForKey:@"foo %d" value:@"bar %d" table:0], 42];
+
+ [NSString stringWithFormat:localizedFormat(@"foo %d"), 42];
+}
diff --git a/test/SemaObjC/format-strings-objc.m b/test/SemaObjC/format-strings-objc.m
index 8490130..2667e30 100644
--- a/test/SemaObjC/format-strings-objc.m
+++ b/test/SemaObjC/format-strings-objc.m
@@ -232,6 +232,8 @@ void testInvalidFormatArgument(NSDictionary *dict) {
// <rdar://problem/11825593>
void testByValueObjectInFormat(Foo *obj) {
printf("%d %d %d", 1L, *obj, 1L); // expected-error {{cannot pass object with interface type 'Foo' by value to variadic function; expected type from format string was 'int'}} expected-warning 2 {{format specifies type 'int' but the argument has type 'long'}}
+ printf("%!", *obj); // expected-error {{cannot pass object with interface type 'Foo' by value through variadic function}} expected-warning {{invalid conversion specifier}}
+ printf(0, *obj); // expected-error {{cannot pass object with interface type 'Foo' by value through variadic function}}
[Bar log2:@"%d", *obj]; // expected-error {{cannot pass object with interface type 'Foo' by value to variadic method; expected type from format string was 'int'}}
}
@@ -241,3 +243,8 @@ void testTypeOf(NSInteger dW, NSInteger dH) {
NSLog(@"dW %d dH %d",({ __typeof__(dW) __a = (dW); __a < 0 ? -__a : __a; }),({ __typeof__(dH) __a = (dH); __a < 0 ? -__a : __a; })); // expected-warning 2 {{values of type 'NSInteger' should not be used as format arguments; add an explicit cast to 'long' instead}}
}
+void testUnicode() {
+ NSLog(@"%C", 0x2022); // no-warning
+ NSLog(@"%C", 0x202200); // expected-warning{{format specifies type 'unichar' (aka 'unsigned short') but the argument has type 'int'}}
+}
+
diff --git a/test/SemaObjC/forward-protocol-incomplete-impl-warn.m b/test/SemaObjC/forward-protocol-incomplete-impl-warn.m
index 01fedec..c3efeba 100644
--- a/test/SemaObjC/forward-protocol-incomplete-impl-warn.m
+++ b/test/SemaObjC/forward-protocol-incomplete-impl-warn.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify -fobjc-default-synthesize-properties %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// rdar://12958878
@interface NSObject @end
diff --git a/test/SemaObjC/iboutlet.m b/test/SemaObjC/iboutlet.m
index 01e1bfc..3c7f958 100644
--- a/test/SemaObjC/iboutlet.m
+++ b/test/SemaObjC/iboutlet.m
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -fsyntax-only -fobjc-default-synthesize-properties -Wno-objc-root-class -verify %s
-// RUN: %clang_cc1 -x objective-c++ -fsyntax-only -fobjc-default-synthesize-properties -Wno-objc-root-class -verify %s
+// RUN: %clang_cc1 -fsyntax-only -Wno-objc-root-class -verify %s
+// RUN: %clang_cc1 -x objective-c++ -fsyntax-only -Wno-objc-root-class -verify %s
// rdar://11448209
#define READONLY readonly
diff --git a/test/SemaObjC/iboutletcollection-attr.m b/test/SemaObjC/iboutletcollection-attr.m
index 82cb96f..f088ca3 100644
--- a/test/SemaObjC/iboutletcollection-attr.m
+++ b/test/SemaObjC/iboutletcollection-attr.m
@@ -18,15 +18,15 @@
typedef void *PV;
@interface BAD {
- __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(I, 1))) id ivar1; // expected-error {{expected ')'}} expected-note {{to match}}
+ __attribute__((iboutletcollection(B))) id ivar2; // expected-error {{unknown type name 'B'}}
+ __attribute__((iboutletcollection(PV))) id ivar3; // expected-error {{invalid type 'PV' (aka 'void *') as argument of iboutletcollection attribute}}
__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 {{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}}
+@property (nonatomic, retain) __attribute__((iboutletcollection(I,2,3))) id prop1; // expected-error {{expected ')'}} expected-note {{to match}}
+@property (nonatomic, retain) __attribute__((iboutletcollection(B))) id prop2; // expected-error {{unknown type name 'B'}}
@property __attribute__((iboutletcollection(BAD))) int prop3; // expected-warning {{property with 'iboutletcollection' attribute must be an object type (invalid 'int')}}
@end
@@ -41,3 +41,10 @@ typedef void *PV;
@property (nonatomic, strong)
__attribute__((iboutletcollection(RDar10296078_OtherClass<RDar10296078_Protocol>))) NSArray *stuff;
@end
+
+// rdar://14212998
+@class UILabel;
+@class NSArray;
+@interface OCTViewController
+@property (nonatomic, assign) __attribute__((iboutletcollection(UILabel))) NSArray *labels; // expected-warning {{IBOutletCollection properties should be copy/strong and not assign}}
+@end
diff --git a/test/SemaObjC/idiomatic-parentheses.m b/test/SemaObjC/idiomatic-parentheses.m
index 801db59..c6281f0 100644
--- a/test/SemaObjC/idiomatic-parentheses.m
+++ b/test/SemaObjC/idiomatic-parentheses.m
@@ -9,6 +9,7 @@
}
- (id) init;
- (id) initWithInt: (int) i;
+- (id) myInit __attribute__((objc_method_family(init)));
- (void) iterate: (id) coll;
- (id) nextObject;
@property unsigned uid;
@@ -34,6 +35,12 @@
return self;
}
+- (id) myInit {
+ if (self = [self myInit]) {
+ }
+ return self;
+}
+
- (void) iterate: (id) coll {
id cur;
while (cur = [coll nextObject]) {
diff --git a/test/SemaObjC/instancetype.m b/test/SemaObjC/instancetype.m
index 8137964..7811d3e 100644
--- a/test/SemaObjC/instancetype.m
+++ b/test/SemaObjC/instancetype.m
@@ -25,7 +25,7 @@
- (instancetype)otherMethodInProto2; // expected-note{{overridden method returns an instance of its class type}}
@end
-@interface Subclass1 : Root
+@interface Subclass1 : Root // expected-note 4 {{receiver is instance of class declared here}}
- (instancetype)initSubclass1;
- (void)methodOnSubclass1;
+ (instancetype)allocSubclass1;
diff --git a/test/SemaObjC/ivar-lookup.m b/test/SemaObjC/ivar-lookup.m
index df9d8ba..938c8eb 100644
--- a/test/SemaObjC/ivar-lookup.m
+++ b/test/SemaObjC/ivar-lookup.m
@@ -80,3 +80,77 @@ extern struct foo x;
int IVAR; // expected-error {{instance variable is already declared}}
}
@end
+
+// PR5984
+// rdar://14037151
+@interface Radar14037151 {
+ int myStatus;
+}
+- (int) test;
+@end
+
+@implementation Radar14037151
+- (int) test
+{
+ myStatus = 1; // works
+ __typeof(myStatus) __in; // works.
+ union U {
+ __typeof(myStatus) __in; // fails.
+ };
+ struct S {
+ __typeof(myStatus) __in; // fails.
+ struct S1 {
+ __typeof(myStatus) __in; // fails.
+ struct S {
+ __typeof(myStatus) __in; // fails.
+ };
+ };
+ };
+
+ return 0;
+}
+@end
+
+// rdar://14278560
+@class NSString, NSData, NSNumber;
+
+@interface NSObject
+{
+ Class isa;
+}
+@end
+
+@interface Foo
+{
+ int a;
+ NSString* b;
+ NSData* c;
+}
+@end
+
+@interface Bar : Foo
+@end
+
+@interface Bar () {
+ NSString *q_strong;
+ NSNumber *r_strong;
+ int d; // expected-note {{previous definition is here}}
+ NSString *e_strong; // expected-note {{previous definition is here}}
+ NSData *f_weak; // expected-note {{previous definition is here}}
+ int g; // expected-note 2 {{previous definition is here}}
+}
+@end
+
+@interface Bar () {
+ int g; // expected-note {{previous definition is here}} \
+ // expected-error {{instance variable is already declared}}
+}
+@end
+
+@implementation Bar {
+ int d; // expected-error {{instance variable is already declared}}
+ NSString *e_strong; // expected-error {{instance variable is already declared}}
+ NSData *f_weak; // expected-error {{instance variable is already declared}}
+ NSData *g; // expected-error 2 {{instance variable is already declared}}
+}
+@end
diff --git a/test/SemaObjC/ivar-ref-misuse.m b/test/SemaObjC/ivar-ref-misuse.m
index 3115f5b..2c2fb2f 100644
--- a/test/SemaObjC/ivar-ref-misuse.m
+++ b/test/SemaObjC/ivar-ref-misuse.m
@@ -1,6 +1,6 @@
// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
-@interface Sprite { // expected-note{{'Sprite' declared here}}
+@interface Sprite {
int sprite, spree;
int UseGlobalBar;
}
@@ -17,8 +17,7 @@ int UseGlobalBar;
+ (void)setFoo:(int)foo {
sprite = foo; // expected-error {{instance variable 'sprite' accessed in class method}}
spree = foo;
- Xsprite = foo; // expected-error {{unknown type name 'Xsprite'; did you mean 'Sprite'?}} \
- // expected-error{{expected identifier or '('}}
+ Xsprite = foo; // expected-error {{use of undeclared identifier 'Xsprite'}}
UseGlobalBar = 10;
}
+ (void)setSprite:(int)sprite {
diff --git a/test/SemaObjC/message.m b/test/SemaObjC/message.m
index 40fa102..2c4d806 100644
--- a/test/SemaObjC/message.m
+++ b/test/SemaObjC/message.m
@@ -107,7 +107,7 @@ void foo5(id p) {
// expected-warning {{instance method '-bar' not found}}
}
-@interface I1
+@interface I1 // expected-note {{receiver is instance of class declared here}}
-(void)unavail_meth __attribute__((unavailable)); // expected-note {{marked unavailable here}}
@end
diff --git a/test/SemaObjC/method-bad-param.m b/test/SemaObjC/method-bad-param.m
index d44b536..ad67a34 100644
--- a/test/SemaObjC/method-bad-param.m
+++ b/test/SemaObjC/method-bad-param.m
@@ -42,3 +42,17 @@ enum bogus; // expected-note {{forward declaration of 'enum bogus'}}
}
@end
+@interface arrayfun
+- (int[6])arrayRet; // expected-error {{function cannot return array type 'int [6]'}}
+- (int())funcRet; // expected-error {{function cannot return function type 'int ()'}}
+@end
+
+@interface qux
+- (void) my_method: (int)arg; // expected-note {{method 'my_method:' declared here}}
+@end
+
+// FIXME: The diagnostic and recovery here could probably be improved.
+@implementation qux // expected-warning {{method definition for 'my_method:' not found}}
+- (void) my_method: (int) { // expected-error {{expected identifier}}
+}
+@end
diff --git a/test/SemaObjC/method-conflict-2.m b/test/SemaObjC/method-conflict-2.m
index ec80a43..47c3d6c 100644
--- a/test/SemaObjC/method-conflict-2.m
+++ b/test/SemaObjC/method-conflict-2.m
@@ -64,3 +64,52 @@ typedef long long int64_t;
return 0;
}
@end
+
+// rdar://14650159
+// Tests that property inherited indirectly from a nested protocol
+// is seen by the method implementation type matching logic before
+// method in super class is seen. This fixes the warning coming
+// out of that method mismatch.
+@interface NSObject (NSDict)
+- (void)setValue:(id)value;
+- (id)value;
+@end
+
+@protocol ProtocolWithValue
+@property (nonatomic) unsigned value;
+@end
+
+@protocol InterveningProtocol <ProtocolWithValue>
+@end
+
+@interface UsesProtocolWithValue : NSObject <ProtocolWithValue>
+@end
+
+@implementation UsesProtocolWithValue
+@synthesize value=_value;
+- (unsigned) value
+{
+ return _value;
+}
+- (void) setValue:(unsigned)value
+{
+ _value = value;
+}
+@end
+
+
+@interface UsesInterveningProtocol : NSObject <InterveningProtocol>
+@end
+
+@implementation UsesInterveningProtocol
+
+@synthesize value=_value;
+- (unsigned) value
+{
+ return _value;
+}
+- (void) setValue:(unsigned)value
+{
+ _value = value;
+}
+@end
diff --git a/test/SemaObjC/method-not-defined.m b/test/SemaObjC/method-not-defined.m
index 22466f7..792469b 100644
--- a/test/SemaObjC/method-not-defined.m
+++ b/test/SemaObjC/method-not-defined.m
@@ -1,6 +1,6 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
-@interface Foo
+@interface Foo // expected-note {{receiver is instance of class declared here}}
@end
void test() {
diff --git a/test/SemaObjC/method-sentinel-attr.m b/test/SemaObjC/method-sentinel-attr.m
index 274e936..d230be5 100644
--- a/test/SemaObjC/method-sentinel-attr.m
+++ b/test/SemaObjC/method-sentinel-attr.m
@@ -10,7 +10,7 @@
- (void) foo5 : (int)x, ... __attribute__ ((__sentinel__(1))); // expected-note {{method has been explicitly marked sentinel here}}
- (void) foo6 : (int)x, ... __attribute__ ((__sentinel__(5))); // expected-note {{method has been explicitly marked sentinel here}}
- (void) foo7 : (int)x, ... __attribute__ ((__sentinel__(0))); // expected-note {{method has been explicitly marked sentinel here}}
-- (void) foo8 : (int)x, ... __attribute__ ((__sentinel__("a"))); // expected-error {{'sentinel' attribute requires parameter 1 to be an integer constant}}
+- (void) foo8 : (int)x, ... __attribute__ ((__sentinel__("a"))); // expected-error {{'__sentinel__' attribute requires parameter 1 to be an integer constant}}
- (void) foo9 : (int)x, ... __attribute__ ((__sentinel__(-1))); // expected-error {{'sentinel' parameter 1 less than zero}}
- (void) foo10 : (int)x, ... __attribute__ ((__sentinel__(1,1)));
- (void) foo11 : (int)x, ... __attribute__ ((__sentinel__(1,1,3))); // expected-error {{attribute takes no more than 2 arguments}}
diff --git a/test/SemaObjC/missing-atend-metadata.m b/test/SemaObjC/missing-atend-metadata.m
index f072981..f235ab9 100644
--- a/test/SemaObjC/missing-atend-metadata.m
+++ b/test/SemaObjC/missing-atend-metadata.m
@@ -1,6 +1,6 @@
// RUN: %clang_cc1 -triple i386-apple-darwin9 -fsyntax-only -verify -Wno-objc-root-class %s
-@interface I0
+@interface I0 // expected-note {{receiver is instance of class declared here}}
@end
@implementation I0 // expected-note {{implementation started here}}
diff --git a/test/SemaObjC/nsobject-attribute.m b/test/SemaObjC/nsobject-attribute.m
index b794eaf..ead222c 100644
--- a/test/SemaObjC/nsobject-attribute.m
+++ b/test/SemaObjC/nsobject-attribute.m
@@ -1,6 +1,8 @@
// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
typedef struct CGColor * __attribute__ ((NSObject)) CGColorRef;
+typedef struct CGColor * __attribute__((NSObject(12))) Illegal; // expected-error {{'NSObject' attribute takes no arguments}}
+
static int count;
static CGColorRef tmp = 0;
diff --git a/test/SemaObjC/objc-array-literal.m b/test/SemaObjC/objc-array-literal.m
index 9f59316..706207d 100644
--- a/test/SemaObjC/objc-array-literal.m
+++ b/test/SemaObjC/objc-array-literal.m
@@ -1,5 +1,7 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
// rdar://10111397
+// RUN: %clang_cc1 -fsyntax-only -triple i386-apple-macosx10.9.0 -fobjc-runtime=macosx-fragile-10.9.0 -fobjc-subscripting-legacy-runtime -verify %s
+// rdar://15363492
#if __LP64__ || (TARGET_OS_EMBEDDED && !TARGET_OS_IPHONE) || TARGET_OS_WIN32 || NS_BUILD_32_LIKE_64
typedef unsigned long NSUInteger;
@@ -39,3 +41,17 @@ int main() {
const char *blah;
NSArray *array2 = @[blah]; // expected-error{{collection element of type 'const char *' is not an Objective-C object}}
}
+
+// rdar://14303083
+id Test14303083() {
+ id obj = @[ @"A", (@"B" @"C")];
+ return @[ @"A", @"B" @"C"]; // expected-warning {{concatenated NSString literal for an NSArray expression - possibly missing a comma}}
+}
+id radar15147688() {
+#define R15147688_A @"hello"
+#define R15147688_B "world"
+#define CONCATSTR R15147688_A R15147688_B
+ id x = @[ @"stuff", CONCATSTR ]; // no-warning
+ x = @[ @"stuff", @"hello" "world"]; // expected-warning {{concatenated NSString literal for an NSArray expression}}
+ return x;
+}
diff --git a/test/SemaObjC/objc-dictionary-literal.m b/test/SemaObjC/objc-dictionary-literal.m
index 0b6da4a..9d86d88 100644
--- a/test/SemaObjC/objc-dictionary-literal.m
+++ b/test/SemaObjC/objc-dictionary-literal.m
@@ -1,5 +1,7 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
// rdar://11062080
+// RUN: %clang_cc1 -fsyntax-only -triple i386-apple-macosx10.9.0 -fobjc-runtime=macosx-fragile-10.9.0 -fobjc-subscripting-legacy-runtime -verify %s
+// rdar://15363492
@interface NSNumber
+ (NSNumber *)numberWithChar:(char)value;
diff --git a/test/SemaObjC/objcbridge-attribute.m b/test/SemaObjC/objcbridge-attribute.m
new file mode 100644
index 0000000..2db2ff4
--- /dev/null
+++ b/test/SemaObjC/objcbridge-attribute.m
@@ -0,0 +1,66 @@
+// RUN: %clang_cc1 -fsyntax-only -fobjc-arc -verify -Wno-objc-root-class %s
+// rdar://15454846
+
+typedef struct __attribute__ ((objc_bridge(NSError))) __CFErrorRef * CFErrorRef; // expected-note 2 {{declared here}}
+
+typedef struct __attribute__((objc_bridge(12))) __CFMyColor *CFMyColorRef; // expected-error {{parameter of 'objc_bridge' attribute must be a single name of an Objective-C class}}
+
+typedef struct __attribute__ ((objc_bridge)) __CFArray *CFArrayRef; // expected-error {{parameter of 'objc_bridge' attribute must be a single name of an Objective-C class}}
+
+typedef void * __attribute__ ((objc_bridge(NSURL))) CFURLRef; // expected-error {{'objc_bridge' attribute only applies to struct or union}}
+
+typedef void * CFStringRef __attribute__ ((objc_bridge(NSString))); // expected-error {{'objc_bridge' attribute only applies to struct or union}}
+
+typedef struct __attribute__((objc_bridge(NSLocale, NSError))) __CFLocale *CFLocaleRef;// expected-error {{use of undeclared identifier 'NSError'}}
+
+typedef struct __CFData __attribute__((objc_bridge(NSData))) CFDataRef; // expected-error {{'objc_bridge' attribute only applies to struct or union}}
+
+typedef struct __attribute__((objc_bridge(NSDictionary))) __CFDictionary * CFDictionaryRef;
+
+typedef struct __CFSetRef * CFSetRef __attribute__((objc_bridge(NSSet))); // expected-error {{'objc_bridge' attribute only applies to struct or union}};
+
+typedef union __CFUColor __attribute__((objc_bridge(NSUColor))) * CFUColorRef; // expected-error {{'objc_bridge' attribute only applies to struct or union}};
+
+typedef union __CFUColor __attribute__((objc_bridge(NSUColor))) *CFUColor1Ref; // expected-error {{'objc_bridge' attribute only applies to struct or union}};
+
+typedef union __attribute__((objc_bridge(NSUColor))) __CFUPrimeColor XXX;
+typedef XXX *CFUColor2Ref;
+
+@interface I
+{
+ __attribute__((objc_bridge(NSError))) void * color; // expected-error {{'objc_bridge' attribute only applies to struct or union}};
+}
+@end
+
+@protocol NSTesting @end
+@class NSString;
+
+typedef struct __attribute__((objc_bridge(NSTesting))) __CFError *CFTestingRef; // expected-note {{declared here}}
+
+id Test1(CFTestingRef cf) {
+ return (NSString *)cf; // expected-error {{CF object of type 'CFTestingRef' (aka 'struct __CFError *') is bridged to 'NSTesting', which is not an Objective-C class}}
+}
+
+typedef CFErrorRef CFErrorRef1;
+
+typedef CFErrorRef1 CFErrorRef2;
+
+@interface NSError @end
+
+@interface MyError : NSError
+@end
+
+@interface NSUColor @end
+
+@class NSString;
+
+void Test2(CFErrorRef2 cf, NSError *ns, NSString *str, Class c, CFUColor2Ref cf2) {
+ (void)(NSString *)cf; // expected-warning {{'CFErrorRef2' (aka 'struct __CFErrorRef *') bridges to NSError, not 'NSString'}}
+ (void)(NSError *)cf; // okay
+ (void)(MyError*)cf; // okay,
+ (void)(NSUColor *)cf2; // okay
+ (void)(CFErrorRef)ns; // okay
+ (void)(CFErrorRef)str; // expected-warning {{'NSString' cannot bridge to 'CFErrorRef' (aka 'struct __CFErrorRef *')}}
+ (void)(Class)cf; // expected-warning {{'CFErrorRef2' (aka 'struct __CFErrorRef *') bridges to NSError, not 'Class'}}
+ (void)(CFErrorRef)c; // expected-warning {{'Class' cannot bridge to 'CFErrorRef'}}
+}
diff --git a/test/SemaObjC/overriding-property-in-class-extension.m b/test/SemaObjC/overriding-property-in-class-extension.m
index 77efd55..8c0e1b9 100644
--- a/test/SemaObjC/overriding-property-in-class-extension.m
+++ b/test/SemaObjC/overriding-property-in-class-extension.m
@@ -1,5 +1,4 @@
// RUN: %clang_cc1 -fsyntax-only -verify -Weverything %s
-// expected-no-diagnostics
// rdar://12103434
@class NSString;
@@ -8,7 +7,7 @@
@interface MyClass : NSObject
-@property (nonatomic, copy, readonly) NSString* name;
+@property (nonatomic, copy, readonly) NSString* name; // expected-warning {{property attributes 'readonly' and 'copy' are mutually exclusive}}
@end
diff --git a/test/SemaObjC/property-5.m b/test/SemaObjC/property-5.m
index cd7cc24..cf4f873 100644
--- a/test/SemaObjC/property-5.m
+++ b/test/SemaObjC/property-5.m
@@ -8,7 +8,7 @@
@interface MutableNSData : NSData @end
-@interface Base : NSData <P1>
+@interface Base : NSData <P1> // expected-note {{receiver is instance of class declared here}}
@property(readonly) id ref;
@property(readonly) Base *p_base;
@property(readonly) NSData *nsdata;
diff --git a/test/SemaObjC/property-ambiguous-synthesis.m b/test/SemaObjC/property-ambiguous-synthesis.m
new file mode 100644
index 0000000..98f5945
--- /dev/null
+++ b/test/SemaObjC/property-ambiguous-synthesis.m
@@ -0,0 +1,48 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
+// rdar://13075400
+
+@protocol FooAsID
+@property (copy) id foo; // expected-note 2 {{it could also be property of type 'id' declared here}} \\
+ // expected-warning {{property of type 'id' was selected for synthesis}}
+@end
+
+@protocol FooAsDouble
+@property double foo; // expected-warning 2 {{property of type 'double' was selected for synthesis}} \
+ // expected-note {{it could also be property of type 'double' declared here}}
+@end
+
+@protocol FooAsShort
+@property short foo; // expected-note {{it could also be property of type 'short' declared here}}
+@end
+
+@interface NSObject @end
+
+@interface AnObject : NSObject<FooAsDouble,FooAsID>
+@end
+
+@interface Sub : AnObject
+@end
+
+@implementation Sub
+@synthesize foo=_MyFooIvar; // expected-note {{property synthesized here}}
+@end
+
+
+@interface AnotherObject : NSObject<FooAsDouble, FooAsID,FooAsDouble, FooAsID, FooAsDouble,FooAsID>
+@end
+
+@implementation AnotherObject
+@synthesize foo=_MyFooIvar; // expected-note {{property synthesized here}}
+@end
+
+
+@interface YetAnotherObject : NSObject<FooAsID,FooAsShort, FooAsDouble,FooAsID, FooAsShort>
+@end
+
+@implementation YetAnotherObject
+@synthesize foo=_MyFooIvar; // expected-note {{property synthesized here}}
+@end
+
+double func(YetAnotherObject *object) {
+ return [object foo]; // expected-error {{returning 'id' from a function with incompatible result type 'double'}}
+}
diff --git a/test/SemaObjC/property-category-1.m b/test/SemaObjC/property-category-1.m
index 3788bc9..0e8c3fc 100644
--- a/test/SemaObjC/property-category-1.m
+++ b/test/SemaObjC/property-category-1.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
+// RUN: %clang_cc1 -fsyntax-only -verify -disable-objc-default-synthesize-properties -Wno-objc-root-class %s
@interface Object
+ (id)new;
diff --git a/test/SemaObjC/property-choose-expr.m b/test/SemaObjC/property-choose-expr.m
new file mode 100644
index 0000000..71265e5
--- /dev/null
+++ b/test/SemaObjC/property-choose-expr.m
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
+// expected-no-diagnostics
+
+@interface NSArray
+-(int)count;
+@end
+
+// <rdar://problem/14438917>
+char* f(NSArray *array) {
+ return _Generic(__builtin_choose_expr(__builtin_types_compatible_p(__typeof__(array.count), void), 0.f, array.count),
+ unsigned int:"uint",
+ float:"void",
+ default: "ignored");
+}
diff --git a/test/SemaObjC/property-in-class-extension-1.m b/test/SemaObjC/property-in-class-extension-1.m
index ab461ef..51837fd 100644
--- a/test/SemaObjC/property-in-class-extension-1.m
+++ b/test/SemaObjC/property-in-class-extension-1.m
@@ -8,19 +8,20 @@
@property (nonatomic, readonly) NSString* addingMemoryModel;
-@property (nonatomic, copy, readonly) NSString* matchingMemoryModel;
+@property (nonatomic, copy, readonly) NSString* matchingMemoryModel; // expected-warning {{property attributes 'readonly' and 'copy' are mutually exclusive}}
-@property (nonatomic, retain, readonly) NSString* addingNoNewMemoryModel;
+@property (nonatomic, retain, readonly) NSString* addingNoNewMemoryModel; // expected-warning {{property attributes 'readonly' and 'retain' are mutually exclusive}}
@property (readonly) NSString* none;
@property (readonly) NSString* none1;
-@property (assign, readonly) NSString* changeMemoryModel; // expected-note {{property declared here}}
+@property (assign, readonly) NSString* changeMemoryModel; // expected-note {{property declared here}} \
+ // expected-warning {{property attributes 'readonly' and 'assign' are mutually exclusive}}
@property (readonly) __weak id weak_prop;
@property (readonly) __weak id weak_prop1;
-@property (assign, readonly) NSString* assignProperty;
+@property (assign, readonly) NSString* assignProperty; // expected-warning {{property attributes 'readonly' and 'assign' are mutually exclusive}}
@property (readonly) NSString* readonlyProp;
diff --git a/test/SemaObjC/property-ownership-attr.m b/test/SemaObjC/property-ownership-attr.m
new file mode 100644
index 0000000..f83c560
--- /dev/null
+++ b/test/SemaObjC/property-ownership-attr.m
@@ -0,0 +1,19 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+// rdar://15014468
+
+@protocol P
+ @property(readonly) id z;
+@end
+
+@interface Foo
+ @property (readonly) id x;
+@end
+
+@interface MutableFoo : Foo
+ @property (copy) id x;
+@end
+
+@interface Foo (Cat) <P>
+@property (copy) id z; // expected-warning {{'copy' attribute on property 'z' does not match the property inherited from 'P'}}
+@end
+
diff --git a/test/SemaObjC/protocol-id-test-1.m b/test/SemaObjC/protocol-id-test-1.m
index 19a4432..2366f73 100644
--- a/test/SemaObjC/protocol-id-test-1.m
+++ b/test/SemaObjC/protocol-id-test-1.m
@@ -7,10 +7,10 @@
@protocol P
@end
-@interface INTF<P>
+@interface INTF<P> // expected-note {{receiver is instance of class declared here}}
- (void)IMeth;
@end
@implementation INTF
-- (void)IMeth {INTF<P> *pi; [pi Meth]; } // expected-warning {{method '-Meth' not found (return type defaults to 'id')}}
+- (void)IMeth {INTF<P> *pi; [pi Meth]; } // expected-warning {{instance method '-Meth' not found (return type defaults to 'id'); did you mean '-IMeth'?}}
@end
diff --git a/test/SemaObjC/protocol-id-test-2.m b/test/SemaObjC/protocol-id-test-2.m
index 6bd2fee..4c1befb 100644
--- a/test/SemaObjC/protocol-id-test-2.m
+++ b/test/SemaObjC/protocol-id-test-2.m
@@ -8,5 +8,5 @@
@end
@implementation INTF
-- (void)IMeth { [(id<P>)self Meth]; } // expected-warning {{method '-Meth' not found (return type defaults to 'id')}}
+- (void)IMeth { [(id<P>)self Meth]; } // expected-warning {{instance method '-Meth' not found (return type defaults to 'id'); did you mean '-IMeth'?}}
@end
diff --git a/test/SemaObjC/provisional-ivar-lookup.m b/test/SemaObjC/provisional-ivar-lookup.m
index 7460fc2..a6276b8 100644
--- a/test/SemaObjC/provisional-ivar-lookup.m
+++ b/test/SemaObjC/provisional-ivar-lookup.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -fobjc-default-synthesize-properties -verify -Wno-objc-root-class %s
+// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
// rdar:// 8565343
@interface Foo {
diff --git a/test/SemaObjC/related-result-type-inference.m b/test/SemaObjC/related-result-type-inference.m
index 50aaf2d..547e83f 100644
--- a/test/SemaObjC/related-result-type-inference.m
+++ b/test/SemaObjC/related-result-type-inference.m
@@ -173,7 +173,7 @@ void test_inference() {
@interface Fail @end
@protocol X @end
@implementation Fail
-- (id<X>) initWithX
+- (id<X>) initWithX // expected-note {{compiler has implicitly changed method 'initWithX' return type}}
{
return (id)self; // expected-warning {{casting 'Fail *' to incompatible type 'id<X>'}}
}
@@ -184,3 +184,19 @@ void test_inference() {
@interface WeirdNSString : NSString
- (id)initWithCString:(const char*)string, void *blah;
@end
+
+
+// rdar://14121570
+@protocol PMFilterManager
+@end
+
+@interface UIViewController : NSObject
+@end
+
+@implementation UIViewController
++ (UIViewController<PMFilterManager> *)newFilterViewControllerForType // expected-note {{compiler has implicitly changed method 'newFilterViewControllerForType' return type}}
+{
+ UIViewController<PMFilterManager> *filterVC;
+ return filterVC; // expected-warning {{incompatible pointer types casting 'UIViewController *' to type 'UIViewController<PMFilterManager> *'}}
+}
+@end
diff --git a/test/SemaObjC/selector-3.m b/test/SemaObjC/selector-3.m
index f968aeb..d782c78 100644
--- a/test/SemaObjC/selector-3.m
+++ b/test/SemaObjC/selector-3.m
@@ -14,7 +14,7 @@
- (void) foo
{
SEL a,b,c;
- a = @selector(b1ar); // expected-warning {{unimplemented selector 'b1ar'}}
+ a = @selector(b1ar); // expected-warning {{creating selector for nonexistent method 'b1ar'}}
b = @selector(bar);
}
@end
@@ -25,7 +25,7 @@
SEL func()
{
- return @selector(length); // expected-warning {{unimplemented selector 'length'}}
+ return @selector(length); // expected-warning {{creating selector for nonexistent method 'length'}}
}
// rdar://9545564
@@ -69,7 +69,7 @@ extern SEL MySelector(SEL s);
@implementation INTF
- (void) Meth {
- if( [cnx respondsToSelector:MySelector(@selector( _setQueue: ))] ) // expected-warning {{unimplemented selector '_setQueue:'}}
+ if( [cnx respondsToSelector:MySelector(@selector( _setQueue: ))] ) // expected-warning {{creating selector for nonexistent method '_setQueue:'}}
{
}
@@ -81,3 +81,32 @@ extern SEL MySelector(SEL s);
}
}
@end
+
+// rdar://14007194
+@interface UxTechTest : NSObject
+- (int) invalidate : (id)Arg; // expected-warning {{multiple selectors named 'invalidate:' found}}
++ (int) C_invalidate : (int)arg; // expected-warning {{multiple selectors named 'C_invalidate:' found}}
+@end
+
+@interface UxTechTest(CAT)
+- (char) invalidate : (int)arg; // expected-note {{also found}}
++ (int) C_invalidate : (char)arg; // expected-note {{also found}}
+@end
+
+@interface NSPort : NSObject
+- (double) invalidate : (void*)Arg1; // expected-note {{also found}}
++ (int) C_invalidate : (id*)arg; // expected-note {{also found}}
+@end
+
+
+@interface USEText : NSPort
+- (int) invalidate : (int)arg; // expected-note {{also found}}
+@end
+
+@implementation USEText
+- (int) invalidate :(int) arg { return 0; }
+@end
+
+@interface USETextSub : USEText
+- (int) invalidate : (id)arg;
+@end
diff --git a/test/SemaObjC/self-comparison.m b/test/SemaObjC/self-comparison.m
new file mode 100644
index 0000000..00137ee
--- /dev/null
+++ b/test/SemaObjC/self-comparison.m
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
+
+@interface A {
+ id xxx;
+}
+-(int)bar;
+@end
+@implementation A
+-(int)bar {
+ return xxx == xxx; // expected-warning {{self-comparison always evaluates to true}}
+}
+@end
diff --git a/test/SemaObjC/sign-conversion.m b/test/SemaObjC/sign-conversion.m
new file mode 100644
index 0000000..584ea19
--- /dev/null
+++ b/test/SemaObjC/sign-conversion.m
@@ -0,0 +1,39 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -Wsign-conversion %s
+// rdar://13855394
+
+typedef unsigned int NSUInteger;
+
+@interface NSObject
+- new;
+- (NSUInteger)hash;
+@end
+
+@interface X : NSObject
+@property NSUInteger uint;
+@end
+
+@interface NSArray : NSObject
+
+- (NSUInteger)count;
+- (id)objectAtIndex:(NSUInteger)index;
+- (id)objectAtIndexedSubscript:(NSUInteger)index;
+
+@end
+
+void foo() {
+ X *x = [X new];
+ signed int sint = -1;
+ [x setUint:sint]; // expected-warning {{implicit conversion changes signedness: 'int' to 'NSUInteger'}}
+ x.uint = sint; // expected-warning {{implicit conversion changes signedness: 'int' to 'NSUInteger'}}
+}
+
+// rdar://13855682
+void Test1() {
+signed int si = -1;
+NSArray *array;
+
+(void)((NSObject*)array[si]).hash; // expected-warning {{implicit conversion changes signedness: 'int' to 'NSUInteger'}}
+
+(void)[((NSObject*)array[si]) hash]; // expected-warning {{implicit conversion changes signedness: 'int' to 'NSUInteger'}}
+(void)array[si]; // expected-warning {{implicit conversion changes signedness: 'int' to 'NSUInteger'}}
+}
diff --git a/test/SemaObjC/super-class-protocol-conformance.m b/test/SemaObjC/super-class-protocol-conformance.m
index 32d5392..1e2d56f 100644
--- a/test/SemaObjC/super-class-protocol-conformance.m
+++ b/test/SemaObjC/super-class-protocol-conformance.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify -disable-objc-default-synthesize-properties %s
// rdar://7884086
@interface NSObject @end
diff --git a/test/SemaObjC/super-dealloc-attribute.m b/test/SemaObjC/super-dealloc-attribute.m
index 35f6dac..ecab109 100644
--- a/test/SemaObjC/super-dealloc-attribute.m
+++ b/test/SemaObjC/super-dealloc-attribute.m
@@ -40,9 +40,9 @@
[super MyDealloc];
} // expected-warning {{method possibly missing a [super XXX] call}}
-- (void) MyDeallocMeth {} // No warning here.
+- (void) MyDeallocMeth {}
- (void) AnnotMyDeallocMeth{} // expected-warning {{method possibly missing a [super AnnotMyDeallocMeth] call}}
-- (void) AnnotMeth{}; // No warning here. Annotation is in its class.
+- (void) AnnotMeth{};
+ (void)registerClass:(id)name {} // expected-warning {{method possibly missing a [super registerClass:] call}}
@end
@@ -85,3 +85,48 @@
}
@end
+
+// rdar://14251387
+#define IBAction void)__attribute__((ibaction)
+
+@interface UIViewController @end
+
+@interface ViewController : UIViewController
+- (void) someMethodRequiringSuper NS_REQUIRES_SUPER;
+- (IBAction) someAction;
+- (IBAction) someActionRequiringSuper NS_REQUIRES_SUPER;
+@end
+
+
+@implementation ViewController
+- (void) someMethodRequiringSuper
+{
+}
+- (IBAction) someAction
+{
+}
+- (IBAction) someActionRequiringSuper
+{
+}
+@end
+
+// rdar://15385981
+@interface Barn
+- (void)openDoor __attribute__((objc_requires_super));
+@end
+
+@implementation Barn
+- (void) openDoor
+{
+ ;
+}
+@end
+
+@interface HorseBarn:Barn @end
+
+@implementation HorseBarn
+- (void) openDoor
+{
+ ;
+} // expected-warning {{method possibly missing a [super openDoor] call}}
+@end
diff --git a/test/SemaObjC/super-property-notation.m b/test/SemaObjC/super-property-notation.m
index 4741d1b..aa67f0a 100644
--- a/test/SemaObjC/super-property-notation.m
+++ b/test/SemaObjC/super-property-notation.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -fobjc-default-synthesize-properties -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
@interface B
+(int) classGetter;
diff --git a/test/SemaObjC/synth-provisional-ivars-1.m b/test/SemaObjC/synth-provisional-ivars-1.m
index 92a9d71..39f4747 100644
--- a/test/SemaObjC/synth-provisional-ivars-1.m
+++ b/test/SemaObjC/synth-provisional-ivars-1.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -fobjc-default-synthesize-properties -verify -Wno-objc-root-class %s
+// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
// expected-no-diagnostics
// rdar://8913053
diff --git a/test/SemaObjC/synth-provisional-ivars.m b/test/SemaObjC/synth-provisional-ivars.m
index 9d7abd5..d2eb61a 100644
--- a/test/SemaObjC/synth-provisional-ivars.m
+++ b/test/SemaObjC/synth-provisional-ivars.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -fobjc-default-synthesize-properties -verify -Wno-objc-root-class %s
+// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
int bar;
diff --git a/test/SemaObjC/synthesized-ivar.m b/test/SemaObjC/synthesized-ivar.m
index 8c9d905..884a3ca 100644
--- a/test/SemaObjC/synthesized-ivar.m
+++ b/test/SemaObjC/synthesized-ivar.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -fobjc-default-synthesize-properties -verify -Wno-objc-root-class %s
+// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
@interface I
{
}
diff --git a/test/SemaObjC/tentative-property-decl.m b/test/SemaObjC/tentative-property-decl.m
index f69ac6d..aa7df52 100644
--- a/test/SemaObjC/tentative-property-decl.m
+++ b/test/SemaObjC/tentative-property-decl.m
@@ -14,7 +14,7 @@
@class NSString;
@interface MyClass : Super
-@property(nonatomic, copy, readonly) NSString *prop;
+@property(nonatomic, copy, readonly) NSString *prop; // expected-warning {{property attributes 'readonly' and 'copy' are mutually exclusive}}
@property(nonatomic, copy, readonly) id warnProp; // expected-warning {{property attributes 'readonly' and 'copy' are mutually exclusive}}
@end
@@ -29,7 +29,7 @@
@protocol P
-@property(nonatomic, copy, readonly) NSString *prop;
+@property(nonatomic, copy, readonly) NSString *prop; // expected-warning {{property attributes 'readonly' and 'copy' are mutually exclusive}}
@property(nonatomic, copy, readonly) id warnProp; // expected-warning {{property attributes 'readonly' and 'copy' are mutually exclusive}}
@end
diff --git a/test/SemaObjC/unimplemented-protocol-prop.m b/test/SemaObjC/unimplemented-protocol-prop.m
index 1438cf5..270d879 100644
--- a/test/SemaObjC/unimplemented-protocol-prop.m
+++ b/test/SemaObjC/unimplemented-protocol-prop.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
+// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class -disable-objc-default-synthesize-properties %s
@protocol PROTOCOL0
@required
diff --git a/test/SemaObjC/unsued-backing-ivar-warning.m b/test/SemaObjC/unsued-backing-ivar-warning.m
new file mode 100644
index 0000000..c07dea7
--- /dev/null
+++ b/test/SemaObjC/unsued-backing-ivar-warning.m
@@ -0,0 +1,76 @@
+// RUN: %clang_cc1 -fsyntax-only -Wunused-property-ivar -verify -Wno-objc-root-class %s
+// rdar://14989999
+
+@interface NSObject @end
+
+@interface Example : NSObject
+@property (nonatomic, copy) id t; // expected-note {{property declared here}}
+@property (nonatomic, copy) id u; // expected-note {{property declared here}}
+@property (nonatomic, copy) id v; // expected-note {{property declared here}}
+@property (nonatomic, copy) id w;
+@property (nonatomic, copy) id x; // expected-note {{property declared here}}
+@property (nonatomic, copy) id y; // expected-note {{property declared here}}
+@property (nonatomic, copy) id z;
+@property (nonatomic, copy) id ok;
+@end
+
+@implementation Example
+- (void) setX:(id)newX { // expected-warning {{ivar '_x' which backs the property is not referenced in this property's accessor}}
+ _y = newX;
+}
+- (id) y { // expected-warning {{ivar '_y' which backs the property is not referenced in this property's accessor}}
+ return _v;
+}
+
+- (void) setV:(id)newV { // expected-warning {{ivar '_v' which backs the property is not referenced in this property's accessor}}
+ _y = newV;
+}
+
+// No warning here because there is no backing ivar.
+// both setter/getter are user defined.
+- (void) setW:(id)newW {
+ _y = newW;
+}
+- (id) w {
+ return _v;
+}
+
+- (id) u { // expected-warning {{ivar '_u' which backs the property is not referenced in this property's accessor}}
+ return _v;
+}
+
+@synthesize ok = okIvar;
+- (void) setOk:(id)newOk {
+ okIvar = newOk;
+}
+
+@synthesize t = tIvar;
+- (void) setT:(id)newT { // expected-warning {{ivar 'tIvar' which backs the property is not referenced in this property's accessor}}
+ okIvar = newT;
+}
+@end
+
+// rdar://15473432
+typedef char BOOL;
+@interface CalDAVServerVersion {
+ BOOL _supportsTimeRangeFilterWithoutEndDate;
+}
+@property (nonatomic, readonly,nonatomic) BOOL supportsTimeRangeFilterWithoutEndDate;
+@end
+
+@interface CalDAVConcreteServerVersion : CalDAVServerVersion {
+}
+@end
+
+@interface CalendarServerVersion : CalDAVConcreteServerVersion
+@end
+
+@implementation CalDAVServerVersion
+@synthesize supportsTimeRangeFilterWithoutEndDate=_supportsTimeRangeFilterWithoutEndDate;
+@end
+
+@implementation CalendarServerVersion
+-(BOOL)supportsTimeRangeFilterWithoutEndDate {
+ return 0;
+}
+@end
diff --git a/test/SemaObjC/warn-direct-ivar-access.m b/test/SemaObjC/warn-direct-ivar-access.m
index 283a00f..d34e5f1 100644
--- a/test/SemaObjC/warn-direct-ivar-access.m
+++ b/test/SemaObjC/warn-direct-ivar-access.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -fobjc-arc -fobjc-runtime-has-weak -fobjc-default-synthesize-properties -Wdirect-ivar-access -verify -Wno-objc-root-class %s
+// RUN: %clang_cc1 -fsyntax-only -fobjc-arc -fobjc-runtime-has-weak -Wdirect-ivar-access -verify -Wno-objc-root-class %s
// rdar://6505197
__attribute__((objc_root_class)) @interface MyObject {
diff --git a/test/SemaObjC/warn-implicit-atomic-property.m b/test/SemaObjC/warn-implicit-atomic-property.m
index 887a286..7d5934f 100644
--- a/test/SemaObjC/warn-implicit-atomic-property.m
+++ b/test/SemaObjC/warn-implicit-atomic-property.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -Wimplicit-atomic-properties -fobjc-default-synthesize-properties -verify -Wno-objc-root-class %s
+// RUN: %clang_cc1 -fsyntax-only -Wimplicit-atomic-properties -verify -Wno-objc-root-class %s
// rdar://8774580
@interface Super
diff --git a/test/SemaObjC/warn-missing-super.m b/test/SemaObjC/warn-missing-super.m
index e9769a9..e3f2f41 100644
--- a/test/SemaObjC/warn-missing-super.m
+++ b/test/SemaObjC/warn-missing-super.m
@@ -53,6 +53,6 @@ __attribute__((objc_root_class))
// CHECK-GC-ONLY: warn-missing-super.m:26:1: warning: method possibly missing a [super finalize] call
// CHECK-GC-ONLY: 1 warning generated.
-// RUN: %clang_cc1 -fsyntax-only -triple x86_64-apple-darwin10 -fobjc-arc %s 2>&1 | FileCheck --check-prefix=CHECK-ARC %s
+// RUN: not %clang_cc1 -fsyntax-only -triple x86_64-apple-darwin10 -fobjc-arc %s 2>&1 | FileCheck --check-prefix=CHECK-ARC %s
// CHECK-ARC: warn-missing-super.m:36:10: error: ARC forbids explicit message send of 'dealloc'
// CHECK-ARC: 1 error generated.
diff --git a/test/SemaObjC/warn-retain-block-property.m b/test/SemaObjC/warn-retain-block-property.m
index 45823e3..84cdd9f 100644
--- a/test/SemaObjC/warn-retain-block-property.m
+++ b/test/SemaObjC/warn-retain-block-property.m
@@ -1,7 +1,7 @@
-// RUN: %clang_cc1 -fsyntax-only -fblocks -fobjc-arc -Wno-objc-root-class %s 2>&1 | FileCheck --check-prefix=CHECK-ARC %s
+// RUN: not %clang_cc1 -fsyntax-only -fblocks -fobjc-arc -Wno-objc-root-class %s 2>&1 | FileCheck --check-prefix=CHECK-ARC %s
// rdar://9829425
-// RUN: %clang_cc1 -fsyntax-only -fblocks -Wno-objc-root-class %s 2>&1 | FileCheck %s
+// RUN: not %clang_cc1 -fsyntax-only -fblocks -Wno-objc-root-class %s 2>&1 | FileCheck %s
// rdar://11761511
extern void doSomething();
OpenPOWER on IntegriCloud