summaryrefslogtreecommitdiffstats
path: root/test/SemaObjC
diff options
context:
space:
mode:
Diffstat (limited to 'test/SemaObjC')
-rw-r--r--test/SemaObjC/access-property-getter.m2
-rw-r--r--test/SemaObjC/attr-deprecated.m11
-rw-r--r--test/SemaObjC/bad-receiver-1.m2
-rw-r--r--test/SemaObjC/block-attr.m2
-rw-r--r--test/SemaObjC/block-return.m13
-rw-r--r--test/SemaObjC/builtin_objc_lib_functions.m29
-rw-r--r--test/SemaObjC/builtin_objc_msgSend.m3
-rw-r--r--test/SemaObjC/call-super-2.m2
-rw-r--r--test/SemaObjC/category-1.m22
-rw-r--r--test/SemaObjC/class-conforming-protocol-2.m15
-rw-r--r--test/SemaObjC/class-method-lookup.m2
-rw-r--r--test/SemaObjC/compare-qualified-class.m2
-rw-r--r--test/SemaObjC/compare-qualified-id.m5
-rw-r--r--test/SemaObjC/comptypes-10.m34
-rw-r--r--test/SemaObjC/comptypes-a.m7
-rw-r--r--test/SemaObjC/conditional-expr-4.m2
-rw-r--r--test/SemaObjC/conflict-nonfragile-abi2.m4
-rw-r--r--test/SemaObjC/continuation-class-err.m6
-rw-r--r--test/SemaObjC/crash-label.m2
-rw-r--r--test/SemaObjC/custom-atomic-property.m20
-rw-r--r--test/SemaObjC/default-synthesize-1.m2
-rw-r--r--test/SemaObjC/default-synthesize.m4
-rw-r--r--test/SemaObjC/direct-synthesized-ivar-access.m14
-rw-r--r--test/SemaObjC/duplicate-ivar-in-class-extension.m2
-rw-r--r--test/SemaObjC/duplicate-property-class-extension.m15
-rw-r--r--test/SemaObjC/error-missing-getter.m19
-rw-r--r--test/SemaObjC/error-property-gc-attr.m4
-rw-r--r--test/SemaObjC/exprs.m10
-rw-r--r--test/SemaObjC/format-arg-attribute.m6
-rw-r--r--test/SemaObjC/ibaction.m2
-rw-r--r--test/SemaObjC/iboutletcollection-attr.m2
-rw-r--r--test/SemaObjC/incomplete-implementation.m26
-rw-r--r--test/SemaObjC/ivar-in-class-extension-error.m2
-rw-r--r--test/SemaObjC/ivar-in-class-extension.m2
-rw-r--r--test/SemaObjC/ivar-in-implementations.m2
-rw-r--r--test/SemaObjC/method-arg-decay.m5
-rw-r--r--test/SemaObjC/method-arg-qualifier-warning.m4
-rw-r--r--test/SemaObjC/method-bad-param.m14
-rw-r--r--test/SemaObjC/method-conflict-1.m83
-rw-r--r--test/SemaObjC/method-conflict-2.m44
-rw-r--r--test/SemaObjC/method-conflict.m6
-rw-r--r--test/SemaObjC/method-def-1.m2
-rw-r--r--test/SemaObjC/method-in-class-extension-impl.m20
-rw-r--r--test/SemaObjC/method-lookup-5.m10
-rw-r--r--test/SemaObjC/method-lookup.m2
-rw-r--r--test/SemaObjC/method-prototype-scope.m38
-rw-r--r--test/SemaObjC/method-sentinel-attr.m4
-rw-r--r--test/SemaObjC/method-typecheck-3.m22
-rw-r--r--test/SemaObjC/method-undef-category-warn-1.m12
-rw-r--r--test/SemaObjC/method-undef-extension-warn-1.m5
-rw-r--r--test/SemaObjC/method-undefined-warn-1.m14
-rw-r--r--test/SemaObjC/no-objc-exceptions.m13
-rw-r--r--test/SemaObjC/nonnull.h2
-rw-r--r--test/SemaObjC/nonnull.m26
-rw-r--r--test/SemaObjC/property-9.m11
-rw-r--r--test/SemaObjC/property-and-class-extension.m2
-rw-r--r--test/SemaObjC/property-and-ivar-use.m2
-rw-r--r--test/SemaObjC/property-dot-receiver.m22
-rw-r--r--test/SemaObjC/property-impl-misuse.m20
-rw-r--r--test/SemaObjC/property-in-class-extension.m37
-rw-r--r--test/SemaObjC/property-missing.m12
-rw-r--r--test/SemaObjC/property-user-setter.m10
-rw-r--r--test/SemaObjC/provisional-ivar-lookup.m43
-rw-r--r--test/SemaObjC/selector-1.m11
-rw-r--r--test/SemaObjC/selector-2.m14
-rw-r--r--test/SemaObjC/selector-3.m29
-rw-r--r--test/SemaObjC/self-assign.m14
-rw-r--r--test/SemaObjC/setter-dotsyntax.m19
-rw-r--r--test/SemaObjC/special-dep-unavail-warning.m47
-rw-r--r--test/SemaObjC/super-class-protocol-conformance.m2
-rw-r--r--test/SemaObjC/super.m2
-rw-r--r--test/SemaObjC/synth-provisional-ivars-1.m28
-rw-r--r--test/SemaObjC/synth-provisional-ivars.m4
-rw-r--r--test/SemaObjC/synthesized-ivar.m43
-rw-r--r--test/SemaObjC/undef-protocol-methods-1.m21
-rw-r--r--test/SemaObjC/undef-superclass-1.m2
-rw-r--r--test/SemaObjC/uninit-variables.m27
-rw-r--r--test/SemaObjC/warn-deprecated-implementations.m45
-rw-r--r--test/SemaObjC/warn-implicit-atomic-property.m13
-rw-r--r--test/SemaObjC/warn-incompatible-builtin-types.m2
-rw-r--r--test/SemaObjC/warn-write-strings.m2
81 files changed, 1005 insertions, 102 deletions
diff --git a/test/SemaObjC/access-property-getter.m b/test/SemaObjC/access-property-getter.m
index 331bb30..afaf82e 100644
--- a/test/SemaObjC/access-property-getter.m
+++ b/test/SemaObjC/access-property-getter.m
@@ -30,7 +30,7 @@
@implementation XCWorkQueueCommandCacheFetchInvocation
- (id)harvestPredictivelyProcessedOutputFiles
{
- _outputStream.release;
+ _outputStream.release; // expected-warning {{property access result unused - getters should not be used for side effects}}
return 0;
}
@end
diff --git a/test/SemaObjC/attr-deprecated.m b/test/SemaObjC/attr-deprecated.m
index a58068b..d3d5f95 100644
--- a/test/SemaObjC/attr-deprecated.m
+++ b/test/SemaObjC/attr-deprecated.m
@@ -97,3 +97,14 @@ __attribute ((deprecated))
@end
+@interface Test2
+@property int test2 __attribute__((deprecated));
+@end
+
+void test(Test2 *foo) {
+ int x;
+ x = foo.test2; // expected-warning {{'test2' is deprecated}}
+ x = [foo test2]; // expected-warning {{'test2' is deprecated}}
+ foo.test2 = x; // expected-warning {{'test2' is deprecated}}
+ [foo setTest2: x]; // expected-warning {{'setTest2:' is deprecated}}
+}
diff --git a/test/SemaObjC/bad-receiver-1.m b/test/SemaObjC/bad-receiver-1.m
index 33e1630..fe3eecf 100644
--- a/test/SemaObjC/bad-receiver-1.m
+++ b/test/SemaObjC/bad-receiver-1.m
@@ -16,6 +16,6 @@ typedef const struct __CFString * CFStringRef;
void func() {
CFStringRef obj;
- [obj self]; // expected-warning {{receiver type 'CFStringRef' (aka 'struct __CFString const *') is not 'id'}} \\
+ [obj self]; // expected-warning {{receiver type 'CFStringRef' (aka 'const struct __CFString *') is not 'id'}} \\
expected-warning {{method '-self' not found}}
}
diff --git a/test/SemaObjC/block-attr.m b/test/SemaObjC/block-attr.m
index de203e7..80092fc 100644
--- a/test/SemaObjC/block-attr.m
+++ b/test/SemaObjC/block-attr.m
@@ -6,5 +6,7 @@
@property void(^someBlock)(void); // expected-warning {{'copy' attribute must be specified for the block property}}
@property(copy) void(^OK)(void);
+// rdar://8820813
+@property (readonly) void (^block)(void); // readonly property is OK
@end
diff --git a/test/SemaObjC/block-return.m b/test/SemaObjC/block-return.m
new file mode 100644
index 0000000..15c3fb6
--- /dev/null
+++ b/test/SemaObjC/block-return.m
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -verify -fblocks -fobjc-gc-only %s
+// rdar://8979379
+
+@interface NSString
+- (__attribute__((objc_gc(strong))) const char *)UTF8String;
+@end
+
+int main() {
+__attribute__((objc_gc(strong))) char const *(^libraryNameForIndex)() = ^() {
+ NSString *moduleName;
+ return [moduleName UTF8String];
+ };
+}
diff --git a/test/SemaObjC/builtin_objc_lib_functions.m b/test/SemaObjC/builtin_objc_lib_functions.m
new file mode 100644
index 0000000..02b05b9
--- /dev/null
+++ b/test/SemaObjC/builtin_objc_lib_functions.m
@@ -0,0 +1,29 @@
+// RUN: %clang_cc1 -x objective-c %s -fsyntax-only -verify
+// rdar://8592641
+Class f0() { return objc_getClass("a"); } // expected-warning {{implicitly declaring C library function 'objc_getClass' with type 'id (const char *)'}} \
+ // expected-note {{please include the header <objc/runtime.h> or explicitly provide a declaration for 'objc_getClass'}}
+
+// rdar://8735023
+Class f1() { return objc_getMetaClass("a"); } // expected-warning {{implicitly declaring C library function 'objc_getMetaClass' with type 'id (const char *)'}} \
+ // expected-note {{please include the header <objc/runtime.h> or explicitly provide a declaration for 'objc_getMetaClass'}}
+
+void f2(id val) { objc_enumerationMutation(val); } // expected-warning {{implicitly declaring C library function 'objc_enumerationMutation' with type 'void (id)'}} \
+ // expected-note {{please include the header <objc/runtime.h> or explicitly provide a declaration for 'objc_enumerationMutation'}}
+
+long double f3(id self, SEL op) { return objc_msgSend_fpret(self, op); } // expected-warning {{implicitly declaring C library function 'objc_msgSend_fpret' with type 'long double (id, SEL, ...)'}} \
+ // expected-note {{please include the header <objc/message.h> or explicitly provide a declaration for 'objc_msgSend_fpret'}}
+
+id f4(struct objc_super *super, SEL op) { // expected-warning {{declaration of 'struct objc_super' will not be visible outside of this function}}
+ return objc_msgSendSuper(super, op); // expected-warning {{implicitly declaring C library function 'objc_msgSendSuper' with type 'id (void *, SEL, ...)'}} \
+ // expected-note {{please include the header <objc/message.h> or explicitly provide a declaration for 'objc_msgSendSuper'}}
+}
+
+id f5(id val, id *dest) {
+ return objc_assign_strongCast(val, dest); // expected-warning {{implicitly declaring C library function 'objc_assign_strongCast' with type 'id (id, id *)'}} \
+ // expected-note {{please include the header </objc/objc-auto.h> or explicitly provide a declaration for 'objc_assign_strongCast'}}
+}
+
+int f6(Class exceptionClass, id exception) {
+ return objc_exception_match(exceptionClass, exception); // expected-warning {{implicitly declaring C library function 'objc_exception_match' with type 'int (id, id)'}} \
+ // expected-note {{please include the header </objc/objc-exception.h> or explicitly provide a declaration for 'objc_exception_match'}}
+}
diff --git a/test/SemaObjC/builtin_objc_msgSend.m b/test/SemaObjC/builtin_objc_msgSend.m
new file mode 100644
index 0000000..bf17225
--- /dev/null
+++ b/test/SemaObjC/builtin_objc_msgSend.m
@@ -0,0 +1,3 @@
+// RUN: %clang_cc1 %s -fsyntax-only -verify
+// rdar://8632525
+extern id objc_msgSend(id self, SEL op, ...);
diff --git a/test/SemaObjC/call-super-2.m b/test/SemaObjC/call-super-2.m
index 043314d..84a625c 100644
--- a/test/SemaObjC/call-super-2.m
+++ b/test/SemaObjC/call-super-2.m
@@ -35,7 +35,7 @@ id objc_getClass(const char *s);
@implementation Derived
+ (int) class_func1
{
- int i = (size_t)[self class_func0]; // expected-warning {{method '-class_func0' not found (return type defaults to 'id')}}
+ int i = (size_t)[self class_func0]; // expected-warning {{method '+class_func0' not found (return type defaults to 'id')}}
return i + (size_t)[super class_func0]; // expected-warning {{method '+class_func0' not found (return type defaults to 'id')}}
}
+ (int) class_func2
diff --git a/test/SemaObjC/category-1.m b/test/SemaObjC/category-1.m
index 18cbb83..4cc5daf 100644
--- a/test/SemaObjC/category-1.m
+++ b/test/SemaObjC/category-1.m
@@ -62,7 +62,7 @@
// <rdar://problem/7249233>
@protocol MultipleCat_P
--(void) im0; // expected-warning {{method in protocol not implemented [-Wprotocol]}}
+-(void) im0; // expected-note {{method declared here}}
@end
@interface MultipleCat_I @end // expected-note {{required for direct or indirect protocol 'MultipleCat_P'}}
@@ -71,9 +71,27 @@
@interface MultipleCat_I() <MultipleCat_P> @end
-@implementation MultipleCat_I // expected-warning {{incomplete implementation}}
+@implementation MultipleCat_I // expected-warning {{incomplete implementation}} \
+ // expected-warning {{method in protocol not implemented [-Wprotocol]}}
@end
// <rdar://problem/7680391> - Handle nameless categories with no name that refer
// to an undefined class
@interface RDar7680391 () @end // expected-error{{cannot find interface declaration}}
+
+// <rdar://problem/8891119> - Handle @synthesize being used in conjunction
+// with explicitly declared accessor.
+@interface RDar8891119 {
+ id _name;
+}
+@end
+@interface RDar8891119 ()
+- (id)name;
+@end
+@interface RDar8891119 ()
+@property (copy) id name;
+@end
+@implementation RDar8891119
+@synthesize name = _name;
+@end
+
diff --git a/test/SemaObjC/class-conforming-protocol-2.m b/test/SemaObjC/class-conforming-protocol-2.m
index fcf9146..a3bd0b1 100644
--- a/test/SemaObjC/class-conforming-protocol-2.m
+++ b/test/SemaObjC/class-conforming-protocol-2.m
@@ -1,22 +1,23 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -Wmethod-signatures -fsyntax-only -verify %s
@protocol NSWindowDelegate @end
-@interface NSWindow
-- (void)setDelegate:(id <NSWindowDelegate>)anObject;
-- (id <NSWindowDelegate>) delegate;
+@protocol IBStringsTableWindowDelegate <NSWindowDelegate>
@end
-@protocol IBStringsTableWindowDelegate <NSWindowDelegate>
+@interface NSWindow
+- (void)setDelegate:(id <NSWindowDelegate>)anObject; // expected-note {{previous definition is here}}
+- (id <IBStringsTableWindowDelegate>) delegate; // expected-note {{previous definition is here}}
@end
+
@interface IBStringsTableWindow : NSWindow {}
@end
@implementation IBStringsTableWindow
-- (void)setDelegate:(id <IBStringsTableWindowDelegate>)delegate {
+- (void)setDelegate:(id <IBStringsTableWindowDelegate>)delegate { // expected-warning {{conflicting parameter types in implementation of 'setDelegate:'}}
}
-- (id <IBStringsTableWindowDelegate>)delegate {
+- (id <NSWindowDelegate>)delegate { // expected-warning {{conflicting return type in implementation of 'delegate':}}
return 0;
}
@end
diff --git a/test/SemaObjC/class-method-lookup.m b/test/SemaObjC/class-method-lookup.m
index f26d692..8c8c216 100644
--- a/test/SemaObjC/class-method-lookup.m
+++ b/test/SemaObjC/class-method-lookup.m
@@ -20,7 +20,7 @@
[self rootInstanceMethod]; /* class is searched for an instance method */
[MyIntermediate rootInstanceMethod]; /* with the same name. */
- [self instanceMethod];// expected-warning {{'-instanceMethod' not found (return type defaults to 'id')}}
+ [self instanceMethod];// expected-warning {{'+instanceMethod' not found (return type defaults to 'id')}}
[MyDerived instanceMethod];// expected-warning {{'+instanceMethod' not found (return type defaults to 'id')}}
}
@end
diff --git a/test/SemaObjC/compare-qualified-class.m b/test/SemaObjC/compare-qualified-class.m
index cb2b26a..0f415b6 100644
--- a/test/SemaObjC/compare-qualified-class.m
+++ b/test/SemaObjC/compare-qualified-class.m
@@ -1,5 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
-// rdar:// 8191774
+// rdar://8191774
@protocol SomeProtocol
@end
diff --git a/test/SemaObjC/compare-qualified-id.m b/test/SemaObjC/compare-qualified-id.m
index 08fb366..ce0db19 100644
--- a/test/SemaObjC/compare-qualified-id.m
+++ b/test/SemaObjC/compare-qualified-id.m
@@ -5,7 +5,7 @@ typedef unsigned int NSUInteger;
typedef struct _NSZone NSZone;
@class NSInvocation, NSMethodSignature, NSCoder, NSString, NSEnumerator;
@protocol NSObject - (BOOL)isEqual:(id)object; @end
-@protocol NSCopying - (id)copyWithZone:(NSZone *)zone; @end // expected-warning {{method in protocol not implemented [-Wprotocol]}}
+@protocol NSCopying - (id)copyWithZone:(NSZone *)zone; @end // expected-note {{method declared here}}
@protocol NSMutableCopying - (id)mutableCopyWithZone:(NSZone *)zone; @end
@protocol NSCoding - (void)encodeWithCoder:(NSCoder *)aCoder; @end
@interface NSObject <NSObject> {} @end
@@ -23,7 +23,8 @@ extern NSString * const NSTaskDidTerminateNotification;
- (NSString *)evaluateAsStringInContext:(XCPropertyExpansionContext *)context withNestingState:(const void *)state;
@end
-@implementation XCPropertyExpansionContext // expected-warning {{incomplete implementation}}
+@implementation XCPropertyExpansionContext // expected-warning {{incomplete implementation}} \
+ // expected-warning {{method in protocol not implemented [-Wprotocol]}}
- (NSString *)expandedValueForProperty:(NSString *)property {
id <XCPropertyValues> cachedValueNode = [_propNamesToPropValuesCache objectForKey:property]; // expected-warning {{method '-objectForKey:' not found (return type defaults to 'id')}}
if (cachedValueNode == ((void *)0)) { }
diff --git a/test/SemaObjC/comptypes-10.m b/test/SemaObjC/comptypes-10.m
new file mode 100644
index 0000000..0a22190
--- /dev/null
+++ b/test/SemaObjC/comptypes-10.m
@@ -0,0 +1,34 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+//rdar: //8591619
+// pr8453
+
+@protocol NSCopying @end
+@protocol NSPROTO @end
+@protocol NSPROTO1 @end
+@protocol NSPROTO2 @end
+
+@interface NSObject <NSCopying, NSPROTO, NSPROTO1> {
+ Class isa;
+}
+@end
+
+void gorf(NSObject <NSCopying> *); // expected-note {{passing argument to parameter here}}
+
+NSObject <NSCopying> *foo(id <NSCopying> bar, id id_obj)
+{
+ NSObject <NSCopying> *Init = bar; // expected-warning {{initializing 'NSObject<NSCopying> *' with an expression of incompatible type 'id<NSCopying>'}}
+ NSObject *Init1 = bar; // expected-warning {{initializing 'NSObject *' with an expression of incompatible type 'id<NSCopying>'}}
+
+ NSObject <NSCopying> *I = id_obj;
+ NSObject *I1 = id_obj;
+ gorf(bar); // expected-warning {{passing 'id<NSCopying>' to parameter of incompatible type 'NSObject<NSCopying> *'}}
+
+ gorf(id_obj);
+
+ return bar; // expected-warning {{returning 'id<NSCopying>' from a function with incompatible result type 'NSObject<NSCopying> *'}}
+}
+
+void test(id <NSCopying, NSPROTO, NSPROTO2> bar)
+{
+ NSObject <NSCopying> *Init = bar; // expected-warning {{initializing 'NSObject<NSCopying> *' with an expression of incompatible type 'id<NSCopying,NSPROTO,NSPROTO2>'}}
+}
diff --git a/test/SemaObjC/comptypes-a.m b/test/SemaObjC/comptypes-a.m
index d48dfe4..8480f52 100644
--- a/test/SemaObjC/comptypes-a.m
+++ b/test/SemaObjC/comptypes-a.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify -pedantic %s
+// RUN: %clang_cc1 -fsyntax-only -Wmethod-signatures -verify -pedantic %s
typedef signed char BOOL;
typedef int NSInteger;
@@ -18,7 +18,8 @@ NSInteger codeAssistantCaseCompareItems(id<PBXCompletionItem> a, id<PBXCompletio
@interface TedWantsToVerifyObjCDoesTheRightThing
-- compareThis:(int)a withThat:(id)b; // expected-note {{previous definition is here}}
+- compareThis:(int)a withThat:(id)b; // expected-note {{previous definition is here}} \
+ // expected-note {{previous definition is here}}
@end
@@ -26,7 +27,7 @@ NSInteger codeAssistantCaseCompareItems(id<PBXCompletionItem> a, id<PBXCompletio
- compareThis:(id<PBXCompletionItem>)
a // expected-warning {{conflicting parameter types in implementation of 'compareThis:withThat:': 'int' vs 'id<PBXCompletionItem>'}}
- withThat:(id<PBXCompletionItem>)b {
+ withThat:(id<PBXCompletionItem>)b { // expected-warning {{conflicting parameter types in implementation of 'compareThis:withThat:': 'id' vs 'id<PBXCompletionItem>'}}
return self;
}
diff --git a/test/SemaObjC/conditional-expr-4.m b/test/SemaObjC/conditional-expr-4.m
index b3317f5..56bcfc2 100644
--- a/test/SemaObjC/conditional-expr-4.m
+++ b/test/SemaObjC/conditional-expr-4.m
@@ -26,7 +26,7 @@ A *f1_a(int cond, A *a) {
}
void *f1_const_a(int x, void *p, const A * q) {
- void *r = x ? p : q; // expected-warning{{initializing 'void *' with an expression of type 'void const *' discards qualifiers}}
+ void *r = x ? p : q; // expected-warning{{initializing 'void *' with an expression of type 'const void *' discards qualifiers}}
return r;
}
diff --git a/test/SemaObjC/conflict-nonfragile-abi2.m b/test/SemaObjC/conflict-nonfragile-abi2.m
index e4b513f..86947cf 100644
--- a/test/SemaObjC/conflict-nonfragile-abi2.m
+++ b/test/SemaObjC/conflict-nonfragile-abi2.m
@@ -1,5 +1,5 @@
// RUN: %clang_cc1 -fobjc-nonfragile-abi -verify -fsyntax-only %s
-// rdar : // 8225011
+// rdar://8225011
int glob; // expected-note {{global variable declared here}}
@@ -15,7 +15,7 @@ int glob; // expected-note {{global variable declared here}}
@implementation I
- (int) Meth { return glob; } // expected-warning {{when default property synthesis is on, 'glob' lookup will access}}
@synthesize glob;
-// rdar: // 8248681
+// rdar://8248681
- (int) Meth1: (int) p {
extern int le;
int l = 1;
diff --git a/test/SemaObjC/continuation-class-err.m b/test/SemaObjC/continuation-class-err.m
index 2525182..700cf61 100644
--- a/test/SemaObjC/continuation-class-err.m
+++ b/test/SemaObjC/continuation-class-err.m
@@ -12,7 +12,7 @@
@interface ReadOnly ()
@property(readwrite, copy) id object; // expected-warning {{property attribute in continuation class does not match the primary class}}
-@property(readonly) id object1; // expected-error {{illegal declaration of property in continuation class 'ReadOnly': attribute must be}}
+@property(readonly) id object1; // expected-error {{illegal redeclaration of property in continuation class 'ReadOnly' (attribute must be 'readwrite', while its primary must be 'readonly')}}
@property (readwrite, assign) int indentLevel; // OK. assign the the default in any case.
@end
@@ -31,8 +31,8 @@
@end
@interface Bar ()
-@property (copy) id foo; // expected-error {{illegal declaration of property in continuation class 'Bar': attribute must be}}
-@property (copy) id fee; // expected-error {{illegal declaration of property in continuation class 'Bar': attribute must be}}
+@property (copy) id foo; // expected-error {{illegal redeclaration of property in continuation class 'Bar' (attribute must be 'readwrite', while its primary must be 'readonly')}}
+@property (copy) id fee; // expected-error {{illegal redeclaration of property in continuation class 'Bar' (attribute must be 'readwrite', while its primary must be 'readonly')}}
@end
@implementation Bar
diff --git a/test/SemaObjC/crash-label.m b/test/SemaObjC/crash-label.m
index ffcb463..405d6bf 100644
--- a/test/SemaObjC/crash-label.m
+++ b/test/SemaObjC/crash-label.m
@@ -7,4 +7,4 @@ Exit: [nilArgs release]; // expected-error {{use of undeclared identifier}}
- (NSDictionary *) _setupKernelStandardMode:(NSString *)source { // expected-error 2 {{expected a type}} \
expected-error {{missing context for method declaration}} \
expected-note{{to match this '{'}}
- Exit: if(_ciKernel && !success ) { // expected-error {{use of undeclared identifier}} // expected-error 2 {{expected}} expected-note{{to match this '{'}}
+ Exit: if(_ciKernel && !success ) { // expected-error {{use of undeclared identifier}} // expected-error 2 {{expected}} expected-note{{to match this '{'}} expected-error{{use of undeclared identifier 'success'}}
diff --git a/test/SemaObjC/custom-atomic-property.m b/test/SemaObjC/custom-atomic-property.m
new file mode 100644
index 0000000..f80119e
--- /dev/null
+++ b/test/SemaObjC/custom-atomic-property.m
@@ -0,0 +1,20 @@
+// RUN: %clang_cc1 -fsyntax-only -Wcustom-atomic-properties -verify %s
+
+@interface Foo
+@property (assign) Foo *myProp; // expected-note {{property declared here}} expected-note {{property declared here}}
+@end
+
+@implementation Foo
+ -(Foo*)myProp {return 0;} // expected-warning {{atomic by default property 'myProp' has a user defined getter (property should be marked 'atomic' if this is intended)}}
+ -(void)setMyProp:(Foo*)e {} // expected-warning {{atomic by default property 'myProp' has a user defined setter (property should be marked 'atomic' if this is intended)}}
+@end
+
+@interface Foo2 {
+ Foo *myProp;
+}
+@property (assign) Foo *myProp;
+@end
+
+@implementation Foo2
+@synthesize myProp; // no warnings.
+@end
diff --git a/test/SemaObjC/default-synthesize-1.m b/test/SemaObjC/default-synthesize-1.m
index 374fa83..a55834d 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-nonfragile-abi2 -verify %s
+// RUN: %clang_cc1 -fsyntax-only -fobjc-nonfragile-abi -fobjc-default-synthesize-properties -verify %s
@interface NSObject
- (void) release;
diff --git a/test/SemaObjC/default-synthesize.m b/test/SemaObjC/default-synthesize.m
index 0586dae..33e3bd6 100644
--- a/test/SemaObjC/default-synthesize.m
+++ b/test/SemaObjC/default-synthesize.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -fobjc-nonfragile-abi2 -verify %s
+// RUN: %clang_cc1 -fsyntax-only -fobjc-nonfragile-abi -fobjc-default-synthesize-properties -verify %s
@interface NSString @end
@@ -94,7 +94,7 @@
@implementation SubClass @end
-// rdar: // 7920807
+// rdar://7920807
@interface C @end
@interface C (Category)
@property int p; // expected-warning {{property 'p' requires method 'p' to be defined }} \
diff --git a/test/SemaObjC/direct-synthesized-ivar-access.m b/test/SemaObjC/direct-synthesized-ivar-access.m
new file mode 100644
index 0000000..a72fb5f
--- /dev/null
+++ b/test/SemaObjC/direct-synthesized-ivar-access.m
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 -Wnonfragile-abi2 -fsyntax-only -fobjc-nonfragile-abi -fobjc-default-synthesize-properties -verify %s
+// rdar://8673791
+
+@interface I {
+}
+
+@property int IVAR; // expected-note {{property declared here}}
+- (int) OK;
+@end
+
+@implementation I
+- (int) Meth { return IVAR; } // expected-warning {{direct access of synthesized ivar by using property access 'IVAR'}}
+- (int) OK { return self.IVAR; }
+@end
diff --git a/test/SemaObjC/duplicate-ivar-in-class-extension.m b/test/SemaObjC/duplicate-ivar-in-class-extension.m
index b66736f..0507b352 100644
--- a/test/SemaObjC/duplicate-ivar-in-class-extension.m
+++ b/test/SemaObjC/duplicate-ivar-in-class-extension.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -fobjc-nonfragile-abi2 -verify %s
+// RUN: %clang_cc1 -fsyntax-only -fobjc-nonfragile-abi -verify %s
@interface Root @end
diff --git a/test/SemaObjC/duplicate-property-class-extension.m b/test/SemaObjC/duplicate-property-class-extension.m
index a84f83f..bf48ed6 100644
--- a/test/SemaObjC/duplicate-property-class-extension.m
+++ b/test/SemaObjC/duplicate-property-class-extension.m
@@ -1,21 +1,24 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
+// rdar://7629420
@interface Foo
-@property (readonly) char foo; // expected-note {{property declared here}}
+@property (readonly) char foo;
+@property (readwrite) char bar; // expected-note {{property declared here}}
@end
@interface Foo ()
-@property (readwrite) char foo; // OK
+@property (readwrite) char foo; // expected-note 2 {{property declared here}}
@property (readwrite) char NewProperty; // expected-note 2 {{property declared here}}
+@property (readwrite) char bar; // expected-error{{illegal redeclaration of 'readwrite' property in continuation class 'Foo' (perhaps you intended this to be a 'readwrite' redeclaration of a 'readonly' public property?)}}
@end
@interface Foo ()
-@property (readwrite) char foo; // OK again, make primary property readwrite for 2nd time!
-@property (readwrite) char NewProperty; // expected-error {{illegal declaration of property in continuation class 'Foo': attribute must be readwrite, while its primary must be readonly}}
+@property (readwrite) char foo; // expected-error {{property has a previous declaration}}
+@property (readwrite) char NewProperty; // expected-error {{property has a previous declaration}}
@end
@interface Foo ()
-@property (readonly) char foo; // expected-error {{illegal declaration of property in continuation class 'Foo': attribute must be readwrite, while its primary must be readonly}}
-@property (readwrite) char NewProperty; // expected-error {{illegal declaration of property in continuation class 'Foo': attribute must be readwrite, while its primary must be readonly}}
+@property (readonly) char foo; // expected-error {{property has a previous declaration}}
+@property (readwrite) char NewProperty; // expected-error {{property has a previous declaration}}
@end
diff --git a/test/SemaObjC/error-missing-getter.m b/test/SemaObjC/error-missing-getter.m
new file mode 100644
index 0000000..3c91ab2
--- /dev/null
+++ b/test/SemaObjC/error-missing-getter.m
@@ -0,0 +1,19 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+// rdar://8155806
+
+@interface Subclass
+{
+ int setterOnly;
+}
+- (void) setSetterOnly : (int) arg;
+@end
+
+int func (int arg, Subclass *x) {
+ if (x.setterOnly) { // expected-error {{expected getter method not found on object of type 'Subclass *'}}
+ x.setterOnly = 1;
+ }
+ func(x.setterOnly + 1, x); // expected-error {{expected getter method not found on object of type 'Subclass *'}}
+ int i = x.setterOnly + 1; // expected-error {{expected getter method not found on object of type 'Subclass *'}}
+ return x.setterOnly + 1; // expected-error {{expected getter method not found on object of type 'Subclass *'}}
+}
+
diff --git a/test/SemaObjC/error-property-gc-attr.m b/test/SemaObjC/error-property-gc-attr.m
index 661638c..a77b68b 100644
--- a/test/SemaObjC/error-property-gc-attr.m
+++ b/test/SemaObjC/error-property-gc-attr.m
@@ -20,9 +20,9 @@
@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 a __strong property 'NOT' must be garbage collectable}}
+@synthesize NOT=II; // expected-error {{property 'NOT' must be declared __weak to match existing ivar 'II' with __weak attribute}}
@synthesize WID;
@synthesize ID;
-@synthesize AWEAK; // expected-error {{existing ivar 'AWEAK' for a __strong property 'AWEAK' must be garbage collectable}}
+@synthesize AWEAK; // expected-error {{property 'AWEAK' must be declared __weak to match existing ivar 'AWEAK' with __weak attribute}}
@synthesize WI;
@end
diff --git a/test/SemaObjC/exprs.m b/test/SemaObjC/exprs.m
index 3370bda..13c34e5 100644
--- a/test/SemaObjC/exprs.m
+++ b/test/SemaObjC/exprs.m
@@ -22,3 +22,13 @@ void test2() {
#define MAX(A,B) ({ __typeof__(A) __a = (A); __typeof__(B) __b = (B); __a < __b ? __b : __a; })
void (^foo)(int, int) = ^(int x, int y) { int z = MAX(x, y); };
+
+
+
+// rdar://8445858
+@class Object;
+static Object *g;
+void test3(Object *o) {
+ // this is ok.
+ __sync_bool_compare_and_swap(&g, 0, o);
+}
diff --git a/test/SemaObjC/format-arg-attribute.m b/test/SemaObjC/format-arg-attribute.m
index 264e7a8..98dff3a 100644
--- a/test/SemaObjC/format-arg-attribute.m
+++ b/test/SemaObjC/format-arg-attribute.m
@@ -9,9 +9,9 @@ extern void fc1 (const NSString *) __attribute__((format_arg)); // expected-err
extern void fc2 (const NSString *) __attribute__((format_arg())); // expected-error {{attribute requires 1 argument(s)}}
extern void fc3 (const NSString *) __attribute__((format_arg(1, 2))); // expected-error {{attribute requires 1 argument(s)}}
-struct s1 { int i; } __attribute__((format_arg(1))); // expected-warning {{'format_arg' attribute only applies to function types}}
-union u1 { int i; } __attribute__((format_arg(1))); // expected-warning {{'format_arg' attribute only applies to function types}}
-enum e1 { E1V0 } __attribute__((format_arg(1))); // expected-warning {{'format_arg' attribute only applies to function types}}
+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}}
extern NSString *ff3 (const NSString *) __attribute__((format_arg(3-2)));
extern NSString *ff4 (const NSString *) __attribute__((format_arg(foo))); // expected-error {{attribute requires 1 argument(s)}}
diff --git a/test/SemaObjC/ibaction.m b/test/SemaObjC/ibaction.m
index b97e002..bcedf83 100644
--- a/test/SemaObjC/ibaction.m
+++ b/test/SemaObjC/ibaction.m
@@ -4,10 +4,12 @@
{
__attribute__((iboutlet)) id myoutlet;
}
++ (void) __attribute__((ibaction)) myClassMethod:(id)msg; // expected-warning{{ibaction attribute can only be applied to Objective-C instance methods}}
- (void) __attribute__((ibaction)) myMessage:(id)msg;
@end
@implementation Foo
++ (void) __attribute__((ibaction)) myClassMethod:(id)msg {} // expected-warning{{ibaction attribute can only be applied to Objective-C instance methods}}
// Normally attributes should not be attached to method definitions, but
// we allow 'ibaction' to be attached because it can be expanded from
// the IBAction macro.
diff --git a/test/SemaObjC/iboutletcollection-attr.m b/test/SemaObjC/iboutletcollection-attr.m
index fb64e3a..217daa7 100644
--- a/test/SemaObjC/iboutletcollection-attr.m
+++ b/test/SemaObjC/iboutletcollection-attr.m
@@ -1,6 +1,6 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
// RUN: %clang_cc1 -x objective-c++ -fsyntax-only -verify %s
-// rdar: // 8308053
+// rdar://8308053
@interface I {
__attribute__((iboutletcollection(I))) id ivar1;
diff --git a/test/SemaObjC/incomplete-implementation.m b/test/SemaObjC/incomplete-implementation.m
new file mode 100644
index 0000000..612c331
--- /dev/null
+++ b/test/SemaObjC/incomplete-implementation.m
@@ -0,0 +1,26 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+@interface I
+- Meth; // expected-note{{method definition for 'Meth' not found}}
+@end
+
+@implementation I // expected-warning{{incomplete implementation}}
+@end
+
+@implementation I(CAT)
+- Meth {return 0;}
+@end
+
+#pragma GCC diagnostic ignored "-Wincomplete-implementation"
+@interface I2
+- Meth;
+@end
+
+@implementation I2
+@end
+
+@implementation I2(CAT)
+- Meth {return 0;}
+@end
+
+
diff --git a/test/SemaObjC/ivar-in-class-extension-error.m b/test/SemaObjC/ivar-in-class-extension-error.m
index 6e0b577..23a7491 100644
--- a/test/SemaObjC/ivar-in-class-extension-error.m
+++ b/test/SemaObjC/ivar-in-class-extension-error.m
@@ -1,5 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
-// rdar:// 6812436
+// rdar://6812436
@interface A @end
diff --git a/test/SemaObjC/ivar-in-class-extension.m b/test/SemaObjC/ivar-in-class-extension.m
index 4130d8f..b5772f6 100644
--- a/test/SemaObjC/ivar-in-class-extension.m
+++ b/test/SemaObjC/ivar-in-class-extension.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -fobjc-nonfragile-abi2 -verify %s
+// RUN: %clang_cc1 -fsyntax-only -fobjc-nonfragile-abi -verify %s
@interface SomeClass @end
diff --git a/test/SemaObjC/ivar-in-implementations.m b/test/SemaObjC/ivar-in-implementations.m
index 4060526..74db322 100644
--- a/test/SemaObjC/ivar-in-implementations.m
+++ b/test/SemaObjC/ivar-in-implementations.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -fobjc-nonfragile-abi2 -verify %s
+// RUN: %clang_cc1 -fsyntax-only -fobjc-nonfragile-abi -verify %s
@interface Super @end
diff --git a/test/SemaObjC/method-arg-decay.m b/test/SemaObjC/method-arg-decay.m
index 012a3ee..6e11e97 100644
--- a/test/SemaObjC/method-arg-decay.m
+++ b/test/SemaObjC/method-arg-decay.m
@@ -56,7 +56,7 @@ PBXFindMatchContains, PBXFindMatchStartsWith, PBXFindMatchWholeWords,
@interface PBXProjectModule : PBXModule <PBXFindableText> {
}
@end @class PBXBookmark;
-@protocol PBXSelectionTarget - (NSObject <PBXSelectionTarget> *) performAction:(id)action withSelection:(NSArray *)selection; // expected-warning {{method in protocol not implemented [-Wprotocol]}}
+@protocol PBXSelectionTarget - (NSObject <PBXSelectionTarget> *) performAction:(id)action withSelection:(NSArray *)selection; // expected-note {{method declared here}}
@end @class XCPropertyDictionary, XCPropertyCondition, XCPropertyConditionSet, XCMutablePropertyConditionSet;
extern NSMutableArray *XCFindPossibleKeyModules(PBXModule *module, BOOL useExposedModulesOnly);
@interface NSString (StringUtilities) - (NSString *) trimToLength:(NSInteger)length preserveRange:(NSRange)range;
@@ -72,7 +72,8 @@ extern NSMutableArray *XCFindPossibleKeyModules(PBXModule *module, BOOL useExpos
}
- (PBXModule *) moduleForTab:(NSTabViewItem *)item; // expected-note {{method definition for 'moduleForTab:' not found}}
@end
-@implementation XCPerspectiveModule // expected-warning {{incomplete implementation}}
+@implementation XCPerspectiveModule // expected-warning {{incomplete implementation}} \
+ // expected-warning {{method in protocol not implemented [-Wprotocol]}}
+ (void) openForProjectDocument:(PBXProjectDocument *)projectDocument {
}
- (PBXModule *) type:(Class)type inPerspective:(id)perspectiveIdentifer matchingFunction:(BOOL (void *, void *))comparator usingData:(void *)data {
diff --git a/test/SemaObjC/method-arg-qualifier-warning.m b/test/SemaObjC/method-arg-qualifier-warning.m
index 463fb7f..690509e 100644
--- a/test/SemaObjC/method-arg-qualifier-warning.m
+++ b/test/SemaObjC/method-arg-qualifier-warning.m
@@ -12,8 +12,8 @@ static NSString * const Identifier3 = @"Identifier3";
int main () {
- [@"Identifier1" isEqualToString:Identifier1]; // expected-warning {{sending 'NSString const *' to parameter of type 'NSString *' discards qualifiers}}
- [@"Identifier2" isEqualToString:Identifier2]; // expected-warning {{sending 'NSString const *' to parameter of type 'NSString *' discards qualifiers}}
+ [@"Identifier1" isEqualToString:Identifier1]; // expected-warning {{sending 'const NSString *' to parameter of type 'NSString *' discards qualifiers}}
+ [@"Identifier2" isEqualToString:Identifier2]; // expected-warning {{sending 'const NSString *' to parameter of type 'NSString *' discards qualifiers}}
[@"Identifier3" isEqualToString:Identifier3];
return 0;
}
diff --git a/test/SemaObjC/method-bad-param.m b/test/SemaObjC/method-bad-param.m
index 324ed342..388e447 100644
--- a/test/SemaObjC/method-bad-param.m
+++ b/test/SemaObjC/method-bad-param.m
@@ -28,3 +28,17 @@ void f0(foo *a0) {
extern void g0(int x, ...);
g0(1, *(foo*)0); // expected-error {{cannot pass object with interface type 'foo' by-value through variadic function}}
}
+
+// rdar://8421082
+enum bogus; // expected-note {{forward declaration of 'enum bogus'}}
+
+@interface fee {
+}
+- (void)crashMe:(enum bogus)p;
+@end
+
+@implementation fee
+- (void)crashMe:(enum bogus)p { // expected-error {{variable has incomplete type 'enum bogus'}}
+}
+@end
+
diff --git a/test/SemaObjC/method-conflict-1.m b/test/SemaObjC/method-conflict-1.m
new file mode 100644
index 0000000..3cf2c6b
--- /dev/null
+++ b/test/SemaObjC/method-conflict-1.m
@@ -0,0 +1,83 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+// This test case tests the default behavior.
+
+// rdar://7933061
+
+@interface NSObject @end
+
+@interface NSArray : NSObject @end
+
+@interface MyClass : NSObject {
+}
+- (void)myMethod:(NSArray *)object;
+- (void)myMethod1:(NSObject *)object; // broken-note {{previous definition is here}}
+@end
+
+@implementation MyClass
+- (void)myMethod:(NSObject *)object {
+}
+- (void)myMethod1:(NSArray *)object { // broken-warning {{conflicting parameter types in implementation of 'myMethod1:': 'NSObject *' vs 'NSArray *'}}
+}
+@end
+
+
+@protocol MyProtocol @end
+
+@interface MyOtherClass : NSObject <MyProtocol> {
+}
+- (void)myMethod:(id <MyProtocol>)object; // broken-note {{previous definition is here}}
+- (void)myMethod1:(id <MyProtocol>)object; // broken-note {{previous definition is here}}
+@end
+
+@implementation MyOtherClass
+- (void)myMethod:(MyClass *)object { // broken-warning {{conflicting parameter types in implementation of 'myMethod:': 'id<MyProtocol>' vs 'MyClass *'}}
+}
+- (void)myMethod1:(MyClass<MyProtocol> *)object { // broken-warning {{conflicting parameter types in implementation of 'myMethod1:': 'id<MyProtocol>' vs 'MyClass<MyProtocol> *'}}
+}
+@end
+
+
+
+@interface A @end
+@interface B : A @end
+
+@interface Test1 {}
+- (void) test1:(A*) object; // broken-note {{previous definition is here}}
+- (void) test2:(B*) object;
+@end
+
+@implementation Test1
+- (void) test1:(B*) object {} // broken-warning {{conflicting parameter types in implementation of 'test1:': 'A *' vs 'B *'}}
+- (void) test2:(A*) object {}
+@end
+
+// rdar://problem/8597621 wants id -> A* to be an exception
+@interface Test2 {}
+- (void) test1:(id) object; // broken-note {{previous definition is here}}
+- (void) test2:(A*) object;
+@end
+@implementation Test2
+- (void) test1:(A*) object {} // broken-warning {{conflicting parameter types in implementation of 'test1:': 'id' vs 'A *'}}
+- (void) test2:(id) object {}
+@end
+
+@interface Test3 {}
+- (A*) test1;
+- (B*) test2; // broken-note {{previous definition is here}}
+@end
+
+@implementation Test3
+- (B*) test1 { return 0; }
+- (A*) test2 { return 0; } // broken-warning {{conflicting return type in implementation of 'test2': 'B *' vs 'A *'}}
+@end
+
+// The particular case of overriding with an id return is white-listed.
+@interface Test4 {}
+- (id) test1;
+- (A*) test2;
+@end
+@implementation Test4
+- (A*) test1 { return 0; } // id -> A* is rdar://problem/8596987
+- (id) test2 { return 0; }
+@end
diff --git a/test/SemaObjC/method-conflict-2.m b/test/SemaObjC/method-conflict-2.m
new file mode 100644
index 0000000..7b5a08a
--- /dev/null
+++ b/test/SemaObjC/method-conflict-2.m
@@ -0,0 +1,44 @@
+// RUN: %clang_cc1 -Wmethod-signatures -fsyntax-only -verify %s
+
+@interface A @end
+@interface B : A @end
+
+@interface Test1 {}
+- (void) test1:(A*) object; // expected-note {{previous definition is here}}
+- (void) test2:(B*) object;
+@end
+
+@implementation Test1
+- (void) test1:(B*) object {} // expected-warning {{conflicting parameter types in implementation of 'test1:': 'A *' vs 'B *'}}
+- (void) test2:(A*) object {}
+@end
+
+@interface Test2 {}
+- (void) test1:(id) object; // expected-note {{previous definition is here}}
+- (void) test2:(A*) object;
+@end
+
+@implementation Test2
+- (void) test1:(A*) object {} // expected-warning {{conflicting parameter types in implementation of 'test1:': 'id' vs 'A *'}}
+- (void) test2:(id) object {}
+@end
+
+@interface Test3 {}
+- (A*) test1;
+- (B*) test2; // expected-note {{previous definition is here}}
+@end
+
+@implementation Test3
+- (B*) test1 { return 0; }
+- (A*) test2 { return 0; } // expected-warning {{conflicting return type in implementation of 'test2': 'B *' vs 'A *'}}
+@end
+
+// The particular case of overriding with an id return is white-listed.
+@interface Test4 {}
+- (id) test1;
+- (A*) test2;
+@end
+@implementation Test4
+- (A*) test1 { return 0; } // id -> A* is rdar://problem/8596987
+- (id) test2 { return 0; }
+@end
diff --git a/test/SemaObjC/method-conflict.m b/test/SemaObjC/method-conflict.m
index 5dc886f..4eb7290 100644
--- a/test/SemaObjC/method-conflict.m
+++ b/test/SemaObjC/method-conflict.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -Wmethod-signatures -fsyntax-only -verify %s
typedef signed char BOOL;
typedef unsigned int NSUInteger;
@@ -40,7 +40,7 @@ typedef NSUInteger XDSourceLanguage;
@end @class XDSCOperation;
@interface XDSCClassFormatter : NSObject {
}
-+ (NSUInteger) compartmentsForClassifier: (id <XDUMLClassifier>) classifier withSpecification: (XDSCDisplaySpecification *) displaySpec;
++ (NSUInteger) compartmentsForClassifier: (id <XDUMLClassifier>) classifier withSpecification: (XDSCDisplaySpecification *) displaySpec; // expected-note {{previous definition is here}}
@end
@class NSString;
@implementation XDSCClassFormatter
@@ -49,7 +49,7 @@ typedef NSUInteger XDSourceLanguage;
{
return 0;
}
-+ (NSUInteger) compartmentsForClassifier: (id <XDSCClassifier>) classifier withSpecification: (XDSCDisplaySpecification *) displaySpec {
++ (NSUInteger) compartmentsForClassifier: (id <XDSCClassifier>) classifier withSpecification: (XDSCDisplaySpecification *) displaySpec { // expected-warning {{conflicting parameter types in implementation of 'compartmentsForClassifier:withSpecification:'}}
return 0;
}
@end
diff --git a/test/SemaObjC/method-def-1.m b/test/SemaObjC/method-def-1.m
index 7630ad0..bc7ea7b 100644
--- a/test/SemaObjC/method-def-1.m
+++ b/test/SemaObjC/method-def-1.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -Wmethod-signatures -fsyntax-only -verify %s
@interface foo
- (int)meth;
diff --git a/test/SemaObjC/method-in-class-extension-impl.m b/test/SemaObjC/method-in-class-extension-impl.m
new file mode 100644
index 0000000..c205322
--- /dev/null
+++ b/test/SemaObjC/method-in-class-extension-impl.m
@@ -0,0 +1,20 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+// rdar://8530080
+
+@protocol ViewDelegate @end
+
+@interface NSTextView
+- (id <ViewDelegate>)delegate;
+@end
+
+@interface FooTextView : NSTextView
+@end
+
+@interface FooTextView()
+- (id)delegate;
+@end
+
+@implementation FooTextView
+- (id)delegate {return 0; }
+@end
+
diff --git a/test/SemaObjC/method-lookup-5.m b/test/SemaObjC/method-lookup-5.m
new file mode 100644
index 0000000..13df218
--- /dev/null
+++ b/test/SemaObjC/method-lookup-5.m
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+// rdar://8592156
+
+typedef struct objc_class *Class;
+@interface A
+-(Class) foo;
+@end
+
+void f0(A *a) { int x = [[a foo] baz]; } // expected-warning {{method '+baz' not found (return type defaults to 'id')}} \
+ // expected-warning {{ncompatible pointer to integer conversion initializing 'int' with an expression of type 'id'}}
diff --git a/test/SemaObjC/method-lookup.m b/test/SemaObjC/method-lookup.m
index e378958..3091124 100644
--- a/test/SemaObjC/method-lookup.m
+++ b/test/SemaObjC/method-lookup.m
@@ -22,7 +22,7 @@ typedef int NSInteger;
static NSMutableArray * recentCompletions = ((void *)0);
+ (float) factorForRecentCompletion:(NSString *) completion
{
- for (NSObject<PBXCompletionItem> * item in [self completionItems]) // expected-warning{{method '-completionItems' not found (return type defaults to 'id')}}
+ for (NSObject<PBXCompletionItem> * item in [self completionItems]) // expected-warning{{method '+completionItems' not found (return type defaults to 'id')}}
{
if ([item respondsToSelector:@selector(setPriority:)])
{
diff --git a/test/SemaObjC/method-prototype-scope.m b/test/SemaObjC/method-prototype-scope.m
new file mode 100644
index 0000000..2184172
--- /dev/null
+++ b/test/SemaObjC/method-prototype-scope.m
@@ -0,0 +1,38 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+// rdar://8877730
+
+int object;
+
+@class NSString, NSArray;
+
+@interface Test
+- Func:(int)XXXX, id object;
+
+- doSomethingElseWith:(id)object;
+
+- (NSString *)doSomethingWith:(NSString *)object and:(NSArray *)object; // expected-warning {{redefinition of method parameter 'object'}} \
+ // expected-note {{previous declaration is here}}
+@end
+
+@implementation Test
+
+- (NSString *)doSomethingWith:(NSString *)object and:(NSArray *)object // expected-warning {{redefinition of method parameter 'object'}} \
+ // expected-note {{previous declaration is here}}
+{
+ return object; // expected-warning {{incompatible pointer types returning 'NSArray *' from a function with result type 'NSString *'}}
+}
+
+- Func:(int)XXXX, id object { return object; }
+
+- doSomethingElseWith:(id)object { return object; }
+
+@end
+
+struct P;
+
+@interface Test1
+- doSomethingWith:(struct S *)object and:(struct P *)obj; // expected-warning {{declaration of 'struct S' will not be visible outside of this function}}
+@end
+
+int obj;
diff --git a/test/SemaObjC/method-sentinel-attr.m b/test/SemaObjC/method-sentinel-attr.m
index 6ec362f..5375408 100644
--- a/test/SemaObjC/method-sentinel-attr.m
+++ b/test/SemaObjC/method-sentinel-attr.m
@@ -16,7 +16,7 @@
- (void) foo11 : (int)x, ... __attribute__ ((__sentinel__(1,1,3))); // expected-error {{attribute requires 0, 1 or 2 argument(s)}}
- (void) foo12 : (int)x, ... ATTR; // expected-note {{method has been explicitly marked sentinel here}}
-// rdar:// 7975788
+// rdar://7975788
- (id) foo13 : (id)firstObj, ... __attribute__((sentinel(0,1)));
- (id) foo14 : (id)firstObj : (Class)secondObj, ... __attribute__((sentinel(0,1)));
- (id) foo15 : (id*)firstObj, ... __attribute__((sentinel(0,1)));
@@ -40,7 +40,7 @@ int main ()
[p foo12:1]; // expected-warning {{not enough variable arguments in 'foo12:' declaration to fit a sentinel}}
- // rdar:// 7975788
+ // rdar://7975788
[ p foo13 : NULL];
[ p foo14 : 0 : NULL];
[ p foo16 : NULL];
diff --git a/test/SemaObjC/method-typecheck-3.m b/test/SemaObjC/method-typecheck-3.m
new file mode 100644
index 0000000..1999b7d
--- /dev/null
+++ b/test/SemaObjC/method-typecheck-3.m
@@ -0,0 +1,22 @@
+// RUN: %clang_cc1 -Wmethod-signatures -fsyntax-only -verify %s
+
+@class B;
+@interface A
+- (B*)obj;
+- (B*)a; // expected-note {{previous definition is here}}
+- (void)takesA: (A*)a; // expected-note {{previous definition is here}}
+- (void)takesId: (id)a; // expected-note {{previous definition is here}}
+@end
+
+
+@interface B : A
+@end
+
+@implementation B
+- (id)obj {return self;} // 'id' overrides are white-listed?
+- (A*)a { return self;} // expected-warning {{conflicting return type in implementation of 'a'}}
+- (void)takesA: (B*)a // expected-warning {{conflicting parameter types in implementation of 'takesA:'}}
+{}
+- (void)takesId: (B*)a // expected-warning {{conflicting parameter types in implementation of 'takesId:'}}
+{}
+@end
diff --git a/test/SemaObjC/method-undef-category-warn-1.m b/test/SemaObjC/method-undef-category-warn-1.m
index b367801..532ecfc 100644
--- a/test/SemaObjC/method-undef-category-warn-1.m
+++ b/test/SemaObjC/method-undef-category-warn-1.m
@@ -4,23 +4,25 @@
@end
@protocol P
-- (void) Pmeth; // expected-warning {{method in protocol not implemented [-Wprotocol]}}
-- (void) Pmeth1; // expected-warning {{method in protocol not implemented [-Wprotocol]}}
+- (void) Pmeth; // expected-note {{method declared here }}
+- (void) Pmeth1; // expected-note {{method declared here }}
@end
@interface MyClass1(CAT) <P> // expected-note {{required for direct or indirect protocol 'P'}}
- (void) meth2; // expected-note {{method definition for 'meth2' not found}}
@end
-@implementation MyClass1(CAT) // expected-warning {{incomplete implementation}}
+@implementation MyClass1(CAT) // expected-warning {{incomplete implementation}} \
+ // expected-warning {{method in protocol not implemented [-Wprotocol]}}
- (void) Pmeth1{}
@end
@interface MyClass1(DOG) <P> // expected-note {{required for direct or indirect protocol 'P'}}
-- (void)ppp; // expected-note {{method definition for 'ppp' not found}}
+- (void)ppp; // expected-note {{method definition for 'ppp' not found}}
@end
-@implementation MyClass1(DOG) // expected-warning {{incomplete implementation}}
+@implementation MyClass1(DOG) // expected-warning {{incomplete implementation}} \
+ // expected-warning {{method in protocol not implemented [-Wprotocol]}}
- (void) Pmeth {}
@end
diff --git a/test/SemaObjC/method-undef-extension-warn-1.m b/test/SemaObjC/method-undef-extension-warn-1.m
index 1addcf7..ade861e 100644
--- a/test/SemaObjC/method-undef-extension-warn-1.m
+++ b/test/SemaObjC/method-undef-extension-warn-1.m
@@ -5,7 +5,7 @@
@protocol P
- (void)Pmeth;
-- (void)Pmeth1; // expected-warning {{method in protocol not implemented [-Wprotocol]}}
+- (void)Pmeth1; // expected-note {{method declared here}}
@end
// Class extension
@@ -18,6 +18,7 @@
- (void)categoryMethod;
@end
-@implementation MyClass // expected-warning {{incomplete implementation}}
+@implementation MyClass // expected-warning {{incomplete implementation}} \
+ // expected-warning {{method in protocol not implemented [-Wprotocol]}}
- (void)Pmeth {}
@end
diff --git a/test/SemaObjC/method-undefined-warn-1.m b/test/SemaObjC/method-undefined-warn-1.m
index 1ebc59e..922a034 100644
--- a/test/SemaObjC/method-undefined-warn-1.m
+++ b/test/SemaObjC/method-undefined-warn-1.m
@@ -40,3 +40,17 @@
- (void) cls_meth1 : (int) arg2{}
@end
+
+// rdar://8850818
+@interface Root @end
+
+@interface Foo : Root @end
+
+@implementation Foo
+
+- (void)someFunction { return; }
+
++ (void)anotherFunction {
+ [self someFunction]; // expected-warning {{method '+someFunction' not found (return type defaults to 'id')}}
+}
+@end
diff --git a/test/SemaObjC/no-objc-exceptions.m b/test/SemaObjC/no-objc-exceptions.m
new file mode 100644
index 0000000..78419a2
--- /dev/null
+++ b/test/SemaObjC/no-objc-exceptions.m
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 -fno-objc-exceptions -fsyntax-only -verify %s
+
+void f() {
+ @throw @"Hello"; // expected-error {{cannot use '@throw' with Objective-C exceptions disabled}}
+}
+
+void g() {
+ @try { // expected-error {{cannot use '@try' with Objective-C exceptions disabled}}
+ f();
+ } @finally {
+
+ }
+}
diff --git a/test/SemaObjC/nonnull.h b/test/SemaObjC/nonnull.h
new file mode 100644
index 0000000..f5a038f
--- /dev/null
+++ b/test/SemaObjC/nonnull.h
@@ -0,0 +1,2 @@
+// rdar: //6857843
+#define NONNULL_ATTR __attribute__((nonnull))
diff --git a/test/SemaObjC/nonnull.m b/test/SemaObjC/nonnull.m
index 15fee74..6c45d97 100644
--- a/test/SemaObjC/nonnull.m
+++ b/test/SemaObjC/nonnull.m
@@ -1,8 +1,11 @@
+#include "nonnull.h"
+
// RUN: %clang_cc1 -fblocks -fsyntax-only -verify %s
@class NSObject;
-int f1(int x) __attribute__((nonnull)); // expected-warning{{'nonnull' attribute applied to function with no pointer arguments}}
+NONNULL_ATTR
+int f1(int x); // no warning
int f2(int *x) __attribute__ ((nonnull (1)));
int f3(int *x) __attribute__ ((nonnull (0))); // expected-error {{'nonnull' attribute parameter 1 is out of bounds}}
int f4(int *x, int *y) __attribute__ ((nonnull (1,2)));
@@ -44,4 +47,23 @@ foo (int i1, int i2, int i3, void (^cp1)(), void (^cp2)(), void (^cp3)())
func7((NSObject*) 0); // no-warning
}
-void func5(int) __attribute__((nonnull)); // expected-warning{{'nonnull' attribute applied to function with no pointer arguments}}
+void func5(int) NONNULL_ATTR; // no warning
+
+// rdar://6857843
+struct dispatch_object_s {
+ int x;
+};
+
+typedef union {
+ long first;
+ struct dispatch_object_s *_do;
+} dispatch_object_t __attribute__((transparent_union));
+
+__attribute__((nonnull))
+void _dispatch_queue_push_list(dispatch_object_t _head); // no warning
+
+void func6(dispatch_object_t _head) {
+ _dispatch_queue_push_list(0); // expected-warning {{null passed to a callee which requires a non-null argument}}
+ _dispatch_queue_push_list(_head._do); // no warning
+}
+
diff --git a/test/SemaObjC/property-9.m b/test/SemaObjC/property-9.m
index 669f9c0..2b6564d 100644
--- a/test/SemaObjC/property-9.m
+++ b/test/SemaObjC/property-9.m
@@ -96,3 +96,14 @@ typedef signed char BOOL;
- (float)setMyStyle:(int)style;
@end
+// rdar://8774513
+@class MDAInstance; // expected-note {{forward class is declared here}}
+
+@interface MDATestDocument
+@property(retain) MDAInstance *instance;
+@end
+
+id f0(MDATestDocument *d) {
+ return d.instance.path; // expected-error {{property 'path' cannot be found in forward class object 'MDAInstance *'}}
+}
+
diff --git a/test/SemaObjC/property-and-class-extension.m b/test/SemaObjC/property-and-class-extension.m
index 51bf8de..926538a 100644
--- a/test/SemaObjC/property-and-class-extension.m
+++ b/test/SemaObjC/property-and-class-extension.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -fobjc-nonfragile-abi2 -verify %s
+// RUN: %clang_cc1 -fsyntax-only -fobjc-nonfragile-abi -verify %s
/**
When processing @synthesize, treat ivars in a class extension the same as ivars in the class @interface,
diff --git a/test/SemaObjC/property-and-ivar-use.m b/test/SemaObjC/property-and-ivar-use.m
index b9235c1..70e5534 100644
--- a/test/SemaObjC/property-and-ivar-use.m
+++ b/test/SemaObjC/property-and-ivar-use.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -fobjc-nonfragile-abi2 -verify %s
+// RUN: %clang_cc1 -fsyntax-only -fobjc-nonfragile-abi -verify %s
// 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-dot-receiver.m b/test/SemaObjC/property-dot-receiver.m
new file mode 100644
index 0000000..733ad42
--- /dev/null
+++ b/test/SemaObjC/property-dot-receiver.m
@@ -0,0 +1,22 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -x objective-c++ -fsyntax-only -verify %s
+// rdar://8962253
+
+@interface Singleton {
+}
++ (Singleton*) instance;
+@end
+
+@implementation Singleton
+
+- (void) someSelector { }
+
++ (Singleton*) instance { return 0; }
+
++ (void) compileError
+{
+ [Singleton.instance someSelector]; // clang issues error here
+}
+
+@end
+
diff --git a/test/SemaObjC/property-impl-misuse.m b/test/SemaObjC/property-impl-misuse.m
index 58c91c5..122afc1d 100644
--- a/test/SemaObjC/property-impl-misuse.m
+++ b/test/SemaObjC/property-impl-misuse.m
@@ -14,3 +14,23 @@
@synthesize Y; // expected-note {{previous use is here}}
@synthesize Z=Y; // expected-error {{synthesized properties 'Z' and 'Y' both claim ivar 'Y'}}
@end
+
+// rdar://8703553
+@interface IDEPathCell
+{
+@private
+ id _gradientStyle;
+}
+
+@property (readwrite, assign, nonatomic) id gradientStyle;
+@end
+
+@implementation IDEPathCell
+
+@synthesize gradientStyle = _gradientStyle;
+- (void)setGradientStyle:(id)value { }
+
++ (void)_componentCellWithRepresentedObject {
+ self.gradientStyle; // expected-error {{property 'gradientStyle' not found on object of type 'Class'}}
+}
+@end
diff --git a/test/SemaObjC/property-in-class-extension.m b/test/SemaObjC/property-in-class-extension.m
index 3f252d0..6ae0b81 100644
--- a/test/SemaObjC/property-in-class-extension.m
+++ b/test/SemaObjC/property-in-class-extension.m
@@ -1,5 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
-// rdar: // 7766184
+// rdar://7766184
@interface Foo @end
@@ -12,4 +12,39 @@ void FUNC () {
foo.bar = 0; // expected-error {{assigning to property with 'readonly' attribute not allowed}}
}
+// rdar://8747333
+@class NSObject;
+
+@interface rdar8747333 {
+@private
+ NSObject *_bar;
+ NSObject *_baz;
+ NSObject *_bam;
+}
+- (NSObject *)baz;
+@end
+
+@interface rdar8747333 ()
+- (NSObject *)bar;
+@end
+
+@interface rdar8747333 ()
+@property (readwrite, assign) NSObject *bar;
+@property (readwrite, assign) NSObject *baz;
+@property (readwrite, assign) NSObject *bam;
+@property (readwrite, assign) NSObject *warn;
+@end
+
+@interface rdar8747333 ()
+- (NSObject *)bam;
+- (NSObject *)warn; // expected-note {{method definition for 'warn' not found}}
+- (void)setWarn : (NSObject *)val; // expected-note {{method definition for 'setWarn:' not found}}
+@end
+
+@implementation rdar8747333 // expected-warning {{incomplete implementation}}
+@synthesize bar = _bar;
+@synthesize baz = _baz;
+@synthesize bam = _bam;
+@dynamic warn;
+@end
diff --git a/test/SemaObjC/property-missing.m b/test/SemaObjC/property-missing.m
index 6ce0bea..bf75601 100644
--- a/test/SemaObjC/property-missing.m
+++ b/test/SemaObjC/property-missing.m
@@ -20,3 +20,15 @@ void f3(id o)
o.foo; // expected-error{{property 'foo' not found on object of type 'id'}}
}
+// rdar://8851803
+@class SomeOtherClass; // expected-note {{forward class is declared here}}
+
+@interface MyClass {
+ SomeOtherClass *someOtherObject;
+}
+@end
+
+void foo(MyClass *myObject) {
+ myObject.someOtherObject.someProperty = 0; // expected-error {{property 'someOtherObject' refers to an incomplete Objective-C class 'SomeOtherClass' (with no @interface available)}}
+}
+
diff --git a/test/SemaObjC/property-user-setter.m b/test/SemaObjC/property-user-setter.m
index 9479bc6..2f1e197 100644
--- a/test/SemaObjC/property-user-setter.m
+++ b/test/SemaObjC/property-user-setter.m
@@ -70,7 +70,7 @@ static int g_val;
{
int setterOnly;
}
-- (void) setSetterOnly:(int)value; // expected-note {{or because setter is declared here, but no getter method 'setterOnly' is found}}
+- (void) setSetterOnly:(int)value;
@end
@implementation Subclass
@@ -82,14 +82,14 @@ static int g_val;
@interface C {}
// - (int)Foo;
-- (void)setFoo:(int)value; // expected-note 2 {{or because setter is declared here, but no getter method 'Foo' is found}}
+- (void)setFoo:(int)value;
@end
void g(int);
void f(C *c) {
- c.Foo = 17; // expected-error {{property 'Foo' not found on object of type 'C *'}}
- g(c.Foo); // expected-error {{property 'Foo' not found on object of type 'C *'}}
+ c.Foo = 17; // OK
+ g(c.Foo); // expected-error {{expected getter method not found on object of type 'C *'}}
}
@@ -97,7 +97,7 @@ void abort(void);
int main (void) {
Subclass *x = [[Subclass alloc] init];
- x.setterOnly = 4; // expected-error {{property 'setterOnly' not found on object of type 'Subclass *'}}
+ x.setterOnly = 4; // OK
if (g_val != 4)
abort ();
return 0;
diff --git a/test/SemaObjC/provisional-ivar-lookup.m b/test/SemaObjC/provisional-ivar-lookup.m
new file mode 100644
index 0000000..04d6a41
--- /dev/null
+++ b/test/SemaObjC/provisional-ivar-lookup.m
@@ -0,0 +1,43 @@
+// RUN: %clang_cc1 -fsyntax-only -fobjc-default-synthesize-properties -fobjc-nonfragile-abi -verify %s
+
+// rdar:// 8565343
+@interface Foo {
+@private
+ int _foo;
+ int _foo2;
+}
+@property (readwrite, nonatomic) int foo, foo1, foo2, foo3;
+@property (readwrite, nonatomic) int PROP;
+@end
+
+@implementation Foo
+
+@synthesize foo = _foo;
+@synthesize foo1;
+
+- (void)setFoo:(int)value {
+ _foo = foo; // expected-error {{use of undeclared identifier 'foo'}}
+}
+
+- (void)setFoo1:(int)value {
+ _foo = foo1; // OK
+}
+
+- (void)setFoo2:(int)value {
+ _foo = foo2; // expected-error {{use of undeclared identifier 'foo2'}}
+}
+
+- (void)setFoo3:(int)value {
+ _foo = foo3; // OK
+}
+
+@synthesize foo2 = _foo2;
+@synthesize foo3;
+
+@synthesize PROP=PROP;
+- (void)setPROP:(int)value {
+ PROP = PROP; // OK
+}
+
+@end
+
diff --git a/test/SemaObjC/selector-1.m b/test/SemaObjC/selector-1.m
index 9a7375b..16d44cb 100644
--- a/test/SemaObjC/selector-1.m
+++ b/test/SemaObjC/selector-1.m
@@ -1,22 +1,15 @@
// RUN: %clang_cc1 -verify %s
-@interface Lancelot @end
-@implementation Lancelot
-
-- (void):(int)x {}
-- (void)xx:(int)x :(int)y { }
-
-@end
-
@interface I
- (id) compare: (char) arg1;
+- length;
@end
@interface J
- (id) compare: (id) arg1;
@end
-SEL foo()
+SEL func()
{
return @selector(compare:); // Non warning on multiple selector found.
}
diff --git a/test/SemaObjC/selector-2.m b/test/SemaObjC/selector-2.m
new file mode 100644
index 0000000..fb75369
--- /dev/null
+++ b/test/SemaObjC/selector-2.m
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 -fsyntax-only -Wselector -verify %s
+// rdar://8851684
+@interface I
+- length;
+@end
+
+static inline SEL IsEmpty() {
+ return @selector(length);
+}
+
+int main (int argc, const char * argv[]) {
+ return 0;
+}
+
diff --git a/test/SemaObjC/selector-3.m b/test/SemaObjC/selector-3.m
new file mode 100644
index 0000000..69a74f8
--- /dev/null
+++ b/test/SemaObjC/selector-3.m
@@ -0,0 +1,29 @@
+// RUN: %clang_cc1 -fsyntax-only -Wselector -verify %s
+// rdar://8851684
+
+@interface Foo
+- (void) foo;
+- (void) bar;
+@end
+
+@implementation Foo
+- (void) bar
+{
+}
+
+- (void) foo
+{
+ SEL a,b,c;
+ a = @selector(b1ar); // expected-warning {{unimplemented selector 'b1ar'}}
+ b = @selector(bar);
+}
+@end
+
+@interface I
+- length;
+@end
+
+SEL func()
+{
+ return @selector(length); // expected-warning {{unimplemented selector 'length'}}
+}
diff --git a/test/SemaObjC/self-assign.m b/test/SemaObjC/self-assign.m
new file mode 100644
index 0000000..f05b028
--- /dev/null
+++ b/test/SemaObjC/self-assign.m
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+@interface A
+@end
+
+@implementation A
+- (id):(int)x :(int)y {
+ int z;
+ // <rdar://problem/8939352>
+ if (self = [self :x :y]) {} // expected-warning{{using the result of an assignment as a condition without parentheses}} \
+ // expected-note{{use '==' to turn this assignment into an equality comparison}} \
+ // expected-note{{place parentheses around the assignment to silence this warning}}
+ return self;
+}
+@end
diff --git a/test/SemaObjC/setter-dotsyntax.m b/test/SemaObjC/setter-dotsyntax.m
new file mode 100644
index 0000000..e0b51e8
--- /dev/null
+++ b/test/SemaObjC/setter-dotsyntax.m
@@ -0,0 +1,19 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+// rdar://8528170
+
+@interface NSObject @end
+
+@protocol MyProtocol
+- (int) level;
+- (void) setLevel:(int)inLevel;
+@end
+
+@interface MyClass : NSObject <MyProtocol>
+@end
+
+int main ()
+{
+ id<MyProtocol> c;
+ c.level = 10;
+ return 0;
+}
diff --git a/test/SemaObjC/special-dep-unavail-warning.m b/test/SemaObjC/special-dep-unavail-warning.m
new file mode 100644
index 0000000..b7a2d66
--- /dev/null
+++ b/test/SemaObjC/special-dep-unavail-warning.m
@@ -0,0 +1,47 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+// rdar://8769853
+
+@interface B
+- (void) depInA;
+- (void) unavailMeth __attribute__((unavailable)); // expected-note {{function has been explicitly marked unavailable here}}
+- (void) depInA1 __attribute__((deprecated));
+- (void) unavailMeth1;
+- (void) depInA2 __attribute__((deprecated));
+- (void) unavailMeth2 __attribute__((unavailable)); // expected-note {{function has been explicitly marked unavailable here}}
+- (void) depunavailInA;
+- (void) depunavailInA1 __attribute__((deprecated)) __attribute__((unavailable)); // expected-note {{function has been explicitly marked unavailable here}}
+- (void)FuzzyMeth __attribute__((deprecated));
+- (void)FuzzyMeth1 __attribute__((unavailable));
+@end
+
+@interface A
+- (void) unavailMeth1 __attribute__((unavailable)); // expected-note {{function has been explicitly marked unavailable here}}
+- (void) depInA __attribute__((deprecated));
+- (void) depInA2 __attribute__((deprecated));
+- (void) depInA1;
+- (void) unavailMeth2 __attribute__((unavailable));
+- (void) depunavailInA __attribute__((deprecated)) __attribute__((unavailable)); // expected-note {{function has been explicitly marked unavailable here}}
+- (void) depunavailInA1;
+- (void)FuzzyMeth __attribute__((unavailable));
+- (void)FuzzyMeth1 __attribute__((deprecated));
+@end
+
+
+@class C;
+
+void test(C *c) {
+ [c depInA]; // expected-warning {{'depInA' maybe deprecated because receiver type is unknown}}
+ [c unavailMeth]; // expected-warning {{'unavailMeth' maybe unavailable because receiver type is unknown}}
+ [c depInA1]; // expected-warning {{'depInA1' maybe deprecated because receiver type is unknown}}
+ [c unavailMeth1]; // expected-warning {{'unavailMeth1' maybe unavailable because receiver type is unknown}}
+ [c depInA2]; // expected-warning {{'depInA2' maybe deprecated because receiver type is unknown}}
+ [c unavailMeth2]; // expected-warning {{'unavailMeth2' maybe unavailable because receiver type is unknown}}
+ [c depunavailInA]; // expected-warning {{'depunavailInA' maybe deprecated because receiver type is unknown}} \
+ // expected-warning {{'depunavailInA' maybe unavailable because receiver type is unknown}}
+ [c depunavailInA1]; // expected-warning {{'depunavailInA1' maybe deprecated because receiver type is unknown}} \
+ // expected-warning {{'depunavailInA1' maybe unavailable because receiver type is unknown}}
+ [c FuzzyMeth]; // expected-warning {{'FuzzyMeth' maybe deprecated because receiver type is unknown}}
+ [c FuzzyMeth1]; // expected-warning {{'FuzzyMeth1' maybe deprecated because receiver type is unknown}}
+
+}
+
diff --git a/test/SemaObjC/super-class-protocol-conformance.m b/test/SemaObjC/super-class-protocol-conformance.m
index f555c32..bf19c83 100644
--- a/test/SemaObjC/super-class-protocol-conformance.m
+++ b/test/SemaObjC/super-class-protocol-conformance.m
@@ -1,5 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
-// rdar: // 7884086
+// rdar://7884086
@interface NSObject @end
diff --git a/test/SemaObjC/super.m b/test/SemaObjC/super.m
index 31d8db1..0c42e99 100644
--- a/test/SemaObjC/super.m
+++ b/test/SemaObjC/super.m
@@ -55,7 +55,7 @@ void f0(int super) {
expected-warning {{method '-m' not found (return type defaults to 'id')}}
}
void f1(id puper) { // expected-note {{'puper' declared here}}
- [super m]; // expected-error{{use of undeclared identifier 'super'; did you mean 'puper'?}}
+ [super m]; // expected-error{{use of undeclared identifier 'super'}}
}
// radar 7400691
diff --git a/test/SemaObjC/synth-provisional-ivars-1.m b/test/SemaObjC/synth-provisional-ivars-1.m
new file mode 100644
index 0000000..33de173
--- /dev/null
+++ b/test/SemaObjC/synth-provisional-ivars-1.m
@@ -0,0 +1,28 @@
+// RUN: %clang_cc1 -fsyntax-only -fobjc-nonfragile-abi -fobjc-default-synthesize-properties -verify %s
+// rdar://8913053
+
+typedef unsigned char BOOL;
+
+@interface MailApp
+{
+ BOOL _isAppleInternal;
+}
+@property(assign) BOOL isAppleInternal;
+@end
+
+static BOOL isAppleInternal() {return 0; }
+
+@implementation MailApp
+
+- (BOOL)isAppleInternal {
+ return _isAppleInternal;
+}
+
+- (void)setIsAppleInternal:(BOOL)flag {
+ _isAppleInternal= !!flag;
+}
+
+- (void) Meth {
+ self.isAppleInternal = isAppleInternal();
+}
+@end
diff --git a/test/SemaObjC/synth-provisional-ivars.m b/test/SemaObjC/synth-provisional-ivars.m
index 973c771..e8179aa 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-nonfragile-abi2 -verify %s
+// RUN: %clang_cc1 -fsyntax-only -fobjc-nonfragile-abi -fobjc-default-synthesize-properties -verify %s
int bar;
@@ -18,7 +18,7 @@ int bar;
@end
@implementation I
-- (int) Meth { return PROP; } // expected-note {{'PROP' declared here}}
+- (int) Meth { return PROP; } // expected-note 2{{'PROP' declared here}}
@dynamic PROP1;
- (int) Meth1 { return PROP1; } // expected-error {{use of undeclared identifier 'PROP1'}}
diff --git a/test/SemaObjC/synthesized-ivar.m b/test/SemaObjC/synthesized-ivar.m
index 58bcf40..3bc372b 100644
--- a/test/SemaObjC/synthesized-ivar.m
+++ b/test/SemaObjC/synthesized-ivar.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -fobjc-nonfragile-abi -verify %s
+// RUN: %clang_cc1 -fsyntax-only -fobjc-nonfragile-abi -fobjc-default-synthesize-properties -verify %s
@interface I
{
}
@@ -12,5 +12,42 @@
}
@end
-// rdar: // 7823675
-int f0(I *a) { return a->IP; } // expected-error {{instance variable 'IP' is protected}}
+// rdar://7823675
+int f0(I *a) { return a->IP; } // expected-error {{instance variable 'IP' is private}}
+
+// rdar://8769582
+
+@interface I1 {
+ int protected_ivar;
+}
+@property int PROP_INMAIN;
+@end
+
+@interface I1() {
+ int private_ivar;
+}
+@property int PROP_INCLASSEXT;
+@end
+
+@implementation I1
+- (int) Meth {
+ PROP_INMAIN = 1;
+ PROP_INCLASSEXT = 2;
+ protected_ivar = 1; // OK
+ return private_ivar; // OK
+}
+@end
+
+
+@interface DER : I1
+@end
+
+@implementation DER
+- (int) Meth {
+ protected_ivar = 1; // OK
+ PROP_INMAIN = 1; // expected-error {{instance variable 'PROP_INMAIN' is private}}
+ PROP_INCLASSEXT = 2; // expected-error {{instance variable 'PROP_INCLASSEXT' is private}}
+ return private_ivar; // expected-error {{instance variable 'private_ivar' is private}}
+}
+@end
+
diff --git a/test/SemaObjC/undef-protocol-methods-1.m b/test/SemaObjC/undef-protocol-methods-1.m
index cbef3e5..44d384c6 100644
--- a/test/SemaObjC/undef-protocol-methods-1.m
+++ b/test/SemaObjC/undef-protocol-methods-1.m
@@ -1,25 +1,25 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
@protocol P1
-- (void) P1proto; // expected-warning {{method in protocol not implemented [-Wprotocol]}}
-+ (void) ClsP1Proto; // expected-warning {{method in protocol not implemented [-Wprotocol]}}
+- (void) P1proto; // expected-note {{method declared here}}
++ (void) ClsP1Proto; // expected-note {{method declared here}}
- (void) DefP1proto;
@end
@protocol P2
-- (void) P2proto; // expected-warning {{method in protocol not implemented [-Wprotocol]}}
-+ (void) ClsP2Proto; // expected-warning {{method in protocol not implemented [-Wprotocol]}}
+- (void) P2proto; // expected-note {{method declared here}}
++ (void) ClsP2Proto; // expected-note {{method declared here}}
@end
@protocol P3<P2>
-- (void) P3proto; // expected-warning {{method in protocol not implemented [-Wprotocol]}}
-+ (void) ClsP3Proto; // expected-warning {{method in protocol not implemented [-Wprotocol]}}
+- (void) P3proto; // expected-note {{method declared here}}
++ (void) ClsP3Proto; // expected-note {{method declared here}}
+ (void) DefClsP3Proto;
@end
@protocol PROTO<P1, P3>
-- (void) meth; // expected-warning {{method in protocol not implemented [-Wprotocol]}}
-- (void) meth : (int) arg1; // expected-warning {{method in protocol not implemented [-Wprotocol]}}
-+ (void) cls_meth : (int) arg1; // expected-warning {{method in protocol not implemented [-Wprotocol]}}
+- (void) meth; // expected-note {{method declared here}}
+- (void) meth : (int) arg1; // expected-note {{method declared here}}
++ (void) cls_meth : (int) arg1; // expected-note {{method declared here}}
@end
@interface INTF <PROTO> // expected-note 3 {{required for direct or indirect protocol 'PROTO'}} \
@@ -28,7 +28,8 @@
// expected-note 2 {{required for direct or indirect protocol 'P2'}}
@end
-@implementation INTF // expected-warning {{incomplete implementation}}
+@implementation INTF // expected-warning {{incomplete implementation}} \
+ // expected-warning 9 {{method in protocol not implemented [-Wprotocol}}
- (void) DefP1proto{}
+ (void) DefClsP3Proto{}
diff --git a/test/SemaObjC/undef-superclass-1.m b/test/SemaObjC/undef-superclass-1.m
index 0c2594c..c941f82 100644
--- a/test/SemaObjC/undef-superclass-1.m
+++ b/test/SemaObjC/undef-superclass-1.m
@@ -22,7 +22,7 @@
@implementation SUPER
- (void)dealloc {
- [super dealloc]; // expected-error {{no super class declared in @interface for 'SUPER'}}
+ [super dealloc]; // expected-error {{'SUPER' cannot use 'super' because it is a root class}}
}
@end
diff --git a/test/SemaObjC/uninit-variables.m b/test/SemaObjC/uninit-variables.m
new file mode 100644
index 0000000..63c2140
--- /dev/null
+++ b/test/SemaObjC/uninit-variables.m
@@ -0,0 +1,27 @@
+// RUN: %clang_cc1 -fsyntax-only -Wuninitialized-experimental -fsyntax-only -fblocks %s -verify
+
+// Duplicated from uninit-variables.c.
+// Test just to ensure the analysis is working.
+int test1() {
+ int x; // expected-note{{variable 'x' is declared here}} expected-note{{add initialization}}
+ return x; // expected-warning{{variable 'x' is possibly uninitialized when used here}}
+}
+
+// Test ObjC fast enumeration.
+void test2() {
+ id collection = 0;
+ for (id obj in collection) {
+ if (0 == obj) // no-warning
+ break;
+ }
+}
+
+void test3() {
+ id collection = 0;
+ id obj;
+ for (obj in collection) { // no-warning
+ if (0 == obj) // no-warning
+ break;
+ }
+}
+
diff --git a/test/SemaObjC/warn-deprecated-implementations.m b/test/SemaObjC/warn-deprecated-implementations.m
new file mode 100644
index 0000000..7bcd10c
--- /dev/null
+++ b/test/SemaObjC/warn-deprecated-implementations.m
@@ -0,0 +1,45 @@
+// RUN: %clang_cc1 -fsyntax-only -Wdeprecated-implementations -verify %s
+// rdar://8973810
+
+@protocol P
+- (void) D __attribute__((deprecated)); // expected-note {{method declared here}}
+@end
+
+@interface A <P>
++ (void)F __attribute__((deprecated)); // expected-note {{method declared here}}
+@end
+
+@interface A()
+- (void) E __attribute__((deprecated)); // expected-note {{method declared here}}
+@end
+
+@implementation A
++ (void)F { } // expected-warning {{Implementing deprecated method}}
+- (void) D {} // expected-warning {{Implementing deprecated method}}
+- (void) E {} // expected-warning {{Implementing deprecated method}}
+@end
+
+__attribute__((deprecated))
+@interface CL // expected-note 2 {{class declared here}}
+@end
+
+@implementation CL // expected-warning {{Implementing deprecated class}}
+@end
+
+@implementation CL ( SomeCategory ) // expected-warning {{Implementing deprecated category}}
+@end
+
+@interface CL_SUB : CL // expected-warning {{'CL' is deprecated}}
+@end
+
+@interface BASE
+- (void) B __attribute__((deprecated)); // expected-note {{method declared here}}
+@end
+
+@interface SUB : BASE
+@end
+
+@implementation SUB
+- (void) B {} // expected-warning {{Implementing deprecated method}}
+@end
+
diff --git a/test/SemaObjC/warn-implicit-atomic-property.m b/test/SemaObjC/warn-implicit-atomic-property.m
new file mode 100644
index 0000000..0b4590a
--- /dev/null
+++ b/test/SemaObjC/warn-implicit-atomic-property.m
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 -fsyntax-only -Wimplicit-atomic-properties -fobjc-nonfragile-abi -fobjc-default-synthesize-properties -verify %s
+// rdar://8774580
+
+@interface Super
+@property (nonatomic, readwrite) int P; // OK
+@property (atomic, readwrite) int P1; // OK
+@property (readwrite) int P2; // expected-note {{property declared here}}
+@property int P3; // expected-note {{property declared here}}
+@end
+
+@implementation Super // expected-warning {{property is assumed atomic when auto-synthesizing the property [-Wimplicit-atomic-properties]}}
+@synthesize P,P1,P2; // expected-warning {{property is assumed atomic by default [-Wimplicit-atomic-properties]}}
+@end
diff --git a/test/SemaObjC/warn-incompatible-builtin-types.m b/test/SemaObjC/warn-incompatible-builtin-types.m
index 79c8cea..fd4fb7d 100644
--- a/test/SemaObjC/warn-incompatible-builtin-types.m
+++ b/test/SemaObjC/warn-incompatible-builtin-types.m
@@ -1,5 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
-// rdar 7634850
+// rdar://7634850
@interface Foo
- (void)foo:(Class)class; // expected-note{{passing argument to parameter 'class' here}}
diff --git a/test/SemaObjC/warn-write-strings.m b/test/SemaObjC/warn-write-strings.m
index 04af00c..450d0a6 100644
--- a/test/SemaObjC/warn-write-strings.m
+++ b/test/SemaObjC/warn-write-strings.m
@@ -1,4 +1,4 @@
// RUN: %clang_cc1 -verify -fsyntax-only -Wwrite-strings %s
// PR4804
-char* x = "foo"; // expected-warning {{initializing 'char *' with an expression of type 'char const [4]' discards qualifiers}}
+char* x = "foo"; // expected-warning {{initializing 'char *' with an expression of type 'const char [4]' discards qualifiers}}
OpenPOWER on IntegriCloud