diff options
| author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2015-07-30 19:06:04 +0000 |
|---|---|---|
| committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2015-07-30 19:06:04 +0000 |
| commit | c0d4b00fee2768bac7dca3362360ad993e0db75b (patch) | |
| tree | 7314b3208e0b1ac873730ed168707fe4deaa2447 /clang/test/SemaObjC | |
| parent | 64a1bd9db87d61c25be94bc24a3caabd313e3e61 (diff) | |
| download | bcm5719-llvm-c0d4b00fee2768bac7dca3362360ad993e0db75b.tar.gz bcm5719-llvm-c0d4b00fee2768bac7dca3362360ad993e0db75b.zip | |
[sema] Allow to opt-out of overriding the super class's designated initializers by marking the initializer as unavailable in the subclass.
rdar://20281322
llvm-svn: 243676
Diffstat (limited to 'clang/test/SemaObjC')
| -rw-r--r-- | clang/test/SemaObjC/attr-designated-init.m | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/clang/test/SemaObjC/attr-designated-init.m b/clang/test/SemaObjC/attr-designated-init.m index a8673e1b019..05085884784 100644 --- a/clang/test/SemaObjC/attr-designated-init.m +++ b/clang/test/SemaObjC/attr-designated-init.m @@ -1,6 +1,7 @@ // RUN: %clang_cc1 -fsyntax-only -Wno-incomplete-implementation -verify -fblocks %s #define NS_DESIGNATED_INITIALIZER __attribute__((objc_designated_initializer)) +#define NS_UNAVAILABLE __attribute__((unavailable)) void fnfoo(void) NS_DESIGNATED_INITIALIZER; // expected-error {{only applies to init methods of interface or class extension declarations}} @@ -253,7 +254,7 @@ __attribute__((objc_root_class)) __attribute__((objc_root_class)) @interface MyObject - (instancetype)initWithStuff:(id)stuff __attribute__((objc_designated_initializer)); -- (instancetype)init __attribute__((unavailable)); +- (instancetype)init NS_UNAVAILABLE; @end @implementation MyObject @@ -378,6 +379,15 @@ __attribute__((objc_root_class)) } @end +@interface SubTest1 : Test1 +-(instancetype)init NS_UNAVAILABLE; +-(instancetype)initWithRequiredParameter:(id)foo NS_DESIGNATED_INITIALIZER; +@end +@implementation SubTest1 +-(instancetype)initWithRequiredParameter:(id)foo { + return [super init]; +} +@end @interface Test2 : NSObject @end |

