Home | History | Annotate | Download | only in CodeGenObjC
      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 
     16 __attribute__((objc_runtime_name("MySecretNamespace.Protocol3")))
     17 @protocol Protocol3
     18 @end
     19 
     20 __attribute__((objc_runtime_name("MySecretNamespace.Message")))
     21 @interface Message <Protocol, Protocol2> {
     22   id MyIVAR;
     23 }
     24 
     25 @property(retain) Message *msgProp;
     26 @property(retain) Message<Protocol3> *msgProtoProp;
     27 @property(retain) id<Protocol3> idProtoProp;
     28 
     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 
     58 // CHECK: @"OBJC_IVAR_$_MySecretNamespace.Message.MyIVAR" = global i64 0
     59 // CHECK: @"OBJC_CLASS_$_MySecretNamespace.Message" = global %struct._class_t
     60 // CHECK: @"OBJC_METACLASS_$_MySecretNamespace.Message" = global %struct._class_t
     61 
     62 // CHECK: private global [42 x i8] c"T@\22MySecretNamespace.Message\22,&,V_msgProp\00"
     63 // CHECK: private global [76 x i8] c"T@\22MySecretNamespace.Message<MySecretNamespace.Protocol3>\22,&,V_msgProtoProp\00"
     64 // CHECK: private global [50 x i8] c"T@\22<MySecretNamespace.Protocol3>\22,&,V_idProtoProp\00"
     65 
     66 // CHECK: @"OBJC_CLASS_$_foo" = external global %struct._class_t
     67 // CHECK: define internal i8* @"\01-[Message MyMethod]"
     68 // CHECK: [[IVAR:%.*]] = load i64, i64* @"OBJC_IVAR_$_MySecretNamespace.Message.MyIVAR"
     69