xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGenObjC/objc-asm-attribute-test.m (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc// RUN: %clang_cc1 -emit-llvm -triple x86_64-apple-darwin %s -o - | FileCheck %s
2*0a6a1f1dSLionel Sambuc// rdar://16462586
3*0a6a1f1dSLionel Sambuc
4*0a6a1f1dSLionel Sambuc__attribute__((objc_runtime_name("MySecretNamespace.Protocol")))
5*0a6a1f1dSLionel Sambuc@protocol Protocol
6*0a6a1f1dSLionel Sambuc- (void) MethodP;
7*0a6a1f1dSLionel Sambuc+ (void) ClsMethodP;
8*0a6a1f1dSLionel Sambuc@end
9*0a6a1f1dSLionel Sambuc
10*0a6a1f1dSLionel Sambuc__attribute__((objc_runtime_name("MySecretNamespace.Protocol2")))
11*0a6a1f1dSLionel Sambuc@protocol Protocol2
12*0a6a1f1dSLionel Sambuc- (void) MethodP2;
13*0a6a1f1dSLionel Sambuc+ (void) ClsMethodP2;
14*0a6a1f1dSLionel Sambuc@end
15*0a6a1f1dSLionel Sambuc
16*0a6a1f1dSLionel Sambuc__attribute__((objc_runtime_name("MySecretNamespace.Message")))
17*0a6a1f1dSLionel Sambuc@interface Message <Protocol, Protocol2> {
18*0a6a1f1dSLionel Sambuc  id MyIVAR;
19*0a6a1f1dSLionel Sambuc}
20*0a6a1f1dSLionel Sambuc@end
21*0a6a1f1dSLionel Sambuc
22*0a6a1f1dSLionel Sambuc@implementation Message
23*0a6a1f1dSLionel Sambuc- (id) MyMethod {
24*0a6a1f1dSLionel Sambuc  return MyIVAR;
25*0a6a1f1dSLionel Sambuc}
26*0a6a1f1dSLionel Sambuc
27*0a6a1f1dSLionel Sambuc+ (id) MyClsMethod {
28*0a6a1f1dSLionel Sambuc  return 0;
29*0a6a1f1dSLionel Sambuc}
30*0a6a1f1dSLionel Sambuc
31*0a6a1f1dSLionel Sambuc- (void) MethodP{}
32*0a6a1f1dSLionel Sambuc- (void) MethodP2{}
33*0a6a1f1dSLionel Sambuc
34*0a6a1f1dSLionel Sambuc+ (void) ClsMethodP {}
35*0a6a1f1dSLionel Sambuc+ (void) ClsMethodP2 {}
36*0a6a1f1dSLionel Sambuc@end
37*0a6a1f1dSLionel Sambuc
38*0a6a1f1dSLionel Sambuc// rdar://16877359
39*0a6a1f1dSLionel Sambuc__attribute__((objc_runtime_name("foo")))
40*0a6a1f1dSLionel Sambuc@interface SLREarth
41*0a6a1f1dSLionel Sambuc- (instancetype)init;
42*0a6a1f1dSLionel Sambuc+ (instancetype)alloc;
43*0a6a1f1dSLionel Sambuc@end
44*0a6a1f1dSLionel Sambuc
45*0a6a1f1dSLionel Sambucid Test16877359() {
46*0a6a1f1dSLionel Sambuc    return [SLREarth alloc];
47*0a6a1f1dSLionel Sambuc}
48*0a6a1f1dSLionel Sambuc
49*0a6a1f1dSLionel Sambuc// CHECK: @"OBJC_IVAR_$_MySecretNamespace.Message.MyIVAR" = global i64
50*0a6a1f1dSLionel Sambuc// CHECK: @"OBJC_CLASS_$_MySecretNamespace.Message" = global %struct._class_t
51*0a6a1f1dSLionel Sambuc// CHECK: @"OBJC_METACLASS_$_MySecretNamespace.Message" = global %struct._class_t
52*0a6a1f1dSLionel Sambuc// CHECK: @"OBJC_CLASS_$_foo" = external global %struct._class_t
53*0a6a1f1dSLionel Sambuc// CHECK: define internal i8* @"\01-[Message MyMethod]"
54*0a6a1f1dSLionel Sambuc// CHECK: [[IVAR:%.*]] = load i64* @"OBJC_IVAR_$_MySecretNamespace.Message.MyIVAR"
55