Mercurial > hg > CbC > CbC_llvm
comparison clang/test/CodeGenObjC/class-stubs.m @ 236:c4bab56944e8 llvm-original
LLVM 16
author | kono |
---|---|
date | Wed, 09 Nov 2022 17:45:10 +0900 |
parents | 79ff65ed7e25 |
children | 1f2b6ac9f198 |
comparison
equal
deleted
inserted
replaced
232:70dce7da266c | 236:c4bab56944e8 |
---|---|
1 // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -Wno-objc-root-class -emit-llvm -o - %s | FileCheck %s | 1 // RUN: %clang_cc1 -no-opaque-pointers -triple x86_64-apple-darwin10 -Wno-objc-root-class -emit-llvm -o - %s | FileCheck %s |
2 | 2 |
3 // -- classref for the message send in main() | 3 // -- classref for the message send in main() |
4 // | 4 // |
5 // The class is declared with objc_class_stub, so LSB of the class pointer | 5 // The class is declared with objc_class_stub, so LSB of the class pointer |
6 // must be set to 1. | 6 // must be set to 1. |
34 __attribute__((objc_class_stub)) | 34 __attribute__((objc_class_stub)) |
35 __attribute__((objc_subclassing_restricted)) | 35 __attribute__((objc_subclassing_restricted)) |
36 @interface Derived : Base | 36 @interface Derived : Base |
37 @end | 37 @end |
38 | 38 |
39 int main() { | 39 int main(void) { |
40 [Base classMethod]; | 40 [Base classMethod]; |
41 } | 41 } |
42 // CHECK-LABEL: define{{.*}} i32 @main() | 42 // CHECK-LABEL: define{{.*}} i32 @main() |
43 // CHECK-NEXT: entry: | 43 // CHECK-NEXT: entry: |
44 // CHECK-NEXT: [[CLASS:%.*]] = call %struct._class_t* @objc_loadClassref(i8** @"OBJC_CLASSLIST_REFERENCES_$_") | 44 // CHECK-NEXT: [[CLASS:%.*]] = call %struct._class_t* @objc_loadClassref(i8** @"OBJC_CLASSLIST_REFERENCES_$_") |
45 // CHECK-NEXT: [[RECEIVER:%.*]] = bitcast %struct._class_t* [[CLASS]] to i8* | |
45 // CHECK-NEXT: [[SELECTOR:%.*]] = load i8*, i8** @OBJC_SELECTOR_REFERENCES_ | 46 // CHECK-NEXT: [[SELECTOR:%.*]] = load i8*, i8** @OBJC_SELECTOR_REFERENCES_ |
46 // CHECK-NEXT: [[RECEIVER:%.*]] = bitcast %struct._class_t* [[CLASS]] to i8* | 47 // CHECK-NEXT: call void bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to void (i8*, i8*)*)(i8* noundef [[RECEIVER]], i8* noundef [[SELECTOR]]) |
47 // CHECK-NEXT: call void bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to void (i8*, i8*)*)(i8* [[RECEIVER]], i8* [[SELECTOR]]) | |
48 // CHECK-NEXT: ret i32 0 | 48 // CHECK-NEXT: ret i32 0 |
49 | 49 |
50 // CHECK-LABEL: declare extern_weak %struct._class_t* @objc_loadClassref(i8**) | 50 // CHECK-LABEL: declare extern_weak %struct._class_t* @objc_loadClassref(i8**) |
51 // CHECK-SAME: [[ATTRLIST:#.*]] | 51 // CHECK-SAME: [[ATTRLIST:#.*]] |
52 | 52 |
53 @implementation Derived (MyCategory) | 53 @implementation Derived (MyCategory) |
54 | 54 |
55 + (void) anotherClassMethod { | 55 + (void) anotherClassMethod { |
56 [super classMethod]; | 56 [super classMethod]; |
57 } | 57 } |
58 // CHECK-LABEL: define internal void @"\01+[Derived(MyCategory) anotherClassMethod]"(i8* %self, i8* %_cmd) #0 { | 58 // CHECK-LABEL: define internal void @"\01+[Derived(MyCategory) anotherClassMethod]"(i8* noundef %self, i8* noundef %_cmd) #0 { |
59 // CHECK-NEXT: entry: | 59 // CHECK-NEXT: entry: |
60 // CHECK: [[SUPER:%.*]] = alloca %struct._objc_super, align 8 | 60 // CHECK: [[SUPER:%.*]] = alloca %struct._objc_super, align 8 |
61 // CHECK: [[METACLASS_REF:%.*]] = load %struct._class_t*, %struct._class_t** @"OBJC_CLASSLIST_SUP_REFS_$_", align 8 | 61 // CHECK: [[METACLASS_REF:%.*]] = load %struct._class_t*, %struct._class_t** @"OBJC_CLASSLIST_SUP_REFS_$_", align 8 |
62 // CHECK: [[CAST_METACLASS_REF:%.*]] = bitcast %struct._class_t* [[METACLASS_REF]] to i8* | 62 // CHECK: [[CAST_METACLASS_REF:%.*]] = bitcast %struct._class_t* [[METACLASS_REF]] to i8* |
63 // CHECK: [[DEST:%.*]] = getelementptr inbounds %struct._objc_super, %struct._objc_super* [[SUPER]], i32 0, i32 1 | 63 // CHECK: [[DEST:%.*]] = getelementptr inbounds %struct._objc_super, %struct._objc_super* [[SUPER]], i32 0, i32 1 |
64 // CHECK: store i8* [[CAST_METACLASS_REF]], i8** [[DEST]], align 8 | 64 // CHECK: store i8* [[CAST_METACLASS_REF]], i8** [[DEST]], align 8 |
65 // CHECK: call void bitcast (i8* (%struct._objc_super*, i8*, ...)* @objc_msgSendSuper2 to void (%struct._objc_super*, i8*)*)(%struct._objc_super* [[SUPER]], i8* {{%.*}}) | 65 // CHECK: call void bitcast (i8* (%struct._objc_super*, i8*, ...)* @objc_msgSendSuper2 to void (%struct._objc_super*, i8*)*)(%struct._objc_super* noundef [[SUPER]], i8* noundef {{%.*}}) |
66 // CHECK: ret void | 66 // CHECK: ret void |
67 | 67 |
68 - (void) anotherInstanceMethod { | 68 - (void) anotherInstanceMethod { |
69 [super instanceMethod]; | 69 [super instanceMethod]; |
70 } | 70 } |
71 // CHECK-LABEL: define internal void @"\01-[Derived(MyCategory) anotherInstanceMethod]"(%0* %self, i8* %_cmd) #0 { | 71 // CHECK-LABEL: define internal void @"\01-[Derived(MyCategory) anotherInstanceMethod]"(%0* noundef %self, i8* noundef %_cmd) #0 { |
72 // CHECK-NEXT: entry: | 72 // CHECK-NEXT: entry: |
73 // CHECK: [[SUPER:%.*]] = alloca %struct._objc_super, align 8 | 73 // CHECK: [[SUPER:%.*]] = alloca %struct._objc_super, align 8 |
74 // CHECK: [[CLASS_REF:%.*]] = call %struct._class_t* @objc_loadClassref(i8** @"OBJC_CLASSLIST_SUP_REFS_$_.1") | 74 // CHECK: [[CLASS_REF:%.*]] = call %struct._class_t* @objc_loadClassref(i8** @"OBJC_CLASSLIST_SUP_REFS_$_.1") |
75 // CHECK: [[CAST_CLASS_REF:%.*]] = bitcast %struct._class_t* [[CLASS_REF]] to i8* | 75 // CHECK: [[CAST_CLASS_REF:%.*]] = bitcast %struct._class_t* [[CLASS_REF]] to i8* |
76 // CHECK: [[DEST:%.*]] = getelementptr inbounds %struct._objc_super, %struct._objc_super* [[SUPER]], i32 0, i32 1 | 76 // CHECK: [[DEST:%.*]] = getelementptr inbounds %struct._objc_super, %struct._objc_super* [[SUPER]], i32 0, i32 1 |
77 // CHECK: store i8* [[CAST_CLASS_REF]], i8** [[DEST]], align 8 | 77 // CHECK: store i8* [[CAST_CLASS_REF]], i8** [[DEST]], align 8 |
78 // CHECK: call void bitcast (i8* (%struct._objc_super*, i8*, ...)* @objc_msgSendSuper2 to void (%struct._objc_super*, i8*)*)(%struct._objc_super* [[SUPER]], i8* {{%.*}}) | 78 // CHECK: call void bitcast (i8* (%struct._objc_super*, i8*, ...)* @objc_msgSendSuper2 to void (%struct._objc_super*, i8*)*)(%struct._objc_super* noundef [[SUPER]], i8* noundef {{%.*}}) |
79 // CHECK: ret void | 79 // CHECK: ret void |
80 | 80 |
81 @end | 81 @end |
82 | 82 |
83 // -- calls to objc_loadClassRef() are readnone | 83 // -- calls to objc_loadClassRef() are readnone |