blob: c988eae654e6bf0e46cdc70f065113db6197732a [file] [log] [blame]
Fariborz Jahanian451b92a2014-07-16 16:16:04 +00001// 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 Gregorb32684e2015-06-16 21:04:55 +000016__attribute__((objc_runtime_name("MySecretNamespace.Protocol3")))
17@protocol Protocol3
18@end
19
Fariborz Jahanian451b92a2014-07-16 16:16:04 +000020__attribute__((objc_runtime_name("MySecretNamespace.Message")))
21@interface Message <Protocol, Protocol2> {
22 id MyIVAR;
23}
Douglas Gregorb32684e2015-06-16 21:04:55 +000024
25@property(retain) Message *msgProp;
26@property(retain) Message<Protocol3> *msgProtoProp;
27@property(retain) id<Protocol3> idProtoProp;
28
Fariborz Jahanian451b92a2014-07-16 16:16:04 +000029@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
54id Test16877359() {
55 return [SLREarth alloc];
56}
57
Douglas Gregorb32684e2015-06-16 21:04:55 +000058// CHECK: @"OBJC_IVAR_$_MySecretNamespace.Message.MyIVAR" = global i64 0
Fariborz Jahanian451b92a2014-07-16 16:16:04 +000059// CHECK: @"OBJC_CLASS_$_MySecretNamespace.Message" = global %struct._class_t
60// CHECK: @"OBJC_METACLASS_$_MySecretNamespace.Message" = global %struct._class_t
Douglas Gregorb32684e2015-06-16 21:04:55 +000061
Saleem Abdulrasool3f307512016-09-18 16:12:14 +000062// 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 Gregorb32684e2015-06-16 21:04:55 +000065
Fariborz Jahanian451b92a2014-07-16 16:16:04 +000066// CHECK: @"OBJC_CLASS_$_foo" = external global %struct._class_t
67// CHECK: define internal i8* @"\01-[Message MyMethod]"
David Blaikiea953f282015-02-27 21:19:58 +000068// CHECK: [[IVAR:%.*]] = load i64, i64* @"OBJC_IVAR_$_MySecretNamespace.Message.MyIVAR"