summaryrefslogtreecommitdiffstats
path: root/test/SemaObjC/warn-explicit-call-initialize.m
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2014-08-22 16:57:26 +0000
committerFariborz Jahanian <fjahanian@apple.com>2014-08-22 16:57:26 +0000
commit99ef95c3fcaacededee4e5424c69f809cd9b5973 (patch)
treeb09901205230202b4dda35c733c67da6ac113042 /test/SemaObjC/warn-explicit-call-initialize.m
parent703e007714b477763fe7beb091aab6b1271830eb (diff)
Objective-C. Warn if user has made explicit call
to +initilize as this results in an extra call to this method. rdar://16628028 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216271 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaObjC/warn-explicit-call-initialize.m')
-rw-r--r--test/SemaObjC/warn-explicit-call-initialize.m19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/SemaObjC/warn-explicit-call-initialize.m b/test/SemaObjC/warn-explicit-call-initialize.m
new file mode 100644
index 0000000000..786894cb1d
--- /dev/null
+++ b/test/SemaObjC/warn-explicit-call-initialize.m
@@ -0,0 +1,19 @@
+// RUN: %clang_cc1 -fsyntax-only -triple x86_64-apple-darwin10 -verify %s
+// rdar://16628028
+
+@interface NSObject
++ (void)initialize; // expected-note {{method 'initialize' declared here}}
+@end
+
+@interface I : NSObject
++ (void)initialize; // expected-note {{method 'initialize' declared here}}
+@end
+
+@implementation I
+- (void) Meth {
+ [I initialize]; // expected-warning {{explicit call to +initialize results in duplicate call to +initialize}}
+ [NSObject initialize]; // expected-warning {{explicit call to +initialize results in duplicate call to +initialize}}
+}
++ (void)initialize {}
+@end
+