[PATCH] D87534: Sema: introduce `__attribute__((__swift_name__))`

Saleem Abdulrasool via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 15 13:52:29 PDT 2020


compnerd added inline comments.


================
Comment at: clang/include/clang/Basic/Attr.td:2173
+      SubjectList<[Enum, EnumConstant, Field, Function, GlobalVar, Struct, TypedefName,
+                   ObjCInterface, ObjCClassMethod, ObjCInstanceMethod, ObjCProperty, ObjCProtocol],
+      ErrorDiag, "ExpectedSwiftNameSubjects">;
----------------
doug.gregor wrote:
> compnerd wrote:
> > Note for @rjmccall and @doug.gregor - this version actually enumerates the subjects to which this attribute appertains unlike what was in the original swift version.  Are there other subjects which this should list?
> Hmm. If we enumerate the subjects, we're going to have to update Clang whenever Swift's Clang importer learns a new trick. For example, this is probably missing CXXMethod and FunctionTmpl based on work that's going on in Swift. I suspect we're also missing ObjCCompatibilityAlias. I'm inclined to treat this more like AsmLabelAttr and not try to enumerate subjects at all.
That seems fair to me.  I'll try to remove the subject list and try to clean up the fallout.


================
Comment at: clang/test/SemaObjC/attr-swift-name.m:1
+// RUN: %clang_cc1 -verify -fsyntax-only -fobjc-arc -fblocks %s
+
----------------
aaron.ballman wrote:
> The `fblocks` makes me wonder -- should this attribute be one you can write on a block?
This is not something that can be applied to blocks.  Removing the `-fblocks` is probably a good idea since it isn't actually used.  copy-paste failure on my part :-(.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D87534



More information about the cfe-commits mailing list