[PATCH] D87396: Sema: add support for `__attribute__((__swift_typedef_bridged__))`

Saleem Abdulrasool via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 11 10:52:18 PDT 2020


compnerd added inline comments.


================
Comment at: clang/include/clang/Basic/Attr.td:2121
 
+def SwiftBridgedTypedef : Attr {
+  let Spellings = [GNU<"swift_bridged_typedef">];
----------------
aaron.ballman wrote:
> Should this be inherited on redeclarations?
I don't see why not.  @rjmccall, @doug.gregor any reason to not permit this to be inherited by redeclarations? 


================
Comment at: clang/include/clang/Basic/Attr.td:2123
+  let Spellings = [GNU<"swift_bridged_typedef">];
+  let Subjects = SubjectList<[TypedefName], ErrorDiag, "typedefs">;
+  let Documentation = [SwiftBridgedTypedefDocs];
----------------
aaron.ballman wrote:
> Does the default diagnostic text generate something bad that caused you to add `typedefs` here?
I don't remember, I'll double check.


================
Comment at: clang/lib/Sema/SemaDeclAttr.cpp:7543
+  case ParsedAttr::AT_SwiftBridgedTypedef:
+    handleSimpleAttribute<SwiftBridgedTypedefAttr>(S, D, AL);
+    break;
----------------
aaron.ballman wrote:
> Should there be any type checking that the underlying type of the typedef is a sensible one to bridge?
I can't really think of anything that you could check that would be valuable.  What types of things were you thinking?


================
Comment at: clang/test/SemaObjC/attr-swift_bridged_typedef.m:8
+
+struct __attribute__((swift_bridged_typedef)) S {};
+// expected-error at -1 {{'swift_bridged_typedef' attribute only applies to typedefs}}
----------------
aaron.ballman wrote:
> Please also add some examples where the attribute has arguments. Also, should this work in Objective-C++ when using a `using` type alias? If so, an example showing that working would also be helpful.
I don't know about the ObjC++11 case with the `using`.  @doug.gregor or @rjmccall?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D87396



More information about the cfe-commits mailing list