Debian Codegraph @

clang/test/CodeGenObjC/category-super-class-meth.m

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