[Lldb-commits] [PATCH] D109908: [lldb] Show fix-it applied even if expression didn't evaluate succesfully
Augusto Noronha via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Wed Sep 22 13:09:31 PDT 2021
augusto2112 added a comment.
In D109908#3004789 <https://reviews.llvm.org/D109908#3004789>, @teemperor wrote:
> Could you add a test for that? The usual test fixit in Clang is `.`/`->` mixup, e.g.
>
> (lldb) expr struct Foo { int i; }; Foo *f; f.i ; unknown_identifier_for_fatal_error
> (int) $0 = 0
> Fix-it applied, fixed expression was:
> struct Foo { int i; }; Foo *f; f->i ; unknown_identifier_for_fatal_error
> ...
Added!
> I think this patch also needs to update `UserExpression::Evaluate` which, IIRC, is clearing the fixed expression when it fails to parse.
I think that makes sense... If we fail to parse the fix-it we silently ignore it and don't need to tell the user about it.
> The direction of the patch is IMHO fine. One thing that would be nice is to see if we could maybe preserve the Fix-It diagnostics from the original expression.
What do you mean by this? If we could preserve the original expression.
> If we just return whatever the fixed expression fails with then it's not clear why the compiler actually generated a Fix-It. But that's more of a nice-to-have I think.
You can see in the test I added, fixing `foo.bar` to `foo->bar` where `foo` won't execute correctly, but it's still nice for the user to see that the Fix-it was applied.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D109908/new/
https://reviews.llvm.org/D109908
More information about the lldb-commits
mailing list