[PATCH] D87395: Sema: add support for `__attribute__((__swift_objc_members__))`

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 10 10:57:39 PDT 2020


aaron.ballman added inline comments.


================
Comment at: clang/include/clang/Basic/Attr.td:2121
 
+def SwiftObjCMembers : Attr {
+  let Spellings = [GNU<"swift_objc_members">];
----------------
Should this be inherited by redeclarations, or is that not a thing with `ObjCInterfaceDecl`s?


================
Comment at: clang/include/clang/Basic/AttrDocs.td:3387
+The ``swift_objc_members`` attribute maps to the ``@objcMembers`` Swift
+attribute, which indicates that Swift members of this class, its subclasses, and
+all extensions thereof, will implicitly be exposed back to Objective-C.
----------------
The documentation is a bit hard to follow -- the user is going to be adding this attribute to an ObjC interface, so the docs should be talking about what that means from the ObjC side of things more so than the Swift side, no?


================
Comment at: clang/lib/Sema/SemaDeclAttr.cpp:7546
+  case ParsedAttr::AT_SwiftObjCMembers:
+    handleSimpleAttribute<SwiftObjCMembersAttr>(S, D, AL);
+    break;
----------------
Does it matter if the user writes this attribute on an interface that exposes no members? e.g., are there warnings we may want to give the user about using the attribute in a weird way? (Sorry if this should be obvious, but I don't have experience with Swift.)


================
Comment at: clang/test/SemaObjC/attr-swift_objc_members.m:4
+#if !__has_attribute(swift_objc_members)
+#error cannot verify precense of swift_objc_members attribute
+#endif
----------------
gribozavr2 wrote:
> 
The typo fix makes sense to me, but for my own understanding, why switch to a string literal?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D87395/new/

https://reviews.llvm.org/D87395



More information about the cfe-commits mailing list