Skip to content

Commit d47633d

Browse files
committed
[NFC] Reorganize test file
1 parent 29d29c1 commit d47633d

File tree

1 file changed

+27
-5
lines changed

1 file changed

+27
-5
lines changed

test/IRGen/objc_implementation.swift

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
// RUN: %FileCheck --input-file %t.ir %s
33
// RUN: %FileCheck --input-file %t.ir --check-prefix NEGATIVE %s
44

5+
//
6+
// @_objcImplementation class
7+
//
8+
59
// Metaclass
610
// CHECK: @"OBJC_METACLASS_$_ImplClass" = global %objc_class { %objc_class* @"OBJC_METACLASS_$_NSObject", %objc_class* @"OBJC_METACLASS_$_NSObject", %swift.opaque* @_objc_empty_cache, %swift.opaque* null, i64 ptrtoint ({ i32, i32, i32, i32, i8*, i8*, i8*, i8*, i8*, i8*, i8* }* [[_METACLASS_DATA_ImplClass:@[^, ]+]] to i64) }, align 8
711
// CHECK: [[OBJC_CLASS_NAME_:@[^, ]+]] = private unnamed_addr constant [10 x i8] c"ImplClass\00"
@@ -15,12 +19,22 @@
1519
// CHECK: [[_DATA_ImplClass:@[^, ]+]] = internal constant { i32, i32, i32, i32, i8*, i8*, { i32, i32, [1 x { i8*, i8*, i8* }] }*, i8*, i8*, i8*, i8* } { i32 128, i32 8, i32 8, i32 0, i8* null, i8* getelementptr inbounds ([10 x i8], [10 x i8]* [[OBJC_CLASS_NAME_]], i64 0, i64 0), { i32, i32, [1 x { i8*, i8*, i8* }] }* [[_INSTANCE_METHODS_ImplClass]], i8* null, i8* null, i8* null, i8* null }, section "__DATA, __objc_data", align 8
1620
// CHECK: @"OBJC_CLASS_$_ImplClass" = global <{ i64, %objc_class*, %swift.opaque*, %swift.opaque*, { i32, i32, i32, i32, i8*, i8*, { i32, i32, [1 x { i8*, i8*, i8* }] }*, i8*, i8*, i8*, i8* }* }> <{ i64 ptrtoint (%objc_class* @"OBJC_METACLASS_$_ImplClass" to i64), %objc_class* @"OBJC_CLASS_$_NSObject", %swift.opaque* @_objc_empty_cache, %swift.opaque* null, { i32, i32, i32, i32, i8*, i8*, { i32, i32, [1 x { i8*, i8*, i8* }] }*, i8*, i8*, i8*, i8* }* [[_DATA_ImplClass]] }>, section "__DATA,__objc_data, regular", align 8
1721

22+
// Swift metadata
23+
// NEGATIVE-NOT: OBJC_CLASS_$_ImplClass.{{[0-9]}}
24+
// NEGATIVE-NOT: $sSo9ImplClassCMn
25+
// NEGATIVE-NOT: $sSo9ImplClassCHn
26+
// NEGATIVE-NOT: $sSo9ImplClassCN
27+
// NEGATIVE-NOT: $sSo9ImplClassCMf
1828
@_objcImplementation extension ImplClass {
1929
@objc func mainMethod(_: Int32) {
2030
print("mainMethod")
2131
}
2232
}
2333

34+
//
35+
// @_objcImplementation category
36+
//
37+
2438
// Category1
2539
// CHECK: [[OBJC_CLASS_NAME_2:@[^, ]+]] = private unnamed_addr constant [10 x i8] c"Category1\00"
2640
// CHECK: [[selector_data_category1Method_:@[^, ]+]] = private global [17 x i8] c"category1Method:\00", section "__TEXT,__objc_methname,cstring_literals", align 1
@@ -32,16 +46,24 @@
3246
}
3347
}
3448

49+
//
50+
// Epilogue
51+
//
52+
3553
// CHECK: @"objc_classes_OBJC_CLASS_$_ImplClass" = internal global i8* bitcast (<{ i64, %objc_class*, %swift.opaque*, %swift.opaque*, { i32, i32, i32, i32, i8*, i8*, { i32, i32, [1 x { i8*, i8*, i8* }] }*, i8*, i8*, i8*, i8* }* }>* @"OBJC_CLASS_$_ImplClass" to i8*), section "__DATA,__objc_classlist,regular,no_dead_strip", align 8
3654
// CHECK: @objc_categories = internal global [1 x i8*] [i8* bitcast ({ i8*, %objc_class*, { i32, i32, [1 x { i8*, i8*, i8* }] }*, i8*, i8*, i8*, i8*, i32 }* [[_CATEGORY_ImplClass_Category1]] to i8*)], section "__DATA,__objc_catlist,regular,no_dead_strip", align 8
3755

56+
57+
//
58+
// Functions
59+
//
60+
3861
// CHECK: define internal void @"$sSo9ImplClassC19objc_implementationE10mainMethodyys5Int32VFTo"
3962
// CHECK: define internal void @"$sSo9ImplClassC19objc_implementationE15category1Methodyys5Int32VFTo"
4063

64+
//
65+
// Not implemented in Swift
66+
//
67+
4168
// NEGATIVE-NOT: Category2
4269
// NEGATIVE-NOT: NoImplClass
43-
// NEGATIVE-NOT: OBJC_CLASS_$_ImplClass.{{[0-9]}}
44-
// NEGATIVE-NOT: $sSo9ImplClassCMn
45-
// NEGATIVE-NOT: $sSo9ImplClassCHn
46-
// NEGATIVE-NOT: $sSo9ImplClassCN
47-
// NEGATIVE-NOT: $sSo9ImplClassCMf

0 commit comments

Comments
 (0)