-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Cleanup attr.def #16031
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cleanup attr.def #16031
Conversation
Classes can't be realigned today. Destructors…could be inlinable, I guess, but that would only ever come into play if you knew a class instance didn't escape, which seems super rare across module boundaries (since it's valid for an initializer to escape |
I'm not a fan of the idea of |
Hi @slavapestov – The value in As for inlining in general, do we no longer care about module private classes? For example, a private tree-like data structure where the destructor is trivially inlinable? |
@davezarzycki I'm not sure I understand your question about inlining. |
@davezarzycki I'm not sure why I'm a reviewer on this PR. It doesn't seem to be code I've been into. What sort of input from me would be helpful? |
Hi @slavapestov, @rjmccall, and @jrose-apple, Just to be clear here, I want to know whether the new "OnXYZ" flags in this pull request expose any clean up opportunities or oversights in the existing I'm primarily interested in questions 1 and 2 at the top of this pull request: does the formalization of I'm less concerned about questions 3 and 4. I just wanted to double check with people that there weren't any oversights with the existing "OnXYZ" flags while I was cleaning up the file. Finally, I do think that aggregate "OnXYZ" flags are incredibly valuable, especially for people less familiar with the code, or people trying to extend the code. For example, PS – Hi @davidungar. I misinterpreted how GitHub reports "reviewers" in their user interface. I thought somebody requested you as a reviewer in #16014 and therefore you should be added to this pull request too. Upon closer inspection, it seems that GitHub reports any commenter on pull request code as a "reviewer", which is confusing. |
Ping. Any feedback/review on this pull request would be appreciated. |
include/swift/AST/Attr.def
Outdated
CONTEXTUAL_SIMPLE_DECL_ATTR(postfix, Postfix, | ||
OnFunc | OnAccessor | OnOperator | | ||
DeclModifier, | ||
25) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
infix/prefix/postfix can't ever be on accessors.
include/swift/AST/Attr.def
Outdated
SIMPLE_DECL_ATTR(LLDBDebuggerFunction, LLDBDebuggerFunction, | ||
OnFunc | OnAccessor | | ||
UserInaccessible, | ||
17) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this can be on accessors.
include/swift/AST/Attr.def
Outdated
OnFunc, 11) | ||
|
||
OnFunc | OnAccessor, | ||
11) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think IBAction
can be on accessors.
1) Formalize "OnAccessor". A hack used to alias this to "OnFunc". 2) New aggregates: OnNominalType, OnGenericType, OnAbstractFunction. 3) Consistent and self-documented (albeit custom) style to ease code review/audits. 4) Removes a few cases of `OnAccessor` based on pull request swiftlang#16031 feedback.
cabdcda
to
7b94731
Compare
PS – I'm trying to respect the tentative "commits 'require' review" goal, so if somebody could approve this, I'd appreciate it. Thanks. |
Yeah, those attributes require very specific syntax which is tied in the parser to func declarations. |
This builds on #16014, so please ignore the first commit.
OnAccessor
. A hack used to alias this toOnFunc
.OnNominalType
,OnGenericType
,OnAbstractFunction
.@rjmccall and @slavapestov – Review questions:
OnAccessor
is formalized, should it be removed from any attributes?OnAccessor
is formalized, shouldOnFunc
be removed from any attributes?.def
file. For example, it is intentional thatinline
doesn't work on destructors? Also, why doesn't_alignment
includeOnClass
? There might be more oversights. Feedback would be appreciated.OnAbstractFunction & ~OnDestructor
. Should it be formalized? PerhapsOnNonDestructorFunctions
?