aboutsummaryrefslogtreecommitdiff
path: root/test/SemaObjC/protocol-implementing-class-methods.m
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2011-07-28 23:19:50 +0000
committerFariborz Jahanian <fjahanian@apple.com>2011-07-28 23:19:50 +0000
commitfefe91e6017321aa7db431b94cb3615f6c97da7a (patch)
treed90308064fe7ae92a78a8c26ae38fc757564a688 /test/SemaObjC/protocol-implementing-class-methods.m
parentb4ae29ced808ae77914754a9e966513aa26b580b (diff)
objective-c: warn if implementation of a method in category
masks an existing method in its primary class, class extensions, and primary class's non-optional protocol methods; as primary class, or one of its subclass's will implement this method. This warning has potential of being noisy so it has its own group. // rdar://7020493 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136426 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaObjC/protocol-implementing-class-methods.m')
-rw-r--r--test/SemaObjC/protocol-implementing-class-methods.m28
1 files changed, 28 insertions, 0 deletions
diff --git a/test/SemaObjC/protocol-implementing-class-methods.m b/test/SemaObjC/protocol-implementing-class-methods.m
new file mode 100644
index 0000000000..6d68e8c21c
--- /dev/null
+++ b/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