[PATCH] D86049: RFC: Implement optional exportable wrapper function generation for objc_direct methods.
Michael Wyman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Aug 9 10:16:48 PDT 2022
mwyman added inline comments.
================
Comment at: clang/include/clang/Basic/Attr.td:2251-2256
+def ObjCDirectVisible : Attr {
+ let Spellings = [Clang<"objc_direct_visible">];
+ let Subjects = SubjectList<[ObjCMethod], ErrorDiag>;
+ let LangOpts = [ObjC];
+ let Documentation = [ObjCDirectVisibleDocs];
+}
----------------
Should this inherit `ObjCDirect`, to include both objc_direct and the visibility aspect? I don't see any reason we would want to add `objc_direct_visible` without also having `objc_direct`, so why make developers add both?
As an alternative, would it make sense to allow adding `__attribute__((visibility("default")))` on direct methods?
Also, it doesn't seem like this allows making `@property`s visible, so should there be a similar attribute for properties?
================
Comment at: clang/lib/CodeGen/CGObjCMac.cpp:4025-4036
+ if (OMD->isDirectMethodVisible() && Fn->getName().str()[0] == '\1') {
+ // Drop '\1' to work with dlsym.
+ std::string Name = Fn->getName().str().substr(1);
+
+ assert(Name[0] == '-' || Name[0] == '+');
+ assert(Name[1] == '[' && Name[Name.length() - 1] == ']');
+
----------------
Should this move to clang/lib/AST/Mangle.cpp's mangleObjCMethodName?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D86049/new/
https://reviews.llvm.org/D86049
More information about the cfe-commits
mailing list