Skip to content

Cherry pick inline diagnostics #9426

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

adrian-prantl
Copy link

and port them to the Swift plugin!

This patch is a reworking of Pete Lawrence's (@PortalPete) proposal
for better expression evaluator error messages:
llvm#80938

Before:

```
$ lldb -o "expr a+b"
(lldb) expr a+b
error: <user expression 0>:1:1: use of undeclared identifier 'a'
a+b
^
error: <user expression 0>:1:3: use of undeclared identifier 'b'
a+b
  ^
```

After:

```
(lldb) expr a+b
            ^ ^
            │ ╰─ error: use of undeclared identifier 'b'
            ╰─ error: use of undeclared identifier 'a'
```

This eliminates the confusing `<user expression 0>:1:3` source
location and avoids echoing the expression to the console again, which
results in a cleaner presentation that makes it easier to grasp what's
going on. You can't see it here, bug the word "error" is now also in
color, if so desired.

Depends on llvm#106442.

(cherry picked from commit d33fa70)
…vm#110707)

This is a cleanup that moves the API towards value semantics.

(cherry picked from commit 8789c96)
and implement them for dwim-print (a.k.a. `p`) as an example.

The next step will be to expose them as structured data in
SBCommandReturnObject.

(cherry picked from commit 089227f)
)

In a later commit, I want to add a method to access diagnostics as
actual structured data, which will make these function names rather
confusing.

(cherry picked from commit c275080)
)

This allows IDEs to render LLDB expression diagnostics to their liking
without relying on characterprecise ASCII art from LLDB. It is exposed
as a versioned SBStructuredData object, since it is expected that this
may need to be tweaked based on actual usage.

(cherry picked from commit 9eddc8b)
@adrian-prantl
Copy link
Author

@swift-ci test

@adrian-prantl adrian-prantl requested review from bulbazord and removed request for JDevlieghere October 16, 2024 03:32
llvm#112451)

…reverse order

The second inner loop (only) was missing the check for offset > column.
Also this patch sorts the diagnostics before printing them.

(cherry picked from commit 889e6ad)
@adrian-prantl adrian-prantl force-pushed the cherry-pick-inline-diags branch from d3585f0 to e103979 Compare October 16, 2024 16:54
@adrian-prantl
Copy link
Author

@swift-ci test

@adrian-prantl adrian-prantl merged commit 1d2e2d1 into swiftlang:stable/20240723 Oct 16, 2024
2 of 3 checks passed
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