-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Fix mangling of '@noDerivative' and unify function attribute mangling operators. #36772
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
Conversation
@swift-ci please test |
Build failed |
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.
LGTM
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.
Can you pease not use a top-level operator ('k') for this?
We only have very few left and we should not "waste" them for something which is not critical for symbol sizes.
Could you suggest an existing operator that I should fold under? |
You can make a sub-operator of 'TJ', e.g. 'TJk'. |
Should the same rationale apply to Similarly, |
In 3c5b367 I made the change I proposed above. PTAL.
|
3c5b367
to
f41e130
Compare
f41e130
to
a626cdb
Compare
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.
Skimmed this, but it LGTM
a626cdb
to
53b5fc9
Compare
@swift-ci please test |
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.
Thanks, the mangling scheme looks good now.
I just have a few comments on the implementation.
53b5fc9
to
52bf864
Compare
@swift-ci please test |
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.
LGTM, thanks!
52bf864
to
b8a5de5
Compare
@swift-ci please test |
Build failed |
b8a5de5
to
faec5d0
Compare
`@noDerivative` was not mangled in function types, and was resolved incorrectly when there's an ownership specifier. It is fixed by this patch with the following changes: * Add `NoDerivative` demangle node represented by a `k` operator. ``` list-type ::= type identifier? 'k'? 'z'? 'h'? 'n'? 'd'? // type with optional label, '@noDerivative', inout convention, shared convention, owned convention, and variadic specifier ``` * Fix `NoDerivative`'s overflown offset in `ParameterTypeFlags` (`7` -> `6`). * In type decoder and type resolver where attributed type nodes are processed, add support for nested attributed nodes, e.g. `inout @noDerivative T`. * Add `TypeResolverContext::InoutFunctionInput` so that when we resolve an `inout @noDerivative T` parameter, the `@noDerivative T` checking logic won't get a `TypeResolverContext::None` set by the caller. Resolves rdar://75916833.
faec5d0
to
171c92c
Compare
@swift-ci please test and merge |
…and `@noDerivative`. Repurpose mangling operator `Y` as an umbrella operator that covers new attributes on function types. Free up operators `J`, `j`, and `k`. ``` async ::= 'Ya' // 'async' annotation on function types sendable ::= 'Yb' // @sendable on function types throws ::= 'K' // 'throws' annotation on function types differentiable ::= 'Yjf' // @differentiable(_forward) on function type differentiable ::= 'Yjr' // @differentiable(reverse) on function type differentiable ::= 'Yjd' // @differentiable on function type differentiable ::= 'Yjl' // @differentiable(_linear) on function type ``` Resolves rdar://76299796.
171c92c
to
fb66de6
Compare
@swift-ci please test and merge |
@swift-ci please test macos |
1 similar comment
@swift-ci please test macos |
Unify mangling operators for attributes
async
,@Sendable
, and@differentiable
under a singleY
operator. Free up operatorsJ
andj
.@noDerivative
was not mangled in function types, and was resolved incorrectly when there's an ownership specifier. It is fixed by this patch with the following changes:NoDerivative
demangle node represented by aYk
operator.NoDerivative
's overflown offset inParameterTypeFlags
(7
->6
).inout @noDerivative T
.TypeResolverContext::InoutFunctionInput
so that when we resolve aninout @noDerivative T
parameter, the@noDerivative T
checking logic won't get aTypeResolverContext::None
set by the caller.Resolves rdar://76299796 and rdar://75916833.