summaryrefslogtreecommitdiffstats
path: root/test/SemaObjC
diff options
context:
space:
mode:
Diffstat (limited to 'test/SemaObjC')
-rw-r--r--test/SemaObjC/block-type-safety.m8
-rw-r--r--test/SemaObjC/category-1.m6
-rw-r--r--test/SemaObjC/compare-qualified-id.m7
-rw-r--r--test/SemaObjC/comptypes-7.m5
-rw-r--r--test/SemaObjC/conditional-expr.m4
-rw-r--r--test/SemaObjC/gcc-cast-ext.m6
-rw-r--r--test/SemaObjC/ivar-in-class-extension-error.m15
-rw-r--r--test/SemaObjC/ivar-in-implementations.m23
-rw-r--r--test/SemaObjC/ivar-sem-check-1.m3
-rw-r--r--test/SemaObjC/method-arg-decay.m10
-rw-r--r--test/SemaObjC/method-undef-category-warn-1.m22
-rw-r--r--test/SemaObjC/method-undef-extension-warn-1.m10
-rw-r--r--test/SemaObjC/method-undefined-warn-1.m16
-rw-r--r--test/SemaObjC/method-warn-unused-attribute.m12
-rw-r--r--test/SemaObjC/no-protocol-option-tests.m32
-rw-r--r--test/SemaObjC/nsobject-attribute.m6
-rw-r--r--test/SemaObjC/property-expression-error.m5
-rw-r--r--test/SemaObjC/property-in-class-extension.m15
-rw-r--r--test/SemaObjC/property-ivar-mismatch.m4
-rw-r--r--test/SemaObjC/property.m4
-rw-r--r--test/SemaObjC/undef-protocol-methods-1.m34
21 files changed, 167 insertions, 80 deletions
diff --git a/test/SemaObjC/block-type-safety.m b/test/SemaObjC/block-type-safety.m
index dab0af4..b40f9b0 100644
--- a/test/SemaObjC/block-type-safety.m
+++ b/test/SemaObjC/block-type-safety.m
@@ -34,11 +34,11 @@ void test1() {
r0(^Super* () { return 0; }); // OK
r0(^Sub* () { return 0; }); // OK, variable of type Super* gets return value of type Sub*
- r0(^id () { return 0; }); // expected-error {{incompatible block pointer types passing 'id (^)(void)', expected 'Super *(^)()'}}
+ r0(^id () { return 0; });
r1(^Super* () { return 0; }); // expected-error {{incompatible block pointer types passing 'Super *(^)(void)', expected 'Sub *(^)()'}}
r1(^Sub* () { return 0; }); // OK
- r1(^id () { return 0; }); // expected-error {{incompatible block pointer types passing 'id (^)(void)', expected 'Sub *(^)()'}}
+ r1(^id () { return 0; });
r2(^id<NSObject>() { return 0; });
}
@@ -60,7 +60,7 @@ void f1(void (^f)(id x)) {
void test2(void)
{
f0(^(id a) { }); // OK
- f1(^(A* a) { }); // expected-error {{incompatible block pointer types passing 'void (^)(A *)', expected 'void (^)(id)'}}
+ f1(^(A* a) { });
f1(^(id<NSObject> a) { }); // OK
}
@@ -80,7 +80,7 @@ void test2(void)
// programmer wants to write this:
-printMyThings1 {
- [myThings enumerateObjectsWithBlock: ^(MyThing *obj) { // expected-error {{incompatible block pointer types sending 'void (^)(MyThing *)', expected 'void (^)(id)'}}
+ [myThings enumerateObjectsWithBlock: ^(MyThing *obj) {
[obj printThing];
}];
}
diff --git a/test/SemaObjC/category-1.m b/test/SemaObjC/category-1.m
index 24324f8..18cbb83 100644
--- a/test/SemaObjC/category-1.m
+++ b/test/SemaObjC/category-1.m
@@ -62,16 +62,16 @@
// <rdar://problem/7249233>
@protocol MultipleCat_P
--(void) im0;
+-(void) im0; // expected-warning {{method in protocol not implemented [-Wprotocol]}}
@end
-@interface MultipleCat_I @end
+@interface MultipleCat_I @end // expected-note {{required for direct or indirect protocol 'MultipleCat_P'}}
@interface MultipleCat_I() @end
@interface MultipleCat_I() <MultipleCat_P> @end
-@implementation MultipleCat_I // expected-warning {{incomplete implementation}}, expected-warning {{method definition for 'im0' not found}}
+@implementation MultipleCat_I // expected-warning {{incomplete implementation}}
@end
// <rdar://problem/7680391> - Handle nameless categories with no name that refer
diff --git a/test/SemaObjC/compare-qualified-id.m b/test/SemaObjC/compare-qualified-id.m
index 497a1b6..08fb366 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
+@protocol NSCopying - (id)copyWithZone:(NSZone *)zone; @end // expected-warning {{method in protocol not implemented [-Wprotocol]}}
@protocol NSMutableCopying - (id)mutableCopyWithZone:(NSZone *)zone; @end
@protocol NSCoding - (void)encodeWithCoder:(NSCoder *)aCoder; @end
@interface NSObject <NSObject> {} @end
@@ -15,7 +15,7 @@ typedef struct {} NSFastEnumerationState;
@interface NSMutableDictionary : NSDictionary - (void)removeObjectForKey:(id)aKey; @end
extern NSString * const NSTaskDidTerminateNotification;
-@interface XCPropertyExpansionContext : NSObject <NSCopying> {
+@interface XCPropertyExpansionContext : NSObject <NSCopying> { // expected-note {{required for direct or indirect protocol 'NSCopying'}}
NSMutableDictionary * _propNamesToPropValuesCache;
} @end
@@ -23,8 +23,7 @@ extern NSString * const NSTaskDidTerminateNotification;
- (NSString *)evaluateAsStringInContext:(XCPropertyExpansionContext *)context withNestingState:(const void *)state;
@end
-@implementation XCPropertyExpansionContext // expected-warning {{method definition for 'copyWithZone:' not found}} \
- // expected-warning {{incomplete implementation}}
+@implementation XCPropertyExpansionContext // expected-warning {{incomplete implementation}}
- (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-7.m b/test/SemaObjC/comptypes-7.m
index fedad1b..2519c41 100644
--- a/test/SemaObjC/comptypes-7.m
+++ b/test/SemaObjC/comptypes-7.m
@@ -66,5 +66,10 @@ int main()
if (obj_C == j) foo() ; // expected-warning {{comparison of distinct pointer types ('Class' and 'int *')}}
if (j == obj_C) foo() ; // expected-warning {{comparison of distinct pointer types ('int *' and 'Class')}}
+ Class bar1 = Nil;
+ Class <MyProtocol> bar = Nil;
+ bar = bar1;
+ bar1 = bar;
+
return 0;
}
diff --git a/test/SemaObjC/conditional-expr.m b/test/SemaObjC/conditional-expr.m
index 914e3ca..1436f7e 100644
--- a/test/SemaObjC/conditional-expr.m
+++ b/test/SemaObjC/conditional-expr.m
@@ -21,10 +21,10 @@
@end
@interface DTFilterOutputStream2
-- nextOutputStream;
+- nextOutputStream; // expected-note {{{{method definition for 'nextOutputStream' not found}}
@end
-@implementation DTFilterOutputStream2 // expected-warning {{incomplete implementation}} expected-warning {{method definition for 'nextOutputStream' not found}}
+@implementation DTFilterOutputStream2 // expected-warning {{incomplete implementation}}
- (id)initWithNextOutputStream:(id <DTOutputStreams>) outputStream {
id <DTOutputStreams> nextOutputStream = [self nextOutputStream];
self = nextOutputStream; // expected-warning {{incompatible type assigning 'id<DTOutputStreams>', expected 'DTFilterOutputStream2 *'}}
diff --git a/test/SemaObjC/gcc-cast-ext.m b/test/SemaObjC/gcc-cast-ext.m
index 28abfbc..599e37d 100644
--- a/test/SemaObjC/gcc-cast-ext.m
+++ b/test/SemaObjC/gcc-cast-ext.m
@@ -5,8 +5,8 @@ typedef struct _NSRange { } NSRange;
@class PBXFileReference;
@interface PBXDocBookmark
-+ alloc;
-- autorelease;
++ alloc; // expected-note {{{{method definition for 'alloc' not found}}
+- autorelease; // expected-note {{{{method definition for 'autorelease' not found}}
@end
// GCC allows pointer expressions in integer constant expressions.
@@ -14,7 +14,7 @@ struct {
char control[((int)(char *)2)];
} xx;
-@implementation PBXDocBookmark // expected-warning {{incomplete implementation}} expected-warning {{method definition for 'autorelease' not found}} expected-warning {{method definition for 'alloc' not found}}
+@implementation PBXDocBookmark // expected-warning {{incomplete implementation}}
+ (id)bookmarkWithFileReference:(PBXFileReference *)fileRef gylphRange:(NSRange)range anchor:(NSString *)htmlAnchor
{
diff --git a/test/SemaObjC/ivar-in-class-extension-error.m b/test/SemaObjC/ivar-in-class-extension-error.m
new file mode 100644
index 0000000..ffc0e8b
--- /dev/null
+++ b/test/SemaObjC/ivar-in-class-extension-error.m
@@ -0,0 +1,15 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+// rdar:// 6812436
+
+@interface A @end
+
+@interface A () { // expected-error {{ivars may not be placed in class extension}}
+ int _p0;
+}
+@property int p0;
+@end
+
+@interface A(CAT) { // expected-error {{ivars may not be placed in categories}}
+ int _p1;
+}
+@end
diff --git a/test/SemaObjC/ivar-in-implementations.m b/test/SemaObjC/ivar-in-implementations.m
index 32d3c35..4060526 100644
--- a/test/SemaObjC/ivar-in-implementations.m
+++ b/test/SemaObjC/ivar-in-implementations.m
@@ -11,12 +11,29 @@
@implementation INTFSTANDALONE : Super // expected-warning {{class implementation may not have super class}}
{
-@private
- id IVAR1;
+ id PRIV_IVAR;
@protected
- id IVAR2; // expected-error {{only private ivars may be declared in implementation}}
+ id PRTCTD;
@private
id IVAR3;
int IVAR; // expected-error {{instance variable is already declared}}
+@public
+ id IVAR4;
}
@end
+
+@interface Base @end
+
+@implementation Base {
+ int ivar1;
+@public
+ int ivar2;
+}
+@end
+
+id fn1(INTFSTANDALONE *b) { return b->PRIV_IVAR; } // expected-error {{instance variable 'PRIV_IVAR' is private}}
+
+id fn2(INTFSTANDALONE *b) { return b->PRTCTD; } // expected-error {{instance variable 'PRTCTD' is protected}}
+
+id fn4(INTFSTANDALONE *b) { return b->IVAR4; }
+
diff --git a/test/SemaObjC/ivar-sem-check-1.m b/test/SemaObjC/ivar-sem-check-1.m
index 099a7a6..de038f5 100644
--- a/test/SemaObjC/ivar-sem-check-1.m
+++ b/test/SemaObjC/ivar-sem-check-1.m
@@ -9,8 +9,7 @@ typedef int FOO();
int arr[]; // expected-error {{field has incomplete type}}
struct S IC; // expected-error {{field has incomplete type}}
struct T { // expected-note {{previous definition is here}}
- struct T {} X; // expected-error {{nested redefinition of 'T'}} \
- // expected-error {{field has incomplete type}}
+ struct T {} X; // expected-error {{nested redefinition of 'T'}}
}YYY;
FOO BADFUNC; // expected-error {{field 'BADFUNC' declared as a function}}
int kaka; // expected-note {{previous declaration is here}}
diff --git a/test/SemaObjC/method-arg-decay.m b/test/SemaObjC/method-arg-decay.m
index f600029..012a3ee 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;
+@protocol PBXSelectionTarget - (NSObject <PBXSelectionTarget> *) performAction:(id)action withSelection:(NSArray *)selection; // expected-warning {{method in protocol not implemented [-Wprotocol]}}
@end @class XCPropertyDictionary, XCPropertyCondition, XCPropertyConditionSet, XCMutablePropertyConditionSet;
extern NSMutableArray *XCFindPossibleKeyModules(PBXModule *module, BOOL useExposedModulesOnly);
@interface NSString (StringUtilities) - (NSString *) trimToLength:(NSInteger)length preserveRange:(NSRange)range;
@@ -67,14 +67,12 @@ extern NSMutableArray *XCFindPossibleKeyModules(PBXModule *module, BOOL useExpos
@interface XCExtendedTabView : NSTabView <XCDockViewHeader> {
}
@end @class PBXProjectDocument, PBXFileReference, PBXModule, XCWindowTool;
-@interface XCPerspectiveModule : PBXProjectModule <PBXSelectionTarget> {
+@interface XCPerspectiveModule : PBXProjectModule <PBXSelectionTarget> { // expected-note {{required for direct or indirect protocol 'PBXSelectionTarget'}}
XCExtendedTabView *_perspectivesTabView;
}
-- (PBXModule *) moduleForTab:(NSTabViewItem *)item;
+- (PBXModule *) moduleForTab:(NSTabViewItem *)item; // expected-note {{method definition for 'moduleForTab:' not found}}
@end
-@implementation XCPerspectiveModule // expected-warning {{method definition for 'moduleForTab:' not found}} \
- // expected-warning {{method definition for 'performAction:withSelection:' not found}} \
- // expected-warning {{incomplete implementation}}
+@implementation XCPerspectiveModule // expected-warning {{incomplete implementation}}
+ (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-undef-category-warn-1.m b/test/SemaObjC/method-undef-category-warn-1.m
index 75ca5b5..b367801 100644
--- a/test/SemaObjC/method-undef-category-warn-1.m
+++ b/test/SemaObjC/method-undef-category-warn-1.m
@@ -1,30 +1,26 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
-@interface MyClass1
+@interface MyClass1
@end
@protocol P
-- (void) Pmeth;
-- (void) Pmeth1;
+- (void) Pmeth; // expected-warning {{method in protocol not implemented [-Wprotocol]}}
+- (void) Pmeth1; // expected-warning {{method in protocol not implemented [-Wprotocol]}}
@end
-@interface MyClass1(CAT) <P>
-- (void) meth2;
+@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}} \
- expected-warning {{method definition for 'meth2' not found}} \
- expected-warning {{method definition for 'Pmeth' not found}}
+@implementation MyClass1(CAT) // expected-warning {{incomplete implementation}}
- (void) Pmeth1{}
@end
-@interface MyClass1(DOG) <P>
-- (void)ppp;
+@interface MyClass1(DOG) <P> // expected-note {{required for direct or indirect protocol 'P'}}
+- (void)ppp; // expected-note {{method definition for 'ppp' not found}}
@end
-@implementation MyClass1(DOG) // expected-warning {{incomplete implementation}} \
- expected-warning {{method definition for 'ppp' not found}} \
- expected-warning {{method definition for 'Pmeth1' not found}}
+@implementation MyClass1(DOG) // expected-warning {{incomplete implementation}}
- (void) Pmeth {}
@end
diff --git a/test/SemaObjC/method-undef-extension-warn-1.m b/test/SemaObjC/method-undef-extension-warn-1.m
index fc27870..1addcf7 100644
--- a/test/SemaObjC/method-undef-extension-warn-1.m
+++ b/test/SemaObjC/method-undef-extension-warn-1.m
@@ -1,16 +1,16 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
-@interface MyClass
+@interface MyClass // expected-note {{required for direct or indirect protocol 'P'}}
@end
@protocol P
- (void)Pmeth;
-- (void)Pmeth1;
+- (void)Pmeth1; // expected-warning {{method in protocol not implemented [-Wprotocol]}}
@end
// Class extension
@interface MyClass () <P>
-- (void)meth2;
+- (void)meth2; // expected-note {{method definition for 'meth2' not found}}
@end
// Add a category to test that clang does not emit warning for this method.
@@ -18,8 +18,6 @@
- (void)categoryMethod;
@end
-@implementation MyClass // expected-warning {{incomplete implementation}} \
- expected-warning {{method definition for 'meth2' not found}} \
- expected-warning {{method definition for 'Pmeth1' not found}}
+@implementation MyClass // expected-warning {{incomplete implementation}}
- (void)Pmeth {}
@end
diff --git a/test/SemaObjC/method-undefined-warn-1.m b/test/SemaObjC/method-undefined-warn-1.m
index cfe1d56..1ebc59e 100644
--- a/test/SemaObjC/method-undefined-warn-1.m
+++ b/test/SemaObjC/method-undefined-warn-1.m
@@ -3,12 +3,12 @@
@interface INTF
- (void) meth;
- (void) meth : (int) arg1;
-- (int) int_meth;
-+ (int) cls_meth;
-+ (void) cls_meth1 : (int) arg1;
+- (int) int_meth; // expected-note {{method definition for 'int_meth' not found}}
++ (int) cls_meth; // expected-note {{method definition for 'cls_meth' not found}}
++ (void) cls_meth1 : (int) arg1; // expected-note {{method definition for 'cls_meth1:' not found}}
@end
-@implementation INTF // expected-warning {{incomplete implementation}} expected-warning {{method definition for 'int_meth' not found}} expected-warning {{method definition for 'cls_meth' not found}} expected-warning {{method definition for 'cls_meth1:' not found}}
+@implementation INTF // expected-warning {{incomplete implementation}}
- (void) meth {}
- (void) meth : (int) arg2{}
- (void) cls_meth1 : (int) arg2{}
@@ -17,12 +17,12 @@
@interface INTF1
- (void) meth;
- (void) meth : (int) arg1;
-- (int) int_meth;
-+ (int) cls_meth;
-+ (void) cls_meth1 : (int) arg1;
+- (int) int_meth; // expected-note {{method definition for 'int_meth' not found}}
++ (int) cls_meth; // expected-note {{method definition for 'cls_meth' not found}}
++ (void) cls_meth1 : (int) arg1; // expected-note {{method definition for 'cls_meth1:' not found}}
@end
-@implementation INTF1 // expected-warning {{incomplete implementation}} expected-warning {{method definition for 'int_meth' not found}} expected-warning {{method definition for 'cls_meth' not found}} expected-warning {{method definition for 'cls_meth1:' not found}}
+@implementation INTF1 // expected-warning {{incomplete implementation}}
- (void) meth {}
- (void) meth : (int) arg2{}
- (void) cls_meth1 : (int) arg2{}
diff --git a/test/SemaObjC/method-warn-unused-attribute.m b/test/SemaObjC/method-warn-unused-attribute.m
index d9dcf99..042f442 100644
--- a/test/SemaObjC/method-warn-unused-attribute.m
+++ b/test/SemaObjC/method-warn-unused-attribute.m
@@ -1,8 +1,16 @@
// RUN: %clang_cc1 -fsyntax-only -Wunused-value -verify %s
@interface INTF
-// Currently this is rejected by both GCC and Clang (and Clang was crashing on it).
-- (id) foo __attribute__((warn_unused_result)); // expected-warning{{warning: 'warn_unused_result' attribute only applies to function types}}
+- (id) foo __attribute__((warn_unused_result));
+- (void) garf __attribute__((warn_unused_result)); // expected-warning {{attribute 'warn_unused_result' cannot be applied to Objective-C method without return value}}
+- (int) fee __attribute__((warn_unused_result));
++ (int) c __attribute__((warn_unused_result));
@end
+void foo(INTF *a) {
+ [a garf];
+ [a fee]; // expected-warning {{ignoring return value of function declared with warn_unused_result attribute}}
+ [INTF c]; // expected-warning {{ignoring return value of function declared with warn_unused_result attribute}}
+}
+
diff --git a/test/SemaObjC/no-protocol-option-tests.m b/test/SemaObjC/no-protocol-option-tests.m
new file mode 100644
index 0000000..5d2da0a
--- /dev/null
+++ b/test/SemaObjC/no-protocol-option-tests.m
@@ -0,0 +1,32 @@
+// RUN: %clang_cc1 -fsyntax-only -Wno-protocol -verify %s
+// rdar: // 7056600
+
+@protocol P
+- PMeth;
+@end
+
+// Test1
+@interface I <P> @end
+@implementation I @end // no warning with -Wno-protocol
+
+// Test2
+@interface C -PMeth; @end
+@interface C (Category) <P> @end
+@implementation C (Category) @end // no warning with -Wno-protocol
+
+// Test2
+@interface super - PMeth; @end
+@interface J : super <P>
+- PMeth; // expected-note {{ method definition for 'PMeth' not found}}
+@end
+@implementation J @end // expected-warning {{incomplete implementation}}
+
+// Test3
+@interface K : super <P>
+@end
+@implementation K @end // no warning with -Wno-protocol
+
+// Test4
+@interface Root @end
+@interface L : Root<P> @end
+@implementation L @end // no warning with -Wno-protocol
diff --git a/test/SemaObjC/nsobject-attribute.m b/test/SemaObjC/nsobject-attribute.m
index fdf9e35..13a4929 100644
--- a/test/SemaObjC/nsobject-attribute.m
+++ b/test/SemaObjC/nsobject-attribute.m
@@ -7,11 +7,16 @@ static CGColorRef tmp = 0;
typedef struct S1 __attribute__ ((NSObject)) CGColorRef1; // expected-error {{__attribute ((NSObject)) is for pointer types only}}
typedef void * __attribute__ ((NSObject)) CGColorRef2; // expected-error {{__attribute ((NSObject)) is for pointer types only}}
+
@interface HandTested {
@public
CGColorRef x;
}
+
@property(copy) CGColorRef x;
+// rdar: // 7809460
+typedef struct CGColor *CGColorRefNoNSObject;
+@property (nonatomic, retain) __attribute__((NSObject)) CGColorRefNoNSObject color;
@end
void setProperty(id self, id value) {
@@ -24,6 +29,7 @@ id getProperty(id self) {
@implementation HandTested
@synthesize x=x;
+@dynamic color;
@end
int main(int argc, char *argv[]) {
diff --git a/test/SemaObjC/property-expression-error.m b/test/SemaObjC/property-expression-error.m
index b59c1b1..6b5cf04 100644
--- a/test/SemaObjC/property-expression-error.m
+++ b/test/SemaObjC/property-expression-error.m
@@ -16,3 +16,8 @@ int main() {
&object.index; // expected-error {{address of property expression requested}}
return 0;
}
+
+typedef int Foo;
+void test() {
+ Foo.x; // expected-error {{expected identifier or '('}}
+}
diff --git a/test/SemaObjC/property-in-class-extension.m b/test/SemaObjC/property-in-class-extension.m
new file mode 100644
index 0000000..3f252d0
--- /dev/null
+++ b/test/SemaObjC/property-in-class-extension.m
@@ -0,0 +1,15 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+// rdar: // 7766184
+
+@interface Foo @end
+
+@interface Foo ()
+ @property (readonly) int bar;
+@end
+
+void FUNC () {
+ Foo *foo;
+ foo.bar = 0; // expected-error {{assigning to property with 'readonly' attribute not allowed}}
+}
+
+
diff --git a/test/SemaObjC/property-ivar-mismatch.m b/test/SemaObjC/property-ivar-mismatch.m
index ea3acfc..16ff338 100644
--- a/test/SemaObjC/property-ivar-mismatch.m
+++ b/test/SemaObjC/property-ivar-mismatch.m
@@ -3,12 +3,12 @@
@interface Test4
{
- char ivar;
+ char ivar; // expected-note{{ivar is declared here}}
}
@property int prop;
@end
@implementation Test4
-@synthesize prop = ivar; // expected-error {{type of property 'prop' does not match type of ivar 'ivar'}}
+@synthesize prop = ivar; // expected-error {{type of property 'prop' ('int') does not match type of ivar 'ivar' ('char')}}
@end
diff --git a/test/SemaObjC/property.m b/test/SemaObjC/property.m
index b7f0fca..4d00bd2 100644
--- a/test/SemaObjC/property.m
+++ b/test/SemaObjC/property.m
@@ -2,7 +2,7 @@
@interface I
{
- int IVAR;
+ int IVAR; // expected-note{{ivar is declared here}}
int name;
}
@property int d1;
@@ -19,7 +19,7 @@
@synthesize d1; // expected-error {{synthesized property 'd1' must either be named the same as}}
@dynamic bad; // expected-error {{property implementation must have its declaration in interface 'I'}}
@synthesize prop_id; // expected-error {{synthesized property 'prop_id' must either be named the same}} // expected-note {{previous declaration is here}}
-@synthesize prop_id = IVAR; // expected-error {{type of property 'prop_id' does not match type of ivar 'IVAR'}} // expected-error {{property 'prop_id' is already implemented}}
+@synthesize prop_id = IVAR; // expected-error {{type of property 'prop_id' ('id') does not match type of ivar 'IVAR' ('int')}} // expected-error {{property 'prop_id' is already implemented}}
@synthesize name; // OK! property with same name as an accessible ivar of same name
@end
diff --git a/test/SemaObjC/undef-protocol-methods-1.m b/test/SemaObjC/undef-protocol-methods-1.m
index 9a35ef7..cbef3e5 100644
--- a/test/SemaObjC/undef-protocol-methods-1.m
+++ b/test/SemaObjC/undef-protocol-methods-1.m
@@ -1,40 +1,34 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
@protocol P1
-- (void) P1proto;
-+ (void) ClsP1Proto;
+- (void) P1proto; // expected-warning {{method in protocol not implemented [-Wprotocol]}}
++ (void) ClsP1Proto; // expected-warning {{method in protocol not implemented [-Wprotocol]}}
- (void) DefP1proto;
@end
@protocol P2
-- (void) P2proto;
-+ (void) ClsP2Proto;
+- (void) P2proto; // expected-warning {{method in protocol not implemented [-Wprotocol]}}
++ (void) ClsP2Proto; // expected-warning {{method in protocol not implemented [-Wprotocol]}}
@end
@protocol P3<P2>
-- (void) P3proto;
-+ (void) ClsP3Proto;
+- (void) P3proto; // expected-warning {{method in protocol not implemented [-Wprotocol]}}
++ (void) ClsP3Proto; // expected-warning {{method in protocol not implemented [-Wprotocol]}}
+ (void) DefClsP3Proto;
@end
@protocol PROTO<P1, P3>
-- (void) meth;
-- (void) meth : (int) arg1;
-+ (void) cls_meth : (int) arg1;
+- (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]}}
@end
-@interface INTF <PROTO>
+@interface INTF <PROTO> // expected-note 3 {{required for direct or indirect protocol 'PROTO'}} \
+ // expected-note 2 {{required for direct or indirect protocol 'P1'}} \
+ // expected-note 2 {{required for direct or indirect protocol 'P3'}} \
+ // expected-note 2 {{required for direct or indirect protocol 'P2'}}
@end
-@implementation INTF // expected-warning {{incomplete implementation}} \
- expected-warning {{method definition for 'meth' not found}} \
- expected-warning {{method definition for 'meth:' not found}} \
- expected-warning {{method definition for 'cls_meth:' not found}} \
- expected-warning {{method definition for 'P3proto' not found}} \
- expected-warning {{method definition for 'ClsP3Proto' not found}} \
- expected-warning {{method definition for 'P2proto' not found}} \
- expected-warning {{method definition for 'ClsP2Proto' not found}} \
- expected-warning {{method definition for 'ClsP1Proto' not found}} \
- expected-warning {{method definition for 'P1proto' not found}}
+@implementation INTF // expected-warning {{incomplete implementation}}
- (void) DefP1proto{}
+ (void) DefClsP3Proto{}
OpenPOWER on IntegriCloud