Skip to content

Commit 308d947

Browse files
author
Alex B
committed
Address Feedback nr.2
1 parent 03ff4e0 commit 308d947

File tree

2 files changed

+54
-3
lines changed

2 files changed

+54
-3
lines changed

lld/MachO/ObjC.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -574,8 +574,6 @@ ObjcCategoryMerger::tryGetSymbolAtIsecOffset(const ConcatInputSection *isec,
574574
Defined *definedSym = cast<Defined>(sym);
575575
sym = tryFindDefinedOnIsec(definedSym->isec(),
576576
definedSym->value + reloc->addend);
577-
578-
auto *defSym = dyn_cast<Defined>(sym);
579577
}
580578

581579
return sym;

lld/test/MachO/objc-category-merging-swift.s

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,64 @@
33

44
############ Test merging multiple categories into a single category ############
55
## Apply category merging to swiftc code just make sure we can handle addends
6-
## and don't erase cateogry names for swift -- in order to not crash
6+
## and don't erase category names for swift -- in order to not crash
77
# RUN: llvm-mc -filetype=obj -triple=arm64-apple-macos -o cat_swift.o %s
88
# RUN: %lld -arch arm64 -dylib -o cat_swift.dylib cat_swift.o -objc_category_merging
9+
# RUN: llvm-objdump --objc-meta-data --macho cat_swift.dylib | FileCheck %s --check-prefixes=CHECK-MERGE
10+
11+
; CHECK-MERGE: Contents of (__DATA_CONST,__objc_classlist) section
12+
; CHECK-MERGE: _$s11SimpleClassAACN
13+
; CHECK-MERGE: isa {{.+}} _OBJC_METACLASS_$__TtC11SimpleClass11SimpleClass
14+
; CHECK-MERGE: superclass 0x0
15+
; CHECK-MERGE: cache 0x0
16+
; CHECK-MERGE: vtable 0x0
17+
; CHECK-MERGE: data {{.+}} (struct class_ro_t *) Swift class
18+
; CHECK-MERGE: flags 0x80
19+
; CHECK-MERGE: instanceStart 8
20+
; CHECK-MERGE: instanceSize 8
21+
; CHECK-MERGE: reserved 0x0
22+
; CHECK-MERGE: ivarLayout 0x0
23+
; CHECK-MERGE: name {{.+}} _TtC11SimpleClass11SimpleClass
24+
; CHECK-MERGE: baseMethods {{.+}} (struct method_list_t *)
25+
; CHECK-MERGE: entsize 24
26+
; CHECK-MERGE: count 3
27+
; CHECK-MERGE: name {{.+}} categoryInstanceMethod
28+
; CHECK-MERGE: types {{.+}} q16@0:8
29+
; CHECK-MERGE: imp _$s11SimpleClassAAC22categoryInstanceMethodSiyFTo
30+
; CHECK-MERGE: name {{.+}} baseClassInstanceMethod
31+
; CHECK-MERGE: types {{.+}} i16@0:8
32+
; CHECK-MERGE: imp _$s11SimpleClassAAC04baseB14InstanceMethods5Int32VyFTo
33+
; CHECK-MERGE: name {{.+}} init
34+
; CHECK-MERGE: types {{.+}} @16@0:8
35+
; CHECK-MERGE: imp _$s11SimpleClassAACABycfcTo
36+
; CHECK-MERGE: baseProtocols 0x0
37+
; CHECK-MERGE: ivars 0x0
38+
; CHECK-MERGE: weakIvarLayout 0x0
39+
; CHECK-MERGE: baseProperties 0x0
40+
; CHECK-MERGE: Meta Class
41+
; CHECK-MERGE: isa 0x0
42+
; CHECK-MERGE: superclass 0x0
43+
; CHECK-MERGE: cache 0x0
44+
; CHECK-MERGE: vtable 0x0
45+
; CHECK-MERGE: data {{.+}} (struct class_ro_t *)
46+
; CHECK-MERGE: flags 0x81 RO_META
47+
; CHECK-MERGE: instanceStart 40
48+
; CHECK-MERGE: instanceSize 40
49+
; CHECK-MERGE: reserved 0x0
50+
; CHECK-MERGE: ivarLayout 0x0
51+
; CHECK-MERGE: name {{.+}} _TtC11SimpleClass11SimpleClass
52+
; CHECK-MERGE: baseMethods 0x0 (struct method_list_t *)
53+
; CHECK-MERGE: baseProtocols 0x0
54+
; CHECK-MERGE: ivars 0x0
55+
; CHECK-MERGE: weakIvarLayout 0x0
56+
; CHECK-MERGE: baseProperties 0x0
57+
; CHECK-MERGE: Contents of (__DATA_CONST,__objc_imageinfo) section
58+
; CHECK-MERGE: version 0
59+
; CHECK-MERGE: flags 0x740 OBJC_IMAGE_HAS_CATEGORY_CLASS_PROPERTIES Swift 5 or later
960

1061
; ================== Generated from Swift: ==================
62+
;; > xcrun swiftc --version
63+
;; swift-driver version: 1.109.2 Apple Swift version 6.0 (swiftlang-6.0.0.3.300 clang-1600.0.20.10)
1164
;; > xcrun swiftc -S SimpleClass.swift -o SimpleClass.s
1265
; import Foundation
1366
; @objc class SimpleClass: NSObject {

0 commit comments

Comments
 (0)