[PATCH] D84005: Introduce ns_error_domain attribute.

Michael Forster via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 20 07:14:53 PDT 2020


MForster marked an inline comment as done.
MForster added inline comments.


================
Comment at: clang/include/clang/Basic/Attr.td:1860
+def NSErrorDomain : Attr {
+  let Spellings = [GNU<"ns_error_domain">];
+  let Args = [IdentifierArgument<"ErrorDomain">];
----------------
MForster wrote:
> aaron.ballman wrote:
> > gribozavr2 wrote:
> > > aaron.ballman wrote:
> > > > MForster wrote:
> > > > > gribozavr2 wrote:
> > > > > > Could we try to add a list of subjects here? It seems like it is a type-only attribute, and most likely enum-only.
> > > > > > 
> > > > > > let Subjects = SubjectList<[Enum]>;
> > > > > @milseman, could you comment on this? 
> > > > > 
> > > > > In the meantime I've added the restriction. Obviously this makes the tests fail. I will also test this change against the Swift unit tests.
> > > > FWIW, this is not a attribute; it's a declaration attribute.
> > > > 
> > > > Is there a reason it's not inheritable?
> > > > 
> > > > I assume it's not getting a Clang spelling because Objective-C isn't tracking C2x yet? (Though that spelling still seems useful to Objective-C++ users in general for these NS attributes.)
> > > > FWIW, this is not a attribute; it's a declaration attribute.
> > > 
> > > Sorry, yes, of course I meant to say "declaration attribute".
> > > 
> > > > Is there a reason it's not inheritable?
> > > 
> > > Good observation, I think it should be.
> > > 
> > > > I assume it's not getting a Clang spelling because Objective-C isn't tracking C2x yet?
> > > 
> > > Cocoa users are expected to use the `NS_*` macros instead of using the attribute directly, so even if a C2x spelling was an option (IDK if it is), there would be very limited use for it.
> > > Cocoa users are expected to use the NS_* macros instead of using the attribute directly, so even if a C2x spelling was an option (IDK if it is), there would be very limited use for it.
> > 
> > Okay, that's reasonable, thanks!
> > Is there a reason it's not inheritable?
> 
> I made it inheritable. @milseman, any comment on whether that is appropriate? 
>> Could we try to add a list of subjects here? It seems like it is a type-only attribute, and most likely enum-only.
>>
>> let Subjects = SubjectList<[Enum]>;
>
> @milseman, could you comment on this?
>
> In the meantime I've added the restriction. Obviously this makes the tests fail. I will also test this change against the Swift unit tests.

FWIW, no failures in the Swift tests.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84005





More information about the cfe-commits mailing list