[clang][objc][codegen] Skip emitting ObjC category metadata when the
authorJosh Learn <joshua_learn@apple.com>
Sat, 13 Nov 2021 00:17:18 +0000 (16:17 -0800)
committerAkira Hatanaka <ahatanaka@apple.com>
Sat, 13 Nov 2021 00:21:21 +0000 (16:21 -0800)
commit7611e16fce9ce36b6bd6dceda691f6bc7e754347
treebce9c795982828923e4ce875a52c9bce12427b97
parentcb0e14ce6dcdd614a7207f4ce6fcf81a164471ab
[clang][objc][codegen] Skip emitting ObjC category metadata when the
category is empty

Currently, if we create a category in ObjC that is empty, we still emit
runtime metadata for that category. This is a scenario that could
commonly be run into when using __attribute__((objc_direct_members)),
which elides the need for much of the category metadata. This is
slightly wasteful and can be easily skipped by checking the category
metadata contents during CodeGen.

rdar://66177182

Differential Revision: https://reviews.llvm.org/D113455
clang/lib/CodeGen/CGObjCMac.cpp
clang/test/CodeGenObjC/category-class-empty.m [new file with mode: 0644]
clang/test/CodeGenObjC/non-lazy-classes.m