Fariborz Jahanian | 451b92a | 2014-07-16 16:16:04 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -emit-llvm -triple x86_64-apple-darwin %s -o - | FileCheck %s |
| 2 | // rdar://16462586 |
| 3 | |
| 4 | __attribute__((objc_runtime_name("MySecretNamespace.Protocol"))) |
| 5 | @protocol Protocol |
| 6 | - (void) MethodP; |
| 7 | + (void) ClsMethodP; |
| 8 | @end |
| 9 | |
| 10 | __attribute__((objc_runtime_name("MySecretNamespace.Protocol2"))) |
| 11 | @protocol Protocol2 |
| 12 | - (void) MethodP2; |
| 13 | + (void) ClsMethodP2; |
| 14 | @end |
| 15 | |
Douglas Gregor | b32684e | 2015-06-16 21:04:55 +0000 | [diff] [blame] | 16 | __attribute__((objc_runtime_name("MySecretNamespace.Protocol3"))) |
| 17 | @protocol Protocol3 |
| 18 | @end |
| 19 | |
Fariborz Jahanian | 451b92a | 2014-07-16 16:16:04 +0000 | [diff] [blame] | 20 | __attribute__((objc_runtime_name("MySecretNamespace.Message"))) |
| 21 | @interface Message <Protocol, Protocol2> { |
| 22 | id MyIVAR; |
| 23 | } |
Douglas Gregor | b32684e | 2015-06-16 21:04:55 +0000 | [diff] [blame] | 24 | |
| 25 | @property(retain) Message *msgProp; |
| 26 | @property(retain) Message<Protocol3> *msgProtoProp; |
| 27 | @property(retain) id<Protocol3> idProtoProp; |
| 28 | |
Fariborz Jahanian | 451b92a | 2014-07-16 16:16:04 +0000 | [diff] [blame] | 29 | @end |
| 30 | |
| 31 | @implementation Message |
| 32 | - (id) MyMethod { |
| 33 | return MyIVAR; |
| 34 | } |
| 35 | |
| 36 | + (id) MyClsMethod { |
| 37 | return 0; |
| 38 | } |
| 39 | |
| 40 | - (void) MethodP{} |
| 41 | - (void) MethodP2{} |
| 42 | |
| 43 | + (void) ClsMethodP {} |
| 44 | + (void) ClsMethodP2 {} |
| 45 | @end |
| 46 | |
| 47 | // rdar://16877359 |
| 48 | __attribute__((objc_runtime_name("foo"))) |
| 49 | @interface SLREarth |
| 50 | - (instancetype)init; |
| 51 | + (instancetype)alloc; |
| 52 | @end |
| 53 | |
| 54 | id Test16877359() { |
| 55 | return [SLREarth alloc]; |
| 56 | } |
| 57 | |
Douglas Gregor | b32684e | 2015-06-16 21:04:55 +0000 | [diff] [blame] | 58 | // CHECK: @"OBJC_IVAR_$_MySecretNamespace.Message.MyIVAR" = global i64 0 |
Fariborz Jahanian | 451b92a | 2014-07-16 16:16:04 +0000 | [diff] [blame] | 59 | // CHECK: @"OBJC_CLASS_$_MySecretNamespace.Message" = global %struct._class_t |
| 60 | // CHECK: @"OBJC_METACLASS_$_MySecretNamespace.Message" = global %struct._class_t |
Douglas Gregor | b32684e | 2015-06-16 21:04:55 +0000 | [diff] [blame] | 61 | |
Saleem Abdulrasool | 3f30751 | 2016-09-18 16:12:14 +0000 | [diff] [blame] | 62 | // CHECK: private unnamed_addr constant [42 x i8] c"T@\22MySecretNamespace.Message\22,&,V_msgProp\00" |
| 63 | // CHECK: private unnamed_addr constant [76 x i8] c"T@\22MySecretNamespace.Message<MySecretNamespace.Protocol3>\22,&,V_msgProtoProp\00" |
| 64 | // CHECK: private unnamed_addr constant [50 x i8] c"T@\22<MySecretNamespace.Protocol3>\22,&,V_idProtoProp\00" |
Douglas Gregor | b32684e | 2015-06-16 21:04:55 +0000 | [diff] [blame] | 65 | |
Fariborz Jahanian | 451b92a | 2014-07-16 16:16:04 +0000 | [diff] [blame] | 66 | // CHECK: @"OBJC_CLASS_$_foo" = external global %struct._class_t |
| 67 | // CHECK: define internal i8* @"\01-[Message MyMethod]" |
David Blaikie | a953f28 | 2015-02-27 21:19:58 +0000 | [diff] [blame] | 68 | // CHECK: [[IVAR:%.*]] = load i64, i64* @"OBJC_IVAR_$_MySecretNamespace.Message.MyIVAR" |