[PATCH] D75574: RFC: Implement objc_direct_protocol attribute to remove protocol metadata
Nathan Lanza via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 3 15:00:41 PST 2020
lanza created this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
Motivated by the new objc_direct attribute, this change aims to limit
metadata generation from Protocols that the programmer knows isn't
going to be used at runtime. This attribute simply causes the frontend
to not generate any protocol metadata entries (e.g. OBJC_CLASS_NAME,
_OBJC_$_PROTOCOL_INSTANCE_METHDOS, _OBJC_PROTOCOL, etc) for a protocol
marked with `__attribute__((objc_direct))`.
There are a few APIs used to retrieve a protocol at runtime.
`@protocol(SomeProtocol)` will now error out of the requested protocol
is marked with attribute. `objc_getProtocol` will returl `NULL` which
is consistent with the behavior of a non-existing protocol.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D75574
Files:
clang/include/clang/AST/DeclObjC.h
clang/include/clang/Basic/Attr.td
clang/include/clang/Basic/AttrDocs.td
clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/include/clang/Basic/ObjCRuntime.h
clang/lib/AST/DeclObjC.cpp
clang/lib/CodeGen/CGObjCMac.cpp
clang/lib/Sema/SemaDeclAttr.cpp
clang/lib/Sema/SemaExprObjC.cpp
clang/test/CodeGenObjC/static-protocol.m
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D75574.248047.patch
Type: text/x-patch
Size: 10850 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200303/e18a68bf/attachment-0001.bin>
More information about the cfe-commits
mailing list