[PATCH] D16790: Add ObjC category merging to ObjCPass

Pete Cooper via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 1 16:54:32 PST 2016


pete created this revision.
pete added a reviewer: lhames.
pete added subscribers: kledzik, llvm-commits.
pete added a project: lld.

This ports the start of the ObjC category merging pass from ld64 to lld.

This is used in code such as the following:

@interface A @end
@implementation A
+(void) foo {
}
@end

@interface A (Cat) @end
@implementation A (Cat)
+(void) bar {
}
@end

In this example, we would have a category list with the element 'A (Cat)'. This pass takes the methods from the category and adds them to the method list on the class 'A'.  That is, class 'A' had a method list { foo } but after this pass will have { foo, bar }.

This is only the first of several optimizations in this area.  This handles instance methods, but future commits will handle class methods, protocols, and properties.  The code here is meant to be extensible in that i'll later need to add support for all the different offsets and atom types for those optimizations too.

http://reviews.llvm.org/D16790

Files:
  lib/ReaderWriter/MachO/ObjCPass.cpp
  test/mach-o/objc-method-list-merge.yaml

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D16790.46594.patch
Type: text/x-patch
Size: 54835 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160202/5d98b5fb/attachment.bin>


More information about the llvm-commits mailing list