1// RUN: %clang_cc1 %s -emit-llvm -triple x86_64-apple-darwin -o - | FileCheck %s
2// rdar://12459358
3@interface NSObject
4-(id)copy;
5+(id)copy;
6@end
7
8@interface Sub1 : NSObject @end
9
10@implementation Sub1
11-(id)copy { return [super copy]; }  // ok: instance method in class
12+(id)copy { return [super copy]; }  // ok: class method in class
13@end
14
15@interface Sub2 : NSObject @end
16
17@interface Sub2 (Category) @end
18
19@implementation Sub2 (Category)
20-(id)copy { return [super copy]; }  // ok: instance method in category
21+(id)copy { return [super copy]; }  // BAD: class method in category
22@end
23
24// CHECK: define internal i8* @"\01+[Sub2(Category) copy]
25// CHECK: [[ONE:%.*]] = load %struct._class_t*, %struct._class_t** @"OBJC_CLASSLIST_SUP_REFS_$_.3"
26// CHECK: [[TWO:%.*]] = bitcast %struct._class_t* [[ONE]] to i8*
27// CHECK: [[THREE:%.*]] = getelementptr inbounds %struct._objc_super, %struct._objc_super* [[OBJC_SUPER:%.*]], i32 0, i32 1
28// CHECK: store i8* [[TWO]], i8** [[THREE]]
29// CHECK: [[FOUR:%.*]] = load i8*, i8** @OBJC_SELECTOR_REFERENCES_
30