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.Message")))
17@interface Message <Protocol, Protocol2> {
18  id MyIVAR;
19}
20@end
21
22@implementation Message
23- (id) MyMethod {
24  return MyIVAR;
25}
26
27+ (id) MyClsMethod {
28  return 0;
29}
30
31- (void) MethodP{}
32- (void) MethodP2{}
33
34+ (void) ClsMethodP {}
35+ (void) ClsMethodP2 {}
36@end
37
38// rdar://16877359
39__attribute__((objc_runtime_name("foo")))
40@interface SLREarth
41- (instancetype)init;
42+ (instancetype)alloc;
43@end
44
45id Test16877359() {
46    return [SLREarth alloc];
47}
48
49// CHECK: @"OBJC_IVAR_$_MySecretNamespace.Message.MyIVAR" = global i64
50// CHECK: @"OBJC_CLASS_$_MySecretNamespace.Message" = global %struct._class_t
51// CHECK: @"OBJC_METACLASS_$_MySecretNamespace.Message" = global %struct._class_t
52// CHECK: @"OBJC_CLASS_$_foo" = external global %struct._class_t
53// CHECK: define internal i8* @"\01-[Message MyMethod]"
54// CHECK: [[IVAR:%.*]] = load i64* @"OBJC_IVAR_$_MySecretNamespace.Message.MyIVAR"
55