Skip to content

[lldb] Handle diagnostics better around expression evaulation retries #7834

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

Conversation

augusto2112
Copy link

The error message produced when expression evaluation parsing failed with automatic retries was not great, and would confuse many users. Change the logic around what diagnostics should be displayed to the user if expression evaluation parsing retry also fails to show the original error message.

rdar://118057664

@augusto2112
Copy link
Author

@swift-ci test

Copy link

@adrian-prantl adrian-prantl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm generally fine with the approach, I would just like you to double-check that SwiftASTContext::GetScopedDiagnosticConsumer() isn't better suited for the job.

@adrian-prantl
Copy link

An maybe the answer is no

@adrian-prantl
Copy link

Do you have a testcase?

@augusto2112
Copy link
Author

I'm generally fine with the approach, I would just like you to double-check that SwiftASTContext::GetScopedDiagnosticConsumer() isn't better suited for the job.

As I understand it, SwiftASTContext::GetScopedDiagnosticConsumer is used to capture diagnostics generated by the swift compiler, in this case we're dealing with the more general lldb diagnostics.

In some situations it may be useful to have a separate DiagnosticManager
instance, and then later of move the contents of that instance back to
the "main" DiagnosticManager. For example, when silently retrying some
operation with different parameters, depending on whether the retry
succeeded or failed, LLDB may want to present a different set of
diagnostics to the user (the ones generated on the first try vs the
retry). Implement DiagnosticManager::Consume to allow for this use case.
@augusto2112
Copy link
Author

@swift-ci test

@augusto2112
Copy link
Author

@adrian-prantl had to change my approach a little, if we decide this is the way to go I'll upstream the patch that adds DiagnosticManager::Consume before merging this one.

@augusto2112
Copy link
Author

@swift-ci test windows

@augusto2112
Copy link
Author

@swift-ci test

The error message produced when expression evaluation parsing failed
with automatic retries was not great, and would confuse many users.
Change the logic around what diagnostics should be displayed to the
user if expression evaluation parsing retry also fails to show the
original error message.

rdar://118057664
@augusto2112
Copy link
Author

@swift-ci test

@augusto2112
Copy link
Author

@swift-ci test Windows

@augusto2112
Copy link
Author

@swift-ci test macOS

@augusto2112
Copy link
Author

@swift-ci test Windows

@augusto2112
Copy link
Author

@swift-ci test macOS

@augusto2112
Copy link
Author

@swift-ci test Windows

@adrian-prantl
Copy link

@swift-ci test macos

1 similar comment
@adrian-prantl
Copy link

@swift-ci test macos

@augusto2112 augusto2112 merged commit e4eefe1 into swiftlang:stable/20230725 Dec 6, 2023
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.

2 participants