summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaObjC
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test/SemaObjC')
-rw-r--r--clang/test/SemaObjC/arc.m20
-rw-r--r--clang/test/SemaObjC/incomplete-implementation.m9
-rw-r--r--clang/test/SemaObjC/protocol-implementing-class-methods.m28
-rw-r--r--clang/test/SemaObjC/related-result-type-inference.m6
4 files changed, 48 insertions, 15 deletions
diff --git a/clang/test/SemaObjC/arc.m b/clang/test/SemaObjC/arc.m
index 49dd8a69514..824fc08aec5 100644
--- a/clang/test/SemaObjC/arc.m
+++ b/clang/test/SemaObjC/arc.m
@@ -41,10 +41,10 @@ __weak __strong id x; // expected-error {{the type '__strong id' already has ret
// rdar://8843638
@interface I
-- (id)retain;
-- (id)autorelease;
-- (oneway void)release;
-- (NSUInteger)retainCount;
+- (id)retain; // expected-note {{method declared here}}
+- (id)autorelease; // expected-note {{method declared here}}
+- (oneway void)release; // expected-note {{method declared here}}
+- (NSUInteger)retainCount; // expected-note {{method declared here}}
@end
@implementation I
@@ -55,10 +55,14 @@ __weak __strong id x; // expected-error {{the type '__strong id' already has ret
@end
@implementation I(CAT)
-- (id)retain{return 0;} // expected-error {{ARC forbids implementation of 'retain'}}
-- (id)autorelease{return 0;} // expected-error {{ARC forbids implementation of 'autorelease'}}
-- (oneway void)release{} // expected-error {{ARC forbids implementation of 'release'}}
-- (NSUInteger)retainCount{ return 0; } // expected-error {{ARC forbids implementation of 'retainCount'}}
+- (id)retain{return 0;} // expected-error {{ARC forbids implementation of 'retain'}} \
+ // expected-warning {{category is implementing a method which will also be implemented by its primary class}}
+- (id)autorelease{return 0;} // expected-error {{ARC forbids implementation of 'autorelease'}} \
+ // expected-warning {{category is implementing a method which will also be implemented by its primary class}}
+- (oneway void)release{} // expected-error {{ARC forbids implementation of 'release'}} \
+ // expected-warning {{category is implementing a method which will also be implemented by its primary class}}
+- (NSUInteger)retainCount{ return 0; } // expected-error {{ARC forbids implementation of 'retainCount'}} \
+ // expected-warning {{category is implementing a method which will also be implemented by its primary class}}
@end
// rdar://8861761
diff --git a/clang/test/SemaObjC/incomplete-implementation.m b/clang/test/SemaObjC/incomplete-implementation.m
index 612c331ae8c..f5c5a7cc181 100644
--- a/clang/test/SemaObjC/incomplete-implementation.m
+++ b/clang/test/SemaObjC/incomplete-implementation.m
@@ -1,26 +1,27 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
@interface I
-- Meth; // expected-note{{method definition for 'Meth' not found}}
+- Meth; // expected-note{{method definition for 'Meth' not found}} \
+ // expected-note{{method declared here}}
@end
@implementation I // expected-warning{{incomplete implementation}}
@end
@implementation I(CAT)
-- Meth {return 0;}
+- Meth {return 0;} // expected-warning {{category is implementing a method which will also be implemented by its primary class}}
@end
#pragma GCC diagnostic ignored "-Wincomplete-implementation"
@interface I2
-- Meth;
+- Meth; // expected-note{{method declared here}}
@end
@implementation I2
@end
@implementation I2(CAT)
-- Meth {return 0;}
+- Meth {return 0;} // expected-warning {{category is implementing a method which will also be implemented by its primary class}}
@end
diff --git a/clang/test/SemaObjC/protocol-implementing-class-methods.m b/clang/test/SemaObjC/protocol-implementing-class-methods.m
new file mode 100644
index 00000000000..6d68e8c21cb
--- /dev/null
+++ b/clang/test/SemaObjC/protocol-implementing-class-methods.m
@@ -0,0 +1,28 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+// rdar://7020493
+
+@protocol P1
+@optional
+- (int) PMeth;
+@required
+- (void) : (double) arg; // expected-note {{method declared here}}
+@end
+
+@interface NSImage <P1>
+- (void) initialize; // expected-note {{method declared here}}
+@end
+
+@interface NSImage (AirPortUI)
+- (void) initialize;
+@end
+
+@interface NSImage()
+- (void) CEMeth; // expected-note {{method declared here}}
+@end
+
+@implementation NSImage (AirPortUI)
+- (void) initialize {NSImage *p=0; [p initialize]; } // expected-warning {{category is implementing a method which will also be implemented by its primary class}}
+- (int) PMeth{ return 0; }
+- (void) : (double) arg{}; // expected-warning {{category is implementing a method which will also be implemented by its primary class}}
+- (void) CEMeth {}; // expected-warning {{category is implementing a method which will also be implemented by its primary class}}
+@end
diff --git a/clang/test/SemaObjC/related-result-type-inference.m b/clang/test/SemaObjC/related-result-type-inference.m
index 094f19a6712..11b4b9602e1 100644
--- a/clang/test/SemaObjC/related-result-type-inference.m
+++ b/clang/test/SemaObjC/related-result-type-inference.m
@@ -149,8 +149,8 @@ void test_inference() {
@end
// <rdar://problem/9340699>
-@interface G
-- (id)_ABC_init __attribute__((objc_method_family(init)));
+@interface G
+- (id)_ABC_init __attribute__((objc_method_family(init))); // expected-note {{method declared here}}
@end
@interface G (Additions)
@@ -158,7 +158,7 @@ void test_inference() {
@end
@implementation G (Additions)
-- (id)_ABC_init {
+- (id)_ABC_init { // expected-warning {{category is implementing a method which will also be implemented by its primary class}}
return 0;
}
- (id)_ABC_init2 {
OpenPOWER on IntegriCloud