Skip to content

[AutoDiff] [AST] Handle null decl in 'printDifferentiableAttrArguments'. #36954

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

Merged
merged 1 commit into from
Apr 18, 2021

Conversation

rxwei
Copy link
Contributor

@rxwei rxwei commented Apr 18, 2021

DeclAttribute::print() accepts null decls and has a null default argument. A segfault was triggered in SourceKitService because printDifferentiableAttrArguments took a null decl and deferenced it. This patch makes printDifferentiableAttrArguments() handle null decls — if the decl is null, we do not print the differentiability parameters or the where clause.

I have not added a unit test however because I haven't been able to reproduce it independently. This will be done later as this change is low-risk.

Resolves rdar://76095289.

@rxwei rxwei requested review from joshnewnham and dan-zheng April 18, 2021 08:22
@rxwei
Copy link
Contributor Author

rxwei commented Apr 18, 2021

@swift-ci please test

`DeclAttribute::print()` accepts null decls and has a null default argument.  A segfault was triggered in SourceKitService because `printDifferentiableAttrArguments()` took a null decl and deferenced it.  This patch makes `printDifferentiableAttrArguments()` handle null decls — if the decl is null, we do not print the differentiability parameters or the `where` clause.

I have not added a unit test however because I haven't been able to reproduce it independently.  This will be done later as this change is low-risk.

Resolves rdar://76095289.
@rxwei
Copy link
Contributor Author

rxwei commented Apr 18, 2021

@swift-ci please test

@rxwei rxwei merged commit f171428 into swiftlang:main Apr 18, 2021
@rxwei rxwei deleted the 76095289 branch April 18, 2021 18:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants